import { Field, InterfaceType } from 'type-graphql'; import { Column, Index } from 'typeorm'; import { AbstractEntity } from '@/entities/abstract'; @Index(['identifiers'], { background: true, }) @InterfaceType({ implements: AbstractEntity.objectTypeImplements, }) export default class AbstractProductData extends AbstractEntity { // eslint-disable-next-line @typescript-eslint/ban-types static objectTypeImplements: Function[] = [ ...AbstractEntity.objectTypeImplements, AbstractProductData, ]; /** * Array of known identifiers for this entity. If there are multiple * entities with the same identifiers, then they should be considered the * same. */ @Column({ type: 'text', array: true, default: [], }) identifiers!: string[]; // if any of these match, then this is the same product (let's index this) @Column({ type: 'boolean', nullable: true, }) @Field(() => Boolean, { nullable: true, }) discoverable?: boolean; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) asin?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) dimensions?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) colorCode?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) annotations?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) description?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) name?: string; @Column({ type: 'float', nullable: false, }) @Field(() => Number, { nullable: true, }) price!: number; @Column({ type: 'boolean', nullable: true, }) @Field(() => Boolean, { nullable: true, }) isAvailable?: boolean; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) distributor?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) distributorSKU?: string; @Column({ type: 'text', nullable: true, }) @Field(() => String, { nullable: true, }) category!: string | null; @Column({ type: 'text', array: true, default: [], }) @Field(() => [String], { nullable: false, }) imageUrls!: string[]; @Column({ type: 'boolean', nullable: false, default: false, }) @Field(() => Boolean, { nullable: false, }) featured!: boolean; }