@platform-modules/foreign-ministry 1.0.36 → 1.0.38
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/data-source.js +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/PostReactionsModel.d.ts +12 -0
- package/dist/models/PostReactionsModel.js +56 -0
- package/package.json +1 -1
- package/src/data-source.ts +3 -1
- package/src/index.ts +1 -0
- package/src/models/PostReactionsModel.ts +37 -0
package/dist/data-source.js
CHANGED
|
@@ -37,6 +37,7 @@ const CategoriesModel_1 = require("./models/CategoriesModel");
|
|
|
37
37
|
const PostsModel_1 = require("./models/PostsModel");
|
|
38
38
|
const CommentsModel_1 = require("./models/CommentsModel");
|
|
39
39
|
const PostAttachmentsModel_1 = require("./models/PostAttachmentsModel");
|
|
40
|
+
const PostReactionsModel_1 = require("./models/PostReactionsModel");
|
|
40
41
|
exports.AppDataSource = new typeorm_1.DataSource({
|
|
41
42
|
type: 'postgres',
|
|
42
43
|
host: process.env.DB_HOST || 'localhost',
|
|
@@ -78,6 +79,7 @@ exports.AppDataSource = new typeorm_1.DataSource({
|
|
|
78
79
|
CategoriesModel_1.Categories,
|
|
79
80
|
PostsModel_1.Posts,
|
|
80
81
|
CommentsModel_1.Comments,
|
|
81
|
-
PostAttachmentsModel_1.PostAttachments
|
|
82
|
+
PostAttachmentsModel_1.PostAttachments,
|
|
83
|
+
PostReactionsModel_1.PostReactions
|
|
82
84
|
],
|
|
83
85
|
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -46,3 +46,4 @@ __exportStar(require("./models/CategoriesModel"), exports);
|
|
|
46
46
|
__exportStar(require("./models/PostsModel"), exports);
|
|
47
47
|
__exportStar(require("./models/CommentsModel"), exports);
|
|
48
48
|
__exportStar(require("./models/PostAttachmentsModel"), exports);
|
|
49
|
+
__exportStar(require("./models/PostReactionsModel"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseModel } from './BaseModel';
|
|
2
|
+
import { Posts } from './PostsModel';
|
|
3
|
+
import { User } from './user';
|
|
4
|
+
export declare class PostReactions extends BaseModel {
|
|
5
|
+
post_id: number;
|
|
6
|
+
user_id: number;
|
|
7
|
+
reaction_type: string;
|
|
8
|
+
created_at: Date;
|
|
9
|
+
post?: Posts;
|
|
10
|
+
user?: User;
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PostReactions = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const BaseModel_1 = require("./BaseModel");
|
|
15
|
+
const PostsModel_1 = require("./PostsModel");
|
|
16
|
+
const user_1 = require("./user");
|
|
17
|
+
let PostReactions = class PostReactions extends BaseModel_1.BaseModel {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.post_id = 0;
|
|
21
|
+
this.user_id = 0;
|
|
22
|
+
this.reaction_type = '';
|
|
23
|
+
this.created_at = new Date();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.PostReactions = PostReactions;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], PostReactions.prototype, "post_id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], PostReactions.prototype, "user_id", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: false }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], PostReactions.prototype, "reaction_type", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
|
|
41
|
+
__metadata("design:type", Date)
|
|
42
|
+
], PostReactions.prototype, "created_at", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.ManyToOne)(() => PostsModel_1.Posts, post => post.id),
|
|
45
|
+
(0, typeorm_1.JoinColumn)({ name: 'post_id' }),
|
|
46
|
+
__metadata("design:type", PostsModel_1.Posts)
|
|
47
|
+
], PostReactions.prototype, "post", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.ManyToOne)(() => user_1.User, user => user.id),
|
|
50
|
+
(0, typeorm_1.JoinColumn)({ name: 'user_id' }),
|
|
51
|
+
__metadata("design:type", user_1.User)
|
|
52
|
+
], PostReactions.prototype, "user", void 0);
|
|
53
|
+
exports.PostReactions = PostReactions = __decorate([
|
|
54
|
+
(0, typeorm_1.Entity)({ name: 'post_reactions' }),
|
|
55
|
+
__metadata("design:paramtypes", [])
|
|
56
|
+
], PostReactions);
|
package/package.json
CHANGED
package/src/data-source.ts
CHANGED
|
@@ -36,6 +36,7 @@ import { Categories } from './models/CategoriesModel';
|
|
|
36
36
|
import { Posts } from './models/PostsModel';
|
|
37
37
|
import { Comments } from './models/CommentsModel';
|
|
38
38
|
import { PostAttachments } from './models/PostAttachmentsModel';
|
|
39
|
+
import { PostReactions } from './models/PostReactionsModel';
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
|
|
@@ -81,6 +82,7 @@ export const AppDataSource = new DataSource({
|
|
|
81
82
|
Categories,
|
|
82
83
|
Posts,
|
|
83
84
|
Comments,
|
|
84
|
-
PostAttachments
|
|
85
|
+
PostAttachments,
|
|
86
|
+
PostReactions
|
|
85
87
|
],
|
|
86
88
|
});
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
import { Posts } from './PostsModel';
|
|
4
|
+
import { User } from './user';
|
|
5
|
+
|
|
6
|
+
@Entity({ name: 'post_reactions' })
|
|
7
|
+
export class PostReactions extends BaseModel {
|
|
8
|
+
|
|
9
|
+
@Column({ type: 'int', nullable: false })
|
|
10
|
+
post_id: number;
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: false })
|
|
13
|
+
user_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', length: 50, nullable: false })
|
|
16
|
+
reaction_type: string;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
|
19
|
+
created_at: Date;
|
|
20
|
+
|
|
21
|
+
// Relations
|
|
22
|
+
@ManyToOne(() => Posts, post => post.id)
|
|
23
|
+
@JoinColumn({ name: 'post_id' })
|
|
24
|
+
post?: Posts;
|
|
25
|
+
|
|
26
|
+
@ManyToOne(() => User, user => user.id)
|
|
27
|
+
@JoinColumn({ name: 'user_id' })
|
|
28
|
+
user?: User;
|
|
29
|
+
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.post_id = 0;
|
|
33
|
+
this.user_id = 0;
|
|
34
|
+
this.reaction_type = '';
|
|
35
|
+
this.created_at = new Date();
|
|
36
|
+
}
|
|
37
|
+
}
|