FEAT: update CustomerSidebarSection to support both menu and link items

This commit is contained in:
viniciusgadea
2026-03-25 15:24:59 -03:00
parent 10293ad6a9
commit 80f3913fd2
3 changed files with 20 additions and 52 deletions
+2 -2
View File
@@ -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) {
+10 -2
View File
@@ -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 {