erp-construccion-backend/dist/modules/quality/entities/checklist.entity.js

130 lines
5.1 KiB
JavaScript

"use strict";
/**
* Checklist Entity
* Templates de inspección de calidad
*
* @module Quality
* @table quality.checklists
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Checklist = void 0;
const typeorm_1 = require("typeorm");
const tenant_entity_1 = require("../../core/entities/tenant.entity");
const user_entity_1 = require("../../core/entities/user.entity");
const checklist_item_entity_1 = require("./checklist-item.entity");
const inspection_entity_1 = require("./inspection.entity");
let Checklist = class Checklist {
id;
tenantId;
code;
name;
description;
stage;
prototypeId;
isActive;
version;
createdAt;
createdById;
updatedAt;
updatedById;
deletedAt;
deletedById;
// Relations
tenant;
createdBy;
items;
inspections;
};
exports.Checklist = Checklist;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Checklist.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], Checklist.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
__metadata("design:type", String)
], Checklist.prototype, "code", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
__metadata("design:type", String)
], Checklist.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Checklist.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
__metadata("design:type", String)
], Checklist.prototype, "stage", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'prototype_id', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Checklist.prototype, "prototypeId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_active', type: 'boolean', default: true }),
__metadata("design:type", Boolean)
], Checklist.prototype, "isActive", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
__metadata("design:type", Number)
], Checklist.prototype, "version", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Checklist.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Checklist.prototype, "createdById", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Checklist.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Checklist.prototype, "updatedById", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], Checklist.prototype, "deletedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Checklist.prototype, "deletedById", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => tenant_entity_1.Tenant),
(0, typeorm_1.JoinColumn)({ name: 'tenant_id' }),
__metadata("design:type", tenant_entity_1.Tenant)
], Checklist.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'created_by' }),
__metadata("design:type", user_entity_1.User)
], Checklist.prototype, "createdBy", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => checklist_item_entity_1.ChecklistItem, (item) => item.checklist),
__metadata("design:type", Array)
], Checklist.prototype, "items", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => inspection_entity_1.Inspection, (insp) => insp.checklist),
__metadata("design:type", Array)
], Checklist.prototype, "inspections", void 0);
exports.Checklist = Checklist = __decorate([
(0, typeorm_1.Entity)({ schema: 'quality', name: 'checklists' }),
(0, typeorm_1.Index)(['tenantId', 'code'], { unique: true })
], Checklist);
//# sourceMappingURL=checklist.entity.js.map