feat(backend): implement Phase A database models and controllers for cross-boundary dependencies
Deploy Canina / deploy (push) Failing after 28s
Deploy Canina / deploy (push) Failing after 28s
This commit is contained in:
1 parent
74fcaa6a4e
commit
1ae4c99ffc
26 files changed
+1205
-345
No files matched your search
@@ -22,18 +22,22 @@ export class SettingsService {
|
||||
}
|
||||
|
||||
async upsertScientificTerm(key: string, data: any) {
|
||||
const term = String(data?.term || '');
|
||||
const definition = String(data?.definition || '');
|
||||
const wikiId = String(data?.wikiId || 'general');
|
||||
|
||||
return this.prisma.scientificTerm.upsert({
|
||||
where: { key },
|
||||
update: {
|
||||
term: data.term,
|
||||
definition: data.definition,
|
||||
wikiId: data.wikiId || 'general',
|
||||
term,
|
||||
definition,
|
||||
wikiId,
|
||||
},
|
||||
create: {
|
||||
key,
|
||||
term: data.term,
|
||||
definition: data.definition,
|
||||
wikiId: data.wikiId || 'general',
|
||||
term,
|
||||
definition,
|
||||
wikiId,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -43,4 +47,20 @@ export class SettingsService {
|
||||
where: { key },
|
||||
});
|
||||
}
|
||||
|
||||
async getCategorySetting(category: string) {
|
||||
const setting = await this.prisma.setting.findFirst({
|
||||
where: { category },
|
||||
});
|
||||
return setting ? setting.value : {};
|
||||
}
|
||||
|
||||
async updateCategorySetting(category: string, value: any) {
|
||||
const key = `${category}_config`;
|
||||
return this.prisma.setting.upsert({
|
||||
where: { key },
|
||||
update: { category, value },
|
||||
create: { key, category, value },
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user