Skip to content

Commit

Permalink
feat(core): Make ProductOptionGroup / ProductOption soft-deletable
Browse files Browse the repository at this point in the history
Relates to #291

BREAKING CHANGE: The ProductOptionGroup & ProductOption entities have a new `deletedAt` column
which will require a DB migration.
  • Loading branch information
michaelbromley committed Feb 10, 2021
1 parent ad04e60 commit 0c997bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DeepPartial } from '@vendure/common/lib/shared-types';
import { Column, Entity, ManyToOne, OneToMany } from 'typeorm';

import { SoftDeletable } from '../../common/types/common-types';
import { LocaleString, Translatable, Translation } from '../../common/types/locale-types';
import { HasCustomFields } from '../../config/custom-field/custom-field-types';
import { VendureEntity } from '../base/base.entity';
Expand All @@ -17,10 +18,14 @@ import { ProductOptionGroupTranslation } from './product-option-group-translatio
* @docsCategory entities
*/
@Entity()
export class ProductOptionGroup extends VendureEntity implements Translatable, HasCustomFields {
export class ProductOptionGroup
extends VendureEntity
implements Translatable, HasCustomFields, SoftDeletable {
constructor(input?: DeepPartial<ProductOptionGroup>) {
super(input);
}
@Column({ type: Date, nullable: true })
deletedAt: Date | null;

name: LocaleString;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DeepPartial, ID } from '@vendure/common/lib/shared-types';
import { Column, Entity, ManyToOne, OneToMany } from 'typeorm';

import { SoftDeletable } from '../../common/types/common-types';
import { LocaleString, Translatable, Translation } from '../../common/types/locale-types';
import { HasCustomFields } from '../../config/custom-field/custom-field-types';
import { VendureEntity } from '../base/base.entity';
Expand All @@ -17,10 +18,12 @@ import { ProductOptionTranslation } from './product-option-translation.entity';
* @docsCategory entities
*/
@Entity()
export class ProductOption extends VendureEntity implements Translatable, HasCustomFields {
export class ProductOption extends VendureEntity implements Translatable, HasCustomFields, SoftDeletable {
constructor(input?: DeepPartial<ProductOption>) {
super(input);
}
@Column({ type: Date, nullable: true })
deletedAt: Date | null;

name: LocaleString;

Expand Down

0 comments on commit 0c997bf

Please sign in to comment.