import { BelongsTo, Column, DataType, ForeignKey, HasMany, Index, Model, Table, } from 'sequelize-typescript'; import { Address } from './address'; import { Block } from './block'; import { Coin } from './coin'; import { NftReserve } from './nftReserve'; import { StakeNft } from './stakeNft'; import { Tx } from './tx'; @Table({ timestamps: true }) export class Nft extends Model { @Index({ name: 'nft-nftId-index', using: 'HASH', }) @Column({ type: DataType.STRING }) nftId: string; @Column(DataType.STRING) nftCollection: string; @Index({ name: 'nft-creator-index', using: 'HASH', }) @ForeignKey(() => Address) @Column({ type: DataType.INTEGER, allowNull: false }) creatorId: number; @BelongsTo(() => Address) creator: Address; @Column(DataType.INTEGER) quantity: number; @ForeignKey(() => Coin) @Column(DataType.INTEGER) coinId: number; @Column(DataType.DECIMAL) startReserve: string; @Column(DataType.STRING) totalReserve: string; @Column(DataType.TEXT) tokenUri: string; @Column(DataType.BOOLEAN) allowMint: boolean; @Column(DataType.BOOLEAN) nonFungible: boolean; @ForeignKey(() => Tx) @Column(DataType.INTEGER) txHash: number; @ForeignKey(() => Block) @Column(DataType.INTEGER) blockId: number; @BelongsTo(() => Tx) initTx: Tx; @HasMany(() => StakeNft) stakes: StakeNft[]; @HasMany(() => NftReserve) nftReserve: NftReserve[]; @BelongsTo(() => Coin) coin: Coin; }