@reachu/database 1.0.102 → 1.0.103
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/Category.d.ts +2 -0
- package/dist/entity/Category.js +12 -2
- package/dist/entity/Category.js.map +1 -1
- package/dist/migrations/1693249143377-first-stem-category.d.ts +6 -0
- package/dist/migrations/1693249143377-first-stem-category.js +31 -0
- package/dist/migrations/1693249143377-first-stem-category.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +14 -2
- package/package.json +3 -3
- package/src/entity/Category.ts +7 -0
- package/src/migrations/1693249143377-first-stem-category.ts +16 -0
package/dist/entity/Category.js
CHANGED
|
@@ -11,12 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
|
+
var Category_1;
|
|
14
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
16
|
const typeorm_1 = require("typeorm");
|
|
16
17
|
const AuditedModel_1 = __importDefault(require("./AuditedModel"));
|
|
17
18
|
const CategoryImages_1 = __importDefault(require("./CategoryImages"));
|
|
18
19
|
const Subcategory_1 = __importDefault(require("./Subcategory"));
|
|
19
|
-
let Category = class Category extends AuditedModel_1.default {
|
|
20
|
+
let Category = Category_1 = class Category extends AuditedModel_1.default {
|
|
20
21
|
};
|
|
21
22
|
Category.getCacheKey = () => 'CATEGORIES';
|
|
22
23
|
__decorate([
|
|
@@ -51,7 +52,16 @@ __decorate([
|
|
|
51
52
|
typeorm_1.JoinColumn(),
|
|
52
53
|
__metadata("design:type", CategoryImages_1.default)
|
|
53
54
|
], Category.prototype, "categoryImages", void 0);
|
|
54
|
-
|
|
55
|
+
__decorate([
|
|
56
|
+
typeorm_1.ManyToOne(() => Category_1, { nullable: true }),
|
|
57
|
+
typeorm_1.JoinColumn({ name: 'father_id' }),
|
|
58
|
+
__metadata("design:type", Category)
|
|
59
|
+
], Category.prototype, "fatherCategory", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
typeorm_1.Column({ nullable: true }),
|
|
62
|
+
__metadata("design:type", Number)
|
|
63
|
+
], Category.prototype, "fatherId", void 0);
|
|
64
|
+
Category = Category_1 = __decorate([
|
|
55
65
|
typeorm_1.Entity()
|
|
56
66
|
], Category);
|
|
57
67
|
exports.default = Category;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/entity/Category.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/entity/Category.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAQiB;AACjB,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AAGxC,IAAqB,QAAQ,gBAA7B,MAAqB,QAAS,SAAQ,sBAAY;CAkCjD,CAAA;AADQ,oBAAW,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;AA/BxC;IADC,gCAAsB,EAAE;;oCACd;AAGX;IADC,gBAAM,CAAC,SAAS,CAAC;;sCACL;AAGb;IADC,mBAAS,CAAC,GAAG,EAAE,CAAC,qBAAW,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC;;+CACvC;AAG7B;IADC,0BAAgB,EAAE;8BACR,IAAI;2CAAC;AAGhB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACzB;AAGb;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACpB;AAOlB;IALC,mBAAS,CAAC,GAAG,EAAE,CAAC,wBAAc,EAAE,CAAC,cAA8B,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE;QAC5F,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,SAAS;KACpB,CAAC;IACD,oBAAU,EAAE;8BACG,wBAAc;gDAAC;AAI/B;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,UAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7C,oBAAU,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAClB,QAAQ;gDAAC;AAGzB;IADC,gBAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACV;AA/BE,QAAQ;IAD5B,gBAAM,EAAE;GACY,QAAQ,CAkC5B;kBAlCoB,QAAQ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.firstStemCategory1693249143377 = void 0;
|
|
13
|
+
class firstStemCategory1693249143377 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'firstStemCategory1693249143377';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
|
|
20
|
+
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`);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
down(queryRunner) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
|
|
26
|
+
yield queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.firstStemCategory1693249143377 = firstStemCategory1693249143377;
|
|
31
|
+
//# sourceMappingURL=1693249143377-first-stem-category.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1693249143377-first-stem-category.js","sourceRoot":"","sources":["../../src/migrations/1693249143377-first-stem-category.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,8BAA8B;IAA3C;QACI,SAAI,GAAG,gCAAgC,CAAA;IAY3C,CAAC;IAVgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YAC/E,MAAM,WAAW,CAAC,KAAK,CAAC,gLAAgL,CAAC,CAAC;QAC9M,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;YACxG,MAAM,WAAW,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAClF,CAAC;KAAA;CAEJ;AAbD,wEAaC"}
|
|
@@ -1932,8 +1932,8 @@
|
|
|
1932
1932
|
"affectsGlobalScope": false
|
|
1933
1933
|
},
|
|
1934
1934
|
"../src/entity/category.ts": {
|
|
1935
|
-
"version": "
|
|
1936
|
-
"signature": "
|
|
1935
|
+
"version": "dca03980bd342f465f4163acb1decf1dfe73e6fab706cb79477145b6b19db0d0",
|
|
1936
|
+
"signature": "0934d61293fb660814cbe42c25e9eabb0eb90155ca4eb05a46193f8e9881ee29",
|
|
1937
1937
|
"affectsGlobalScope": false
|
|
1938
1938
|
},
|
|
1939
1939
|
"../src/entity/courier.ts": {
|
|
@@ -3471,6 +3471,11 @@
|
|
|
3471
3471
|
"signature": "ab17663b796634970b2de27429f1e7125dca730e19e608d5739f00f6b2481624",
|
|
3472
3472
|
"affectsGlobalScope": false
|
|
3473
3473
|
},
|
|
3474
|
+
"../src/migrations/1693249143377-first-stem-category.ts": {
|
|
3475
|
+
"version": "49094a9bbc20f5b9fb16f781779f421463a64209f04ec089c0dd07d666ad8107",
|
|
3476
|
+
"signature": "d77e1a1a60fee4a52ada4104357603cf6e213fd5fa02e04c97f026a3353d6f3b",
|
|
3477
|
+
"affectsGlobalScope": false
|
|
3478
|
+
},
|
|
3474
3479
|
"../src/migrations/execute/index.ts": {
|
|
3475
3480
|
"version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
|
|
3476
3481
|
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
|
|
@@ -6443,6 +6448,9 @@
|
|
|
6443
6448
|
"../src/migrations/1693220480521-woo_connect_supplier.ts": [
|
|
6444
6449
|
"../node_modules/typeorm/index.d.ts"
|
|
6445
6450
|
],
|
|
6451
|
+
"../src/migrations/1693249143377-first-stem-category.ts": [
|
|
6452
|
+
"../node_modules/typeorm/index.d.ts"
|
|
6453
|
+
],
|
|
6446
6454
|
"../src/migrations/execute/index.ts": [
|
|
6447
6455
|
"../src/config/connect.ts"
|
|
6448
6456
|
],
|
|
@@ -9271,6 +9279,9 @@
|
|
|
9271
9279
|
"../src/migrations/1693220480521-woo_connect_supplier.ts": [
|
|
9272
9280
|
"../node_modules/typeorm/index.d.ts"
|
|
9273
9281
|
],
|
|
9282
|
+
"../src/migrations/1693249143377-first-stem-category.ts": [
|
|
9283
|
+
"../node_modules/typeorm/index.d.ts"
|
|
9284
|
+
],
|
|
9274
9285
|
"../src/migrations/index.ts": [
|
|
9275
9286
|
"../src/migrations/1628474597284-initialschema.ts",
|
|
9276
9287
|
"../src/migrations/1630077596132-removemangopay.ts",
|
|
@@ -10121,6 +10132,7 @@
|
|
|
10121
10132
|
"../src/migrations/1691679304105-woo_connect_channel_user_6.ts",
|
|
10122
10133
|
"../src/migrations/1691764260299-promote_to_production_11_08_23.ts",
|
|
10123
10134
|
"../src/migrations/1693220480521-woo_connect_supplier.ts",
|
|
10135
|
+
"../src/migrations/1693249143377-first-stem-category.ts",
|
|
10124
10136
|
"../src/migrations/execute/index.ts",
|
|
10125
10137
|
"../src/migrations/index.ts",
|
|
10126
10138
|
"../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.103",
|
|
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.103",
|
|
25
|
+
"@reachu/utils": "1.0.103",
|
|
26
26
|
"dotenv": "8.0.0",
|
|
27
27
|
"express": "4.17.1",
|
|
28
28
|
"mysql2": "1.5.2",
|
package/src/entity/Category.ts
CHANGED
|
@@ -38,5 +38,12 @@ export default class Category extends AuditedModel {
|
|
|
38
38
|
@JoinColumn()
|
|
39
39
|
categoryImages: CategoryImages;
|
|
40
40
|
|
|
41
|
+
@ManyToOne(() => Category, { nullable: true })
|
|
42
|
+
@JoinColumn({ name: 'father_id' })
|
|
43
|
+
fatherCategory: Category;
|
|
44
|
+
|
|
45
|
+
@Column({ nullable: true })
|
|
46
|
+
fatherId: number;
|
|
47
|
+
|
|
41
48
|
static getCacheKey = () => 'CATEGORIES';
|
|
42
49
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class firstStemCategory1693249143377 implements MigrationInterface {
|
|
4
|
+
name = 'firstStemCategory1693249143377'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE \`category\` ADD \`father_id\` int NULL`);
|
|
8
|
+
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`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE \`category\` DROP FOREIGN KEY \`FK_08644d63888f9493b187f8dda2e\``);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE \`category\` DROP COLUMN \`father_id\``);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|