diff --git a/docsfera.json b/docsfera.json index ef933ea..5cdfb82 100644 --- a/docsfera.json +++ b/docsfera.json @@ -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" + } + ] } } }, diff --git a/src/modules/customers/customers.service.ts b/src/modules/customers/customers.service.ts index bcbd11d..f0a161c 100644 --- a/src/modules/customers/customers.service.ts +++ b/src/modules/customers/customers.service.ts @@ -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) { diff --git a/src/modules/customers/dtos/customers.ts b/src/modules/customers/dtos/customers.ts index 7299b23..479bace 100644 --- a/src/modules/customers/dtos/customers.ts +++ b/src/modules/customers/dtos/customers.ts @@ -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 {