- 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>
48 lines
1.2 KiB
TypeScript
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;
|
|
}
|