add folder operation and use createQueryRunner

This commit is contained in:
IO420
2025-09-16 22:37:25 -06:00
parent 7024bfdeac
commit 3e4b3b1b18
15 changed files with 150 additions and 76 deletions
@@ -1,26 +1,13 @@
import { Injectable } from '@nestjs/common';
import { DetalleServicio } from './entities/detalle_servicio.entity';
import { EntityManager } from 'typeorm';
import { CreateDetalleServicioDto } from './dto/create-detalle_servicio.dto';
import { UpdateDetalleServicioDto } from './dto/update-detalle_servicio.dto';
@Injectable()
export class DetalleServicioService {
create(createDetalleServicioDto: CreateDetalleServicioDto) {
return 'This action adds a new detalleServicio';
}
findAll() {
return `This action returns all detalleServicio`;
}
findOne(id: number) {
return `This action returns a #${id} detalleServicio`;
}
update(id: number, updateDetalleServicioDto: UpdateDetalleServicioDto) {
return `This action updates a #${id} detalleServicio`;
}
remove(id: number) {
return `This action removes a #${id} detalleServicio`;
async Create(data: CreateDetalleServicioDto, manager: EntityManager) {
const repo = manager.getRepository(DetalleServicio);
const details = repo.create(data);
return await repo.save(details);
}
}
@@ -1,9 +1,15 @@
import { Type } from 'class-transformer';
import { IsDate, IsInt, IsNotEmpty, IsOptional, Min } from 'class-validator';
import { IsDate, IsIn, IsInt, IsNotEmpty, IsOptional, Min } from 'class-validator';
export class CreateDetalleServicioDto {
@IsInt()
@Min(0)
@IsNotEmpty()
@Min(1)
monto:number
@IsInt()
@Min(1)
@IsNotEmpty()
numero_hojas: number;
@@ -23,8 +29,4 @@ export class CreateDetalleServicioDto {
@IsInt()
@IsNotEmpty()
id_usuario: number;
@IsOptional()
@IsInt()
id_periodo?: number;
}
@@ -1,9 +0,0 @@
export class DetalleServicioDto {
id_detalle_servicio: number;
numero_hojas: number;
fecha_operacion: Date;
id_cuenta: number;
id_servicio: number;
id_usuario: number;
id_periodo: number | null;
}
@@ -15,7 +15,7 @@ export class DetalleServicio {
scale: 2,
nullable: false,
})
monto: string;
monto: number;
@Column({ name: 'numero_hojas', type: 'int', nullable: false, default: 0 })
numero_hojas: number;
@@ -39,13 +39,4 @@ export class DetalleServicio {
@Column({ name: 'id_perido', type: 'int', default: null })
id_periodo: number;
}
/* `id_detalle_servicio` int(11) NOT NULL AUTO_INCREMENT,
`monto` decimal(10,2) NOT NULL,
`numero_hojas` int(11) NOT NULL DEFAULT 0,
`fecha_operacion` timestamp NOT NULL DEFAULT current_timestamp(),
`id_cuenta` int(9) unsigned zerofill NOT NULL,
`id_servicio` int(11) NOT NULL,
`id_usuario` int(11) NOT NULL,
`id_periodo` int(11) DEFAULT NULL,*/
}