@reachu/database 1.0.110 → 1.0.111

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.
@@ -6,15 +6,18 @@ import User from './User';
6
6
  import ShopifyConnection from './ShopifyConnection';
7
7
  import WooConnection from './WooConnection';
8
8
  import UserChannelApiKey from './UserChannelApiKey';
9
+ import { MagentoConnection } from './MagentoConnection.entity';
9
10
  export default class ChannelUser extends AuditedModel {
10
11
  deletedAt: Date;
11
12
  id: number;
12
13
  customName: string;
14
+ active: boolean;
13
15
  user: User;
14
16
  channel: Channel;
15
17
  channelGroup: ChannelGroup[];
16
18
  channelUserProductSync: ChannelUserProductSync[];
17
19
  shopifyConnection: ShopifyConnection;
18
20
  wooConnection: WooConnection;
21
+ magentoConnection: MagentoConnection;
19
22
  userChannelApiKey: UserChannelApiKey;
20
23
  }
@@ -21,6 +21,7 @@ const User_1 = __importDefault(require("./User"));
21
21
  const ShopifyConnection_1 = __importDefault(require("./ShopifyConnection"));
22
22
  const WooConnection_1 = __importDefault(require("./WooConnection"));
23
23
  const UserChannelApiKey_1 = __importDefault(require("./UserChannelApiKey"));
24
+ const MagentoConnection_entity_1 = require("./MagentoConnection.entity");
24
25
  let ChannelUser = class ChannelUser extends AuditedModel_1.default {
25
26
  };
