UNPKG

@tomei/rental

Version:
134 lines (112 loc) 2.35 kB
import { Column, DataType, Table, Model, ForeignKey, BelongsTo, CreatedAt, UpdatedAt, HasMany, } from 'sequelize-typescript'; import { RentalPriceModel } from './rental-price.entity'; import { RentalStatusEnum } from '../enum/rental-status.enum'; import { JointHirerModel } from './joint-hirer.entity'; import { RentalAccountTypeEnum } from '../enum/account-type.enum'; import { AgreementModel } from './agreement.entity'; @Table({ tableName: 'rental_Rental', }) export class RentalModel extends Model { @Column({ primaryKey: true, allowNull: false, type: DataType.STRING(30), }) RentalId: string; @Column({ allowNull: false, type: DataType.STRING(30), }) CustomerId: string; @Column({ allowNull: false, type: DataType.STRING(30), }) CustomerType: string; @Column({ allowNull: false, type: DataType.STRING(30), }) ItemId: string; @Column({ allowNull: false, type: DataType.STRING(30), }) ItemType: string; @ForeignKey(() => RentalPriceModel) @Column({ allowNull: false, type: DataType.STRING(30), }) PriceId: string; @Column({ allowNull: false, type: DataType.DATE, }) StartDateTime: Date; @Column({ allowNull: false, type: DataType.DATE, }) EndDateTime: Date; @Column({ allowNull: false, type: DataType.STRING(50), }) Status: RentalStatusEnum; @Column({ type: DataType.STRING(3000), }) CancelRemarks: string; @Column({ type: DataType.STRING(3000), }) TerminateRemarks: string; @Column({ type: DataType.CHAR(1), }) EscheatmentYN: string; @ForeignKey(() => AgreementModel) @Column({ allowNull: false, unique: true, type: DataType.STRING(30), }) AgreementNo: string; @Column({ allowNull: false, type: DataType.STRING(10), }) AccountType: RentalAccountTypeEnum; @Column({ allowNull: false, type: DataType.STRING(30), }) CreatedById: string; @CreatedAt CreatedAt: Date; @Column({ allowNull: false, type: DataType.STRING(30), }) UpdatedById: string; @UpdatedAt UpdatedAt: Date; @BelongsTo(() => RentalPriceModel) RentalPrice: RentalPriceModel; @BelongsTo(() => AgreementModel) Agreement: AgreementModel; @HasMany(() => JointHirerModel) JointHirers: JointHirerModel[]; }