b9cb6d1c10
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
11 lines
411 B
TypeScript
11 lines
411 B
TypeScript
import { UserKeypairs } from '@/models/index.js';
|
|
import { User } from '@/models/entities/user.js';
|
|
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
|
import { Cache } from './cache.js';
|
|
|
|
const cache = new Cache<UserKeypair>(Infinity);
|
|
|
|
export async function getUserKeypair(userId: User['id']): Promise<UserKeypair> {
|
|
return await cache.fetch(userId, () => UserKeypairs.findOneOrFail(userId));
|
|
}
|