API/src/entity/site.entity.ts

47 lines
1.1 KiB
TypeScript

import { Column, Entity, JoinTable, ManyToMany, PrimaryGeneratedColumn } from 'typeorm';
import { Area } from './area.entity';
import { StockPoint } from './stock_point.entity';
@Entity('site')
export class Site {
@PrimaryGeneratedColumn()
id: number;
@Column({ length: 255, nullable: true })
apiUrl: string;
@Column({ name: 'website_url', length: 255, nullable: true })
websiteUrl: string;
@Column({ length: 255, nullable: true })
consumerKey?: string;
@Column({ length: 255, nullable: true })
consumerSecret?: string;
@Column({ nullable: true })
token?: string;
@Column({ length: 255, unique: true })
name: string;
@Column({ length: 255, nullable: true })
description?: string;
@Column({ length: 32, default: 'woocommerce' })
type: string; // 平台类型:woocommerce | shopyy
@Column({ length: 64, nullable: true })
skuPrefix: string;
@Column({ default: false })
isDisabled: boolean;
@ManyToMany(() => Area)
@JoinTable()
areas: Area[];
@ManyToMany(() => StockPoint, stockPoint => stockPoint.sites)
@JoinTable()
stockPoints: StockPoint[];
}