@reachu/database 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/entity/Attribute.d.ts +8 -0
  3. package/dist/entity/Attribute.js +41 -0
  4. package/dist/entity/Attribute.js.map +1 -0
  5. package/dist/entity/Category.d.ts +7 -1
  6. package/dist/entity/Category.js +23 -1
  7. package/dist/entity/Category.js.map +1 -1
  8. package/dist/entity/CategoryImages.d.ts +12 -0
  9. package/dist/entity/CategoryImages.js +57 -0
  10. package/dist/entity/CategoryImages.js.map +1 -0
  11. package/dist/entity/Product.entity.d.ts +2 -0
  12. package/dist/entity/Product.entity.js +6 -0
  13. package/dist/entity/Product.entity.js.map +1 -1
  14. package/dist/entity/ProductAttribute.d.ts +9 -0
  15. package/dist/entity/ProductAttribute.js +49 -0
  16. package/dist/entity/ProductAttribute.js.map +1 -0
  17. package/dist/entity/index.d.ts +4 -1
  18. package/dist/entity/index.js +7 -1
  19. package/dist/entity/index.js.map +1 -1
  20. package/dist/helpers/products/storage/search.d.ts +1 -0
  21. package/dist/migrations/1677706695399-promote_to_production_2023_01_03.d.ts +6 -0
  22. package/dist/migrations/1677706695399-promote_to_production_2023_01_03.js +49 -0
  23. package/dist/migrations/1677706695399-promote_to_production_2023_01_03.js.map +1 -0
  24. package/dist/repositories/index.d.ts +9 -0
  25. package/dist/repositories/index.js +23 -2
  26. package/dist/repositories/index.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +86 -9
  28. package/package.json +74 -74
  29. package/src/entity/Attribute.ts +30 -0
  30. package/src/entity/Category.ts +28 -2
  31. package/src/entity/CategoryImages.ts +38 -0
  32. package/src/entity/Product.entity.ts +9 -0
  33. package/src/entity/ProductAttribute.ts +27 -0
  34. package/src/entity/index.ts +7 -0
  35. package/src/migrations/1677706695399-promote_to_production_2023_01_03.ts +34 -0
  36. package/src/repositories/index.ts +13 -0
