@reachu/database 1.0.80 → 1.0.81

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.
@@ -1,10 +1,12 @@
1
1
  import AuditedModel from './AuditedModel';
2
2
  import Channel from './Channel';
3
+ import ChannelUser from './ChannelUser';
3
4
  import User from './User';
4
5
  export default class UserChannelApiKey extends AuditedModel {
5
6
  id: number;
6
7
  deletedAt: Date;
7
8
  user: User;
8
9
  channel: Channel;
10
+ ChannelUser: ChannelUser;
9
11
  apiKey: string;
10
12
  }
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const typeorm_1 = require("typeorm");
16
16
  const AuditedModel_1 = __importDefault(require("./AuditedModel"));
17
17
  const Channel_1 = __importDefault(require("./Channel"));
18
+ const ChannelUser_1 = __importDefault(require("./ChannelUser"));
18
19
  const User_1 = __importDefault(require("./User"));
19
20
  let UserChannelApiKey = class UserChannelApiKey extends AuditedModel_1.default {
20
21
  };
@@ -36,6 +37,11 @@ __decorate([
36
37
  typeorm_1.JoinColumn(),
37
38
  __metadata("design:type", Channel_1.default)
38
39
  ], UserChannelApiKey.prototype, "channel", void 0);
40
+ __decorate([
41
+ typeorm_1.ManyToOne(() => ChannelUser_1.default, (channelUser) => channelUser.id, { nullable: true }),
42
+ typeorm_1.JoinColumn(),
43
+ __metadata("design:type", ChannelUser_1.default)
44
+ ], UserChannelApiKey.prototype, "ChannelUser", void 0);
39
45
  __decorate([
40
46
  typeorm_1.Column('varchar'),
41
47
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"UserChannelApiKey.js","sourceRoot":"","sources":["../../src/entity/UserChannelApiKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAQiB;AACjB,kEAA0C;AAC1C,wDAAgC;AAChC,kDAA0B;AAG1B,IAAqB,iBAAiB,GAAtC,MAAqB,iBAAkB,SAAQ,sBAAY;CAiB1D,CAAA;AAfC;IADC,gCA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oBAAU,EAAE;8BACJ,iBAAO;kDAAC;AAIjB;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,qBAAW,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjF,oBAAU,EAAE;8BACA,qBAAW;sDAAC;AAGzB;IADC,gBAAM,CAAC,SAAS,CAAC;;iDACH;AApBI,iBAAiB;IADrC,gBAAM,EAAE;GACY,iBAAiB,CAqBrC;kBArBoB,iBAAiB"}
@@ -0,0 +1,6 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+ export declare class channelApikey1687322723851 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
@@ -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.channelApikey1687322723851 = void 0;
13
+ class channelApikey1687322723851 {
14
+ constructor() {
15
+ this.name = 'channelApikey1687322723851';
16
+ }
17
+ up(queryRunner) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ yield queryRunner.query(`ALTER TABLE \`user_channel_api_key\` ADD \`channel_user_id\` int NULL`);
20
+ yield queryRunner.query(`ALTER TABLE \`user_channel_api_key\` ADD CONSTRAINT \`FK_adc2206f21efb67f9f6425a4ce8\` FOREIGN KEY (\`channel_user_id\`) REFERENCES \`channel_user\`(\`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 \`user_channel_api_key\` DROP FOREIGN KEY \`FK_adc2206f21efb67f9f6425a4ce8\``);
26
+ yield queryRunner.query(`ALTER TABLE \`user_channel_api_key\` DROP COLUMN \`channel_user_id\``);
27
+ });
28
+ }
29
+ }
30
+ exports.channelApikey1687322723851 = channelApikey1687322723851;
31
+ //# sourceMappingURL=1687322723851-channel_apikey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1687322723851-channel_apikey.js","sourceRoot":"","sources":["../../src/migrations/1687322723851-channel_apikey.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,0BAA0B;IAAvC;QACI,SAAI,GAAG,4BAA4B,CAAA;IAYvC,CAAC;IAVgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YACjG,MAAM,WAAW,CAAC,KAAK,CAAC,sMAAsM,CAAC,CAAC;QACpO,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,0FAA0F,CAAC,CAAC;YACpH,MAAM,WAAW,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC;QACpG,CAAC;KAAA;CAEJ;AAbD,gEAaC"}
@@ -2472,8 +2472,8 @@
2472
2472
  "affectsGlobalScope": false
2473
2473
  },
2474
2474
  "../src/entity/userchannelapikey.ts": {
2475
- "version": "caf18870ff9559bfc811da1a0591a926f7e2313f92cd903a8eff338127415ec3",
2476
- "signature": "7efd2406080e07894d8d335fbe75ba26c7dc03e64ce95245ba86c08a271ee76d",
2475
+ "version": "985bc475fc650804cb3902c2d0ccafd248c0163434112d262ff4e74cb636b5c1",
2476
+ "signature": "12372bedd14f6d5431f7273e4a338473a3e61161d6ac0da23e7b81ea92edffb8",
2477
2477
  "affectsGlobalScope": false
2478
2478
  },