26
27
  __decorate([
@@ -35,6 +36,10 @@ __decorate([
35
36
  typeorm_1.Column('varchar', { nullable: true }),
36
37
  __metadata("design:type", String)
37
38
  ], ChannelUser.prototype, "customName", void 0);
39
+ __decorate([
40
+ typeorm_1.Column('boolean', { nullable: true, default: true }),
41
+ __metadata("design:type", Boolean)
42
+ ], ChannelUser.prototype, "active", void 0);
38
43
  __decorate([
39
44
  typeorm_1.ManyToOne(() => User_1.default, (user) => user.id, { onDelete: 'CASCADE' }),
40
45
  typeorm_1.JoinColumn(),
@@ -73,6 +78,13 @@ __decorate([
73
78
  typeorm_1.JoinColumn(),
74
79
  __metadata("design:type", WooConnection_1.default)
75
80
  ], ChannelUser.prototype, "wooConnection", void 0);
81
+ __decorate([
82
+ typeorm_1.ManyToOne(() => MagentoConnection_entity_1.MagentoConnection, (magentoConnection) => magentoConnection.id, {
83
+ nullable: true,
84
+ }),
85
+ typeorm_1.JoinColumn(),
86
+ __metadata("design:type", MagentoConnection_entity_1.MagentoConnection)
87
+ ], ChannelUser.prototype, "magentoConnection", void 0);
76
88
  __decorate([
77
89
  typeorm_1.ManyToOne(() => UserChannelApiKey_1.default, (userChannelApiKey) => userChannelApiKey.id, {
78
90
  nullable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelUser.js","sourceRoot":"","sources":["../../src/entity/ChannelUser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAQiB;AACjB,kEAA0C;AAC1C,wDAAgC;AAChC,kEAA0C;AAC1C,sFAA8D;AAC9D,kDAA0B;AAC1B,4EAAoD;AACpD,oEAA4C;AAE5C,4EAAoD;AAGpD,IAAqB,WAAW,GAAhC,MAAqB,WAAY,SAAQ,sBAAY;CAmDpD,CAAA;AAjDC;IADC,0BAAgB,EAAE;8BACR,IAAI;8CAAC;AAGhB;IADC,gCAAsB,EAAE;;uCACd;AAGX;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACnB;AAInB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACjE,oBAAU,EAAE;8BACP,cAAI;yCAAC;AAIX;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,iBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACnF,oBAAU,EAAE;8BACJ,iBAAO;4CAAC;AAMjB;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,sBAAY,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE;QACvF,OAAO,EAAE,IAAI;KACd,CAAC;IACD,oBAAU,EAAE;;iDACgB;AAU7B;IARC,mBAAS,CACR,GAAG,EAAE,CAAC,gCAAsB,EAC5B,CAAC,sBAA8C,EAAE,EAAE,CAAC,sBAAsB,CAAC,WAAW,EACtF;QACE,OAAO,EAAE,IAAI;KACd,CACF;IACA,oBAAU,EAAE;;2DACoC;AAMjD;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,2BAAiB,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE;QAC/E,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACM,2BAAiB;sDAAC;AAMrC;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,uBAAa,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE;QACnE,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACE,uBAAa;kDAAC;AAM7B;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,2BAAiB,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE;QAC/E,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACM,2BAAiB;sDAAC;AAlDlB,WAAW;IAD/B,gBAAM,EAAE;GACY,WAAW,CAmD/B;kBAnDoB,WAAW"}
1
+ {"version":3,"file":"ChannelUser.js","sourceRoot":"","sources":["../../src/entity/ChannelUser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAQiB;AACjB,kEAA0C;AAC1C,wDAAgC;AAChC,kEAA0C;AAC1C,sFAA8D;AAC9D,kDAA0B;AAC1B,4EAAoD;AACpD,oEAA4C;AAE5C,4EAAoD;AACpD,yEAA+D;AAG/D,IAAqB,WAAW,GAAhC,MAAqB,WAAY,SAAQ,sBAAY;CA4DpD,CAAA;AA1DC;IADC,0BAAgB,EAAE;8BACR,IAAI;8CAAC;AAGhB;IADC,gCAAsB,EAAE;;uCACd;AAGX;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACnB;AAGnB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CACrC;AAIhB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACjE,oBAAU,EAAE;8BACP,cAAI;yCAAC;AAIX;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,iBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACnF,oBAAU,EAAE;8BACJ,iBAAO;4CAAC;AAMjB;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,sBAAY,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE;QACvF,OAAO,EAAE,IAAI;KACd,CAAC;IACD,oBAAU,EAAE;;iDACgB;AAU7B;IARC,mBAAS,CACR,GAAG,EAAE,CAAC,gCAAsB,EAC5B,CAAC,sBAA8C,EAAE,EAAE,CAAC,sBAAsB,CAAC,WAAW,EACtF;QACE,OAAO,EAAE,IAAI;KACd,CACF;IACA,oBAAU,EAAE;;2DACoC;AAMjD;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,2BAAiB,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE;QAC/E,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACM,2BAAiB;sDAAC;AAMrC;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,uBAAa,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE;QACnE,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACE,uBAAa;kDAAC;AAM7B;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,4CAAiB,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE;QAC/E,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACM,4CAAiB;sDAAC;AAMrC;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,2BAAiB,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE;QAC/E,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,oBAAU,EAAE;8BACM,2BAAiB;sDAAC;AA3DlB,WAAW;IAD/B,gBAAM,EAAE;GACY,WAAW,CA4D/B;kBA5DoB,WAAW"}
@@ -4,6 +4,7 @@ export declare class MagentoConnection {
4
4
  importedProducts: boolean;
5
5
  active: boolean;
6
6
  user: User;
7
+ issuplier?: boolean;
7
8
  consumerKey: string;
8
9
  consumerSecret: string;
9
10
  url: string;
@@ -30,10 +30,14 @@ __decorate([
30
30
  __metadata("design:type", Boolean)
31
31
  ], MagentoConnection.prototype, "active", void 0);
32
32
  __decorate([
33
- typeorm_1.OneToOne(() => User_1.default, (user) => user.magento, { onDelete: 'CASCADE' }),
33
+ typeorm_1.ManyToOne(() => User_1.default, (user) => user.magento, { onDelete: 'CASCADE', nullable: true }),
34
34
  typeorm_1.JoinColumn(),
35
35
  __metadata("design:type", User_1.default)
36
36
  ], MagentoConnection.prototype, "user", void 0);
37
+ __decorate([
38
+ typeorm_1.Column('boolean', { nullable: true, default: false }),
39
+ __metadata("design:type", Boolean)
40
+ ], MagentoConnection.prototype, "issuplier", void 0);
37
41
  __decorate([
38
42
  typeorm_1.Column('varchar'),
39
43
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"MagentoConnection.entity.js","sourceRoot":"","sources":["../../src/entity/MagentoConnection.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAAuF;AACvF,kDAA0B;AAG1B,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;CA+B7B,CAAA;AA7BC;IADC,gCAAsB,EAAE;;6CACd;AAGX;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;2DAClB;AAG1B;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;iDAC5B;AAIhB;IAFC,kBAAQ,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACrE,oBAAU,EAAE;8BACP,cAAI;+CAAC;AAGX;IADC,gBAAM,CAAC,SAAS,CAAC;;sDACE;AAGpB;IADC,gBAAM,CAAC,SAAS,CAAC;;yDACK;AAGvB;IADC,gBAAM,CAAC,SAAS,CAAC;;8CACN;AAGZ;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACjB;AAGrB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACjB;AAGrB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACpB;AA9BP,iBAAiB;IAD7B,gBAAM,EAAE;GACI,iBAAiB,CA+B7B;AA/BY,8CAAiB"}
1
+ {"version":3,"file":"MagentoConnection.entity.js","sourceRoot":"","sources":["../../src/entity/MagentoConnection.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAAkG;AAClG,kDAA0B;AAG1B,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;CAkC7B,CAAA;AAhCC;IADC,gCAAsB,EAAE;;6CACd;AAGX;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;2DAClB;AAG1B;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;iDAC5B;AAIhB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACtF,oBAAU,EAAE;8BACP,cAAI;+CAAC;AAGX;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;oDAClC;AAGpB;IADC,gBAAM,CAAC,SAAS,CAAC;;sDACE;AAGpB;IADC,gBAAM,CAAC,SAAS,CAAC;;yDACK;AAGvB;IADC,gBAAM,CAAC,SAAS,CAAC;;8CACN;AAGZ;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACjB;AAGrB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACjB;AAGrB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACpB;AAjCP,iBAAiB;IAD7B,gBAAM,EAAE;GACI,iBAAiB,CAkC7B;AAlCY,8CAAiB"}
@@ -0,0 +1,6 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+ export declare class promoteToProduction1109231694450850673 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.promoteToProduction1109231694450850673 = void 0;
13
+ class promoteToProduction1109231694450850673 {
14
+ constructor() {
15
+ this.name = 'promoteToProduction1109231694450850673';
16
+ }
17
+ up(queryRunner) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ yield queryRunner.query(`CREATE TABLE \`product_category\` (\`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 NULL, \`category_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
20
+ yield queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
21
+ yield queryRunner.query(`ALTER TABLE \`woo_connection\` ADD \`issuplier\` tinyint NULL DEFAULT 0`);
22
+ yield queryRunner.query(`ALTER TABLE \`custom_product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
23
+ yield queryRunner.query(`ALTER TABLE \`image\` ADD \`variant_id\` int NULL`);
24
+ yield queryRunner.query(`ALTER TABLE \`variant\` ADD \`price_compare_at\` decimal(10,2) NULL`);
25
+ yield queryRunner.query(`ALTER TABLE \`product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
26
+ yield queryRunner.query(`ALTER TABLE \`order\` ADD \`price_compare_at\` decimal(10,2) NULL`);
27
+ yield queryRunner.query(`ALTER TABLE \`category\` ADD CONSTRAINT \`FK_08644d63888f9493b187f8dda2e\` FOREIGN KEY (\`father_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
28
+ yield queryRunner.query(`ALTER TABLE \`image\` ADD CONSTRAINT \`FK_71e4b36c663cdd3ec0dd947b6f6\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
29
+ yield queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_0374879a971928bc3f57eed0a59\` FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
30
+ yield queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_2df1f83329c00e6eadde0493e16\` FOREIGN KEY (\`category_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
31
+ });
32
+ }
33
+ down(queryRunner) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ yield queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_2df1f83329c00e6eadde0493e16\``);
36
+ yield queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_0374879a971928bc3f57eed0a59\``);
37
+ yield queryRunner.query(`ALTER TABLE \`image\` DROP FOREIGN KEY \`FK_71e4b36c663cdd3ec0dd947b6f6\``);
38
+ yield queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
39
+ yield queryRunner.query(`ALTER TABLE \`order\` DROP COLUMN \`price_compare_at\``);
40
+ yield queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`price_compare_at\``);
41
+ yield queryRunner.query(`ALTER TABLE \`variant\` DROP COLUMN \`price_compare_at\``);
42
+ yield queryRunner.query(`ALTER TABLE \`image\` DROP COLUMN \`variant_id\``);
43
+ yield queryRunner.query(`ALTER TABLE \`custom_product\` DROP COLUMN \`price_compare_at\``);
44
+ yield queryRunner.query(`ALTER TABLE \`woo_connection\` DROP COLUMN \`issuplier\``);
45
+ yield queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
46
+ yield queryRunner.query(`DROP TABLE \`product_category\``);
47
+ });
48
+ }
49
+ }
50
+ exports.promoteToProduction1109231694450850673 = promoteToProduction1109231694450850673;
51
+ //# sourceMappingURL=1694450850673-promote_to_production_11_09_23.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1694450850673-promote_to_production_11_09_23.js","sourceRoot":"","sources":["../../src/migrations/1694450850673-promote_to_production_11_09_23.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,sCAAsC;IAAnD;QACI,SAAI,GAAG,wCAAwC,CAAA;IAgCnD,CAAC;IA9BgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,mWAAmW,CAAC,CAAC;YAC7X,MAAM,WAAW,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YAC/E,MAAM,WAAW,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;YACnG,MAAM,WAAW,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAC;YACtG,MAAM,WAAW,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAC7E,MAAM,WAAW,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;YAC/F,MAAM,WAAW,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;YAC/F,MAAM,WAAW,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;YAC7F,MAAM,WAAW,CAAC,KAAK,CAAC,gLAAgL,CAAC,CAAC;YAC1M,MAAM,WAAW,CAAC,KAAK,CAAC,2KAA2K,CAAC,CAAC;YACrM,MAAM,WAAW,CAAC,KAAK,CAAC,wLAAwL,CAAC,CAAC;YAClN,MAAM,WAAW,CAAC,KAAK,CAAC,0LAA0L,CAAC,CAAC;QACxN,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,2EAA2E,CAAC,CAAC;YACrG,MAAM,WAAW,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;YACxG,MAAM,WAAW,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAClF,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YAC5E,MAAM,WAAW,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;YAC3F,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAC9E,MAAM,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC/D,CAAC;KAAA;CAEJ;AAjCD,wFAiCC"}
@@ -0,0 +1,6 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+ export declare class promoteToProduction110923_011694451010874 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.promoteToProduction110923_011694451010874 = void 0;
13
+ class promoteToProduction110923_011694451010874 {
14
+ constructor() {
15
+ this.name = 'promoteToProduction110923_011694451010874';
16
+ }
17
+ up(queryRunner) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ yield queryRunner.query(`CREATE TABLE \`product_category\` (\`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 NULL, \`category_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
20
+ yield queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
21
+ yield queryRunner.query(`ALTER TABLE \`woo_connection\` ADD \`issuplier\` tinyint NULL DEFAULT 0`);
22
+ yield queryRunner.query(`ALTER TABLE \`custom_product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
23
+ yield queryRunner.query(`ALTER TABLE \`image\` ADD \`variant_id\` int NULL`);
24
+ yield queryRunner.query(`ALTER TABLE \`variant\` ADD \`price_compare_at\` decimal(10,2) NULL`);
25
+ yield queryRunner.query(`ALTER TABLE \`product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
26
+ yield queryRunner.query(`ALTER TABLE \`order\` ADD \`price_compare_at\` decimal(10,2) NULL`);
27
+ yield queryRunner.query(`ALTER TABLE \`category\` ADD CONSTRAINT \`FK_08644d63888f9493b187f8dda2e\` FOREIGN KEY (\`father_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
28
+ yield queryRunner.query(`ALTER TABLE \`image\` ADD CONSTRAINT \`FK_71e4b36c663cdd3ec0dd947b6f6\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
29
+ yield queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_0374879a971928bc3f57eed0a59\` FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
30
+ yield queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_2df1f83329c00e6eadde0493e16\` FOREIGN KEY (\`category_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
31
+ });
32
+ }
33
+ down(queryRunner) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ yield queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_2df1f83329c00e6eadde0493e16\``);
36
+ yield queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_0374879a971928bc3f57eed0a59\``);
37
+ yield queryRunner.query(`ALTER TABLE \`image\` DROP FOREIGN KEY \`FK_71e4b36c663cdd3ec0dd947b6f6\``);
38
+ yield queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
39
+ yield queryRunner.query(`ALTER TABLE \`order\` DROP COLUMN \`price_compare_at\``);
40
+ yield queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`price_compare_at\``);
41
+ yield queryRunner.query(`ALTER TABLE \`variant\` DROP COLUMN \`price_compare_at\``);
42
+ yield queryRunner.query(`ALTER TABLE \`image\` DROP COLUMN \`variant_id\``);
43
+ yield queryRunner.query(`ALTER TABLE \`custom_product\` DROP COLUMN \`price_compare_at\``);
44
+ yield queryRunner.query(`ALTER TABLE \`woo_connection\` DROP COLUMN \`issuplier\``);
45
+ yield queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
46
+ yield queryRunner.query(`DROP TABLE \`product_category\``);
47
+ });
48
+ }
49
+ }
50
+ exports.promoteToProduction110923_011694451010874 = promoteToProduction110923_011694451010874;
51
+ //# sourceMappingURL=1694451010874-promote_to_production_11_09_23__01.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1694451010874-promote_to_production_11_09_23__01.js","sourceRoot":"","sources":["../../src/migrations/1694451010874-promote_to_production_11_09_23__01.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,yCAAyC;IAAtD;QACI,SAAI,GAAG,2CAA2C,CAAA;IAgCtD,CAAC;IA9BgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,mWAAmW,CAAC,CAAC;YAC7X,MAAM,WAAW,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YAC/E,MAAM,WAAW,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;YACnG,MAAM,WAAW,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAC;YACtG,MAAM,WAAW,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAC7E,MAAM,WAAW,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;YAC/F,MAAM,WAAW,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;YAC/F,MAAM,WAAW,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;YAC7F,MAAM,WAAW,CAAC,KAAK,CAAC,gLAAgL,CAAC,CAAC;YAC1M,MAAM,WAAW,CAAC,KAAK,CAAC,2KAA2K,CAAC,CAAC;YACrM,MAAM,WAAW,CAAC,KAAK,CAAC,wLAAwL,CAAC,CAAC;YAClN,MAAM,WAAW,CAAC,KAAK,CAAC,0LAA0L,CAAC,CAAC;QACxN,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,2EAA2E,CAAC,CAAC;YACrG,MAAM,WAAW,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;YACxG,MAAM,WAAW,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAClF,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YAC5E,MAAM,WAAW,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;YAC3F,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAC9E,MAAM,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC/D,CAAC;KAAA;CAEJ;AAjCD,8FAiCC"}
@@ -0,0 +1,6 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+ export declare class userChannelAndMegentoConnection1694661125001 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.userChannelAndMegentoConnection1694661125001 = void 0;
13
+ class userChannelAndMegentoConnection1694661125001 {
14
+ constructor() {
15
+ this.name = 'userChannelAndMegentoConnection1694661125001';
16
+ }
17
+ up(queryRunner) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ yield queryRunner.query(`ALTER TABLE \`magento_connection\` ADD \`issuplier\` tinyint NULL DEFAULT 0`);
20
+ yield queryRunner.query(`ALTER TABLE \`channel_user\` ADD \`active\` tinyint NULL DEFAULT 1`);
21
+ yield queryRunner.query(`ALTER TABLE \`channel_user\` ADD \`magento_connection_id\` int NULL`);
22
+ yield queryRunner.query(`ALTER TABLE \`magento_connection\` ADD CONSTRAINT \`FK_28d5bb57bf4cfd4c6b07f1cb2a0\` FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
23
+ yield queryRunner.query(`ALTER TABLE \`channel_user\` ADD CONSTRAINT \`FK_33d03e1f4eee82dae40ba0b2461\` FOREIGN KEY (\`magento_connection_id\`) REFERENCES \`magento_connection\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
24
+ });
25
+ }
26
+ down(queryRunner) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ yield queryRunner.query(`ALTER TABLE \`channel_user\` DROP FOREIGN KEY \`FK_33d03e1f4eee82dae40ba0b2461\``);
29
+ yield queryRunner.query(`ALTER TABLE \`magento_connection\` DROP FOREIGN KEY \`FK_28d5bb57bf4cfd4c6b07f1cb2a0\``);
30
+ yield queryRunner.query(`ALTER TABLE \`channel_user\` DROP COLUMN \`magento_connection_id\``);
31
+ yield queryRunner.query(`ALTER TABLE \`channel_user\` DROP COLUMN \`active\``);
32
+ yield queryRunner.query(`ALTER TABLE \`magento_connection\` DROP COLUMN \`issuplier\``);
33
+ });
34
+ }
35
+ }
36
+ exports.userChannelAndMegentoConnection1694661125001 = userChannelAndMegentoConnection1694661125001;
37
+ //# sourceMappingURL=1694661125001-user-channel-and-megento-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1694661125001-user-channel-and-megento-connection.js","sourceRoot":"","sources":["../../src/migrations/1694661125001-user-channel-and-megento-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,4CAA4C;IAAzD;QACI,SAAI,GAAG,8CAA8C,CAAA;IAkBzD,CAAC;IAhBgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;YACvG,MAAM,WAAW,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;YAC9F,MAAM,WAAW,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;YAC/F,MAAM,WAAW,CAAC,KAAK,CAAC,kLAAkL,CAAC,CAAC;YAC5M,MAAM,WAAW,CAAC,KAAK,CAAC,0MAA0M,CAAC,CAAC;QACxO,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAC;YAC5G,MAAM,WAAW,CAAC,KAAK,CAAC,wFAAwF,CAAC,CAAC;YAClH,MAAM,WAAW,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;YAC9F,MAAM,WAAW,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YAC/E,MAAM,WAAW,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAC5F,CAAC;KAAA;CAEJ;AAnBD,oGAmBC"}
@@ -2342,8 +2342,8 @@
2342
2342
  "affectsGlobalScope": false
