@reachu/database 1.0.30 → 1.0.31
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/subscriptions/Plan.d.ts +3 -0
- package/dist/entity/modules/subscriptions/Plan.js +10 -0
- package/dist/entity/modules/subscriptions/Plan.js.map +1 -1
- package/dist/entity/modules/subscriptions/Subscription.d.ts +1 -0
- package/dist/entity/modules/subscriptions/Subscription.js +4 -0
- package/dist/entity/modules/subscriptions/Subscription.js.map +1 -1
- package/dist/migrations/1681967226231-Subscriptions_v2.d.ts +6 -0
- package/dist/migrations/1681967226231-Subscriptions_v2.js +31 -0
- package/dist/migrations/1681967226231-Subscriptions_v2.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +20 -6
- package/package.json +3 -3
- package/src/entity/modules/subscriptions/Plan.ts +10 -1
- package/src/entity/modules/subscriptions/Subscription.ts +4 -1
- package/src/migrations/1681967226231-Subscriptions_v2.ts +16 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import AuditedModel from '../../AuditedModel';
|
|
2
|
+
import Subscription from './Subscription';
|
|
2
3
|
export default class Plan extends AuditedModel {
|
|
4
|
+
deletedAt: Date;
|
|
3
5
|
id: number;
|
|
4
6
|
name: string;
|
|
5
7
|
description: string;
|
|
6
8
|
originId: string;
|
|
7
9
|
response: string;
|
|
10
|
+
subscriptions: Subscription[];
|
|
8
11
|
}
|
|
@@ -14,8 +14,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const AuditedModel_1 = __importDefault(require("../../AuditedModel"));
|
|
16
16
|
const typeorm_1 = require("typeorm");
|
|
17
|
+
const Subscription_1 = __importDefault(require("./Subscription"));
|
|
17
18
|
let Plan = class Plan extends AuditedModel_1.default {
|
|
18
19
|
};
|
|
20
|
+
__decorate([
|
|
21
|
+
typeorm_1.DeleteDateColumn(),
|
|
22
|
+
__metadata("design:type", Date)
|
|
23
|
+
], Plan.prototype, "deletedAt", void 0);
|
|
19
24
|
__decorate([
|
|
20
25
|
typeorm_1.PrimaryGeneratedColumn(),
|
|
21
26
|
__metadata("design:type", Number)
|
|
@@ -36,6 +41,11 @@ __decorate([
|
|
|
36
41
|
typeorm_1.Column('varchar', { nullable: true }),
|
|
37
42
|
__metadata("design:type", String)
|
|
38
43
|
], Plan.prototype, "response", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
typeorm_1.OneToMany(() => Subscription_1.default, (subscription) => subscription.plan),
|
|
46
|
+
typeorm_1.JoinColumn(),
|
|
47
|
+
__metadata("design:type", Array)
|
|
48
|
+
], Plan.prototype, "subscriptions", void 0);
|
|
39
49
|
Plan = __decorate([
|
|
40
50
|
typeorm_1.Entity()
|
|
41
51
|
], Plan);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plan.js","sourceRoot":"","sources":["../../../../src/entity/modules/subscriptions/Plan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"Plan.js","sourceRoot":"","sources":["../../../../src/entity/modules/subscriptions/Plan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA8C;AAC9C,qCAA0G;AAC1G,kEAA0C;AAG1C,IAAqB,IAAI,GAAzB,MAAqB,IAAK,SAAQ,sBAAY;CAuB7C,CAAA;AApBC;IADC,0BAAgB,EAAE;8BACR,IAAI;uCAAC;AAGhB;IADC,gCAAsB,EAAE;;gCACd;AAGX;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;kCACtB;AAGb;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAClB;AAGpB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACrB;AAGjB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACrB;AAIjB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,sBAAY,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;IAChF,oBAAU,EAAE;;2CACiB;AAtBX,IAAI;IADxB,gBAAM,EAAE;GACY,IAAI,CAuBxB;kBAvBoB,IAAI"}
|
|
@@ -22,6 +22,10 @@ __decorate([
|
|
|
22
22
|
typeorm_1.PrimaryGeneratedColumn(),
|
|
23
23
|
__metadata("design:type", Number)
|
|
24
24
|
], Subscription.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
typeorm_1.DeleteDateColumn(),
|
|
27
|
+
__metadata("design:type", Date)
|
|
28
|
+
], Subscription.prototype, "deletedAt", void 0);
|
|
25
29
|
__decorate([
|
|
26
30
|
typeorm_1.ManyToOne(() => User_1.default, (user) => user.id, { onDelete: 'CASCADE' }),
|
|
27
31
|
typeorm_1.JoinColumn(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../../src/entity/modules/subscriptions/Subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA8C;AAC9C,sDAA8B;AAC9B,kDAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../../src/entity/modules/subscriptions/Subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA8C;AAC9C,sDAA8B;AAC9B,kDAA0B;AAE1B,qCAA0G;AAG1G,IAAqB,YAAY,GAAjC,MAAqB,YAAa,SAAQ,sBAAY;CA6BrD,CAAA;AA3BC;IADC,gCAAsB,EAAE;;wCACd;AAGX;IADC,0BAAgB,EAAE;8BACR,IAAI;+CAAC;AAIhB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACvE,oBAAU,EAAE;8BACP,cAAI;0CAAC;AAIX;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACpF,oBAAU,EAAE;8BACP,cAAI;0CAAC;AAGX;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACnB;AAGnB;IADC,gBAAM,CAAC,SAAS,CAAC;;4CACF;AAGhB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACpC;AAGf;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACrB;AAGjB;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACrB;AA5BE,YAAY;IADhC,gBAAM,EAAE;GACY,YAAY,CA6BhC;kBA7BoB,YAAY"}
|
|
@@ -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.SubscriptionsV21681967226231 = void 0;
|
|
13
|
+
class SubscriptionsV21681967226231 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'SubscriptionsV21681967226231';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE \`plan\` ADD \`deleted_at\` datetime(6) NULL`);
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE \`subscription\` ADD \`deleted_at\` datetime(6) NULL`);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
down(queryRunner) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield queryRunner.query(`ALTER TABLE \`subscription\` DROP COLUMN \`deleted_at\``);
|
|
26
|
+
yield queryRunner.query(`ALTER TABLE \`plan\` DROP COLUMN \`deleted_at\``);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.SubscriptionsV21681967226231 = SubscriptionsV21681967226231;
|
|
31
|
+
//# sourceMappingURL=1681967226231-Subscriptions_v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1681967226231-Subscriptions_v2.js","sourceRoot":"","sources":["../../src/migrations/1681967226231-Subscriptions_v2.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,4BAA4B;IAAzC;QACI,SAAI,GAAG,8BAA8B,CAAA;IAYzC,CAAC;IAVgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QAChG,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;YACnF,MAAM,WAAW,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAC/E,CAAC;KAAA;CAEJ;AAbD,oEAaC"}
|
|
@@ -2552,13 +2552,13 @@
|
|
|
2552
2552
|
"affectsGlobalScope": false
|
|
2553
2553
|
},
|
|
2554
2554
|
"../src/entity/modules/subscriptions/plan.ts": {
|
|
2555
|
-
"version": "
|
|
2556
|
-
"signature": "
|
|
2555
|
+
"version": "7878783c9c145a953f9672a737d0b2280eb516d8cdd12c9cc96973d3b39914b4",
|
|
2556
|
+
"signature": "20e27ad6c33cb2539f379f69a82a10b748093d1c2bcb093239adea2d6bf08ffa",
|
|
2557
2557
|
"affectsGlobalScope": false
|
|
2558
2558
|
},
|
|
2559
2559
|
"../src/entity/modules/subscriptions/subscription.ts": {
|
|
2560
|
-
"version": "
|
|
2561
|
-
"signature": "
|
|
2560
|
+
"version": "4c3a09e5183ec399dc018ba05dc687f50c67fc25f3eec82933d75df4c9ddd5a1",
|
|
2561
|
+
"signature": "cdab4b6c9e16417c6f6ef01b8e0181b35913219d9fa2afafd7e7c700e083ed74",
|
|
2562
2562
|
"affectsGlobalScope": false
|
|
2563
2563
|
},
|
|
2564
2564
|
"../src/entity/user.ts": {
|
|
@@ -3171,6 +3171,11 @@
|
|
|
3171
3171
|
"signature": "539f78b38f388da52ce133b617adcb97f7316beb5b62d2fb0a532f8c93e4b6bc",
|
|
3172
3172
|
"affectsGlobalScope": false
|
|
3173
3173
|
},
|
|
3174
|
+
"../src/migrations/1681967226231-subscriptions_v2.ts": {
|
|
3175
|
+
"version": "07526ceda972a1a8dbdd834c0991c85ef3cda90a57a751af913def2a2c53833d",
|
|
3176
|
+
"signature": "556984f615533477aa11bfd2d7baea697ecbb0f914f782aa60eeb23247ceb4a9",
|
|
3177
|
+
"affectsGlobalScope": false
|
|
3178
|
+
},
|
|
3174
3179
|
"../src/migrations/execute/index.ts": {
|
|
3175
3180
|
"version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
|
|
3176
3181
|
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
|
|
@@ -5429,7 +5434,8 @@
|
|
|
5429
5434
|
],
|
|
5430
5435
|
"../src/entity/modules/subscriptions/plan.ts": [
|
|
5431
5436
|
"../node_modules/typeorm/index.d.ts",
|
|
5432
|
-
"../src/entity/auditedmodel.ts"
|
|
5437
|
+
"../src/entity/auditedmodel.ts",
|
|
5438
|
+
"../src/entity/modules/subscriptions/subscription.ts"
|
|
5433
5439
|
],
|
|
5434
5440
|
"../src/entity/modules/subscriptions/subscription.ts": [
|
|
5435
5441
|
"../node_modules/typeorm/index.d.ts",
|
|
@@ -5921,6 +5927,9 @@
|
|
|
5921
5927
|
"../src/migrations/1681765500644-template-auth-fix.ts": [
|
|
5922
5928
|
"../node_modules/typeorm/index.d.ts"
|
|
5923
5929
|
],
|
|
5930
|
+
"../src/migrations/1681967226231-subscriptions_v2.ts": [
|
|
5931
|
+
"../node_modules/typeorm/index.d.ts"
|
|
5932
|
+
],
|
|
5924
5933
|
"../src/migrations/execute/index.ts": [
|
|
5925
5934
|
"../src/config/connect.ts"
|
|
5926
5935
|
],
|
|
@@ -8110,7 +8119,8 @@
|
|
|
8110
8119
|
"../src/entity/modules/shopcart/cartitem.ts"
|
|
8111
8120
|
],
|
|
8112
8121
|
"../src/entity/modules/subscriptions/plan.ts": [
|
|
8113
|
-
"../src/entity/auditedmodel.ts"
|
|
8122
|
+
"../src/entity/auditedmodel.ts",
|
|
8123
|
+
"../src/entity/modules/subscriptions/subscription.ts"
|
|
8114
8124
|
],
|
|
8115
8125
|
"../src/entity/modules/subscriptions/subscription.ts": [
|
|
8116
8126
|
"../src/entity/auditedmodel.ts",
|
|
@@ -8527,6 +8537,9 @@
|
|
|
8527
8537
|
"../src/migrations/1681765500644-template-auth-fix.ts": [
|
|
8528
8538
|
"../node_modules/typeorm/index.d.ts"
|
|
8529
8539
|
],
|
|
8540
|
+
"../src/migrations/1681967226231-subscriptions_v2.ts": [
|
|
8541
|
+
"../node_modules/typeorm/index.d.ts"
|
|
8542
|
+
],
|
|
8530
8543
|
"../src/migrations/index.ts": [
|
|
8531
8544
|
"../src/migrations/1628474597284-initialschema.ts",
|
|
8532
8545
|
"../src/migrations/1630077596132-removemangopay.ts",
|
|
@@ -9305,6 +9318,7 @@
|
|
|
9305
9318
|
"../src/migrations/1681485990275-template-ecommerce-two.ts",
|
|
9306
9319
|
"../src/migrations/1681741033630-subscriptions.ts",
|
|
9307
9320
|
"../src/migrations/1681765500644-template-auth-fix.ts",
|
|
9321
|
+
"../src/migrations/1681967226231-subscriptions_v2.ts",
|
|
9308
9322
|
"../src/migrations/execute/index.ts",
|
|
9309
9323
|
"../src/migrations/index.ts",
|
|
9310
9324
|
"../src/repositories/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.31",
|
|
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.31",
|
|
25
|
+
"@reachu/utils": "1.0.31",
|
|
26
26
|
"dotenv": "8.0.0",
|
|
27
27
|
"express": "4.17.1",
|
|
28
28
|
"mysql2": "1.5.2",
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import AuditedModel from '../../AuditedModel';
|
|
2
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
import { Column, DeleteDateColumn, Entity, JoinColumn, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
|
3
|
+
import Subscription from './Subscription';
|
|
3
4
|
|
|
4
5
|
@Entity()
|
|
5
6
|
export default class Plan extends AuditedModel {
|
|
7
|
+
|
|
8
|
+
@DeleteDateColumn()
|
|
9
|
+
deletedAt: Date;
|
|
10
|
+
|
|
6
11
|
@PrimaryGeneratedColumn()
|
|
7
12
|
id: number;
|
|
8
13
|
|
|
@@ -17,4 +22,8 @@ export default class Plan extends AuditedModel {
|
|
|
17
22
|
|
|
18
23
|
@Column('varchar', { nullable: true })
|
|
19
24
|
response: string;
|
|
25
|
+
|
|
26
|
+
@OneToMany(() => Subscription, (subscription: Subscription) => subscription.plan)
|
|
27
|
+
@JoinColumn()
|
|
28
|
+
subscriptions: Subscription[];
|
|
20
29
|
}
|
|
@@ -2,13 +2,16 @@ import AuditedModel from '../../AuditedModel';
|
|
|
2
2
|
import User from '../../User';
|
|
3
3
|
import Plan from './Plan';
|
|
4
4
|
|
|
5
|
-
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
|
5
|
+
import { Column, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
|
6
6
|
|
|
7
7
|
@Entity()
|
|
8
8
|
export default class Subscription extends AuditedModel {
|
|
9
9
|
@PrimaryGeneratedColumn()
|
|
10
10
|
id: number;
|
|
11
11
|
|
|
12
|
+
@DeleteDateColumn()
|
|
13
|
+
deletedAt: Date;
|
|
14
|
+
|
|
12
15
|
@ManyToOne(() => User, (user: User) => user.id, { onDelete: 'CASCADE' })
|
|
13
16
|
@JoinColumn()
|
|
14
17
|
user: User;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class SubscriptionsV21681967226231 implements MigrationInterface {
|
|
4
|
+
name = 'SubscriptionsV21681967226231'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE \`plan\` ADD \`deleted_at\` datetime(6) NULL`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE \`subscription\` ADD \`deleted_at\` datetime(6) NULL`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE \`subscription\` DROP COLUMN \`deleted_at\``);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE \`plan\` DROP COLUMN \`deleted_at\``);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|