188 lines
7.6 KiB
JavaScript
188 lines
7.6 KiB
JavaScript
"use strict";
|
|
/**
|
|
* NonConformity Entity
|
|
* No conformidades detectadas en inspecciones
|
|
*
|
|
* @module Quality
|
|
* @table quality.non_conformities
|
|
*/
|
|
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.NonConformity = 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 inspection_entity_1 = require("./inspection.entity");
|
|
const corrective_action_entity_1 = require("./corrective-action.entity");
|
|
let NonConformity = class NonConformity {
|
|
id;
|
|
tenantId;
|
|
inspectionId;
|
|
loteId;
|
|
ncNumber;
|
|
detectionDate;
|
|
category;
|
|
severity;
|
|
description;
|
|
rootCause;
|
|
photoUrl;
|
|
contractorId;
|
|
status;
|
|
dueDate;
|
|
closedAt;
|
|
closedById;
|
|
verifiedAt;
|
|
verifiedById;
|
|
closurePhotoUrl;
|
|
closureNotes;
|
|
createdAt;
|
|
createdById;
|
|
updatedAt;
|
|
updatedById;
|
|
// Relations
|
|
tenant;
|
|
inspection;
|
|
createdBy;
|
|
closedBy;
|
|
verifiedBy;
|
|
correctiveActions;
|
|
};
|
|
exports.NonConformity = NonConformity;
|
|
__decorate([
|
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "tenantId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'inspection_id', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "inspectionId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'lote_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "loteId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'nc_number', type: 'varchar', length: 50 }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "ncNumber", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'detection_date', type: 'date' }),
|
|
__metadata("design:type", Date)
|
|
], NonConformity.prototype, "detectionDate", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 100 }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "category", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 20 }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "severity", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'text' }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "description", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'root_cause', type: 'text', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "rootCause", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'photo_url', type: 'varchar', length: 500, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "photoUrl", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'contractor_id', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "contractorId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'open' }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "status", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'due_date', type: 'date', nullable: true }),
|
|
__metadata("design:type", Date)
|
|
], NonConformity.prototype, "dueDate", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'closed_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Date)
|
|
], NonConformity.prototype, "closedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'closed_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "closedById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'verified_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Date)
|
|
], NonConformity.prototype, "verifiedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'verified_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "verifiedById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'closure_photo_url', type: 'varchar', length: 500, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "closurePhotoUrl", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'closure_notes', type: 'text', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "closureNotes", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], NonConformity.prototype, "createdAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.prototype, "createdById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], NonConformity.prototype, "updatedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], NonConformity.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)
|
|
], NonConformity.prototype, "tenant", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => inspection_entity_1.Inspection, (i) => i.nonConformities),
|
|
(0, typeorm_1.JoinColumn)({ name: 'inspection_id' }),
|
|
__metadata("design:type", inspection_entity_1.Inspection)
|
|
], NonConformity.prototype, "inspection", 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)
|
|
], NonConformity.prototype, "createdBy", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
|
|
(0, typeorm_1.JoinColumn)({ name: 'closed_by' }),
|
|
__metadata("design:type", user_entity_1.User)
|
|
], NonConformity.prototype, "closedBy", 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)
|
|
], NonConformity.prototype, "verifiedBy", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.OneToMany)(() => corrective_action_entity_1.CorrectiveAction, (ca) => ca.nonConformity),
|
|
__metadata("design:type", Array)
|
|
], NonConformity.prototype, "correctiveActions", void 0);
|
|
exports.NonConformity = NonConformity = __decorate([
|
|
(0, typeorm_1.Entity)({ schema: 'quality', name: 'non_conformities' }),
|
|
(0, typeorm_1.Index)(['tenantId', 'ncNumber'], { unique: true })
|
|
], NonConformity);
|
|
//# sourceMappingURL=non-conformity.entity.js.map
|