-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaluno.controller.ts
More file actions
27 lines (24 loc) · 906 Bytes
/
aluno.controller.ts
File metadata and controls
27 lines (24 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { Controller, Get, UseGuards, Req, Body, Patch } from '@nestjs/common';
import { AuthGuard } from '../auth/auth.guard';
import { AlunoService } from './aluno.service';
import AuthenticatedRequest from '../types/authenticated-request.interface';
import { AtualizaDadosAlunoDTO } from './dto/atualizaDadosAluno';
@Controller('aluno')
export class AlunoController {
constructor(private readonly alunoService: AlunoService) {}
@UseGuards(AuthGuard)
@Get()
async findOne(@Req() request: AuthenticatedRequest) {
const { id } = request.user;
return this.alunoService.findByClerkId(id);
}
@UseGuards(AuthGuard)
@Patch('/update')
async updateStudentData(
@Req() request: AuthenticatedRequest,
@Body() atualizaDadosAlunoDTO: AtualizaDadosAlunoDTO,
) {
const { id } = request.user;
return await this.alunoService.updateStudentData(id, atualizaDadosAlunoDTO);
}
}