modulo y orerador con seguridad
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { ModuloService } from './modulo.service';
|
||||
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
||||
import { ModuloCreateDto } from './dto/modulo-create.dto';
|
||||
import { ModuloUpdateDto } from './dto/modulo-update.dto';
|
||||
import {ApiTags} from '@nestjs/swagger'
|
||||
// import { Serealize } from '../interceptors/serialize.interceptor';
|
||||
|
||||
@Controller('modulo')
|
||||
@@ -12,11 +21,13 @@ export class ModuloController {
|
||||
constructor(private moduloService: ModuloService) {}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
create(@Body() body: ModuloCreateDto) {
|
||||
return this.moduloService.create(body.id_institucion, body.modulo);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
get() {
|
||||
return this.moduloService.findAll();
|
||||
}
|
||||
@@ -29,6 +40,7 @@ export class ModuloController {
|
||||
}
|
||||
|
||||
@Put()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
update(@Body() body: ModuloUpdateDto) {
|
||||
return this.moduloService.update(body);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { ModuloController } from './modulo.controller';
|
||||
import { ModuloService } from './modulo.service';
|
||||
@@ -6,7 +7,11 @@ import { Modulo } from './entity/modulo.entity';
|
||||
import { InstitucionModule } from '../institucion/institucion.module';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Modulo]), InstitucionModule],
|
||||
imports: [
|
||||
InstitucionModule,
|
||||
PassportModule.register({ defaultStrategy: 'jwt' }),
|
||||
TypeOrmModule.forFeature([Modulo]),
|
||||
],
|
||||
controllers: [ModuloController],
|
||||
providers: [ModuloService],
|
||||
exports: [ModuloService],
|
||||
|
||||
Reference in New Issue
Block a user