@reachu/database 1.0.97 → 1.0.99
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/modules/discount/DiscountCart.d.ts +1 -0
- package/dist/entity/modules/discount/DiscountCart.js +4 -0
- package/dist/entity/modules/discount/DiscountCart.js.map +1 -1
- package/dist/helpers/querys/index.d.ts +1 -1
- package/dist/helpers/querys/index.js +1 -2
- package/dist/helpers/querys/index.js.map +1 -1
- package/dist/migrations/1689702729291-discount-applied.d.ts +6 -0
- package/dist/migrations/1689702729291-discount-applied.js +29 -0
- package/dist/migrations/1689702729291-discount-applied.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +16 -4
- package/package.json +3 -3
- package/src/entity/modules/discount/DiscountCart.ts +11 -1
- package/src/helpers/querys/index.ts +2 -3
- package/src/migrations/1689702729291-discount-applied.ts +14 -0
|
@@ -40,6 +40,10 @@ __decorate([
|
|
|
40
40
|
typeorm_1.JoinColumn(),
|
|
41
41
|
__metadata("design:type", Cart_1.default)
|
|
42
42
|
], DiscountCart.prototype, "cart", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
typeorm_1.Column('boolean', { default: false }),
|
|
45
|
+
__metadata("design:type", Boolean)
|
|
46
|
+
], DiscountCart.prototype, "applied", void 0);
|
|
43
47
|
DiscountCart = __decorate([
|
|
44
48
|
typeorm_1.Entity()
|
|
45
49
|
], DiscountCart);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscountCart.js","sourceRoot":"","sources":["../../../../src/entity/modules/discount/DiscountCart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"DiscountCart.js","sourceRoot":"","sources":["../../../../src/entity/modules/discount/DiscountCart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAOiB;AACjB,sEAA8C;AAC9C,0DAAkC;AAClC,uEAA+C;AAG/C,IAAqB,YAAY,GAAjC,MAAqB,YAAa,SAAQ,sBAAY;CAqBrD,CAAA;AAnBC;IADC,gCAAsB,EAAE;;wCACd;AAGX;IADC,0BAAgB,EAAE;8BACR,IAAI;+CAAC;AAMhB;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,kBAAQ,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAC9D,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,oBAAU,EAAE;8BACH,kBAAQ;8CAAC;AAMnB;IAJC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;QAC9C,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,oBAAU,EAAE;8BACP,cAAI;0CAAC;AAGX;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6CACrB;AApBE,YAAY;IADhC,gBAAM,EAAE;GACY,YAAY,CAqBhC;kBArBoB,YAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getCurrentDate: () => Promise<
|
|
1
|
+
declare const getCurrentDate: () => Promise<string>;
|
|
2
2
|
export { getCurrentDate };
|
|
@@ -17,9 +17,8 @@ const getCurrentDate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
17
17
|
try {
|
|
18
18
|
yield queryRunner.connect();
|
|
19
19
|
const result = yield queryRunner.query('SELECT NOW() as date');
|
|
20
|
-
console.log(`getCurrentDate result: ${JSON.stringify(result)}`);
|
|
21
20
|
const currentDate = result[0].date;
|
|
22
|
-
|
|
21
|
+
return currentDate;
|
|
23
22
|
}
|
|
24
23
|
catch (error) {
|
|
25
24
|
console.error('getCurrentDate: Error:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/querys/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAwC;AAExC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/querys/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAwC;AAExC,MAAM,cAAc,GAAG,GAA0B,EAAE;IACjD,MAAM,UAAU,GAAG,uBAAa,EAAE,CAAC;IACnC,MAAM,WAAW,GAAG,UAAU,CAAC,iBAAiB,EAAE,CAAC;IACnD,IAAI;QACF,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC/D,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnC,OAAO,WAAW,CAAC;KACpB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;KAChD;YAAS;QACR,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;KAC7B;AACH,CAAC,CAAA,CAAC;AAEO,wCAAc"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.discountApplied1689702729291 = void 0;
|
|
13
|
+
class discountApplied1689702729291 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'discountApplied1689702729291';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE \`discount_cart\` ADD \`applied\` tinyint NOT NULL DEFAULT 0`);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
down(queryRunner) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
yield queryRunner.query(`ALTER TABLE \`discount_cart\` DROP COLUMN \`applied\``);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.discountApplied1689702729291 = discountApplied1689702729291;
|
|
29
|
+
//# sourceMappingURL=1689702729291-discount-applied.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1689702729291-discount-applied.js","sourceRoot":"","sources":["../../src/migrations/1689702729291-discount-applied.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,4BAA4B;IAAzC;QACI,SAAI,GAAG,8BAA8B,CAAA;IAUzC,CAAC;IARgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,0EAA0E,CAAC,CAAC;QACxG,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;QACrF,CAAC;KAAA;CAEJ;AAXD,oEAWC"}
|
|
@@ -2742,8 +2742,8 @@
|
|
|
2742
2742
|
"affectsGlobalScope": false
|
|
2743
2743
|
},
|
|
2744
2744
|
"../src/entity/modules/discount/discountcart.ts": {
|
|
2745
|
-
"version": "
|
|
2746
|
-
"signature": "
|
|
2745
|
+
"version": "82c1186c4188d49de4cb667602ded96994f2de4010116b035f7c9b852dc4c579",
|
|
2746
|
+
"signature": "52b0462113b5157c40db1933c73d662dece7d62dc87c72e18314d064e454e91a",
|
|
2747
2747
|
"affectsGlobalScope": false
|
|
2748
2748
|
},
|
|
2749
2749
|
"../src/entity/modules/discount/discount.ts": {
|
|
@@ -2987,8 +2987,8 @@
|
|
|
2987
2987
|
"affectsGlobalScope": false
|
|
2988
2988
|
},
|
|
2989
2989
|
"../src/helpers/querys/index.ts": {
|
|
2990
|
-
"version": "
|
|
2991
|
-
"signature": "
|
|
2990
|
+
"version": "d064daff31b4dbf5bc3b9b05580c32cda536aaab20d52656e21ca9cf55f5cbe2",
|
|
2991
|
+
"signature": "2b4d95c63556d70c165b44312ac7e5bb76706e5a99f1dfcb010e8a06fcf91f40",
|
|
2992
2992
|
"affectsGlobalScope": false
|
|
2993
2993
|
},
|
|
2994
2994
|
"../src/helpers/index.ts": {
|
|
@@ -3416,6 +3416,11 @@
|
|
|
3416
3416
|
"signature": "feaee38c1bd8210d9a44b2ae43fcd87f931007e469a62d53629dc10369ae4663",
|
|
3417
3417
|
"affectsGlobalScope": false
|
|
3418
3418
|
},
|
|
3419
|
+
"../src/migrations/1689702729291-discount-applied.ts": {
|
|
3420
|
+
"version": "ece79e0979400485485a582cf238cf7d1b9a201b954c201e25e5194009aa3671",
|
|
3421
|
+
"signature": "1c8a23b3581b71c2143753b23c74a5928a97c29acdf1bde0e02ba7d228a444b1",
|
|
3422
|
+
"affectsGlobalScope": false
|
|
3423
|
+
},
|
|
3419
3424
|
"../src/migrations/execute/index.ts": {
|
|
3420
3425
|
"version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
|
|
3421
3426
|
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
|
|
@@ -6354,6 +6359,9 @@
|
|
|
6354
6359
|
"../src/migrations/1689279346515-add-discount-user.ts": [
|
|
6355
6360
|
"../node_modules/typeorm/index.d.ts"
|
|
6356
6361
|
],
|
|
6362
|
+
"../src/migrations/1689702729291-discount-applied.ts": [
|
|
6363
|
+
"../node_modules/typeorm/index.d.ts"
|
|
6364
|
+
],
|
|
6357
6365
|
"../src/migrations/execute/index.ts": [
|
|
6358
6366
|
"../src/config/connect.ts"
|
|
6359
6367
|
],
|
|
@@ -9148,6 +9156,9 @@
|
|
|
9148
9156
|
"../src/migrations/1689279346515-add-discount-user.ts": [
|
|
9149
9157
|
"../node_modules/typeorm/index.d.ts"
|
|
9150
9158
|
],
|
|
9159
|
+
"../src/migrations/1689702729291-discount-applied.ts": [
|
|
9160
|
+
"../node_modules/typeorm/index.d.ts"
|
|
9161
|
+
],
|
|
9151
9162
|
"../src/migrations/index.ts": [
|
|
9152
9163
|
"../src/migrations/1628474597284-initialschema.ts",
|
|
9153
9164
|
"../src/migrations/1630077596132-removemangopay.ts",
|
|
@@ -9987,6 +9998,7 @@
|
|
|
9987
9998
|
"../src/migrations/1689005718747-add-active-colum-in-variant.ts",
|
|
9988
9999
|
"../src/migrations/1689020331011-add-discount.ts",
|
|
9989
10000
|
"../src/migrations/1689279346515-add-discount-user.ts",
|
|
10001
|
+
"../src/migrations/1689702729291-discount-applied.ts",
|
|
9990
10002
|
"../src/migrations/execute/index.ts",
|
|
9991
10003
|
"../src/migrations/index.ts",
|
|
9992
10004
|
"../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.99",
|
|
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.99",
|
|
25
|
+
"@reachu/utils": "1.0.99",
|
|
26
26
|
"dotenv": "8.0.0",
|
|
27
27
|
"express": "4.17.1",
|
|
28
28
|
"mysql2": "1.5.2",
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
DeleteDateColumn,
|
|
5
|
+
JoinColumn,
|
|
6
|
+
ManyToOne,
|
|
7
|
+
Column,
|
|
8
|
+
} from 'typeorm';
|
|
2
9
|
import AuditedModel from '../../AuditedModel';
|
|
3
10
|
import Discount from './Discount';
|
|
4
11
|
import Cart from '../../modules/shopcart/Cart';
|
|
@@ -22,4 +29,7 @@ export default class DiscountCart extends AuditedModel {
|
|
|
22
29
|
})
|
|
23
30
|
@JoinColumn()
|
|
24
31
|
cart: Cart;
|
|
32
|
+
|
|
33
|
+
@Column('boolean', { default: false })
|
|
34
|
+
applied: boolean;
|
|
25
35
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { getConnection } from 'typeorm';
|
|
2
2
|
|
|
3
|
-
const getCurrentDate = async () => {
|
|
3
|
+
const getCurrentDate = async (): Promise<string> => {
|
|
4
4
|
const connection = getConnection();
|
|
5
5
|
const queryRunner = connection.createQueryRunner();
|
|
6
6
|
try {
|
|
7
7
|
await queryRunner.connect();
|
|
8
8
|
const result = await queryRunner.query('SELECT NOW() as date');
|
|
9
|
-
console.log(`getCurrentDate result: ${JSON.stringify(result)}`);
|
|
10
9
|
const currentDate = result[0].date;
|
|
11
|
-
|
|
10
|
+
return currentDate;
|
|
12
11
|
} catch (error) {
|
|
13
12
|
console.error('getCurrentDate: Error:', error);
|
|
14
13
|
} finally {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class discountApplied1689702729291 implements MigrationInterface {
|
|
4
|
+
name = 'discountApplied1689702729291'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE \`discount_cart\` ADD \`applied\` tinyint NOT NULL DEFAULT 0`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE \`discount_cart\` DROP COLUMN \`applied\``);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|