erp-construccion-backend/src/modules/inventory/entities/inventory-count-line.entity.ts
rckrdmrd f3515d4f38 [SYNC] feat: Sincronizar módulos de erp-core (parcial)
Módulos copiados:
- partners/ (20 archivos)
- sales/ (19 archivos)
- crm/ (11 archivos)
- inventory/ (32 archivos nuevos)
- financial/taxes.service.ts

Infraestructura copiada:
- shared/errors/
- shared/middleware/
- shared/types/
- shared/utils/

Entidades core copiadas:
- country, currency, discount-rule, payment-term
- product-category, sequence, state, uom

Dependencias instaladas:
- zod
- winston

Estado: PARCIAL - Build no pasa por incompatibilidades
de imports. Ver SYNC-ERPC-CORE-STATUS.md para detalles.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 11:24:38 -06:00

57 lines
1.7 KiB
TypeScript

import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Index, ManyToOne, JoinColumn } from 'typeorm';
import { InventoryCount } from './inventory-count.entity';
@Entity({ name: 'inventory_count_lines', schema: 'inventory' })
export class InventoryCountLine {
@PrimaryGeneratedColumn('uuid')
id: string;
@Index()
@Column({ name: 'count_id', type: 'uuid' })
countId: string;
@ManyToOne(() => InventoryCount, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'count_id' })
count: InventoryCount;
@Index()
@Column({ name: 'product_id', type: 'uuid' })
productId: string;
@Index()
@Column({ name: 'location_id', type: 'uuid', nullable: true })
locationId?: string;
@Column({ name: 'system_quantity', type: 'decimal', precision: 15, scale: 4, nullable: true })
systemQuantity?: number;
@Column({ name: 'counted_quantity', type: 'decimal', precision: 15, scale: 4, nullable: true })
countedQuantity?: number;
// Note: difference is GENERATED in DDL, but we calculate it in app layer
@Column({ name: 'lot_number', type: 'varchar', length: 50, nullable: true })
lotNumber?: string;
@Column({ name: 'serial_number', type: 'varchar', length: 50, nullable: true })
serialNumber?: string;
@Index()
@Column({ name: 'is_counted', type: 'boolean', default: false })
isCounted: boolean;
@Column({ name: 'counted_at', type: 'timestamptz', nullable: true })
countedAt?: Date;
@Column({ name: 'counted_by', type: 'uuid', nullable: true })
countedBy?: string;
@Column({ type: 'text', nullable: true })
notes?: string;
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
updatedAt: Date;
}