File

apps/recallassess/recallassess-api/src/api/client/profile/profile.controller.ts

Prefix

api/client/profile

Index

Methods

Methods

Async getProfile
getProfile(auth: CLAuthData)
Decorators :
@Get()
@ApiOperation({summary: 'Get current participant profile'})
@ApiResponse({status: 200, description: 'Returns current participant profile', type: ProfileDto})
@ApiResponse({status: 404, description: 'Participant not found'})

Get current participant profile GET /api/client/profile

Parameters :
Name Type Optional
auth CLAuthData No
Async updateProfile
updateProfile(auth: CLAuthData, updateDto: UpdateProfileDto)
Decorators :
@Patch()
@UsePipes(new ValidationPipe())
@ApiOperation({summary: 'Update current participant profile'})
@ApiResponse({status: 200, description: 'Returns updated participant profile', type: ProfileDto})
@ApiResponse({status: 404, description: 'Participant not found'})

Update current participant profile PATCH /api/client/profile

Parameters :
Name Type Optional
auth CLAuthData No
updateDto UpdateProfileDto No
import { Body, Controller, Get, Patch, UsePipes, ValidationPipe } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { CLAuthData, ClientAuth } from '../../shared/decorators/client-auth.decorator';
import { ProfileDto, UpdateProfileDto } from './dto';
import { CLProfileService } from './profile.service';

@ApiTags('Client - Profile')
@Controller('api/client/profile')
export class CLProfileController {
  constructor(private profileService: CLProfileService) {}

  /**
   * Get current participant profile
   * GET /api/client/profile
   */
  @Get()
  @ApiOperation({ summary: 'Get current participant profile' })
  @ApiResponse({
    status: 200,
    description: 'Returns current participant profile',
    type: ProfileDto,
  })
  @ApiResponse({
    status: 404,
    description: 'Participant not found',
  })
  async getProfile(@ClientAuth() auth: CLAuthData): Promise<ProfileDto> {
    return this.profileService.getProfile(auth.participantId);
  }

  /**
   * Update current participant profile
   * PATCH /api/client/profile
   */
  @Patch()
  @UsePipes(
    new ValidationPipe({
      transform: true,
      whitelist: true,
      forbidNonWhitelisted: true,
    }),
  )
  @ApiOperation({ summary: 'Update current participant profile' })
  @ApiResponse({
    status: 200,
    description: 'Returns updated participant profile',
    type: ProfileDto,
  })
  @ApiResponse({
    status: 404,
    description: 'Participant not found',
  })
  async updateProfile(
    @ClientAuth() auth: CLAuthData,
    @Body() updateDto: UpdateProfileDto,
  ): Promise<ProfileDto> {
    return this.profileService.updateProfile(auth.participantId, updateDto);
  }
}

results matching ""

    No results matching ""