diff --git a/src/modules/hr/entities/employee.entity.ts b/src/modules/hr/entities/employee.entity.ts index b4be02f..ec59bf3 100644 --- a/src/modules/hr/entities/employee.entity.ts +++ b/src/modules/hr/entities/employee.entity.ts @@ -29,6 +29,7 @@ export type Genero = 'M' | 'F'; @Entity({ schema: 'hr', name: 'employees' }) @Index(['tenantId', 'codigo'], { unique: true }) @Index(['tenantId', 'curp'], { unique: true }) +@Index(['userId'], { unique: true }) export class Employee { @PrimaryGeneratedColumn('uuid') id: string; @@ -111,6 +112,10 @@ export class Employee { @Column({ name: 'created_by', type: 'uuid', nullable: true }) createdById: string; + // Mapeo a usuario del sistema (opcional - empleado puede no tener acceso) + @Column({ name: 'user_id', type: 'uuid', nullable: true }) + userId: string; + // Relations @ManyToOne(() => Tenant) @JoinColumn({ name: 'tenant_id' }) @@ -124,6 +129,11 @@ export class Employee { @JoinColumn({ name: 'created_by' }) createdBy: User; + // Relación a usuario del sistema (1:1, opcional) + @ManyToOne(() => User, { nullable: true }) + @JoinColumn({ name: 'user_id' }) + user: User; + @OneToMany(() => EmployeeFraccionamiento, (ef) => ef.employee) asignaciones: EmployeeFraccionamiento[]; diff --git a/src/modules/inventory/entities/almacen-proyecto.entity.ts b/src/modules/inventory/entities/almacen-proyecto.entity.ts index 81f7283..47b0841 100644 --- a/src/modules/inventory/entities/almacen-proyecto.entity.ts +++ b/src/modules/inventory/entities/almacen-proyecto.entity.ts @@ -40,12 +40,12 @@ export class AlmacenProyecto { fraccionamientoId: string; @Column({ - name: 'warehouse_type', + name: 'construction_warehouse_type', type: 'varchar', length: 20, default: 'obra', }) - warehouseType: WarehouseTypeConstruction; + constructionWarehouseType: WarehouseTypeConstruction; @Column({ name: 'location_description', type: 'text', nullable: true }) locationDescription: string;