From d322340e86651c0b61e929d5df73656c28240839 Mon Sep 17 00:00:00 2001 From: IO420 <320154041@pcpuma.acatlan.unam.mx> Date: Wed, 17 Sep 2025 16:33:57 -0600 Subject: [PATCH] add new EP --- src/Operations/operations.controller.ts | 7 +++-- src/alumno/student.controller.ts | 3 -- src/app.module.ts | 4 +-- .../detalle_servicio.controller.ts | 29 ++----------------- src/user/entities/user.entity.ts | 24 +++++++-------- 5 files changed, 21 insertions(+), 46 deletions(-) diff --git a/src/Operations/operations.controller.ts b/src/Operations/operations.controller.ts index 734f5d8..2b18dca 100644 --- a/src/Operations/operations.controller.ts +++ b/src/Operations/operations.controller.ts @@ -1,9 +1,12 @@ -import { Controller } from "@nestjs/common"; +import { Body, Controller, Post } from "@nestjs/common"; import { OperationsService } from "./operations.services"; @Controller('operations') export class OperationsController{ constructor(private readonly operationsService:OperationsService){} - + @Post() + async Login(@Body() data) { + return this.operationsService.chargePrint(data,data.userid); + } } \ No newline at end of file diff --git a/src/alumno/student.controller.ts b/src/alumno/student.controller.ts index 6b063f2..d064281 100644 --- a/src/alumno/student.controller.ts +++ b/src/alumno/student.controller.ts @@ -3,13 +3,10 @@ import { Get, Post, Body, - Patch, Param, - Delete, } from '@nestjs/common'; import { StudentService } from './student.service'; import { CreateStudentDto } from './dto/create-student.dto'; -import { UpdateStudentDto } from './dto/update-student.dto'; import { Student } from './entities/student.entity'; @Controller('student') diff --git a/src/app.module.ts b/src/app.module.ts index 8d87171..eb62c13 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -5,7 +5,7 @@ import { AppService } from './app.service'; import { TypeOrmModule } from '@nestjs/typeorm'; import { StudentModule } from './alumno/student.module'; import { UserModule } from './user/user.module'; -import { User } from './user/entities/user.entity'; +import { Perfil, User } from './user/entities/user.entity'; import { DetalleServicioModule } from './detalle_servicio/detalle_servicio.module'; import { PeriodoModule } from './periodo/periodo.module'; import { ServicioModule } from './servicio/servicio.module'; @@ -29,7 +29,7 @@ import { Servicio } from './servicio/entities/servicio.entity'; username: configService.get('DB_USER'), password: configService.get('DB_PASSWORD'), database: configService.get('DB_NAME'), - entities: [User,Student,DetalleServicio,Periodo,Servicio], + entities: [User,Student,DetalleServicio,Periodo,Servicio,Perfil], synchronize: false,//Never change to true in production! }), }), diff --git a/src/detalle_servicio/detalle_servicio.controller.ts b/src/detalle_servicio/detalle_servicio.controller.ts index 36a1a21..b804907 100644 --- a/src/detalle_servicio/detalle_servicio.controller.ts +++ b/src/detalle_servicio/detalle_servicio.controller.ts @@ -1,34 +1,9 @@ -import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; +import { Controller } from '@nestjs/common'; import { DetalleServicioService } from './detalle_servicio.service'; -import { CreateDetalleServicioDto } from './dto/create-detalle_servicio.dto'; -import { UpdateDetalleServicioDto } from './dto/update-detalle_servicio.dto'; + @Controller('detalle-servicio') export class DetalleServicioController { constructor(private readonly detalleServicioService: DetalleServicioService) {} - @Post() - create(@Body() createDetalleServicioDto: CreateDetalleServicioDto) { - return this.detalleServicioService.create(createDetalleServicioDto); - } - - @Get() - findAll() { - return this.detalleServicioService.findAll(); - } - - @Get(':id') - findOne(@Param('id') id: string) { - return this.detalleServicioService.findOne(+id); - } - - @Patch(':id') - update(@Param('id') id: string, @Body() updateDetalleServicioDto: UpdateDetalleServicioDto) { - return this.detalleServicioService.update(+id, updateDetalleServicioDto); - } - - @Delete(':id') - remove(@Param('id') id: string) { - return this.detalleServicioService.remove(+id); - } } diff --git a/src/user/entities/user.entity.ts b/src/user/entities/user.entity.ts index 1131977..66718e1 100644 --- a/src/user/entities/user.entity.ts +++ b/src/user/entities/user.entity.ts @@ -7,6 +7,18 @@ import { PrimaryGeneratedColumn, } from 'typeorm'; +@Entity({ name: 'perfil' }) +export class Perfil { + @PrimaryGeneratedColumn({ name: 'id_perfil', type: 'int' }) + id_perfil: number; + + @Column({ name: 'perfil', type: 'varchar', length: 45, nullable: false }) + perfil: string; + + @OneToMany(() => User, (user) => user.perfil) + usuarios: User[]; +} + @Entity({ name: 'usuario' }) export class User { @PrimaryGeneratedColumn({ name: 'id_usuario', type: 'int' }) @@ -39,16 +51,4 @@ export class User { @ManyToOne(() => Perfil, (perfil) => perfil.usuarios, { eager: true }) @JoinColumn({ name: 'id_perfil' }) perfil: Perfil; -} - -@Entity({ name: 'perfil' }) -export class Perfil { - @PrimaryGeneratedColumn({ name: 'id_perfil', type: 'int' }) - id_perfil: number; - - @Column({ name: 'perfil', type: 'varchar', length: 45, nullable: false }) - perfil: string; - - @OneToMany(() => User, (user) => user.perfil) - usuarios: User[]; } \ No newline at end of file