dfsi.ts

PHOTO EMBED

Mon Dec 25 2023 18:37:10 GMT+0000 (Coordinated Universal Time)

Saved by @thanuj #sql

import { Entity, Column, ManyToOne, JoinColumn, VirtualColumn} from 'typeorm';
import { CustomerDomainEntity } from '../base/CustomerDomainEntity';
import { SubmissionPeriod } from '../submission/SubmissionPeriod';
import { getDataFileIdSql, getDataFileNameSql } from './DataFileSummaryInfoSql';

export const returnsSubmissionPeriods = () => SubmissionPeriod;
export const returnsSummaryInfo = (submissionPeriod) => submissionPeriod.dataFileSummaryInfo;

@Entity({ name: 'DATA_FILE_SUMMARY_INFO' })
export class DataFileSummaryInfo extends CustomerDomainEntity {

    @ManyToOne(returnsSubmissionPeriods,returnsSummaryInfo)
    @JoinColumn({ name: 'SUBMISSION_PERIOD_SID', referencedColumnName:'sid'})
    submissionPeriod: SubmissionPeriod;

    @Column({name:'DATA_FILE_SID'})
    dataFileSid: number;

    @Column({name: 'CUSTOMER_SID'})
    customerSid: number;

    @Column({name:'NUM_SLIS'})
    numberOfPOSLines: number;

    @Column({name:'NUM_ILIS'})
    numberOfInventoryLines: number;

    @Column({name: 'CREATE_DATE'})
    receivedDate: Date;
    
    @Column({ name: 'SUBMISSION_PERIOD_SID', nullable: true })
    submissionPeriodSid: number;

    @VirtualColumn({ query: getDataFileIdSql})
    dataFileId?: string;
    
    @VirtualColumn({ query: getDataFileNameSql})
    dataFileName?: string;
}

content_copyCOPY