@@ -0,0 +1,34 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class promoteToProduction202301031677706695399 implements MigrationInterface {
4
+ name = 'promoteToProduction202301031677706695399'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`CREATE TABLE \`custom_product_image\` (\`id\` int NOT NULL AUTO_INCREMENT, \`deleted_at\` datetime(6) NULL, \`url\` varchar(255) NOT NULL, \`width\` int NULL, \`height\` int NULL, \`order\` int NOT NULL, \`product_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
8
+ await queryRunner.query(`CREATE TABLE \`custom_product\` (\`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`id\` int NOT NULL AUTO_INCREMENT, \`deleted_at\` datetime(6) NULL, \`title\` varchar(255) NULL, \`description\` text NULL, \`description_two\` text NULL, \`public_price\` decimal(10,2) NULL, \`sku\` varchar(255) NULL, \`barcode\` varchar(255) NULL, \`visible\` tinyint NOT NULL DEFAULT 0, \`product_id\` int NULL, \`user_id\` int NULL, \`price_amount\` decimal(10,2) NULL, \`price_currency_code\` varchar(255) NULL, \`price_base_amount\` decimal(10,2) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
9
+ await queryRunner.query(`CREATE TABLE \`custom_variant\` (\`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`id\` int NOT NULL AUTO_INCREMENT, \`deleted_at\` datetime(6) NULL, \`title\` varchar(255) NOT NULL, \`sku\` varchar(255) NOT NULL, \`barcode\` varchar(255) NULL, \`quantity\` int NOT NULL, \`custom_product_id\` int NULL, \`variant_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
10
+ await queryRunner.query(`ALTER TABLE \`user_settings\` ADD \`custom_products\` tinyint NOT NULL DEFAULT 0`);
11
+ await queryRunner.query(`ALTER TABLE \`shipping\` ADD \`default\` tinyint NOT NULL DEFAULT 0`);
12
+ await queryRunner.query(`ALTER TABLE \`product\` ADD \`active\` tinyint NOT NULL DEFAULT 0`);
13
+ await queryRunner.query(`ALTER TABLE \`custom_product_image\` ADD CONSTRAINT \`FK_02a813811810b4faf6bac7361a4\` FOREIGN KEY (\`product_id\`) REFERENCES \`custom_product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
14
+ await queryRunner.query(`ALTER TABLE \`custom_product\` ADD CONSTRAINT \`FK_7a615131bff0eb11f4709f77bcf\` FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
15
+ await queryRunner.query(`ALTER TABLE \`custom_product\` ADD CONSTRAINT \`FK_f89b6142de14e0db9655247b926\` FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
16
+ await queryRunner.query(`ALTER TABLE \`custom_variant\` ADD CONSTRAINT \`FK_c30da998f87bb92036e815ebdf6\` FOREIGN KEY (\`custom_product_id\`) REFERENCES \`custom_product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
17
+ await queryRunner.query(`ALTER TABLE \`custom_variant\` ADD CONSTRAINT \`FK_2266fdf123653773d75afd951da\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
18
+ }
19
+
20
+ public async down(queryRunner: QueryRunner): Promise<void> {
21
+ await queryRunner.query(`ALTER TABLE \`custom_variant\` DROP FOREIGN KEY \`FK_2266fdf123653773d75afd951da\``);
22
+ await queryRunner.query(`ALTER TABLE \`custom_variant\` DROP FOREIGN KEY \`FK_c30da998f87bb92036e815ebdf6\``);
23
+ await queryRunner.query(`ALTER TABLE \`custom_product\` DROP FOREIGN KEY \`FK_f89b6142de14e0db9655247b926\``);
24
+ await queryRunner.query(`ALTER TABLE \`custom_product\` DROP FOREIGN KEY \`FK_7a615131bff0eb11f4709f77bcf\``);
25
+ await queryRunner.query(`ALTER TABLE \`custom_product_image\` DROP FOREIGN KEY \`FK_02a813811810b4faf6bac7361a4\``);
26
+ await queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`active\``);
27
+ await queryRunner.query(`ALTER TABLE \`shipping\` DROP COLUMN \`default\``);
28
+ await queryRunner.query(`ALTER TABLE \`user_settings\` DROP COLUMN \`custom_products\``);
29
+ await queryRunner.query(`DROP TABLE \`custom_variant\``);
30
+ await queryRunner.query(`DROP TABLE \`custom_product\``);
31
+ await queryRunner.query(`DROP TABLE \`custom_product_image\``);
32
+ }
33
+
34
+ }
@@ -51,6 +51,10 @@ import CustomVariant from '../entity/CustomVariant';
51
51
  import { CustomProduct } from '../entity/CustomProduct';
52
52
  import CustomProductImage from '../entity/CustomProductImage';
53
53
 
54
+ import Attribute from '../entity/Attribute';
55
+ import ProductAttribute from '../entity/ProductAttribute';
56
+ import CategoryImages from '../entity/CategoryImages';
57
+
54
58
  import {
55
59
  CartItemRepository,
56
60
  CartRepository,
@@ -68,6 +72,15 @@ import {
68
72
 
69
73
  import { Repository, EntityRepository } from 'typeorm';
70
74
 
75
+ @EntityRepository(CategoryImages)
76
+ export class CategoryImagesRepository extends Repository<CategoryImages> {}
77
+
78
+ @EntityRepository(ProductAttribute)
79
+ export class ProductAttributeRepository extends Repository<ProductAttribute> {}
80
+
81
+ @EntityRepository(Attribute)
82
+ export class AttributeRepository extends Repository<Attribute> {}
83
+
71
84
  @EntityRepository(CustomVariant)
72
85
  export class CustomVariantRepository extends Repository<CustomVariant> {}
73
86