2479
2479
  "../src/entity/channel.ts": {
@@ -3301,6 +3301,11 @@
3301
3301
  "signature": "5c4b5981535ccf6b437a011756006f5734f76f9abbb7b25e622537653a6f45b2",
3302
3302
  "affectsGlobalScope": false
3303
3303
  },
3304
+ "../src/migrations/1687322723851-channel_apikey.ts": {
3305
+ "version": "d35ea8f9e6f6167fa0bbe77966f68213aaf6bbaad881ddc6200a5a79de0712c1",
3306
+ "signature": "bf72fbaf93cc0e771b724f545a881d8b51bdb493548c133351ede490ebbafeb5",
3307
+ "affectsGlobalScope": false
3308
+ },
3304
3309
  "../src/migrations/execute/index.ts": {
3305
3310
  "version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
3306
3311
  "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
@@ -5834,6 +5839,7 @@
5834
5839
  "../node_modules/typeorm/index.d.ts",
5835
5840
  "../src/entity/auditedmodel.ts",
5836
5841
  "../src/entity/channel.ts",
5842
+ "../src/entity/channeluser.ts",
5837
5843
  "../src/entity/user.ts"
5838
5844
  ],
5839
5845
  "../src/entity/userrole.ts": [
@@ -6148,6 +6154,9 @@
6148
6154
  "../src/migrations/1687235204409-channel_user.ts": [
6149
6155
  "../node_modules/typeorm/index.d.ts"
6150
6156
  ],
6157
+ "../src/migrations/1687322723851-channel_apikey.ts": [
6158
+ "../node_modules/typeorm/index.d.ts"
6159
+ ],
6151
6160
  "../src/migrations/execute/index.ts": [
6152
6161
  "../src/config/connect.ts"
6153
6162
  ],
@@ -8559,6 +8568,7 @@
8559
8568
  "../src/entity/userchannelapikey.ts": [
8560
8569
  "../src/entity/auditedmodel.ts",
8561
8570
  "../src/entity/channel.ts",
8571
+ "../src/entity/channeluser.ts",
8562
8572
  "../src/entity/user.ts"
8563
8573
  ],
8564
8574
  "../src/entity/userrole.ts": [
@@ -8850,6 +8860,9 @@
8850
8860
  "../src/migrations/1687235204409-channel_user.ts": [
8851
8861
  "../node_modules/typeorm/index.d.ts"
8852
8862
  ],
8863
+ "../src/migrations/1687322723851-channel_apikey.ts": [
8864
+ "../node_modules/typeorm/index.d.ts"
8865
+ ],
8853
8866
  "../src/migrations/index.ts": [
8854
8867
  "../src/migrations/1628474597284-initialschema.ts",
8855
8868
  "../src/migrations/1630077596132-removemangopay.ts",
@@ -9658,6 +9671,7 @@
9658
9671
  "../src/migrations/1686309865248-cart_shipping_country.ts",
9659
9672
  "../src/migrations/1686837392110-cart_shipping_default.ts",
9660
9673
  "../src/migrations/1687235204409-channel_user.ts",
9674
+ "../src/migrations/1687322723851-channel_apikey.ts",
9661
9675
  "../src/migrations/execute/index.ts",
9662
9676
  "../src/migrations/index.ts",
9663
9677
  "../src/repositories/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reachu/database",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
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.80",
25
- "@reachu/utils": "1.0.80",
24
+ "@reachu/logger": "1.0.81",
25
+ "@reachu/utils": "1.0.81",
26
26
  "dotenv": "8.0.0",
27
27
  "express": "4.17.1",
28
28
  "mysql2": "1.5.2",
@@ -9,6 +9,8 @@ import {
9
9
  } from 'typeorm';
10
10
  import AuditedModel from './AuditedModel';
11
11
  import Channel from './Channel';
12
+ import ChannelUser from './ChannelUser';
13
+
12
14
  import User from './User';
13
15
 
14
16
  @Entity()
@@ -27,6 +29,10 @@ export default class UserChannelApiKey extends AuditedModel {
27
29
  @JoinColumn()
28
30
  channel: Channel;
29
31
 
32
+ @ManyToOne(() => ChannelUser, (channelUser) => channelUser.id, { nullable: true })
33
+ @JoinColumn()
34
+ ChannelUser: ChannelUser;
35
+
30
36
  @Column('varchar')
31
37
  apiKey: string;
32
38
  }
@@ -0,0 +1,16 @@
1
+ import {MigrationInterface, QueryRunner} from "typeorm";
2
+
3
+ export class channelApikey1687322723851 implements MigrationInterface {
4
+ name = 'channelApikey1687322723851'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE \`user_channel_api_key\` ADD \`channel_user_id\` int NULL`);
8
+ await queryRunner.query(`ALTER TABLE \`user_channel_api_key\` ADD CONSTRAINT \`FK_adc2206f21efb67f9f6425a4ce8\` FOREIGN KEY (\`channel_user_id\`) REFERENCES \`channel_user\`(\`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 \`user_channel_api_key\` DROP FOREIGN KEY \`FK_adc2206f21efb67f9f6425a4ce8\``);
13
+ await queryRunner.query(`ALTER TABLE \`user_channel_api_key\` DROP COLUMN \`channel_user_id\``);
14
+ }
15
+
16
+ }