miinventario-v2/apps/backend/src/modules/integrations/entities/pos-sync-log.entity.ts
rckrdmrd c24f889f70
Some checks failed
Build / Build Backend (push) Has been cancelled
Build / Build Mobile (TypeScript Check) (push) Has been cancelled
Lint / Lint Backend (push) Has been cancelled
Lint / Lint Mobile (push) Has been cancelled
Test / Backend E2E Tests (push) Has been cancelled
Test / Mobile Unit Tests (push) Has been cancelled
Build / Build Docker Image (push) Has been cancelled
[MIINVENTARIO] feat: Add exports, reports, integrations modules and CI/CD pipeline
- Add exports module with PDF/CSV/Excel generation
- Add reports module for inventory analytics
- Add POS integrations module
- Add database migrations for exports, movements and integrations
- Add GitHub Actions CI/CD workflow with Docker support
- Add mobile export and reports screens with tests
- Update epic documentation with traceability
- Add deployment and security guides

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 06:06:34 -06:00

78 lines
1.5 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
ManyToOne,
JoinColumn,
Index,
} from 'typeorm';
import { PosIntegration } from './pos-integration.entity';
export enum SyncLogType {
WEBHOOK_RECEIVED = 'WEBHOOK_RECEIVED',
MANUAL_SYNC = 'MANUAL_SYNC',
SCHEDULED_SYNC = 'SCHEDULED_SYNC',
}
export enum SyncLogStatus {
SUCCESS = 'SUCCESS',
PARTIAL = 'PARTIAL',
FAILED = 'FAILED',
}
@Entity('pos_sync_logs')
@Index(['integrationId', 'createdAt'])
export class PosSyncLog {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'uuid' })
integrationId: string;
@ManyToOne(() => PosIntegration, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'integrationId' })
integration: PosIntegration;
@Column({
type: 'enum',
enum: SyncLogType,
})
type: SyncLogType;
@Column({
type: 'enum',
enum: SyncLogStatus,
})
status: SyncLogStatus;
@Column({ type: 'int', default: 0 })
itemsProcessed: number;
@Column({ type: 'int', default: 0 })
itemsCreated: number;
@Column({ type: 'int', default: 0 })
itemsUpdated: number;
@Column({ type: 'int', default: 0 })
itemsSkipped: number;
@Column({ type: 'int', default: 0 })
itemsFailed: number;
@Column({ type: 'jsonb', nullable: true })
details: {
webhookEventType?: string;
webhookEventId?: string;
errors?: { itemId: string; error: string }[];
duration?: number;
};
@Column({ type: 'text', nullable: true })
errorMessage: string;
@CreateDateColumn()
createdAt: Date;
}