Update packages/backend/src/server/api/endpoints/admin/emoji/add.ts
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
2333886ae1
commit
10794eaa90
|
|
@ -69,8 +69,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
const driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||||
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
const duplicateCheck = await this.customEmojiService.isDuplicateCheck(ps.name);
|
const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
|
||||||
if (duplicateCheck != null) throw new ApiError(meta.errors.duplicateName);
|
if (isDuplicate) throw new ApiError(meta.errors.duplicateName);
|
||||||
|
|
||||||
const emoji = await this.customEmojiService.add({
|
const emoji = await this.customEmojiService.add({
|
||||||
driveFile,
|
driveFile,
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue