Selaa lähdekoodia

refactor(server): Move common types into top-level shared directory

Michael Bromley 7 vuotta sitten
vanhempi
sitoutus
e6bc74eb7a
29 muutettua tiedostoa jossa 28 lisäystä ja 28 poistoa
  1. 1 1
      server/src/api/customer/customer.controller.ts
  2. 1 1
      server/src/api/customer/customer.resolver.ts
  3. 1 1
      server/src/api/product/product.resolver.ts
  4. 1 1
      server/src/config/entity-id-strategy.ts
  5. 1 1
      server/src/config/merge-config.ts
  6. 1 1
      server/src/config/vendure-config.ts
  7. 1 1
      server/src/entity/address/address.entity.ts
  8. 1 1
      server/src/entity/administrator/administrator.entity.ts
  9. 1 1
      server/src/entity/base/base.entity.ts
  10. 1 1
      server/src/entity/customer/customer.entity.ts
  11. 1 1
      server/src/entity/product-option-group/product-option-group-translation.entity.ts
  12. 1 1
      server/src/entity/product-option-group/product-option-group.entity.ts
  13. 1 1
      server/src/entity/product-option/product-option-translation.entity.ts
  14. 1 1
      server/src/entity/product-option/product-option.entity.ts
  15. 1 1
      server/src/entity/product-variant/product-variant-translation.entity.ts
  16. 1 1
      server/src/entity/product-variant/product-variant.entity.ts
  17. 1 1
      server/src/entity/product/product-translation.entity.ts
  18. 1 1
      server/src/entity/product/product.entity.ts
  19. 1 1
      server/src/entity/user/user.entity.ts
  20. 1 1
      server/src/locale/locale-types.ts
  21. 1 1
      server/src/locale/translation-updater.ts
  22. 1 1
      server/src/service/config.service.ts
  23. 1 1
      server/src/service/customer.service.ts
  24. 1 1
      server/src/service/id-codec.service.ts
  25. 1 1
      server/src/service/product-option-group.service.ts
  26. 1 1
      server/src/service/product-option.service.ts
  27. 1 1
      server/src/service/product.service.ts
  28. 1 1
      server/src/testing/connection.mock.ts
  29. 0 0
      shared/shared-types.ts

+ 1 - 1
server/src/api/customer/customer.controller.ts

@@ -1,5 +1,5 @@
 import { Controller, Get, Param } from '@nestjs/common';
-import { PaginatedList } from '../../common/common-types';
+import { PaginatedList } from '../../../../shared/shared-types';
 import { Customer } from '../../entity/customer/customer.entity';
 import { CustomerService } from '../../service/customer.service';
 

+ 1 - 1
server/src/api/customer/customer.resolver.ts

@@ -1,5 +1,5 @@
 import { Mutation, Query, ResolveProperty, Resolver } from '@nestjs/graphql';
-import { PaginatedList } from '../../common/common-types';
+import { PaginatedList } from '../../../../shared/shared-types';
 import { Address } from '../../entity/address/address.entity';
 import { CreateCustomerDto } from '../../entity/customer/customer.dto';
 import { Customer } from '../../entity/customer/customer.entity';

+ 1 - 1
server/src/api/product/product.resolver.ts

@@ -1,5 +1,5 @@
 import { Mutation, Query, Resolver } from '@nestjs/graphql';
-import { PaginatedList } from '../../common/common-types';
+import { PaginatedList } from '../../../../shared/shared-types';
 import { Product } from '../../entity/product/product.entity';
 import { IdCodecService } from '../../service/id-codec.service';
 import { ProductVariantService } from '../../service/product-variant.service';

+ 1 - 1
server/src/config/entity-id-strategy.ts

@@ -1,4 +1,4 @@
-import { ID } from '../common/common-types';
+import { ID } from '../../../shared/shared-types';
 
 export type PrimaryKeyType = 'increment' | 'uuid';
 

+ 1 - 1
server/src/config/merge-config.ts

