import { Body, Controller, Get, Inject, Param, Post, Req, UseGuards, } from '@nestjs/common'; import { LinkedAttributesService } from '../service/linked_attributes.service'; import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard'; @Controller('linked-attributes') export class LinkedAttributesController { constructor( @Inject('LinkedAttributesService') private readonly linkedAttributesService: LinkedAttributesService, ) {} @Get('all') @UseGuards(JwtAuthGuard) async getAll(@Req() req: any) { const loggedInUser = req.user?.userData; return this.linkedAttributesService.getAllLinkedAttributes(loggedInUser); } @Get('listing/:entity_type') @UseGuards(JwtAuthGuard) async getAttributeListing( @Req() req: any, @Param('entity_type') entity_type: string, ) { const loggedInUser = req.user?.userData; return this.linkedAttributesService.getEntityListing( entity_type, loggedInUser, ); } @Post('upsert') @UseGuards(JwtAuthGuard) async upsertLinkedAttributes(@Req() req: any, @Body() payload: any) { const loggedInUser = req.user?.userData; return this.linkedAttributesService.upsertLinkedAttributes( payload, loggedInUser, ); } }