Update packages/backend/src/server/api/endpoints/admin/emoji/update.ts
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
10794eaa90
commit
1692c188bd
|
|
@ -74,11 +74,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
||||
}
|
||||
const oldemoji = await this.customEmojiService.getEmojiById(ps.id);
|
||||
if (oldemoji !== null) {
|
||||
if (ps.name !== oldemoji.name) {
|
||||
const duplicateCheck = await this.customEmojiService.isDuplicateCheck(ps.name);
|
||||
if (duplicateCheck) throw new ApiError(meta.errors.sameNameEmojiExists);
|
||||
const emoji = await this.customEmojiService.getEmojiById(ps.id);
|
||||
if (emoji != null) {
|
||||
if (ps.name !== emoji.name) {
|
||||
const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
|
||||
if (isDuplicate) throw new ApiError(meta.errors.sameNameEmojiExists);
|
||||
}
|
||||
} else {
|
||||
throw new ApiError(meta.errors.noSuchEmoji);
|
||||
|
|
|
|||
Loading…
Reference in New Issue