json-api-nestjs
Version:
JsonApi Plugin for NestJs
72 lines • 2.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Comments = exports.CommentKind = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@mikro-orm/core");
var CommentKind;
(function (CommentKind) {
CommentKind["Comment"] = "COMMENT";
CommentKind["Message"] = "MESSAGE";
CommentKind["Note"] = "NOTE";
})(CommentKind || (exports.CommentKind = CommentKind = {}));
const _1 = require(".");
let Comments = class Comments {
id;
text;
kind;
createdAt = new Date();
updatedAt = new Date();
createdBy;
};
exports.Comments = Comments;
tslib_1.__decorate([
(0, core_1.PrimaryKey)({
autoincrement: true,
}),
tslib_1.__metadata("design:type", Number)
], Comments.prototype, "id", void 0);
tslib_1.__decorate([
(0, core_1.Property)({
columnType: 'text',
}),
tslib_1.__metadata("design:type", String)
], Comments.prototype, "text", void 0);
tslib_1.__decorate([
(0, core_1.Enum)({ items: () => CommentKind, nativeEnumName: 'comment_kind_enum' }),
tslib_1.__metadata("design:type", String)
], Comments.prototype, "kind", void 0);
tslib_1.__decorate([
(0, core_1.Property)({
length: 0,
name: 'created_at',
nullable: true,
defaultRaw: 'CURRENT_TIMESTAMP(0)',
columnType: 'timestamp(0) without time zone',
}),
tslib_1.__metadata("design:type", Date)
], Comments.prototype, "createdAt", void 0);
tslib_1.__decorate([
(0, core_1.Property)({
length: 0,
onUpdate: () => new Date(),
name: 'updated_at',
nullable: true,
columnType: 'timestamp(0) without time zone',
defaultRaw: 'CURRENT_TIMESTAMP(0)',
}),
tslib_1.__metadata("design:type", Date)
], Comments.prototype, "updatedAt", void 0);
tslib_1.__decorate([
(0, core_1.ManyToOne)(() => _1.Users, {
// #TODO need add chaeck for nullable relation to zod
nullable: true,
fieldName: 'created_by',
}),
tslib_1.__metadata("design:type", Object)
], Comments.prototype, "createdBy", void 0);
exports.Comments = Comments = tslib_1.__decorate([
(0, core_1.Entity)({
tableName: 'comments',
})
], Comments);
//# sourceMappingURL=comments.js.map