zone.entity.ts 889 B

123456789101112131415161718192021222324252627282930
  1. import { DeepPartial } from '@vendure/common/lib/shared-types';
  2. import { Column, Entity, JoinTable, ManyToMany } from 'typeorm';
  3. import { HasCustomFields } from '../../config/custom-field/custom-field-types';
  4. import { VendureEntity } from '../base/base.entity';
  5. import { Country } from '../country/country.entity';
  6. import { CustomZoneFields } from '../custom-entity-fields';
  7. /**
  8. * @description
  9. * A Zone is a grouping of one or more {@link Country} entities. It is used for
  10. * calculating applicable shipping and taxes.
  11. *
  12. * @docsCategory entities
  13. */
  14. @Entity()
  15. export class Zone extends VendureEntity implements HasCustomFields {
  16. constructor(input?: DeepPartial<Zone>) {
  17. super(input);
  18. }
  19. @Column() name: string;
  20. @ManyToMany(type => Country)
  21. @JoinTable()
  22. members: Country[];
  23. @Column(type => CustomZoneFields)
  24. customFields: CustomZoneFields;
  25. }