UNPKG

@tomei/customer-base

Version:

Tomei Customer Base Package

87 lines (68 loc) 1.96 kB
import { Table, Model, Column, DataType, CreatedAt, UpdatedAt, BelongsTo, ForeignKey, } from 'sequelize-typescript'; import { CustomerBaseModel } from './customer-base.entity'; import { EventTypeEnum } from '../enum/event-type.enum'; import { SyncStatusEnum } from '../enum/sync-status.enum'; @Table({ tableName: 'customer_SyncLog', timestamps: true }) export class CustomerSyncLogModel extends Model { @Column({ primaryKey: true, allowNull: false, type: DataType.STRING(30) }) SyncLogId: string; @ForeignKey(() => CustomerBaseModel) @Column({ primaryKey: true, allowNull: false, type: DataType.STRING(30) }) CustomerId: string; @Column({ allowNull: false, type: DataType.STRING(5) }) SourceSystemCode: string; @Column({ allowNull: false, type: DataType.STRING(5) }) TargetSystemCode: string; @Column({ allowNull: true, type: DataType.STRING(30) }) EventId: string; @Column({ allowNull: true, type: DataType.ENUM(...Object.values(EventTypeEnum)), }) EventType: EventTypeEnum; @Column({ allowNull: true, type: DataType.ENUM(...Object.values(SyncStatusEnum)), }) Status: SyncStatusEnum; @Column({ allowNull: true, type: DataType.JSON }) PayloadSnapshot: string; @Column({ allowNull: false, type: DataType.STRING(10), }) TrigerredBy: string; @Column({ allowNull: true, type: DataType.STRING(30), }) QueueJobId: string; @Column({ allowNull: true, type: DataType.DATE, }) SyncedAt: Date; @CreatedAt CreatedAt: Date; @UpdatedAt UpdatedAt: Date; @Column({ allowNull: true, type: DataType.INTEGER }) RetryCount: number; @Column({ allowNull: true, type: DataType.TEXT }) LastErrorMessage: string; @Column({ allowNull: true, type: DataType.DATE }) LastAttemptAt: Date; @Column({ allowNull: true, type: DataType.STRING(10) }) LastStatus: string; @BelongsTo(() => CustomerBaseModel) CustomerBase: CustomerBaseModel; }