@reachu/database 1.0.93 → 1.0.95

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 (46) hide show
  1. package/dist/entity/Variant.d.ts +1 -0
  2. package/dist/entity/Variant.js +4 -0
  3. package/dist/entity/Variant.js.map +1 -1
  4. package/dist/entity/index.d.ts +5 -1
  5. package/dist/entity/index.js +9 -1
  6. package/dist/entity/index.js.map +1 -1
  7. package/dist/entity/modules/discount/Discount.d.ts +18 -0
  8. package/dist/entity/modules/discount/Discount.js +80 -0
  9. package/dist/entity/modules/discount/Discount.js.map +1 -0
  10. package/dist/entity/modules/discount/DiscountCart.d.ts +9 -0
  11. package/dist/entity/modules/discount/DiscountCart.js +47 -0
  12. package/dist/entity/modules/discount/DiscountCart.js.map +1 -0
  13. package/dist/entity/modules/discount/DiscountProduct.d.ts +9 -0
  14. package/dist/entity/modules/discount/DiscountProduct.js +47 -0
  15. package/dist/entity/modules/discount/DiscountProduct.js.map +1 -0
  16. package/dist/entity/modules/discount/DiscountType.d.ts +8 -0
  17. package/dist/entity/modules/discount/DiscountType.js +41 -0
  18. package/dist/entity/modules/discount/DiscountType.js.map +1 -0
  19. package/dist/migrations/1689005718747-add-active-colum-in-variant.d.ts +6 -0
  20. package/dist/migrations/1689005718747-add-active-colum-in-variant.js +47 -0
  21. package/dist/migrations/1689005718747-add-active-colum-in-variant.js.map +1 -0
  22. package/dist/migrations/1689020331011-add-discount.d.ts +6 -0
  23. package/dist/migrations/1689020331011-add-discount.js +45 -0
  24. package/dist/migrations/1689020331011-add-discount.js.map +1 -0
  25. package/dist/migrations/1689279346515-add-discount-user.d.ts +6 -0
  26. package/dist/migrations/1689279346515-add-discount-user.js +31 -0
  27. package/dist/migrations/1689279346515-add-discount-user.js.map +1 -0
  28. package/dist/repositories/discount/index.d.ts +13 -0
  29. package/dist/repositories/discount/index.js +42 -0
  30. package/dist/repositories/discount/index.js.map +1 -0
  31. package/dist/repositories/index.d.ts +2 -0
  32. package/dist/repositories/index.js +6 -1
  33. package/dist/repositories/index.js.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +142 -6
  35. package/package.json +3 -3
  36. package/src/entity/Variant.ts +3 -0
  37. package/src/entity/index.ts +10 -0
  38. package/src/entity/modules/discount/Discount.ts +59 -0
  39. package/src/entity/modules/discount/DiscountCart.ts +25 -0
  40. package/src/entity/modules/discount/DiscountProduct.ts +25 -0
  41. package/src/entity/modules/discount/DiscountType.ts +26 -0
  42. package/src/migrations/1689005718747-add-active-colum-in-variant.ts +32 -0
  43. package/src/migrations/1689020331011-add-discount.ts +30 -0
  44. package/src/migrations/1689279346515-add-discount-user.ts +16 -0
  45. package/src/repositories/discount/index.ts +18 -0
  46. package/src/repositories/index.ts +14 -0
