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

136 lines
5.7 KiB
JavaScript

"use strict";
/**
* TicketAssignment Entity
* Asignaciones de tickets a técnicos
*
* @module Quality
* @table quality.ticket_assignments
*/
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.TicketAssignment = 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 post_sale_ticket_entity_1 = require("./post-sale-ticket.entity");
let TicketAssignment = class TicketAssignment {
id;
tenantId;
ticketId;
technicianId;
assignedAt;
assignedById;
status;
acceptedAt;
scheduledDate;
scheduledTime;
completedAt;
workNotes;
reassignmentReason;
isCurrent;
createdAt;
updatedAt;
// Relations
tenant;
ticket;
technician;
assignedBy;
};
exports.TicketAssignment = TicketAssignment;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], TicketAssignment.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], TicketAssignment.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'ticket_id', type: 'uuid' }),
__metadata("design:type", String)
], TicketAssignment.prototype, "ticketId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'technician_id', type: 'uuid' }),
__metadata("design:type", String)
], TicketAssignment.prototype, "technicianId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'assigned_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], TicketAssignment.prototype, "assignedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'assigned_by', type: 'uuid' }),
__metadata("design:type", String)
], TicketAssignment.prototype, "assignedById", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'assigned' }),
__metadata("design:type", String)
], TicketAssignment.prototype, "status", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'accepted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], TicketAssignment.prototype, "acceptedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'scheduled_date', type: 'date', nullable: true }),
__metadata("design:type", Date)
], TicketAssignment.prototype, "scheduledDate", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'scheduled_time', type: 'time', nullable: true }),
__metadata("design:type", String)
], TicketAssignment.prototype, "scheduledTime", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'completed_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], TicketAssignment.prototype, "completedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'work_notes', type: 'text', nullable: true }),
__metadata("design:type", String)
], TicketAssignment.prototype, "workNotes", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'reassignment_reason', type: 'text', nullable: true }),
__metadata("design:type", String)
], TicketAssignment.prototype, "reassignmentReason", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_current', type: 'boolean', default: true }),
__metadata("design:type", Boolean)
], TicketAssignment.prototype, "isCurrent", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], TicketAssignment.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], TicketAssignment.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)
], TicketAssignment.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => post_sale_ticket_entity_1.PostSaleTicket, (t) => t.assignments, { onDelete: 'CASCADE' }),
(0, typeorm_1.JoinColumn)({ name: 'ticket_id' }),
__metadata("design:type", post_sale_ticket_entity_1.PostSaleTicket)
], TicketAssignment.prototype, "ticket", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'technician_id' }),
__metadata("design:type", user_entity_1.User)
], TicketAssignment.prototype, "technician", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'assigned_by' }),
__metadata("design:type", user_entity_1.User)
], TicketAssignment.prototype, "assignedBy", void 0);
exports.TicketAssignment = TicketAssignment = __decorate([
(0, typeorm_1.Entity)({ schema: 'quality', name: 'ticket_assignments' }),
(0, typeorm_1.Index)(['tenantId', 'ticketId', 'technicianId'])
], TicketAssignment);
//# sourceMappingURL=ticket-assignment.entity.js.map