186 lines
7.5 KiB
JavaScript
186 lines
7.5 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Subcontractor Entity
|
|
* Catálogo de subcontratistas
|
|
*
|
|
* @module Contracts
|
|
* @table contracts.subcontractors
|
|
*/
|
|
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.Subcontractor = 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");
|
|
let Subcontractor = class Subcontractor {
|
|
id;
|
|
tenantId;
|
|
code;
|
|
businessName;
|
|
tradeName;
|
|
rfc;
|
|
address;
|
|
phone;
|
|
email;
|
|
contactName;
|
|
contactPhone;
|
|
primarySpecialty;
|
|
secondarySpecialties;
|
|
status;
|
|
// Performance tracking
|
|
totalContracts;
|
|
completedContracts;
|
|
averageRating;
|
|
totalIncidents;
|
|
// Financial info
|
|
bankName;
|
|
bankAccount;
|
|
clabe;
|
|
notes;
|
|
createdAt;
|
|
createdById;
|
|
updatedAt;
|
|
updatedById;
|
|
deletedAt;
|
|
deletedById;
|
|
// Relations
|
|
tenant;
|
|
createdBy;
|
|
};
|
|
exports.Subcontractor = Subcontractor;
|
|
__decorate([
|
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "tenantId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "code", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'business_name', type: 'varchar', length: 255 }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "businessName", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'trade_name', type: 'varchar', length: 255, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "tradeName", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 13 }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "rfc", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "address", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 20, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "phone", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "email", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'contact_name', type: 'varchar', length: 200, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "contactName", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'contact_phone', type: 'varchar', length: 20, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "contactPhone", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'primary_specialty', type: 'varchar', length: 50 }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "primarySpecialty", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'secondary_specialties', type: 'simple-array', nullable: true }),
|
|
__metadata("design:type", Array)
|
|
], Subcontractor.prototype, "secondarySpecialties", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'active' }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "status", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'total_contracts', type: 'integer', default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], Subcontractor.prototype, "totalContracts", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'completed_contracts', type: 'integer', default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], Subcontractor.prototype, "completedContracts", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'average_rating', type: 'decimal', precision: 3, scale: 2, default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], Subcontractor.prototype, "averageRating", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'total_incidents', type: 'integer', default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], Subcontractor.prototype, "totalIncidents", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'bank_name', type: 'varchar', length: 100, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "bankName", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'bank_account', type: 'varchar', length: 30, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "bankAccount", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'varchar', length: 18, nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "clabe", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "notes", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], Subcontractor.prototype, "createdAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "createdById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], Subcontractor.prototype, "updatedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.prototype, "updatedById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Date)
|
|
], Subcontractor.prototype, "deletedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", String)
|
|
], Subcontractor.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)
|
|
], Subcontractor.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)
|
|
], Subcontractor.prototype, "createdBy", void 0);
|
|
exports.Subcontractor = Subcontractor = __decorate([
|
|
(0, typeorm_1.Entity)({ schema: 'contracts', name: 'subcontractors' }),
|
|
(0, typeorm_1.Index)(['tenantId', 'code'], { unique: true }),
|
|
(0, typeorm_1.Index)(['tenantId', 'rfc'], { unique: true })
|
|
], Subcontractor);
|
|
//# sourceMappingURL=subcontractor.entity.js.map
|