fix(backend): pages/updateのnameの重複チェックはnameプロパティがある時のみ行うように (#15104)

* fix(backend): pagesのnameの重複チェックはnameプロパティがある時のみ行うように

* Update Changelog

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
かっこかり
2025-01-14 20:30:49 +09:00
committed by GitHub
parent 9ddf7751db
commit da9e05582d
2 changed files with 12 additions and 9 deletions

View File

@@ -102,15 +102,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
await this.pagesRepository.findBy({
id: Not(ps.pageId),
userId: me.id,
name: ps.name,
}).then(result => {
if (result.length > 0) {
throw new ApiError(meta.errors.nameAlreadyExists);
}
});
if (ps.name != null) {
await this.pagesRepository.findBy({
id: Not(ps.pageId),
userId: me.id,
name: ps.name,
}).then(result => {
if (result.length > 0) {
throw new ApiError(meta.errors.nameAlreadyExists);
}
});
}
await this.pagesRepository.update(page.id, {
updatedAt: new Date(),