import { Body, Controller, Post, UseGuards } from '@nestjs/common' import { ChallengeWeek } from '../../../models' import { BasicAuthorizationGuard } from '../../../guards' import { ChallengeService } from '../../../services/challenge' import { AuthBaseParams } from '../../../params' @UseGuards(BasicAuthorizationGuard) @Controller('challenge') export class ChallengeController { constructor(private readonly challengeService: ChallengeService) {} @Post('/create') async create(@Body() { session_variables }: AuthBaseParams): Promise> { const challengeWeek = await this.challengeService.create({ patientId: session_variables['x-hasura-user-id'], }) return challengeWeek } }