@aurispec/core-backend 1.0.57 → 1.0.59

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.
@@ -0,0 +1,7 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+ export declare class CreateReportsTable1776185839118 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=1776185839118-create_reports_table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1776185839118-create_reports_table.d.ts","sourceRoot":"","sources":["../../../src/database/migrations/1776185839118-create_reports_table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,+BAAgC,YAAW,kBAAkB;IACtE,IAAI,SAAoC;IAE3B,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAS3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAS7D"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateReportsTable1776185839118 = void 0;
4
+ class CreateReportsTable1776185839118 {
5
+ name = 'CreateReportsTable1776185839118';
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`CREATE TYPE "public"."reports_reason_enum" AS ENUM('MIS_INFORMATION', 'HARMFUL_SPEECH', 'HATE_SPEECH', 'SPAM_OR_PROMOTIONAL', 'PRIVACY_CONVERN', 'OTHERS')`);
8
+ await queryRunner.query(`CREATE TABLE "reports" ("id" SERIAL NOT NULL, "uuid" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP DEFAULT now(), "deleted_at" TIMESTAMP, "post_id" integer NOT NULL, "user_id" integer NOT NULL, "comment" text NOT NULL, "reportable_id" integer NOT NULL, "reason" "public"."reports_reason_enum" NOT NULL, "reportable_type" character varying NOT NULL, CONSTRAINT "UQ_8e2f2f0d6123151948d3a0537a4" UNIQUE ("uuid"), CONSTRAINT "PK_d9013193989303580053c0b5ef6" PRIMARY KEY ("id"))`);
9
+ await queryRunner.query(`CREATE INDEX "IDX_8e2f2f0d6123151948d3a0537a" ON "reports" ("uuid") `);
10
+ await queryRunner.query(`CREATE INDEX "IDX_bd2e348fa6430a75c00baf61bd" ON "reports" ("post_id", "user_id", "reportable_id", "reportable_type") `);
11
+ await queryRunner.query(`ALTER TABLE "reports" ADD CONSTRAINT "FK_b84fcce5b84191fc4b8e5d0d6f9" FOREIGN KEY ("post_id") REFERENCES "posts"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
12
+ await queryRunner.query(`ALTER TABLE "reports" ADD CONSTRAINT "FK_ca7a21eb95ca4625bd5eaef7e0c" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
13
+ }
14
+ async down(queryRunner) {
15
+ await queryRunner.query(`ALTER TABLE "reports" DROP CONSTRAINT "FK_ca7a21eb95ca4625bd5eaef7e0c"`);
16
+ await queryRunner.query(`ALTER TABLE "reports" DROP CONSTRAINT "FK_b84fcce5b84191fc4b8e5d0d6f9"`);
17
+ await queryRunner.query(`DROP INDEX "public"."IDX_bd2e348fa6430a75c00baf61bd"`);
18
+ await queryRunner.query(`DROP INDEX "public"."IDX_8e2f2f0d6123151948d3a0537a"`);
19
+ await queryRunner.query(`DROP TABLE "reports"`);
20
+ await queryRunner.query(`DROP TYPE "public"."reports_reason_enum"`);
21
+ }
22
+ }
23
+ exports.CreateReportsTable1776185839118 = CreateReportsTable1776185839118;
@@ -0,0 +1,7 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+ export declare class ModifiedReportsTable1776186501144 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=1776186501144-modified_reports_table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1776186501144-modified_reports_table.d.ts","sourceRoot":"","sources":["../../../src/database/migrations/1776186501144-modified_reports_table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,iCAAkC,YAAW,kBAAkB;IACxE,IAAI,SAAsC;IAE7B,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAO7D"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModifiedReportsTable1776186501144 = void 0;
4
+ class ModifiedReportsTable1776186501144 {
5
+ name = 'ModifiedReportsTable1776186501144';
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "reports" DROP CONSTRAINT "FK_b84fcce5b84191fc4b8e5d0d6f9"`);
8
+ await queryRunner.query(`DROP INDEX "public"."IDX_bd2e348fa6430a75c00baf61bd"`);
9
+ await queryRunner.query(`ALTER TABLE "reports" DROP COLUMN "post_id"`);
10
+ await queryRunner.query(`CREATE INDEX "IDX_8e068dcc117ab32d614b717a33" ON "reports" ("user_id", "reportable_id", "reportable_type") `);
11
+ }
12
+ async down(queryRunner) {
13
+ await queryRunner.query(`DROP INDEX "public"."IDX_8e068dcc117ab32d614b717a33"`);
14
+ await queryRunner.query(`ALTER TABLE "reports" ADD "post_id" integer NOT NULL`);
15
+ await queryRunner.query(`CREATE INDEX "IDX_bd2e348fa6430a75c00baf61bd" ON "reports" ("post_id", "user_id", "reportable_id", "reportable_type") `);
16
+ await queryRunner.query(`ALTER TABLE "reports" ADD CONSTRAINT "FK_b84fcce5b84191fc4b8e5d0d6f9" FOREIGN KEY ("post_id") REFERENCES "posts"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
17
+ }
18
+ }
19
+ exports.ModifiedReportsTable1776186501144 = ModifiedReportsTable1776186501144;
@@ -1,15 +1,12 @@
1
1
  import { BaseModel } from "./BaseModel";
2
- import { PostModel } from "./PostModel";
3
2
  import { UserModel } from "./UserModel";
4
3
  import { REPORT_REASONS } from "../common/enums";
