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

100 lines
4.3 KiB
JavaScript

"use strict";
/**
* InspectionResult Entity
* Resultados por item de inspección
*
* @module Quality
* @table quality.inspection_results
*/
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.InspectionResult = void 0;
const typeorm_1 = require("typeorm");
const tenant_entity_1 = require("../../core/entities/tenant.entity");
const inspection_entity_1 = require("./inspection.entity");
const checklist_item_entity_1 = require("./checklist-item.entity");
let InspectionResult = class InspectionResult {
id;
tenantId;
inspectionId;
checklistItemId;
result;
observations;
photoUrl;
inspectedAt;
createdAt;
updatedAt;
// Relations
tenant;
inspection;
checklistItem;
};
exports.InspectionResult = InspectionResult;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], InspectionResult.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], InspectionResult.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'inspection_id', type: 'uuid' }),
__metadata("design:type", String)
], InspectionResult.prototype, "inspectionId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'checklist_item_id', type: 'uuid' }),
__metadata("design:type", String)
], InspectionResult.prototype, "checklistItemId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'pending' }),
__metadata("design:type", String)
], InspectionResult.prototype, "result", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], InspectionResult.prototype, "observations", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'photo_url', type: 'varchar', length: 500, nullable: true }),
__metadata("design:type", String)
], InspectionResult.prototype, "photoUrl", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'inspected_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], InspectionResult.prototype, "inspectedAt", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], InspectionResult.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], InspectionResult.prototype, "updatedAt", 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)
], InspectionResult.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => inspection_entity_1.Inspection, (i) => i.results, { onDelete: 'CASCADE' }),
(0, typeorm_1.JoinColumn)({ name: 'inspection_id' }),
__metadata("design:type", inspection_entity_1.Inspection)
], InspectionResult.prototype, "inspection", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => checklist_item_entity_1.ChecklistItem),
(0, typeorm_1.JoinColumn)({ name: 'checklist_item_id' }),
__metadata("design:type", checklist_item_entity_1.ChecklistItem)
], InspectionResult.prototype, "checklistItem", void 0);
exports.InspectionResult = InspectionResult = __decorate([
(0, typeorm_1.Entity)({ schema: 'quality', name: 'inspection_results' }),
(0, typeorm_1.Index)(['tenantId', 'inspectionId', 'checklistItemId'], { unique: true })
], InspectionResult);
//# sourceMappingURL=inspection-result.entity.js.map