|
|
@@ -1,29 +1,17 @@
|
|
|
-import {
|
|
|
- Column,
|
|
|
- CreateDateColumn,
|
|
|
- Entity,
|
|
|
- JoinTable,
|
|
|
- ManyToMany,
|
|
|
- OneToMany,
|
|
|
- PrimaryGeneratedColumn,
|
|
|
- UpdateDateColumn,
|
|
|
-} from 'typeorm';
|
|
|
+import { Column, Entity, JoinTable, ManyToMany, OneToMany } from 'typeorm';
|
|
|
import { DeepPartial } from '../../common/common-types';
|
|
|
-import { LocaleString, Translatable, Translation, TranslationInput } from '../../locale/locale-types';
|
|
|
+import { LocaleString, Translatable, Translation } from '../../locale/locale-types';
|
|
|
+import { VendureEntity } from '../base/base.entity';
|
|
|
import { ProductOptionGroup } from '../product-option-group/product-option-group.entity';
|
|
|
import { ProductVariant } from '../product-variant/product-variant.entity';
|
|
|
import { ProductTranslation } from './product-translation.entity';
|
|
|
|
|
|
-@Entity('product')
|
|
|
-export class Product implements Translatable {
|
|
|
+@Entity()
|
|
|
+export class Product extends VendureEntity implements Translatable {
|
|
|
constructor(input?: DeepPartial<Product>) {
|
|
|
- if (input) {
|
|
|
- Object.assign(this, input);
|
|
|
- }
|
|
|
+ super(input);
|
|
|
}
|
|
|
|
|
|
- @PrimaryGeneratedColumn('uuid') id: string;
|
|
|
-
|
|
|
name: LocaleString;
|
|
|
|
|
|
slug: LocaleString;
|
|
|
@@ -32,10 +20,6 @@ export class Product implements Translatable {
|
|
|
|
|
|
@Column() image: string;
|
|
|
|
|
|
- @CreateDateColumn() createdAt: string;
|
|
|
-
|
|
|
- @UpdateDateColumn() updatedAt: string;
|
|
|
-
|
|
|
@OneToMany(type => ProductTranslation, translation => translation.base, { eager: true })
|
|
|
translations: Array<Translation<Product>>;
|
|
|
|