fix: 絵文字重複周りの修正
This commit is contained in:
parent
272c5a1dfe
commit
3a20dfb245
|
@ -73,15 +73,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
||||
|
||||
const existEmoji = await this.emojisRepository.exist({
|
||||
const duplicationEmoji = await this.emojisRepository.find({
|
||||
where: {
|
||||
name: ps.name,
|
||||
},
|
||||
});
|
||||
|
||||
if (existEmoji) {
|
||||
duplicationEmoji.forEach(
|
||||
(emoji) => {
|
||||
if (emoji.name === ps.name) {
|
||||
throw new ApiError(meta.errors.duplicationEmojiAdd);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const emoji = await this.customEmojiService.add({
|
||||
driveFile,
|
||||
|
|
|
@ -75,6 +75,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchEmoji);
|
||||
}
|
||||
|
||||
const duplicationEmoji = await this.emojisRepository.find({
|
||||
where: {
|
||||
name: emoji.name,
|
||||
},
|
||||
});
|
||||
|
||||
duplicationEmoji.forEach(
|
||||
(_emoji) => {
|
||||
if (_emoji.name === emoji.name) {
|
||||
throw new ApiError(meta.errors.duplicationEmojiAdd);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
let driveFile: MiDriveFile;
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue