Skip to content

Commit 6ad64e5

Browse files
committed
Move isUnique out of CommonRepo
1 parent 1af81da commit 6ad64e5

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/core/database/common.repository.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ export class CommonRepository {
2727
@Inject(DatabaseService)
2828
protected db: DatabaseService;
2929

30-
async isUnique(value: string, label: string) {
31-
const exists = await this.db
32-
.query()
33-
.matchNode('node', label, { value })
34-
.return('node')
35-
.first();
36-
return !exists;
37-
}
38-
3930
async getBaseNode(
4031
id: ID,
4132
label?: string | ResourceShape<any> | EnhancedResource<any>,

src/core/database/dto.repository.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ export const DtoRepository = <
5656
}
5757
label = defaultLabel;
5858
}
59-
return await super.isUnique(value, label);
59+
const exists = await this.db
60+
.query()
61+
.matchNode('node', label, { value })
62+
.return('node')
63+
.first();
64+
return !exists;
6065
}
6166
@Once() private get uniqueLabel() {
6267
const labels = resource.Props.flatMap(

0 commit comments

Comments
 (0)