add new EP

This commit is contained in:
2025-09-17 16:33:57 -06:00
parent 3e4b3b1b18
commit d322340e86
5 changed files with 21 additions and 46 deletions
+5 -2
View File
@@ -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);
}
}
-3
View File
@@ -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')
+2 -2
View File
@@ -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<string>('DB_USER'),
password: configService.get<string>('DB_PASSWORD'),
database: configService.get<string>('DB_NAME'),
entities: [User,Student,DetalleServicio,Periodo,Servicio],
entities: [User,Student,DetalleServicio,Periodo,Servicio,Perfil],
synchronize: false,//Never change to true in production!
}),
}),
@@ -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);
}
}
+12 -12
View File
@@ -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[];
}