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 });
|
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 existEmoji = await this.emojisRepository.exist({
|
const duplicationEmoji = await this.emojisRepository.find({
|
||||||
where: {
|
where: {
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existEmoji) {
|
duplicationEmoji.forEach(
|
||||||
|
(emoji) => {
|
||||||
|
if (emoji.name === ps.name) {
|
||||||
throw new ApiError(meta.errors.duplicationEmojiAdd);
|
throw new ApiError(meta.errors.duplicationEmojiAdd);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const emoji = await this.customEmojiService.add({
|
const emoji = await this.customEmojiService.add({
|
||||||
driveFile,
|
driveFile,
|
||||||
|
|
|
@ -75,6 +75,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.noSuchEmoji);
|
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;
|
let driveFile: MiDriveFile;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue