mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
FEAT: update CustomerSidebarSection to support both menu and link items
This commit is contained in:
+8
-48
@@ -11166,53 +11166,6 @@
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"CustomerSidebarLinkItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"link": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"title",
|
||||
"link"
|
||||
]
|
||||
},
|
||||
"CustomerSidebarMenuItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string"
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/CustomerSidebarLinkItem"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"title",
|
||||
"items"
|
||||
]
|
||||
},
|
||||
"CustomerSidebarSection": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -11222,7 +11175,14 @@
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/CustomerSidebarMenuItem"
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CustomerSidebarMenuItem"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/CustomerSidebarLinkItem"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -72,7 +72,7 @@ export class CustomersService implements OnModuleInit {
|
||||
const result = await lastValueFrom(
|
||||
this.customerService.CustomerGetLinks({ id: customerId }),
|
||||
);
|
||||
return (result.links as unknown as CustomerLinksConfig) || null;
|
||||
return (result.links as CustomerLinksConfig) || null;
|
||||
} catch (err) {
|
||||
if (err.details === ErrorCodes.CUSTOMER.NOT_FOUND)
|
||||
throw new HttpException(err.details, HttpStatus.NOT_FOUND);
|
||||
@@ -89,7 +89,7 @@ export class CustomersService implements OnModuleInit {
|
||||
return await firstValueFrom(
|
||||
this.customerService.CustomerSetLinks({
|
||||
id: customerId,
|
||||
links: links as unknown as CustomerSetLinksRequest['links'],
|
||||
links: links as CustomerSetLinksRequest['links'],
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
|
||||
@@ -36,8 +36,16 @@ export class CustomerSidebarMenuItem {
|
||||
export class CustomerSidebarSection {
|
||||
@ApiProperty()
|
||||
title: string;
|
||||
@ApiProperty({ type: [CustomerSidebarMenuItem] })
|
||||
items: CustomerSidebarMenuItem[];
|
||||
@ApiProperty({
|
||||
type: 'array',
|
||||
items: {
|
||||
oneOf: [
|
||||
{ $ref: '#/components/schemas/CustomerSidebarMenuItem' },
|
||||
{ $ref: '#/components/schemas/CustomerSidebarLinkItem' },
|
||||
],
|
||||
},
|
||||
})
|
||||
items: (CustomerSidebarMenuItem | CustomerSidebarLinkItem)[];
|
||||
}
|
||||
|
||||
export class CustomerLinksConfig {
|
||||
|
||||
Reference in New Issue
Block a user