refactor: 退役运行时视觉模块并泛化模板门禁
This commit is contained in:
1 parent
25d1fe983c
commit
e2e2340bfe
56 files changed
+290
-1037
No files matched your search
@@ -19,7 +19,6 @@ import {
|
||||
InstallTemplateDto,
|
||||
CreateOfferingDto,
|
||||
UpdateOfferingDto,
|
||||
UpdateModuleDto,
|
||||
CreateFieldDefinitionDto,
|
||||
UpdateFieldDefinitionDto,
|
||||
CreateInquiryFormDto,
|
||||
@@ -158,10 +157,9 @@ class AdminWorkspaceController {
|
||||
@Get()
|
||||
async get(@Req() request: FastifyRequest): Promise<unknown> {
|
||||
const brandId = this.requireAdmin(request).brandId;
|
||||
const [brand, installations, modules, fields, offerings, forms] = await Promise.all([
|
||||
const [brand, installations, fields, offerings, forms] = await Promise.all([
|
||||
this.prisma.brandProfile.findUnique({ where: { id: brandId } }),
|
||||
this.prisma.brandTemplateInstallation.findMany({ where: { brandId } }),
|
||||
this.prisma.brandModule.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
|
||||
this.prisma.brandFieldDefinition.findMany({
|
||||
where: { brandId },
|
||||
orderBy: { sortOrder: "asc" },
|
||||
@@ -178,7 +176,6 @@ class AdminWorkspaceController {
|
||||
return {
|
||||
brand,
|
||||
installations,
|
||||
modules,
|
||||
fields,
|
||||
offerings,
|
||||
forms,
|
||||
@@ -378,27 +375,6 @@ class AdminWorkspaceController {
|
||||
return this.templateWorkspace.rollback(this.requireAdmin(request).brandId);
|
||||
}
|
||||
|
||||
@Patch("modules/:id")
|
||||
async updateModule(
|
||||
@Req() request: FastifyRequest,
|
||||
@Param("id") id: string,
|
||||
@Body() body: UpdateModuleDto,
|
||||
): Promise<unknown> {
|
||||
const brandId = this.requireAdmin(request).brandId;
|
||||
const item = await this.prisma.brandModule.findFirst({
|
||||
where: { id, brandId },
|
||||
});
|
||||
if (!item) throw new BadRequestException("品牌模块不存在");
|
||||
const { config, ...fields } = body;
|
||||
return this.prisma.brandModule.update({
|
||||
where: { id },
|
||||
data: {
|
||||
...fields,
|
||||
...(config === undefined ? {} : { config: config as Prisma.InputJsonValue }),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@Post("fields")
|
||||
createField(
|
||||
@Req() request: FastifyRequest,
|
||||
|
||||
Reference in new issue
Block a user