2343
2343
  },
2344
2344
  "../src/entity/magentoconnection.entity.ts": {
2345
- "version": "6cd65932e09d8dc5ee34b8aece529071b92ff59fe9a57b002ab51885c0cf3ee6",
2346
- "signature": "21800ab30614e701c900d32d319a7796b03eaf6fdb2a89be5873ef64afcb8b19",
2345
+ "version": "c06a7c57804a62e65d6b1749d8baca605163ebd938da3037c4059f95b3bcfc2f",
2346
+ "signature": "2ad8bb921a85a8d804eeb2bf622983d62236bcdbeba786669e6d00928e9bfd91",
2347
2347
  "affectsGlobalScope": false
2348
2348
  },
2349
2349
  "../src/entity/permission.ts": {
@@ -2472,8 +2472,8 @@
2472
2472
  "affectsGlobalScope": false
2473
2473
  },
2474
2474
  "../src/entity/channeluser.ts": {
2475
- "version": "8317bbeb8edf9186389cb335578e6e02b514e6dbda17da3658df4e69e89f0b1c",
2476
- "signature": "35c8382e16ed3e1edfb8e3b4dba745bb0f6ac24aad4e51eb4bff043c7db6f75c",
2475
+ "version": "96066964623a2ef30e418c5384ef70b5d7c69208ffc3a39585c97606e9d18ce1",
2476
+ "signature": "29eaa8b758d1a6b9e880a9c6f8bc3c65c6d88a508467a3644e0750b2236ec7c1",
2477
2477
  "affectsGlobalScope": false
2478
2478
  },
