Update packages/backend/src/core/CustomEmojiService.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
nenohi 2023-10-06 13:46:42 +09:00 committed by GitHub
parent f5cc70d943
commit 2333886ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -379,16 +379,18 @@ export class CustomEmojiService implements OnApplicationShutdown {
this.cache.set(`${emoji.name} ${emoji.host}`, emoji);
}
}
/**
*
* @param name
*/
public async isDuplicateCheck(name: string): Promise<boolean> {
return (await this.emojisRepository.findOneBy({ name, host: IsNull() })) !== null;
@bindThis
public checkDuplicate(name: string): Promise<boolean> {
return this.emojisRepository.exist({ where: { name, host: IsNull() } });
}
@bindThis
public async getEmojiById(id: string): Promise<MiEmoji | null> {
public getEmojiById(id: string): Promise<MiEmoji | null> {
return this.emojisRepository.findOneBy({ id });
}