Creacion de entities

This commit is contained in:
2025-09-10 17:46:13 -06:00
parent 0b5a7aa68a
commit 3481d76d38
7 changed files with 74 additions and 4 deletions
+23 -1
View File
@@ -1 +1,23 @@
export class CreatePeriodoDto {}
import {
IsString,
Length,
IsDateString,
IsOptional,
IsBoolean,
} from 'class-validator';
export class CreatePeriodoDto {
@IsString()
@Length(6, 6)
semestre: string;
@IsDateString()
fecha_inicio_servicio: string;
@IsDateString()
fecha_fin_servicio: string;
@IsOptional()
@IsBoolean()
activo?: boolean;
}
+7
View File
@@ -0,0 +1,7 @@
export class PeriodoDto {
id_periodo: number;
semestre: string;
fecha_inicio_servicio: Date;
fecha_fin_servicio: Date;
activo: boolean;
}
+23 -1
View File
@@ -1 +1,23 @@
export class Periodo {}
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
@Entity({ name: 'periodo' })
export class Periodo {
@PrimaryGeneratedColumn({ name: 'id_periodo', type: 'int' })
id_periodo: number;
@Column({ type: 'char', length: 6, nullable: false })
semestre: string;
@Column({ name: 'fecha_inicio_servicio', type: 'date', nullable: false })
fecha_inicio_servicio: Date;
@Column({ name: 'fecha_fin_servicio', type: 'date', nullable: false })
fecha_fin_servicio: Date;
@Column({
type: 'bit',
width: 1,
default: () => "b'1'",
})
activo: boolean;
}
+7 -1
View File
@@ -1 +1,7 @@
export class CreateServicioDto {}
import { IsString, MaxLength } from 'class-validator';
export class CreateServicioDto {
@IsString()
@MaxLength(45)
servicio: string;
}
+4
View File
@@ -0,0 +1,4 @@
export class ServicioDto {
id_servicio: number;
servicio: string;
}
+10 -1
View File
@@ -1 +1,10 @@
export class Servicio {}
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
@Entity({ name: 'servicio' })
export class Servicio {
@PrimaryGeneratedColumn({ name: 'id_servicio', type: 'int' })
id_servicio: number;
@Column({ type: 'varchar', length: 45, nullable: false })
servicio: string;
}