2479
2479
  "../src/entity/channel.ts": {
@@ -3491,6 +3491,21 @@
3491
3491
  "signature": "b4907745ae95c699a2cffbc74608afdc1c862a2d5d03ab178a505819fd00fc5e",
3492
3492
  "affectsGlobalScope": false
3493
3493
  },
3494
+ "../src/migrations/1694450850673-promote_to_production_11_09_23.ts": {
3495
+ "version": "7343f108f4b43428c285de967203123868005486c3e1963a9c947b07752f7110",
3496
+ "signature": "467e5379054e9dd224d49197e81e8b5cc795ea310befe3d0212face8446257b5",
3497
+ "affectsGlobalScope": false
3498
+ },
3499
+ "../src/migrations/1694451010874-promote_to_production_11_09_23__01.ts": {
3500
+ "version": "545aad07e2a2f5739d3e01e4485a859944673041f9084e4008957d230deb8635",
3501
+ "signature": "05e925f40862f4b58acaf368ee7e9760ba86b2289e6a9e30b1bbf343fa996a8f",
3502
+ "affectsGlobalScope": false
3503
+ },
3504
+ "../src/migrations/1694661125001-user-channel-and-megento-connection.ts": {
3505
+ "version": "69cede24eda0997f24b115900e313f3e27179b98aa1f2200c214b1b467673ab8",
3506
+ "signature": "a153e10811f0df1c41ea7e57be621a18250a1e41e9d92523cdb87afcc71072e8",
3507
+ "affectsGlobalScope": false
3508
+ },
3494
3509
  "../src/migrations/execute/index.ts": {
3495
3510
  "version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
3496
3511
  "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
@@ -5488,6 +5503,7 @@
5488
5503
  "../src/entity/channel.ts",
5489
5504
  "../src/entity/channelgroup.ts",
5490
5505
  "../src/entity/channeluserproductsync.ts",
5506
+ "../src/entity/magentoconnection.entity.ts",
5491
5507
  "../src/entity/shopifyconnection.ts",
5492
5508
  "../src/entity/user.ts",
5493
5509
  "../src/entity/userchannelapikey.ts",
@@ -6482,6 +6498,15 @@
6482
6498
  "../src/migrations/1693484300635-variant_images.ts": [
6483
6499
  "../node_modules/typeorm/index.d.ts"
6484
6500
  ],
6501
+ "../src/migrations/1694450850673-promote_to_production_11_09_23.ts": [
6502
+ "../node_modules/typeorm/index.d.ts"
6503
+ ],
6504
+ "../src/migrations/1694451010874-promote_to_production_11_09_23__01.ts": [
6505
+ "../node_modules/typeorm/index.d.ts"
6506
+ ],
6507
+ "../src/migrations/1694661125001-user-channel-and-megento-connection.ts": [
6508
+ "../node_modules/typeorm/index.d.ts"
6509
+ ],
6485
6510
  "../src/migrations/execute/index.ts": [
6486
6511
  "../src/config/connect.ts"
6487
6512
  ],
@@ -8478,6 +8503,7 @@
8478
8503
  "../src/entity/channel.ts",
8479
8504
  "../src/entity/channelgroup.ts",
8480
8505
  "../src/entity/channeluserproductsync.ts",
8506
+ "../src/entity/magentoconnection.entity.ts",
8481
8507
  "../src/entity/shopifyconnection.ts",
8482
8508
  "../src/entity/user.ts",
8483
8509
  "../src/entity/userchannelapikey.ts",
@@ -9328,6 +9354,15 @@
9328
9354
  "../src/migrations/1693484300635-variant_images.ts": [
9329
9355
  "../node_modules/typeorm/index.d.ts"
9330
9356
  ],
9357
+ "../src/migrations/1694450850673-promote_to_production_11_09_23.ts": [
9358
+ "../node_modules/typeorm/index.d.ts"
9359
+ ],
9360
+ "../src/migrations/1694451010874-promote_to_production_11_09_23__01.ts": [
9361
+ "../node_modules/typeorm/index.d.ts"
9362
+ ],
9363
+ "../src/migrations/1694661125001-user-channel-and-megento-connection.ts": [
9364
+ "../node_modules/typeorm/index.d.ts"
9365
+ ],
9331
9366
  "../src/migrations/index.ts": [
9332
9367
  "../src/migrations/1628474597284-initialschema.ts",
9333
9368
  "../src/migrations/1630077596132-removemangopay.ts",
@@ -10183,6 +10218,9 @@
10183
10218
  "../src/migrations/1693249143377-first-stem-category.ts",
10184
10219
  "../src/migrations/1693335945081-first-step-category-2.ts",
10185
10220
  "../src/migrations/1693484300635-variant_images.ts",
10221
+ "../src/migrations/1694450850673-promote_to_production_11_09_23.ts",
10222
+ "../src/migrations/1694451010874-promote_to_production_11_09_23__01.ts",
10223
+ "../src/migrations/1694661125001-user-channel-and-megento-connection.ts",
10186
10224
  "../src/migrations/execute/index.ts",
10187
10225
  "../src/migrations/index.ts",
10188
10226
  "../src/repositories/discount/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reachu/database",
3
- "version": "1.0.110",
3
+ "version": "1.0.111",
4
4
  "description": "reachu-database",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "author": "reachu",
22
22
  "license": "ISC",
23
23
  "dependencies": {
24
- "@reachu/logger": "1.0.110",
25
- "@reachu/utils": "1.0.110",
24
+ "@reachu/logger": "1.0.111",
25
+ "@reachu/utils": "1.0.111",
26
26
  "dotenv": "8.0.0",
27
27
  "express": "4.17.1",
28
28
  "mysql2": "1.5.2",
@@ -16,6 +16,7 @@ import ShopifyConnection from './ShopifyConnection';
16
16
  import WooConnection from './WooConnection';
17
17
 
18
18
  import UserChannelApiKey from './UserChannelApiKey';
19
+ import { MagentoConnection } from './MagentoConnection.entity';
19
20
 
20
21
  @Entity()
21
22
  export default class ChannelUser extends AuditedModel {
@@ -28,6 +29,9 @@ export default class ChannelUser extends AuditedModel {
28
29
  @Column('varchar', { nullable: true })
29
30
  customName: string;
30
31
 
32
+ @Column('boolean', { nullable: true, default: true })
33
+ active: boolean;
34
+
31
35
  @ManyToOne(() => User, (user) => user.id, { onDelete: 'CASCADE' })
32
36
  @JoinColumn()
33
37
  user: User;
@@ -64,6 +68,12 @@ export default class ChannelUser extends AuditedModel {
64
68
  @JoinColumn()
65
69
  wooConnection: WooConnection;
66
70
 
71
+ @ManyToOne(() => MagentoConnection, (magentoConnection) => magentoConnection.id, {
72
+ nullable: true,
73
+ })
74
+ @JoinColumn()
75
+ magentoConnection: MagentoConnection;
76
+
67
77
  @ManyToOne(() => UserChannelApiKey, (userChannelApiKey) => userChannelApiKey.id, {
68
78
  nullable: true,
69
79
  })
@@ -1,4 +1,4 @@
1
- import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
1
+ import { Column, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
2
2
  import User from './User';
3
3
 
4
4
  @Entity()
@@ -12,10 +12,13 @@ export class MagentoConnection {
12
12
  @Column({ type: 'boolean', default: false })
13
13
  active: boolean;
14
14
 
15
- @OneToOne(() => User, (user) => user.magento, { onDelete: 'CASCADE' })
15
+ @ManyToOne(() => User, (user) => user.magento, { onDelete: 'CASCADE', nullable: true })
16
16
  @JoinColumn()
17
17
  user: User;
18
18
 
19
+ @Column('boolean', { nullable: true, default: false })
20
+ issuplier?: boolean;
21
+
19
22
  @Column('varchar')
20
23
  consumerKey: string;
21
24
 
@@ -0,0 +1,36 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class promoteToProduction1109231694450850673 implements MigrationInterface {
4
+ name = 'promoteToProduction1109231694450850673'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`CREATE TABLE \`product_category\` (\`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 NULL, \`category_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
8
+ await queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
9
+ await queryRunner.query(`ALTER TABLE \`woo_connection\` ADD \`issuplier\` tinyint NULL DEFAULT 0`);
10
+ await queryRunner.query(`ALTER TABLE \`custom_product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
11
+ await queryRunner.query(`ALTER TABLE \`image\` ADD \`variant_id\` int NULL`);
12
+ await queryRunner.query(`ALTER TABLE \`variant\` ADD \`price_compare_at\` decimal(10,2) NULL`);
13
+ await queryRunner.query(`ALTER TABLE \`product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
14
+ await queryRunner.query(`ALTER TABLE \`order\` ADD \`price_compare_at\` decimal(10,2) NULL`);
15
+ await queryRunner.query(`ALTER TABLE \`category\` ADD CONSTRAINT \`FK_08644d63888f9493b187f8dda2e\` FOREIGN KEY (\`father_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
16
+ await queryRunner.query(`ALTER TABLE \`image\` ADD CONSTRAINT \`FK_71e4b36c663cdd3ec0dd947b6f6\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
17
+ await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_0374879a971928bc3f57eed0a59\` FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
18
+ await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_2df1f83329c00e6eadde0493e16\` FOREIGN KEY (\`category_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
19
+ }
20
+
21
+ public async down(queryRunner: QueryRunner): Promise<void> {
22
+ await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_2df1f83329c00e6eadde0493e16\``);
23
+ await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_0374879a971928bc3f57eed0a59\``);
24
+ await queryRunner.query(`ALTER TABLE \`image\` DROP FOREIGN KEY \`FK_71e4b36c663cdd3ec0dd947b6f6\``);
25
+ await queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
26
+ await queryRunner.query(`ALTER TABLE \`order\` DROP COLUMN \`price_compare_at\``);
27
+ await queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`price_compare_at\``);
28
+ await queryRunner.query(`ALTER TABLE \`variant\` DROP COLUMN \`price_compare_at\``);
29
+ await queryRunner.query(`ALTER TABLE \`image\` DROP COLUMN \`variant_id\``);
30
+ await queryRunner.query(`ALTER TABLE \`custom_product\` DROP COLUMN \`price_compare_at\``);
31
+ await queryRunner.query(`ALTER TABLE \`woo_connection\` DROP COLUMN \`issuplier\``);
32
+ await queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
33
+ await queryRunner.query(`DROP TABLE \`product_category\``);
34
+ }
35
+
36
+ }
@@ -0,0 +1,36 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class promoteToProduction110923_011694451010874 implements MigrationInterface {
4
+ name = 'promoteToProduction110923_011694451010874'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`CREATE TABLE \`product_category\` (\`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 NULL, \`category_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
8
+ await queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
9
+ await queryRunner.query(`ALTER TABLE \`woo_connection\` ADD \`issuplier\` tinyint NULL DEFAULT 0`);
10
+ await queryRunner.query(`ALTER TABLE \`custom_product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
11
+ await queryRunner.query(`ALTER TABLE \`image\` ADD \`variant_id\` int NULL`);
12
+ await queryRunner.query(`ALTER TABLE \`variant\` ADD \`price_compare_at\` decimal(10,2) NULL`);
13
+ await queryRunner.query(`ALTER TABLE \`product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
14
+ await queryRunner.query(`ALTER TABLE \`order\` ADD \`price_compare_at\` decimal(10,2) NULL`);
15
+ await queryRunner.query(`ALTER TABLE \`category\` ADD CONSTRAINT \`FK_08644d63888f9493b187f8dda2e\` FOREIGN KEY (\`father_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
16
+ await queryRunner.query(`ALTER TABLE \`image\` ADD CONSTRAINT \`FK_71e4b36c663cdd3ec0dd947b6f6\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
17
+ await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_0374879a971928bc3f57eed0a59\` FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
18
+ await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_2df1f83329c00e6eadde0493e16\` FOREIGN KEY (\`category_id\`) REFERENCES \`category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
19
+ }
20
+
21
+ public async down(queryRunner: QueryRunner): Promise<void> {
22
+ await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_2df1f83329c00e6eadde0493e16\``);
23
+ await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_0374879a971928bc3f57eed0a59\``);
24
+ await queryRunner.query(`ALTER TABLE \`image\` DROP FOREIGN KEY \`FK_71e4b36c663cdd3ec0dd947b6f6\``);
25
+ await queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
26
+ await queryRunner.query(`ALTER TABLE \`order\` DROP COLUMN \`price_compare_at\``);
27
+ await queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`price_compare_at\``);
28
+ await queryRunner.query(`ALTER TABLE \`variant\` DROP COLUMN \`price_compare_at\``);
29
+ await queryRunner.query(`ALTER TABLE \`image\` DROP COLUMN \`variant_id\``);
30
+ await queryRunner.query(`ALTER TABLE \`custom_product\` DROP COLUMN \`price_compare_at\``);
31
+ await queryRunner.query(`ALTER TABLE \`woo_connection\` DROP COLUMN \`issuplier\``);
32
+ await queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
33
+ await queryRunner.query(`DROP TABLE \`product_category\``);
34
+ }
35
+
36
+ }
@@ -0,0 +1,22 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class userChannelAndMegentoConnection1694661125001 implements MigrationInterface {
4
+ name = 'userChannelAndMegentoConnection1694661125001'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE \`magento_connection\` ADD \`issuplier\` tinyint NULL DEFAULT 0`);
8
+ await queryRunner.query(`ALTER TABLE \`channel_user\` ADD \`active\` tinyint NULL DEFAULT 1`);
9
+ await queryRunner.query(`ALTER TABLE \`channel_user\` ADD \`magento_connection_id\` int NULL`);
10
+ await queryRunner.query(`ALTER TABLE \`magento_connection\` ADD CONSTRAINT \`FK_28d5bb57bf4cfd4c6b07f1cb2a0\` FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
11
+ await queryRunner.query(`ALTER TABLE \`channel_user\` ADD CONSTRAINT \`FK_33d03e1f4eee82dae40ba0b2461\` FOREIGN KEY (\`magento_connection_id\`) REFERENCES \`magento_connection\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
12
+ }
13
+
14
+ public async down(queryRunner: QueryRunner): Promise<void> {
15
+ await queryRunner.query(`ALTER TABLE \`channel_user\` DROP FOREIGN KEY \`FK_33d03e1f4eee82dae40ba0b2461\``);
16
+ await queryRunner.query(`ALTER TABLE \`magento_connection\` DROP FOREIGN KEY \`FK_28d5bb57bf4cfd4c6b07f1cb2a0\``);
17
+ await queryRunner.query(`ALTER TABLE \`channel_user\` DROP COLUMN \`magento_connection_id\``);
18
+ await queryRunner.query(`ALTER TABLE \`channel_user\` DROP COLUMN \`active\``);
19
+ await queryRunner.query(`ALTER TABLE \`magento_connection\` DROP COLUMN \`issuplier\``);
20
+ }
21
+
22
+ }