erp-core-backend-v2/src/modules/fiscal/entities/cfdi-use.entity.ts
rckrdmrd 5fa451e09f feat(fiscal): Add fiscal module with catalogs (MGN-005)
- Add fiscal entities:
  - TaxCategory, FiscalRegime, CfdiUse
  - PaymentMethod, PaymentType, WithholdingType
- Add fiscal services with filtering capabilities
- Add fiscal controller with REST endpoints
- Add fiscal routes at /api/v1/fiscal
- Register fiscal routes in app.ts

Endpoints:
- GET /fiscal/tax-categories
- GET /fiscal/fiscal-regimes
- GET /fiscal/cfdi-uses
- GET /fiscal/payment-methods
- GET /fiscal/payment-types
- GET /fiscal/withholding-types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 09:31:47 -06:00

48 lines
1.2 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
Index,
} from 'typeorm';
import { PersonType } from './fiscal-regime.entity.js';
@Entity({ schema: 'fiscal', name: 'cfdi_uses' })
@Index('idx_cfdi_uses_code', ['code'], { unique: true })
@Index('idx_cfdi_uses_applies', ['appliesTo'])
export class CfdiUse {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'varchar', length: 10, nullable: false, unique: true })
code: string;
@Column({ type: 'varchar', length: 255, nullable: false })
name: string;
@Column({ type: 'text', nullable: true })
description: string | null;
@Column({
type: 'enum',
enum: PersonType,
nullable: false,
default: PersonType.BOTH,
name: 'applies_to',
})
appliesTo: PersonType;
@Column({ type: 'simple-array', nullable: true, name: 'allowed_regimes' })
allowedRegimes: string[] | null;
@Column({ type: 'boolean', default: true, nullable: false, name: 'is_active' })
isActive: boolean;
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
updatedAt: Date;
}