@reachu/database 1.0.104 → 1.0.108
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.
- package/dist/entity/Image.d.ts +2 -0
- package/dist/entity/Image.js +10 -1
- package/dist/entity/Image.js.map +1 -1
- package/dist/entity/Price.entity.d.ts +1 -0
- package/dist/entity/Price.entity.js +4 -0
- package/dist/entity/Price.entity.js.map +1 -1
- package/dist/entity/Variant.d.ts +2 -0
- package/dist/entity/Variant.js +6 -0
- package/dist/entity/Variant.js.map +1 -1
- package/dist/migrations/1693484300635-variant_images.d.ts +6 -0
- package/dist/migrations/1693484300635-variant_images.js +43 -0
- package/dist/migrations/1693484300635-variant_images.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +24 -8
- package/package.json +3 -3
- package/src/entity/Image.ts +6 -1
- package/src/entity/Price.entity.ts +3 -0
- package/src/entity/Variant.ts +5 -0
- package/src/migrations/1693484300635-variant_images.ts +28 -0
package/dist/entity/Image.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Product } from './Product.entity';
|
|
2
|
+
import Variant from './Variant';
|
|
2
3
|
export default class Image {
|
|
3
4
|
id: number;
|
|
4
5
|
deletedAt: Date;
|
|
@@ -7,4 +8,5 @@ export default class Image {
|
|
|
7
8
|
height?: number;
|
|
8
9
|
order: number;
|
|
9
10
|
product: Product;
|
|
11
|
+
variant: Variant;
|
|
10
12
|
}
|
package/dist/entity/Image.js
CHANGED
|
@@ -8,9 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
const typeorm_1 = require("typeorm");
|
|
13
16
|
const Product_entity_1 = require("./Product.entity");
|
|
17
|
+
const Variant_1 = __importDefault(require("./Variant"));
|
|
14
18
|
let Image = class Image {
|
|
15
19
|
};
|
|
16
20
|
__decorate([
|
|
@@ -38,10 +42,15 @@ __decorate([
|
|
|
38
42
|
__metadata("design:type", Number)
|
|
39
43
|
], Image.prototype, "order", void 0);
|
|
40
44
|
__decorate([
|
|
41
|
-
typeorm_1.ManyToOne(() => Product_entity_1.Product, (product) => product.images, { onDelete: 'CASCADE' }),
|
|
45
|
+
typeorm_1.ManyToOne(() => Product_entity_1.Product, (product) => product.images, { onDelete: 'CASCADE', nullable: true }),
|
|
42
46
|
typeorm_1.JoinColumn(),
|
|
43
47
|
__metadata("design:type", Product_entity_1.Product)
|
|
44
48
|
], Image.prototype, "product", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
typeorm_1.ManyToOne(() => Variant_1.default, (variant) => variant.images, { onDelete: 'CASCADE', nullable: true }),
|
|
51
|
+
typeorm_1.JoinColumn(),
|
|
52
|
+
__metadata("design:type", Variant_1.default)
|
|
53
|
+
], Image.prototype, "variant", void 0);
|
|
45
54
|
Image = __decorate([
|
|
46
55
|
typeorm_1.Entity()
|
|
47
56
|
], Image);
|
package/dist/entity/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/entity/Image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/entity/Image.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAOiB;AACjB,qDAA2C;AAC3C,wDAAgC;AAGhC,IAAqB,KAAK,GAA1B,MAAqB,KAAK;CA0BzB,CAAA;AAxBC;IADC,gCAAsB,EAAE;;iCACd;AAGX;IADC,0BAAgB,EAAE;8BACR,IAAI;wCAAC;AAGhB;IADC,gBAAM,CAAC,SAAS,CAAC;;kCACN;AAGZ;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oCACvB;AAGf;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qCACtB;AAGhB;IADC,gBAAM,CAAC,SAAS,CAAC;;oCACJ;AAId;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9F,oBAAU,EAAE;8BACJ,wBAAO;sCAAC;AAIjB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,iBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC9F,oBAAU,EAAE;8BACJ,iBAAO;sCAAC;AAzBE,KAAK;IADzB,gBAAM,EAAE;GACY,KAAK,CA0BzB;kBA1BoB,KAAK"}
|
|
@@ -25,5 +25,9 @@ __decorate([
|
|
|
25
25
|
typeorm_1.Column('decimal', { precision: 10, scale: 2, nullable: true }),
|
|
26
26
|
__metadata("design:type", Number)
|
|
27
27
|
], Price.prototype, "baseAmount", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
typeorm_1.Column('decimal', { precision: 10, scale: 2, nullable: true }),
|
|
30
|
+
__metadata("design:type", Number)
|
|
31
|
+
], Price.prototype, "compareAt", void 0);
|
|
28
32
|
exports.Price = Price;
|
|
29
33
|
//# sourceMappingURL=Price.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Price.entity.js","sourceRoot":"","sources":["../../src/entity/Price.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiC;AAEjC,MAAa,KAAK;
|
|
1
|
+
{"version":3,"file":"Price.entity.js","sourceRoot":"","sources":["../../src/entity/Price.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiC;AAEjC,MAAa,KAAK;CAYjB;AAVC;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qCAC/C;AAGhB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAChB;AAGtB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC3C;AAGpB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAC5C;AAXrB,sBAYC"}
|
package/dist/entity/Variant.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CustomVariant from './CustomVariant';
|
|
2
2
|
import { Price } from './Price.entity';
|
|
3
3
|
import { Product } from './Product.entity';
|
|
4
|
+
import Image from './Image';
|
|
4
5
|
export default class Variant {
|
|
5
6
|
id: number;
|
|
6
7
|
deletedAt: Date;
|
|
@@ -15,4 +16,5 @@ export default class Variant {
|
|
|
15
16
|
customVariant: CustomVariant;
|
|
16
17
|
originId?: string;
|
|
17
18
|
originData: string;
|
|
19
|
+
images: Image[];
|
|
18
20
|
}
|
package/dist/entity/Variant.js
CHANGED
|
@@ -16,6 +16,7 @@ const typeorm_1 = require("typeorm");
|
|
|
16
16
|
const CustomVariant_1 = __importDefault(require("./CustomVariant"));
|
|
17
17
|
const Price_entity_1 = require("./Price.entity");
|
|
18
18
|
const Product_entity_1 = require("./Product.entity");
|
|
19
|
+
const Image_1 = __importDefault(require("./Image"));
|
|
19
20
|
let Variant = class Variant {
|
|
20
21
|
};
|
|
21
22
|
__decorate([
|
|
@@ -72,6 +73,11 @@ __decorate([
|
|
|
72
73
|
typeorm_1.Column({ type: 'varchar', length: '21844', nullable: true, default: null }),
|
|
73
74
|
__metadata("design:type", String)
|
|
74
75
|
], Variant.prototype, "originData", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
typeorm_1.OneToMany(() => Image_1.default, (image) => image.variant, { eager: true, cascade: true }),
|
|
78
|
+
typeorm_1.JoinColumn(),
|
|
79
|
+
__metadata("design:type", Array)
|
|
80
|
+
], Variant.prototype, "images", void 0);
|
|
75
81
|
Variant = __decorate([
|
|
76
82
|
typeorm_1.Entity()
|
|
77
83
|
], Variant);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Variant.js","sourceRoot":"","sources":["../../src/entity/Variant.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAQiB;AACjB,oEAA4C;AAC5C,iDAAuC;AACvC,qDAA2C;
|
|
1
|
+
{"version":3,"file":"Variant.js","sourceRoot":"","sources":["../../src/entity/Variant.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAQiB;AACjB,oEAA4C;AAC5C,iDAAuC;AACvC,qDAA2C;AAC3C,oDAA4B;AAG5B,IAAqB,OAAO,GAA5B,MAAqB,OAAO;CA6C3B,CAAA;AA3CC;IADC,gCAAsB,EAAE;;mCACd;AAGX;IADC,0BAAgB,EAAE;8BACR,IAAI;0CAAC;AAGhB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sCACxB;AAGf;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;oCAC1B;AAGb;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACrB;AAGjB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;yCACrB;AAGlB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sCACjD;AAGf;IADC,gBAAM,CAAC,GAAG,EAAE,CAAC,oBAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;8BAC3B,oBAAK;8CAAC;AAGrB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;uCACrB;AAIhB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAChF,oBAAU,EAAE;8BACJ,wBAAO;wCAAC;AAIjB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,uBAAa,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACjG,oBAAU,EAAE;8BACE,uBAAa;8CAAC;AAG7B;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACpB;AAGlB;IADC,gBAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CACzD;AAInB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,eAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChF,oBAAU,EAAE;;uCACG;AA5CG,OAAO;IAD3B,gBAAM,EAAE;GACY,OAAO,CA6C3B;kBA7CoB,OAAO"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.variantImages1693484300635 = void 0;
|
|
13
|
+
class variantImages1693484300635 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'variantImages1693484300635';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
|
|
21
|
+
yield queryRunner.query(`ALTER TABLE \`custom_product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
22
|
+
yield queryRunner.query(`ALTER TABLE \`image\` ADD \`variant_id\` int NULL`);
|
|
23
|
+
yield queryRunner.query(`ALTER TABLE \`variant\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
24
|
+
yield queryRunner.query(`ALTER TABLE \`product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
25
|
+
yield queryRunner.query(`ALTER TABLE \`order\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
26
|
+
yield queryRunner.query(`ALTER TABLE \`image\` ADD CONSTRAINT \`FK_71e4b36c663cdd3ec0dd947b6f6\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
down(queryRunner) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
yield queryRunner.query(`ALTER TABLE \`image\` DROP FOREIGN KEY \`FK_71e4b36c663cdd3ec0dd947b6f6\``);
|
|
32
|
+
yield queryRunner.query(`ALTER TABLE \`order\` DROP COLUMN \`price_compare_at\``);
|
|
33
|
+
yield queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`price_compare_at\``);
|
|
34
|
+
yield queryRunner.query(`ALTER TABLE \`variant\` DROP COLUMN \`price_compare_at\``);
|
|
35
|
+
yield queryRunner.query(`ALTER TABLE \`image\` DROP COLUMN \`variant_id\``);
|
|
36
|
+
yield queryRunner.query(`ALTER TABLE \`custom_product\` DROP COLUMN \`price_compare_at\``);
|
|
37
|
+
yield queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
|
|
38
|
+
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`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.variantImages1693484300635 = variantImages1693484300635;
|
|
43
|
+
//# sourceMappingURL=1693484300635-variant_images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1693484300635-variant_images.js","sourceRoot":"","sources":["../../src/migrations/1693484300635-variant_images.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,0BAA0B;IAAvC;QACI,SAAI,GAAG,4BAA4B,CAAA;IAwBvC,CAAC;IAtBgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;YACxG,MAAM,WAAW,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAC9E,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,2KAA2K,CAAC,CAAC;QACzM,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,2EAA2E,CAAC,CAAC;YACrG,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,qDAAqD,CAAC,CAAC;YAC/E,MAAM,WAAW,CAAC,KAAK,CAAC,gLAAgL,CAAC,CAAC;QAC9M,CAAC;KAAA;CAEJ;AAzBD,gEAyBC"}
|
|
@@ -2412,8 +2412,8 @@
|
|
|
2412
2412
|
"affectsGlobalScope": false
|
|
2413
2413
|
},
|
|
2414
2414
|
"../src/entity/image.ts": {
|
|
2415
|
-
"version": "
|
|
2416
|
-
"signature": "
|
|
2415
|
+
"version": "19ab7547c5d21c0737c761ad4782d1c143b60434caf795404026fd3625757248",
|
|
2416
|
+
"signature": "21e01b387406871f1f540b7722119f5bc2f9fe941fd3edacf95eee84db35dd50",
|
|
2417
2417
|
"affectsGlobalScope": false
|
|
2418
2418
|
},
|
|
2419
2419
|
"../src/entity/importedproduct.ts": {
|
|
@@ -2427,8 +2427,8 @@
|
|
|
2427
2427
|
"affectsGlobalScope": false
|
|
2428
2428
|
},
|
|
2429
2429
|
"../src/entity/price.entity.ts": {
|
|
2430
|
-
"version": "
|
|
2431
|
-
"signature": "
|
|
2430
|
+
"version": "6aef659faa28c184b30e4bdaec7da756c08846cfc9fa2245ddb11226862979c2",
|
|
2431
|
+
"signature": "04be4477fa66e64bf58235550211314ac2dc7aaf829b9218ceb7b01eef7eb373",
|
|
2432
2432
|
"affectsGlobalScope": false
|
|
2433
2433
|
},
|
|
2434
2434
|
"../src/entity/modules/shipping/productshipping.ts": {
|
|
@@ -2452,8 +2452,8 @@
|
|
|
2452
2452
|
"affectsGlobalScope": false
|
|
2453
2453
|
},
|
|
2454
2454
|
"../src/entity/variant.ts": {
|
|
2455
|
-
"version": "
|
|
2456
|
-
"signature": "
|
|
2455
|
+
"version": "8a212a4f61da9bf6002d15d1550ba869e8ba116d575cbba04e7503b82d087562",
|
|
2456
|
+
"signature": "50b25567de85a66172ddcd1c0145e35c2d2b4cd41a11ec1c4c7112430d3dce02",
|
|
2457
2457
|
"affectsGlobalScope": false
|
|
2458
2458
|
},
|
|
2459
2459
|
"../src/entity/channelgroup.ts": {
|
|
@@ -3486,6 +3486,11 @@
|
|
|
3486
3486
|
"signature": "09cf1016ee0c5acc4626ff0d2cd6b76839b27cf47b65e41f63b3598f37a5fee7",
|
|
3487
3487
|
"affectsGlobalScope": false
|
|
3488
3488
|
},
|
|
3489
|
+
"../src/migrations/1693484300635-variant_images.ts": {
|
|
3490
|
+
"version": "3127aa7c168419a8d84c5789472d9e632b564831f2e8403f9dc979541de3b41a",
|
|
3491
|
+
"signature": "b4907745ae95c699a2cffbc74608afdc1c862a2d5d03ab178a505819fd00fc5e",
|
|
3492
|
+
"affectsGlobalScope": false
|
|
3493
|
+
},
|
|
3489
3494
|
"../src/migrations/execute/index.ts": {
|
|
3490
3495
|
"version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
|
|
3491
3496
|
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
|
|
@@ -5598,7 +5603,8 @@
|
|
|
5598
5603
|
],
|
|
5599
5604
|
"../src/entity/image.ts": [
|
|
5600
5605
|
"../node_modules/typeorm/index.d.ts",
|
|
5601
|
-
"../src/entity/product.entity.ts"
|
|
5606
|
+
"../src/entity/product.entity.ts",
|
|
5607
|
+
"../src/entity/variant.ts"
|
|
5602
5608
|
],
|
|
5603
5609
|
"../src/entity/importedproduct.ts": [
|
|
5604
5610
|
"../node_modules/typeorm/index.d.ts",
|
|
@@ -6087,6 +6093,7 @@
|
|
|
6087
6093
|
"../src/entity/variant.ts": [
|
|
6088
6094
|
"../node_modules/typeorm/index.d.ts",
|
|
6089
6095
|
"../src/entity/customvariant.ts",
|
|
6096
|
+
"../src/entity/image.ts",
|
|
6090
6097
|
"../src/entity/price.entity.ts",
|
|
6091
6098
|
"../src/entity/product.entity.ts"
|
|
6092
6099
|
],
|
|
@@ -6471,6 +6478,9 @@
|
|
|
6471
6478
|
"../src/migrations/1693335945081-first-step-category-2.ts": [
|
|
6472
6479
|
"../node_modules/typeorm/index.d.ts"
|
|
6473
6480
|
],
|
|
6481
|
+
"../src/migrations/1693484300635-variant_images.ts": [
|
|
6482
|
+
"../node_modules/typeorm/index.d.ts"
|
|
6483
|
+
],
|
|
6474
6484
|
"../src/migrations/execute/index.ts": [
|
|
6475
6485
|
"../src/config/connect.ts"
|
|
6476
6486
|
],
|
|
@@ -8541,7 +8551,8 @@
|
|
|
8541
8551
|
"../src/entity/flatrate.ts"
|
|
8542
8552
|
],
|
|
8543
8553
|
"../src/entity/image.ts": [
|
|
8544
|
-
"../src/entity/product.entity.ts"
|
|
8554
|
+
"../src/entity/product.entity.ts",
|
|
8555
|
+
"../src/entity/variant.ts"
|
|
8545
8556
|
],
|
|
8546
8557
|
"../src/entity/importedproduct.ts": [
|
|
8547
8558
|
"../src/entity/channeluser.ts",
|
|
@@ -8950,6 +8961,7 @@
|
|
|
8950
8961
|
],
|
|
8951
8962
|
"../src/entity/variant.ts": [
|
|
8952
8963
|
"../src/entity/customvariant.ts",
|
|
8964
|
+
"../src/entity/image.ts",
|
|
8953
8965
|
"../src/entity/price.entity.ts",
|
|
8954
8966
|
"../src/entity/product.entity.ts"
|
|
8955
8967
|
],
|
|
@@ -9312,6 +9324,9 @@
|
|
|
9312
9324
|
"../src/migrations/1693335945081-first-step-category-2.ts": [
|
|
9313
9325
|
"../node_modules/typeorm/index.d.ts"
|
|
9314
9326
|
],
|
|
9327
|
+
"../src/migrations/1693484300635-variant_images.ts": [
|
|
9328
|
+
"../node_modules/typeorm/index.d.ts"
|
|
9329
|
+
],
|
|
9315
9330
|
"../src/migrations/index.ts": [
|
|
9316
9331
|
"../src/migrations/1628474597284-initialschema.ts",
|
|
9317
9332
|
"../src/migrations/1630077596132-removemangopay.ts",
|
|
@@ -10166,6 +10181,7 @@
|
|
|
10166
10181
|
"../src/migrations/1693220480521-woo_connect_supplier.ts",
|
|
10167
10182
|
"../src/migrations/1693249143377-first-stem-category.ts",
|
|
10168
10183
|
"../src/migrations/1693335945081-first-step-category-2.ts",
|
|
10184
|
+
"../src/migrations/1693484300635-variant_images.ts",
|
|
10169
10185
|
"../src/migrations/execute/index.ts",
|
|
10170
10186
|
"../src/migrations/index.ts",
|
|
10171
10187
|
"../src/repositories/discount/index.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reachu/database",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.108",
|
|
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.
|
|
25
|
-
"@reachu/utils": "1.0.
|
|
24
|
+
"@reachu/logger": "1.0.108",
|
|
25
|
+
"@reachu/utils": "1.0.108",
|
|
26
26
|
"dotenv": "8.0.0",
|
|
27
27
|
"express": "4.17.1",
|
|
28
28
|
"mysql2": "1.5.2",
|
package/src/entity/Image.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
DeleteDateColumn,
|
|
8
8
|
} from 'typeorm';
|
|
9
9
|
import { Product } from './Product.entity';
|
|
10
|
+
import Variant from './Variant';
|
|
10
11
|
|
|
11
12
|
@Entity()
|
|
12
13
|
export default class Image {
|
|
@@ -28,7 +29,11 @@ export default class Image {
|
|
|
28
29
|
@Column('integer')
|
|
29
30
|
order: number;
|
|
30
31
|
|
|
31
|
-
@ManyToOne(() => Product, (product) => product.images, { onDelete: 'CASCADE' })
|
|
32
|
+
@ManyToOne(() => Product, (product) => product.images, { onDelete: 'CASCADE', nullable: true })
|
|
32
33
|
@JoinColumn()
|
|
33
34
|
product: Product;
|
|
35
|
+
|
|
36
|
+
@ManyToOne(() => Variant, (variant) => variant.images, { onDelete: 'CASCADE', nullable: true })
|
|
37
|
+
@JoinColumn()
|
|
38
|
+
variant: Variant;
|
|
34
39
|
}
|
package/src/entity/Variant.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import CustomVariant from './CustomVariant';
|
|
11
11
|
import { Price } from './Price.entity';
|
|
12
12
|
import { Product } from './Product.entity';
|
|
13
|
+
import Image from './Image';
|
|
13
14
|
|
|
14
15
|
@Entity()
|
|
15
16
|
export default class Variant {
|
|
@@ -53,4 +54,8 @@ export default class Variant {
|
|
|
53
54
|
|
|
54
55
|
@Column({ type: 'varchar', length: '21844', nullable: true, default: null })
|
|
55
56
|
originData: string;
|
|
57
|
+
|
|
58
|
+
@OneToMany(() => Image, (image) => image.variant, { eager: true, cascade: true })
|
|
59
|
+
@JoinColumn()
|
|
60
|
+
images: Image[];
|
|
56
61
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class variantImages1693484300635 implements MigrationInterface {
|
|
4
|
+
name = 'variantImages1693484300635'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE \`custom_product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
10
|
+
await queryRunner.query(`ALTER TABLE \`image\` ADD \`variant_id\` int NULL`);
|
|
11
|
+
await queryRunner.query(`ALTER TABLE \`variant\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
12
|
+
await queryRunner.query(`ALTER TABLE \`product\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE \`order\` ADD \`price_compare_at\` decimal(10,2) NULL`);
|
|
14
|
+
await queryRunner.query(`ALTER TABLE \`image\` ADD CONSTRAINT \`FK_71e4b36c663cdd3ec0dd947b6f6\` FOREIGN KEY (\`variant_id\`) REFERENCES \`variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.query(`ALTER TABLE \`image\` DROP FOREIGN KEY \`FK_71e4b36c663cdd3ec0dd947b6f6\``);
|
|
19
|
+
await queryRunner.query(`ALTER TABLE \`order\` DROP COLUMN \`price_compare_at\``);
|
|
20
|
+
await queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`price_compare_at\``);
|
|
21
|
+
await queryRunner.query(`ALTER TABLE \`variant\` DROP COLUMN \`price_compare_at\``);
|
|
22
|
+
await queryRunner.query(`ALTER TABLE \`image\` DROP COLUMN \`variant_id\``);
|
|
23
|
+
await queryRunner.query(`ALTER TABLE \`custom_product\` DROP COLUMN \`price_compare_at\``);
|
|
24
|
+
await queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
|
|
25
|
+
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`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|