@@ -0,0 +1,30 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class addDiscount1689020331011 implements MigrationInterface {
4
+ name = 'addDiscount1689020331011'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`CREATE TABLE \`discount_type\` (\`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, \`type\` varchar(255) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
8
+ await queryRunner.query(`CREATE TABLE \`discount_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, \`product_id\` int NOT NULL, \`discount_id\` int NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
9
+ await queryRunner.query(`CREATE TABLE \`discount_cart\` (\`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, \`discount_id\` int NOT NULL, \`cart_id\` varchar(36) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
10
+ await queryRunner.query(`CREATE TABLE \`discount\` (\`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, \`discount_count\` int NULL, \`code\` varchar(255) NOT NULL, \`percentage\` int NOT NULL, \`start_date\` datetime NOT NULL, \`end_date\` datetime NOT NULL, \`discount_type_id\` int NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
11
+ await queryRunner.query(`ALTER TABLE \`discount_product\` ADD CONSTRAINT \`FK_6939b3f91b1db4d133d20c33e3b\` FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
12
+ await queryRunner.query(`ALTER TABLE \`discount_product\` ADD CONSTRAINT \`FK_6cfb1683e023b96a42f7e72edd6\` FOREIGN KEY (\`discount_id\`) REFERENCES \`discount\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
13
+ await queryRunner.query(`ALTER TABLE \`discount_cart\` ADD CONSTRAINT \`FK_ff034b5de6a90766ce209ae92a4\` FOREIGN KEY (\`discount_id\`) REFERENCES \`discount\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
14
+ await queryRunner.query(`ALTER TABLE \`discount_cart\` ADD CONSTRAINT \`FK_42951860fa261b863933523298e\` FOREIGN KEY (\`cart_id\`) REFERENCES \`cart\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
15
+ await queryRunner.query(`ALTER TABLE \`discount\` ADD CONSTRAINT \`FK_40b4ec0b1661fe175e00646f507\` FOREIGN KEY (\`discount_type_id\`) REFERENCES \`discount_type\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(`ALTER TABLE \`discount\` DROP FOREIGN KEY \`FK_40b4ec0b1661fe175e00646f507\``);
20
+ await queryRunner.query(`ALTER TABLE \`discount_cart\` DROP FOREIGN KEY \`FK_42951860fa261b863933523298e\``);
21
+ await queryRunner.query(`ALTER TABLE \`discount_cart\` DROP FOREIGN KEY \`FK_ff034b5de6a90766ce209ae92a4\``);
22
+ await queryRunner.query(`ALTER TABLE \`discount_product\` DROP FOREIGN KEY \`FK_6cfb1683e023b96a42f7e72edd6\``);
23
+ await queryRunner.query(`ALTER TABLE \`discount_product\` DROP FOREIGN KEY \`FK_6939b3f91b1db4d133d20c33e3b\``);
24
+ await queryRunner.query(`DROP TABLE \`discount\``);
25
+ await queryRunner.query(`DROP TABLE \`discount_cart\``);
26
+ await queryRunner.query(`DROP TABLE \`discount_product\``);
27
+ await queryRunner.query(`DROP TABLE \`discount_type\``);
28
+ }
29
+
30
+ }
@@ -0,0 +1,16 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class addDiscountUser1689279346515 implements MigrationInterface {
4
+ name = 'addDiscountUser1689279346515'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE \`discount\` ADD \`user_id\` int NULL`);
8
+ await queryRunner.query(`ALTER TABLE \`discount\` ADD CONSTRAINT \`FK_494f73684a24415ee7becc8cb6a\` FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
9
+ }
10
+
11
+ public async down(queryRunner: QueryRunner): Promise<void> {
12
+ await queryRunner.query(`ALTER TABLE \`discount\` DROP FOREIGN KEY \`FK_494f73684a24415ee7becc8cb6a\``);
13
+ await queryRunner.query(`ALTER TABLE \`discount\` DROP COLUMN \`user_id\``);
14
+ }
15
+
16
+ }
@@ -0,0 +1,18 @@
1
+ import { Repository, EntityRepository } from 'typeorm';
2
+
3
+ import Discount from '../../entity/modules/discount/Discount';
4
+ import DiscountCart from '../../entity/modules/discount/DiscountCart';
5
+ import DiscountProduct from '../../entity/modules/discount/DiscountProduct';
6
+ import DiscountType from '../../entity/modules/discount/DiscountType';
7
+
8
+ @EntityRepository(Discount)
9
+ export class DiscountRepository extends Repository<Discount> {}
10
+
11
+ @EntityRepository(DiscountCart)
12
+ export class DiscountCartRepository extends Repository<DiscountCart> {}
13
+
14
+ @EntityRepository(DiscountProduct)
15
+ export class DiscountProductRepository extends Repository<DiscountProduct> {}
16
+
17
+ @EntityRepository(DiscountType)
18
+ export class DiscountTypeRepository extends Repository<DiscountType> {}
@@ -94,6 +94,13 @@ import {
94
94
  UserTemplateEcommerceRepository,
95
95
  } from './templates';
96
96
 
97
+ import {
98
+ DiscountRepository,
99
+ DiscountCartRepository,
100
+ DiscountProductRepository,
101
+ DiscountTypeRepository,
102
+ } from './discount';
103
+
97
104
  import { PlanRepository, SubscriptionRepository, UserCountPlanRepository } from './subscriptions';
98
105
 
99
106
  import { Repository, EntityRepository } from 'typeorm';
@@ -299,6 +306,13 @@ export {
299
306
  UserTemplateEcommerceRepository,
300
307
  };
301
308
 
309
+ export {
310
+ DiscountRepository,
311
+ DiscountCartRepository,
312
+ DiscountProductRepository,
313
+ DiscountTypeRepository,
314
+ };
315
+
302
316
  export { ProductShippingRepository, ShippingCountryRepository, ShippingRepository };
303
317
 
304
318
  export { PlanRepository, SubscriptionRepository, UserCountPlanRepository };