5
- export declare class ReportPostModel extends BaseModel {
6
- post_id: number;
4
+ export declare class ReportModel extends BaseModel {
7
5
  user_id: number;
8
6
  comment: string;
9
7
  reportable_id: number;
10
8
  reason: REPORT_REASONS;
11
9
  reportable_type: string;
12
- post: PostModel;
13
10
  user: UserModel;
14
11
  }
15
12
  //# sourceMappingURL=ReportModel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReportModel.d.ts","sourceRoot":"","sources":["../../src/models/ReportModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAEa,eAAgB,SAAQ,SAAS;IAE1C,OAAO,EAAG,MAAM,CAAC;IAGjB,OAAO,EAAG,MAAM,CAAC;IAGjB,OAAO,EAAG,MAAM,CAAC;IAGjB,aAAa,EAAG,MAAM,CAAC;IAMvB,MAAM,EAAG,cAAc,CAAC;IAGxB,eAAe,EAAG,MAAM,CAAC;IAIzB,IAAI,EAAG,SAAS,CAAC;IAIjB,IAAI,EAAG,SAAS,CAAC;CACpB"}
1
+ {"version":3,"file":"ReportModel.d.ts","sourceRoot":"","sources":["../../src/models/ReportModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAEa,WAAY,SAAQ,SAAS;IAEtC,OAAO,EAAG,MAAM,CAAC;IAGjB,OAAO,EAAG,MAAM,CAAC;IAGjB,aAAa,EAAG,MAAM,CAAC;IAMvB,MAAM,EAAG,cAAc,CAAC;IAGxB,eAAe,EAAG,MAAM,CAAC;IAIzB,IAAI,EAAG,SAAS,CAAC;CACpB"}
@@ -9,61 +9,49 @@ 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
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ReportPostModel = void 0;
12
+ exports.ReportModel = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BaseModel_1 = require("./BaseModel");
15
- const PostModel_1 = require("./PostModel");
16
15
  const UserModel_1 = require("./UserModel");
17
16
  const enums_1 = require("../common/enums");
18
- let ReportPostModel = class ReportPostModel extends BaseModel_1.BaseModel {
19
- post_id;
17
+ let ReportModel = class ReportModel extends BaseModel_1.BaseModel {
20
18
  user_id;
21
19
  comment;
22
20
  reportable_id;
23
21
  reason;
24
22
  reportable_type;
25
- post;
26
23
  user;
27
24
  };
28
- exports.ReportPostModel = ReportPostModel;
25
+ exports.ReportModel = ReportModel;
29
26
  __decorate([
30
27
  (0, typeorm_1.Column)(),
31
28
  __metadata("design:type", Number)
32
- ], ReportPostModel.prototype, "post_id", void 0);
33
- __decorate([
34
- (0, typeorm_1.Column)(),
35
- __metadata("design:type", Number)
36
- ], ReportPostModel.prototype, "user_id", void 0);
29
+ ], ReportModel.prototype, "user_id", void 0);
37
30
  __decorate([
38
31
  (0, typeorm_1.Column)({ type: "text" }),
39
32
  __metadata("design:type", String)
40
- ], ReportPostModel.prototype, "comment", void 0);
33
+ ], ReportModel.prototype, "comment", void 0);
41
34
  __decorate([
42
35
  (0, typeorm_1.Column)(),
43
36
  __metadata("design:type", Number)
44
- ], ReportPostModel.prototype, "reportable_id", void 0);
37
+ ], ReportModel.prototype, "reportable_id", void 0);
45
38
  __decorate([
46
39
  (0, typeorm_1.Column)({
47
40
  type: "enum",
48
41
  enum: enums_1.REPORT_REASONS,
49
42
  }),
50
43
  __metadata("design:type", String)
51
- ], ReportPostModel.prototype, "reason", void 0);
44
+ ], ReportModel.prototype, "reason", void 0);
52
45
  __decorate([
53
46
  (0, typeorm_1.Column)(),
54
47
  __metadata("design:type", String)
55
- ], ReportPostModel.prototype, "reportable_type", void 0);
56
- __decorate([
57
- (0, typeorm_1.ManyToOne)(() => PostModel_1.PostModel, (post) => post.comments),
58
- (0, typeorm_1.JoinColumn)({ name: "post_id", referencedColumnName: "id" }),
59
- __metadata("design:type", PostModel_1.PostModel)
60
- ], ReportPostModel.prototype, "post", void 0);
48
+ ], ReportModel.prototype, "reportable_type", void 0);
61
49
  __decorate([
62
50
  (0, typeorm_1.ManyToOne)(() => UserModel_1.UserModel, (user) => user.events),
63
51
  (0, typeorm_1.JoinColumn)({ name: "user_id", referencedColumnName: "id" }),
64
52
  __metadata("design:type", UserModel_1.UserModel)
65
- ], ReportPostModel.prototype, "user", void 0);
66
- exports.ReportPostModel = ReportPostModel = __decorate([
53
+ ], ReportModel.prototype, "user", void 0);
54
+ exports.ReportModel = ReportModel = __decorate([
67
55
  (0, typeorm_1.Entity)({ name: "reports" }),
68
- (0, typeorm_1.Index)(['post_id', 'user_id', 'reportable_id', 'reportable_type'])
69
- ], ReportPostModel);
56
+ (0, typeorm_1.Index)(['user_id', 'reportable_id', 'reportable_type'])
57
+ ], ReportModel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurispec/core-backend",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "Auri spectrum's backend core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",