147 lines
6.2 KiB
JavaScript
147 lines
6.2 KiB
JavaScript
"use strict";
|
|
/**
|
|
* CorrectiveAction Entity
|
|
* Acciones correctivas (CAPA)
|
|
*
|
|
* @module Quality
|
|
* @table quality.corrective_actions
|
|
*/
|
|
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.CorrectiveAction = 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 non_conformity_entity_1 = require("./non-conformity.entity");
|
|
let CorrectiveAction = class CorrectiveAction {
|
|
id;
|
|
tenantId;
|
|
nonConformityId;
|
|
actionType;
|
|
description;
|
|
responsibleId;
|
|
dueDate;
|
|
status;
|
|
completedAt;
|
|
completionNotes;
|
|
verifiedAt;
|
|
verifiedById;
|
|
effectivenessVerified;
|
|
createdAt;
|
|
createdById;
|
|
updatedAt;
|
|
updatedById;
|
|
// Relations
|
|
tenant;
|
|
nonConformity;
|
|
responsible;
|
|
createdBy;
|
|
verifiedBy;
|
|
};
|
|
exports.CorrectiveAction = CorrectiveAction;
|
|
__decorate([
|
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "tenantId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'non_conformity_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "nonConformityId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'action_type', type: 'varchar', length: 20 }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "actionType", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'text' }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "description", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'responsible_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "responsibleId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'due_date', type: 'date' }),
|
|
__metadata("design:type", Date)
|
|
], CorrectiveAction.prototype, "dueDate", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'pending' }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "status", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'completed_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Date)
|
|
], CorrectiveAction.prototype, "completedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'completion_notes', type: 'text', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "completionNotes", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'verified_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Date)
|
|
], CorrectiveAction.prototype, "verifiedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'verified_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "verifiedById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'effectiveness_verified', type: 'boolean', default: false }),
|
|
__metadata("design:type", Boolean)
|
|
], CorrectiveAction.prototype, "effectivenessVerified", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], CorrectiveAction.prototype, "createdAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "createdById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], CorrectiveAction.prototype, "updatedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], CorrectiveAction.prototype, "updatedById", 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)
|
|
], CorrectiveAction.prototype, "tenant", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => non_conformity_entity_1.NonConformity, (nc) => nc.correctiveActions, { onDelete: 'CASCADE' }),
|
|
(0, typeorm_1.JoinColumn)({ name: 'non_conformity_id' }),
|
|
__metadata("design:type", non_conformity_entity_1.NonConformity)
|
|
], CorrectiveAction.prototype, "nonConformity", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
|
|
(0, typeorm_1.JoinColumn)({ name: 'responsible_id' }),
|
|
__metadata("design:type", user_entity_1.User)
|
|
], CorrectiveAction.prototype, "responsible", 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)
|
|
], CorrectiveAction.prototype, "createdBy", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
|
|
(0, typeorm_1.JoinColumn)({ name: 'verified_by' }),
|
|
__metadata("design:type", user_entity_1.User)
|
|
], CorrectiveAction.prototype, "verifiedBy", void 0);
|
|
exports.CorrectiveAction = CorrectiveAction = __decorate([
|
|
(0, typeorm_1.Entity)({ schema: 'quality', name: 'corrective_actions' }),
|
|
(0, typeorm_1.Index)(['tenantId', 'nonConformityId'])
|
|
], CorrectiveAction);
|
|
//# sourceMappingURL=corrective-action.entity.js.map
|