@@ -1,4 +1,4 @@
-import { DeepPartial } from '../common/common-types';
+import { DeepPartial } from '../../../shared/shared-types';
 import { VendureConfig } from './vendure-config';
 
 /**

+ 1 - 1
server/src/config/vendure-config.ts

@@ -1,6 +1,6 @@
 import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
 import { ConnectionOptions } from 'typeorm';
-import { DeepPartial, ReadOnlyRequired } from '../common/common-types';
+import { DeepPartial, ReadOnlyRequired } from '../../../shared/shared-types';
 import { LanguageCode } from '../locale/language-code';
 import { AutoIncrementIdStrategy } from './auto-increment-id-strategy';
 import { EntityIdStrategy } from './entity-id-strategy';

+ 1 - 1
server/src/entity/address/address.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, ManyToOne } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { VendureEntity } from '../base/base.entity';
 import { Customer } from '../customer/customer.entity';
 

+ 1 - 1
server/src/entity/administrator/administrator.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, JoinColumn, OneToOne } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { VendureEntity } from '../base/base.entity';
 import { User } from '../user/user.entity';
 

+ 1 - 1
server/src/entity/base/base.entity.ts

@@ -1,5 +1,5 @@
 import { CreateDateColumn, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
-import { DeepPartial, ID } from '../../common/common-types';
+import { DeepPartial, ID } from '../../../../shared/shared-types';
 import { getConfig } from '../../config/vendure-config';
 
 const primaryKeyType = getConfig().entityIdStrategy.primaryKeyType as any;

+ 1 - 1
server/src/entity/customer/customer.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, JoinColumn, OneToMany, OneToOne } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { Address } from '../address/address.entity';
 import { VendureEntity } from '../base/base.entity';
 import { User } from '../user/user.entity';

+ 1 - 1
server/src/entity/product-option-group/product-option-group-translation.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, ManyToOne } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';

+ 1 - 1
server/src/entity/product-option-group/product-option-group.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, OneToMany } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { LocaleString, Translatable, Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { ProductOption } from '../product-option/product-option.entity';

+ 1 - 1
server/src/entity/product-option/product-option-translation.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, ManyToOne } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';

+ 1 - 1
server/src/entity/product-option/product-option.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, ManyToOne, OneToMany } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-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';

+ 1 - 1
server/src/entity/product-variant/product-variant-translation.entity.ts

@@ -1,5 +1,5 @@
 import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';

+ 1 - 1
server/src/entity/product-variant/product-variant.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { LocaleString, Translatable, Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { ProductOption } from '../product-option/product-option.entity';

+ 1 - 1
server/src/entity/product/product-translation.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, ManyToOne } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { LanguageCode } from '../../locale/language-code';
 import { Translation, TranslationInput } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';

+ 1 - 1
server/src/entity/product/product.entity.ts

@@ -1,5 +1,5 @@
 import { Column, Entity, JoinTable, ManyToMany, OneToMany } from 'typeorm';
-import { DeepPartial } from '../../common/common-types';
+import { DeepPartial } from '../../../../shared/shared-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';

+ 1 - 1
server/src/entity/user/user.entity.ts

@@ -1,6 +1,6 @@
 import { Column, Entity } from 'typeorm';
+import { DeepPartial } from '../../../../shared/shared-types';
 import { Role } from '../../auth/role';
-import { DeepPartial } from '../../common/common-types';
 import { VendureEntity } from '../base/base.entity';
 
 @Entity()

+ 1 - 1
server/src/locale/locale-types.ts

@@ -1,4 +1,4 @@
-import { ID } from '../common/common-types';
+import { ID } from '../../../shared/shared-types';
 import { VendureEntity } from '../entity/base/base.entity';
 import { LanguageCode } from './language-code';
 

+ 1 - 1
server/src/locale/translation-updater.ts

@@ -1,5 +1,5 @@
 import { EntityManager } from 'typeorm';
-import { DeepPartial, Type } from '../common/common-types';
+import { DeepPartial, Type } from '../../../shared/shared-types';
 import { foundIn, not } from '../common/utils';
 import { Translatable, Translation, TranslationInput } from './locale-types';
 

+ 1 - 1
server/src/service/config.service.ts

@@ -1,7 +1,7 @@
 import { Injectable } from '@nestjs/common';
 import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
 import { ConnectionOptions } from 'typeorm';
-import { ReadOnlyRequired } from '../common/common-types';
+import { ReadOnlyRequired } from '../../../shared/shared-types';
 import { EntityIdStrategy } from '../config/entity-id-strategy';
 import { getConfig, VendureConfig } from '../config/vendure-config';
 import { LanguageCode } from '../locale/language-code';

+ 1 - 1
server/src/service/customer.service.ts

@@ -1,9 +1,9 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
 import { Connection } from 'typeorm';
+import { ID, PaginatedList } from '../../../shared/shared-types';
 import { PasswordService } from '../auth/password.service';
 import { Role } from '../auth/role';
-import { ID, PaginatedList } from '../common/common-types';
 import { CreateAddressDto } from '../entity/address/address.dto';
 import { Address } from '../entity/address/address.entity';
 import { CreateCustomerDto } from '../entity/customer/customer.dto';

+ 1 - 1
server/src/service/id-codec.service.ts

@@ -1,5 +1,5 @@
 import { Injectable } from '@nestjs/common';
-import { ID, PaginatedList } from '../common/common-types';
+import { ID, PaginatedList } from '../../../shared/shared-types';
 import { VendureEntity } from '../entity/base/base.entity';
 import { ConfigService } from './config.service';
 

+ 1 - 1
server/src/service/product-option-group.service.ts

@@ -1,7 +1,7 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
 import { Connection } from 'typeorm';
-import { ID } from '../common/common-types';
+import { ID } from '../../../shared/shared-types';
 import { DEFAULT_LANGUAGE_CODE } from '../common/constants';
 import { ProductOptionGroupTranslation } from '../entity/product-option-group/product-option-group-translation.entity';
 import {

+ 1 - 1
server/src/service/product-option.service.ts

@@ -1,7 +1,7 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
 import { Connection } from 'typeorm';
-import { ID } from '../common/common-types';
+import { ID } from '../../../shared/shared-types';
 import { DEFAULT_LANGUAGE_CODE } from '../common/constants';
 import { ProductOptionGroup } from '../entity/product-option-group/product-option-group.entity';
 import { ProductOptionTranslation } from '../entity/product-option/product-option-translation.entity';

+ 1 - 1
server/src/service/product.service.ts

@@ -1,7 +1,7 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
 import { Connection } from 'typeorm';
-import { ID, PaginatedList } from '../common/common-types';
+import { ID, PaginatedList } from '../../../shared/shared-types';
 import { DEFAULT_LANGUAGE_CODE } from '../common/constants';
 import { ProductOptionGroup } from '../entity/product-option-group/product-option-group.entity';
 import { ProductTranslation } from '../entity/product/product-translation.entity';

+ 1 - 1
server/src/testing/connection.mock.ts

@@ -1,5 +1,5 @@
 import { AbstractRepository, EntityManager, Repository } from 'typeorm';
-import { Type } from '../common/common-types';
+import { Type } from '../../../shared/shared-types';
 import { MockClass } from './testing-types';
 
 /**

+ 0 - 0
server/src/common/common-types.ts → shared/shared-types.ts