UNPKG

@tomei/sso

Version:
114 lines (95 loc) 2.08 kB
import { BelongsTo, Column, CreatedAt, DataType, ForeignKey, HasMany, Model, Table, UpdatedAt, } from 'sequelize-typescript'; import User from './user.entity'; import SystemPrivilegeModel from './system-privilege.entity'; import UserSystemAccessModel from './user-system-access.entity'; import GroupSystemAccessModel from './group-system-access.entity'; @Table({ tableName: 'sso_System', timestamps: true, createdAt: 'CreatedAt', updatedAt: 'UpdatedAt', }) export default class SystemModel extends Model { @Column({ primaryKey: true, allowNull: false, type: DataType.STRING(30), }) SystemCode: string; @Column({ allowNull: false, type: DataType.STRING(200), }) Name: string; @Column({ allowNull: false, type: DataType.STRING(500), }) Description: string; @Column({ allowNull: true, type: DataType.STRING(2000), }) AccessURL: string; @Column({ allowNull: true, type: DataType.STRING(2000), }) GooglePlayURL: string; @Column({ allowNull: true, type: DataType.STRING(2000), }) AppleStoreURL: string; @Column({ allowNull: true, type: DataType.STRING(255), }) APIKey: string; @Column({ allowNull: true, type: DataType.STRING(255), }) APISecret: string; @Column({ allowNull: false, type: DataType.STRING(10), }) Status: string; @ForeignKey(() => User) @Column({ allowNull: false, type: DataType.INTEGER, }) CreatedById: number; @ForeignKey(() => User) @Column({ allowNull: false, type: DataType.INTEGER, }) UpdatedById: number; @CreatedAt CreatedAt: Date; @UpdatedAt UpdatedAt: Date; @BelongsTo(() => User, 'CreatedById') CreatedByUser: User; @BelongsTo(() => User, 'UpdatedById') UpdatedByUser: User; @HasMany(() => SystemPrivilegeModel) SystemPrivileges: SystemPrivilegeModel[]; @HasMany(() => UserSystemAccessModel) UserSystemAccesses: UserSystemAccessModel[]; @HasMany(() => GroupSystemAccessModel) GroupSystemAccesses: GroupSystemAccessModel[]; }