proflores-db-model 0.2.32 → 0.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/apu/Apu.d.ts +14 -0
- package/dist/models/apu/Apu.js +62 -0
- package/dist/models/apu/ApuItem.d.ts +12 -0
- package/dist/models/apu/ApuItem.js +55 -0
- package/dist/models/apu/Budget.d.ts +15 -0
- package/dist/models/apu/Budget.js +64 -0
- package/dist/models/apu/BudgetItem.d.ts +14 -0
- package/dist/models/apu/BudgetItem.js +59 -0
- package/dist/models/apu/Client.d.ts +15 -0
- package/dist/models/apu/Client.js +68 -0
- package/dist/models/apu/Company.d.ts +16 -0
- package/dist/models/apu/Company.js +72 -0
- package/dist/models/apu/Concept.d.ts +15 -0
- package/dist/models/apu/Concept.js +61 -0
- package/dist/models/apu/PriceList.d.ts +12 -0
- package/dist/models/apu/PriceList.js +54 -0
- package/dist/models/apu/Project.d.ts +19 -0
- package/dist/models/apu/Project.js +82 -0
- package/dist/models/apu/Resource.d.ts +16 -0
- package/dist/models/apu/Resource.js +66 -0
- package/dist/models/apu/ResourcePrice.d.ts +13 -0
- package/dist/models/apu/ResourcePrice.js +56 -0
- package/dist/models/apu/budget-snapshot.entity.d.ts +14 -0
- package/dist/models/apu/budget-snapshot.entity.js +67 -0
- package/dist/models/apu/enums/resource-type.enum.d.ts +9 -0
- package/dist/models/apu/enums/resource-type.enum.js +13 -0
- package/dist/models/apu/index.d.ts +13 -0
- package/dist/models/apu/index.js +29 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/models/apu/Apu.ts +40 -0
- package/src/models/apu/ApuItem.ts +35 -0
- package/src/models/apu/Budget.ts +41 -0
- package/src/models/apu/BudgetItem.ts +38 -0
- package/src/models/apu/Client.ts +41 -0
- package/src/models/apu/Company.ts +44 -0
- package/src/models/apu/Concept.ts +39 -0
- package/src/models/apu/PriceList.ts +34 -0
- package/src/models/apu/Project.ts +55 -0
- package/src/models/apu/Resource.ts +44 -0
- package/src/models/apu/ResourcePrice.ts +35 -0
- package/src/models/apu/budget-snapshot.entity.ts +41 -0
- package/src/models/apu/enums/resource-type.enum.ts +9 -0
- package/src/models/apu/index.ts +13 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Project = void 0;
|
|
13
|
+
// apu/entities/Project.ts
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const Company_1 = require("./Company");
|
|
16
|
+
const Client_1 = require("./Client");
|
|
17
|
+
let Project = class Project {
|
|
18
|
+
};
|
|
19
|
+
exports.Project = Project;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], Project.prototype, "idProject", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => Company_1.Company, { nullable: false, onDelete: "RESTRICT" }),
|
|
26
|
+
(0, typeorm_1.JoinColumn)({ name: "idCompany" }),
|
|
27
|
+
__metadata("design:type", Company_1.Company)
|
|
28
|
+
], Project.prototype, "company", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(() => Client_1.Client, { nullable: true, onDelete: "SET NULL" }),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "idClient" }),
|
|
32
|
+
__metadata("design:type", Object)
|
|
33
|
+
], Project.prototype, "client", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true, unique: true }),
|
|
36
|
+
__metadata("design:type", Object)
|
|
37
|
+
], Project.prototype, "code", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)("varchar", { length: 255 }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], Project.prototype, "name", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], Project.prototype, "description", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], Project.prototype, "siteAddress", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)("varchar", { length: 128, nullable: true }),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], Project.prototype, "city", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)("varchar", { length: 128, nullable: true }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], Project.prototype, "state", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)("varchar", { length: 128, nullable: true }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], Project.prototype, "country", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)("varchar", { length: 16, nullable: true }),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], Project.prototype, "postalCode", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true }),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], Project.prototype, "region", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)("date", { nullable: true }),
|
|
72
|
+
__metadata("design:type", Object)
|
|
73
|
+
], Project.prototype, "startDate", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)("date", { nullable: true }),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], Project.prototype, "endDate", void 0);
|
|
78
|
+
exports.Project = Project = __decorate([
|
|
79
|
+
(0, typeorm_1.Entity)("projects"),
|
|
80
|
+
(0, typeorm_1.Index)(["company"]),
|
|
81
|
+
(0, typeorm_1.Index)(["client"])
|
|
82
|
+
], Project);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { ResourceType } from "./enums/resource-type.enum";
|
|
3
|
+
import { UnitOfMeasure } from "../../entities/UnitOfMesure";
|
|
4
|
+
import { ResourcePrice } from "./ResourcePrice";
|
|
5
|
+
import { ApuItem } from "./ApuItem";
|
|
6
|
+
export declare class Resource implements ObjectLiteral {
|
|
7
|
+
idResource: number;
|
|
8
|
+
code?: string | null;
|
|
9
|
+
name: string;
|
|
10
|
+
type: ResourceType;
|
|
11
|
+
unit: UnitOfMeasure;
|
|
12
|
+
satClave?: string | null;
|
|
13
|
+
notes?: string | null;
|
|
14
|
+
prices?: ResourcePrice[];
|
|
15
|
+
apuItems?: ApuItem[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Resource = void 0;
|
|
13
|
+
// apu/entities/Resource.ts
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const resource_type_enum_1 = require("./enums/resource-type.enum");
|
|
16
|
+
const UnitOfMesure_1 = require("../../entities/UnitOfMesure");
|
|
17
|
+
const ResourcePrice_1 = require("./ResourcePrice");
|
|
18
|
+
const ApuItem_1 = require("./ApuItem");
|
|
19
|
+
let Resource = class Resource {
|
|
20
|
+
};
|
|
21
|
+
exports.Resource = Resource;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], Resource.prototype, "idResource", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true, unique: true }),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], Resource.prototype, "code", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)("varchar", { length: 255 }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], Resource.prototype, "name", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({
|
|
36
|
+
type: "enum",
|
|
37
|
+
enum: resource_type_enum_1.ResourceType,
|
|
38
|
+
enumName: "resource_type",
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], Resource.prototype, "type", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure, { nullable: false }),
|
|
44
|
+
(0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
|
|
45
|
+
__metadata("design:type", UnitOfMesure_1.UnitOfMeasure)
|
|
46
|
+
], Resource.prototype, "unit", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], Resource.prototype, "satClave", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], Resource.prototype, "notes", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.OneToMany)(() => ResourcePrice_1.ResourcePrice, (rp) => rp.resource),
|
|
57
|
+
__metadata("design:type", Array)
|
|
58
|
+
], Resource.prototype, "prices", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.OneToMany)(() => ApuItem_1.ApuItem, (ai) => ai.resource),
|
|
61
|
+
__metadata("design:type", Array)
|
|
62
|
+
], Resource.prototype, "apuItems", void 0);
|
|
63
|
+
exports.Resource = Resource = __decorate([
|
|
64
|
+
(0, typeorm_1.Entity)("resources"),
|
|
65
|
+
(0, typeorm_1.Index)(["type"])
|
|
66
|
+
], Resource);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Resource } from "./Resource";
|
|
3
|
+
import { PriceList } from "./PriceList";
|
|
4
|
+
import { Supplier } from "../../entities/Suppliers";
|
|
5
|
+
export declare class ResourcePrice implements ObjectLiteral {
|
|
6
|
+
idResourcePrice: number;
|
|
7
|
+
resource: Resource;
|
|
8
|
+
priceList: PriceList;
|
|
9
|
+
supplier?: Supplier | null;
|
|
10
|
+
unitCost: number;
|
|
11
|
+
effectiveFrom: string;
|
|
12
|
+
effectiveTo?: string | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ResourcePrice = void 0;
|
|
13
|
+
// apu/entities/ResourcePrice.ts
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const Resource_1 = require("./Resource");
|
|
16
|
+
const PriceList_1 = require("./PriceList");
|
|
17
|
+
const Suppliers_1 = require("../../entities/Suppliers");
|
|
18
|
+
let ResourcePrice = class ResourcePrice {
|
|
19
|
+
};
|
|
20
|
+
exports.ResourcePrice = ResourcePrice;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], ResourcePrice.prototype, "idResourcePrice", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.ManyToOne)(() => Resource_1.Resource, { nullable: false, onDelete: "CASCADE" }),
|
|
27
|
+
(0, typeorm_1.JoinColumn)({ name: "idResource" }),
|
|
28
|
+
__metadata("design:type", Resource_1.Resource)
|
|
29
|
+
], ResourcePrice.prototype, "resource", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.ManyToOne)(() => PriceList_1.PriceList, { nullable: false, onDelete: "CASCADE" }),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "idPriceList" }),
|
|
33
|
+
__metadata("design:type", PriceList_1.PriceList)
|
|
34
|
+
], ResourcePrice.prototype, "priceList", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier, { nullable: true }),
|
|
37
|
+
(0, typeorm_1.JoinColumn)({ name: "idSupplier" }),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], ResourcePrice.prototype, "supplier", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 4 }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], ResourcePrice.prototype, "unitCost", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)("date"),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], ResourcePrice.prototype, "effectiveFrom", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)("date", { nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], ResourcePrice.prototype, "effectiveTo", void 0);
|
|
52
|
+
exports.ResourcePrice = ResourcePrice = __decorate([
|
|
53
|
+
(0, typeorm_1.Entity)("resource_prices"),
|
|
54
|
+
(0, typeorm_1.Unique)("uq_resource_price_effective", ["resource", "priceList", "effectiveFrom"]),
|
|
55
|
+
(0, typeorm_1.Index)(["resource", "priceList", "effectiveFrom"])
|
|
56
|
+
], ResourcePrice);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Budget } from '../apu';
|
|
2
|
+
export declare class BudgetSnapshot {
|
|
3
|
+
idSnapshot: number;
|
|
4
|
+
idBudget: number;
|
|
5
|
+
budget: Budget;
|
|
6
|
+
payload: Record<string, any>;
|
|
7
|
+
pdfHash?: string | null;
|
|
8
|
+
idPriceList?: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
total: number;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
generatedBy?: string;
|
|
13
|
+
notes?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BudgetSnapshot = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const apu_1 = require("../apu");
|
|
15
|
+
let BudgetSnapshot = class BudgetSnapshot {
|
|
16
|
+
};
|
|
17
|
+
exports.BudgetSnapshot = BudgetSnapshot;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], BudgetSnapshot.prototype, "idSnapshot", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.Column)(),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], BudgetSnapshot.prototype, "idBudget", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => apu_1.Budget, { onDelete: 'CASCADE' }),
|
|
28
|
+
(0, typeorm_1.JoinColumn)({ name: 'idBudget' }),
|
|
29
|
+
__metadata("design:type", apu_1.Budget)
|
|
30
|
+
], BudgetSnapshot.prototype, "budget", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ type: 'jsonb' }),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], BudgetSnapshot.prototype, "payload", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ nullable: true, length: 64 }),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], BudgetSnapshot.prototype, "pdfHash", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], BudgetSnapshot.prototype, "idPriceList", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 10, default: 'MXN' }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], BudgetSnapshot.prototype, "currency", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ type: 'decimal', precision: 20, scale: 4 }),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], BudgetSnapshot.prototype, "total", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
53
|
+
__metadata("design:type", Date)
|
|
54
|
+
], BudgetSnapshot.prototype, "createdAt", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], BudgetSnapshot.prototype, "generatedBy", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], BudgetSnapshot.prototype, "notes", void 0);
|
|
63
|
+
exports.BudgetSnapshot = BudgetSnapshot = __decorate([
|
|
64
|
+
(0, typeorm_1.Entity)('budget_snapshots'),
|
|
65
|
+
(0, typeorm_1.Index)(['idBudget', 'createdAt']),
|
|
66
|
+
(0, typeorm_1.Index)(['pdfHash'])
|
|
67
|
+
], BudgetSnapshot);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceType = void 0;
|
|
4
|
+
var ResourceType;
|
|
5
|
+
(function (ResourceType) {
|
|
6
|
+
ResourceType["MATERIAL"] = "MATERIAL";
|
|
7
|
+
ResourceType["LABOR"] = "LABOR";
|
|
8
|
+
ResourceType["EQUIPMENT"] = "EQUIPMENT";
|
|
9
|
+
ResourceType["TRANSPORT"] = "TRANSPORT";
|
|
10
|
+
ResourceType["TOOL"] = "TOOL";
|
|
11
|
+
ResourceType["SUBCONTRACT"] = "SUBCONTRACT";
|
|
12
|
+
ResourceType["OTHER"] = "OTHER";
|
|
13
|
+
})(ResourceType || (exports.ResourceType = ResourceType = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { Apu } from './Apu';
|
|
2
|
+
export { ApuItem } from './ApuItem';
|
|
3
|
+
export { Budget } from './Budget';
|
|
4
|
+
export { BudgetItem } from './BudgetItem';
|
|
5
|
+
export { Client } from './Client';
|
|
6
|
+
export { Company } from './Company';
|
|
7
|
+
export { Concept } from './Concept';
|
|
8
|
+
export { PriceList } from './PriceList';
|
|
9
|
+
export { Project } from './Project';
|
|
10
|
+
export { Resource } from './Resource';
|
|
11
|
+
export { ResourcePrice } from './ResourcePrice';
|
|
12
|
+
export { ResourceType } from './enums/resource-type.enum';
|
|
13
|
+
export { BudgetSnapshot } from './budget-snapshot.entity';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BudgetSnapshot = exports.ResourceType = exports.ResourcePrice = exports.Resource = exports.Project = exports.PriceList = exports.Concept = exports.Company = exports.Client = exports.BudgetItem = exports.Budget = exports.ApuItem = exports.Apu = void 0;
|
|
4
|
+
var Apu_1 = require("./Apu"); //
|
|
5
|
+
Object.defineProperty(exports, "Apu", { enumerable: true, get: function () { return Apu_1.Apu; } });
|
|
6
|
+
var ApuItem_1 = require("./ApuItem"); //
|
|
7
|
+
Object.defineProperty(exports, "ApuItem", { enumerable: true, get: function () { return ApuItem_1.ApuItem; } });
|
|
8
|
+
var Budget_1 = require("./Budget");
|
|
9
|
+
Object.defineProperty(exports, "Budget", { enumerable: true, get: function () { return Budget_1.Budget; } });
|
|
10
|
+
var BudgetItem_1 = require("./BudgetItem");
|
|
11
|
+
Object.defineProperty(exports, "BudgetItem", { enumerable: true, get: function () { return BudgetItem_1.BudgetItem; } });
|
|
12
|
+
var Client_1 = require("./Client");
|
|
13
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.Client; } });
|
|
14
|
+
var Company_1 = require("./Company");
|
|
15
|
+
Object.defineProperty(exports, "Company", { enumerable: true, get: function () { return Company_1.Company; } });
|
|
16
|
+
var Concept_1 = require("./Concept");
|
|
17
|
+
Object.defineProperty(exports, "Concept", { enumerable: true, get: function () { return Concept_1.Concept; } });
|
|
18
|
+
var PriceList_1 = require("./PriceList"); //
|
|
19
|
+
Object.defineProperty(exports, "PriceList", { enumerable: true, get: function () { return PriceList_1.PriceList; } });
|
|
20
|
+
var Project_1 = require("./Project");
|
|
21
|
+
Object.defineProperty(exports, "Project", { enumerable: true, get: function () { return Project_1.Project; } });
|
|
22
|
+
var Resource_1 = require("./Resource"); //
|
|
23
|
+
Object.defineProperty(exports, "Resource", { enumerable: true, get: function () { return Resource_1.Resource; } });
|
|
24
|
+
var ResourcePrice_1 = require("./ResourcePrice"); //
|
|
25
|
+
Object.defineProperty(exports, "ResourcePrice", { enumerable: true, get: function () { return ResourcePrice_1.ResourcePrice; } });
|
|
26
|
+
var resource_type_enum_1 = require("./enums/resource-type.enum");
|
|
27
|
+
Object.defineProperty(exports, "ResourceType", { enumerable: true, get: function () { return resource_type_enum_1.ResourceType; } });
|
|
28
|
+
var budget_snapshot_entity_1 = require("./budget-snapshot.entity");
|
|
29
|
+
Object.defineProperty(exports, "BudgetSnapshot", { enumerable: true, get: function () { return budget_snapshot_entity_1.BudgetSnapshot; } });
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -21,4 +21,5 @@ export { SupplierImage } from "./entities/SupplierImage";
|
|
|
21
21
|
export { InventoryImage } from "./entities/InventoryImage";
|
|
22
22
|
|
|
23
23
|
export * from "./types";
|
|
24
|
-
export * from "./models/technical-sheet";
|
|
24
|
+
export * from "./models/technical-sheet";
|
|
25
|
+
export * from "./models/apu";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, OneToMany, JoinColumn, Unique, Check, Index,
|
|
3
|
+
} from "typeorm";
|
|
4
|
+
import { Concept } from "./Concept";
|
|
5
|
+
import { ApuItem } from "./ApuItem";
|
|
6
|
+
|
|
7
|
+
@Entity("apu")
|
|
8
|
+
@Unique("uq_apu_concept_version", ["concept", "version"])
|
|
9
|
+
@Check(`"indirectPct" >= 0 AND "indirectPct" <= 1`)
|
|
10
|
+
@Check(`"profitPct" >= 0 AND "profitPct" <= 1`)
|
|
11
|
+
@Index(["concept", "version"])
|
|
12
|
+
export class Apu implements ObjectLiteral {
|
|
13
|
+
@PrimaryGeneratedColumn("increment")
|
|
14
|
+
idApu!: number;
|
|
15
|
+
|
|
16
|
+
@ManyToOne(() => Concept, { nullable: false, onDelete: "CASCADE" })
|
|
17
|
+
@JoinColumn({ name: "idConcept" })
|
|
18
|
+
concept!: Concept;
|
|
19
|
+
|
|
20
|
+
@Column("int")
|
|
21
|
+
version!: number;
|
|
22
|
+
|
|
23
|
+
@Column("date")
|
|
24
|
+
validFrom!: string;
|
|
25
|
+
|
|
26
|
+
@Column("date", { nullable: true })
|
|
27
|
+
validTo?: string | null;
|
|
28
|
+
|
|
29
|
+
@Column("decimal", { precision: 5, scale: 4, default: 0 })
|
|
30
|
+
indirectPct!: number; // 0..1
|
|
31
|
+
|
|
32
|
+
@Column("decimal", { precision: 5, scale: 4, default: 0 })
|
|
33
|
+
profitPct!: number; // 0..1
|
|
34
|
+
|
|
35
|
+
@Column("text", { nullable: true })
|
|
36
|
+
notes?: string | null;
|
|
37
|
+
|
|
38
|
+
@OneToMany(() => ApuItem, (ai) => ai.apu, { cascade: true })
|
|
39
|
+
items?: ApuItem[];
|
|
40
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// apu/entities/ApuItem.ts
|
|
2
|
+
import {
|
|
3
|
+
Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn, Unique, Check, Index,
|
|
4
|
+
} from "typeorm";
|
|
5
|
+
import { Apu } from "./Apu";
|
|
6
|
+
import { Resource } from "./Resource";
|
|
7
|
+
|
|
8
|
+
@Entity("apu_items")
|
|
9
|
+
@Unique("uq_apu_item_unique", ["apu", "resource"])
|
|
10
|
+
@Check(`"wastePct" >= 0 AND "wastePct" <= 1`)
|
|
11
|
+
@Index(["apu"])
|
|
12
|
+
export class ApuItem implements ObjectLiteral {
|
|
13
|
+
@PrimaryGeneratedColumn("increment")
|
|
14
|
+
idApuItem!: number;
|
|
15
|
+
|
|
16
|
+
@ManyToOne(() => Apu, { nullable: false, onDelete: "CASCADE" })
|
|
17
|
+
@JoinColumn({ name: "idApu" })
|
|
18
|
+
apu!: Apu;
|
|
19
|
+
|
|
20
|
+
@ManyToOne(() => Resource, { nullable: false })
|
|
21
|
+
@JoinColumn({ name: "idResource" })
|
|
22
|
+
resource!: Resource;
|
|
23
|
+
|
|
24
|
+
@Column("decimal", { precision: 18, scale: 6 })
|
|
25
|
+
quantity!: number;
|
|
26
|
+
|
|
27
|
+
@Column("decimal", { precision: 5, scale: 4, default: 0 })
|
|
28
|
+
wastePct!: number;
|
|
29
|
+
|
|
30
|
+
@Column("int", { default: 0 })
|
|
31
|
+
sortOrder!: number;
|
|
32
|
+
|
|
33
|
+
@Column("text", { nullable: true })
|
|
34
|
+
notes?: string | null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// apu/entities/Budget.ts
|
|
2
|
+
import {
|
|
3
|
+
Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, OneToMany, JoinColumn, Index, CreateDateColumn,
|
|
4
|
+
} from "typeorm";
|
|
5
|
+
import { Project } from "./Project";
|
|
6
|
+
import { BudgetItem } from "./BudgetItem";
|
|
7
|
+
|
|
8
|
+
@Entity("budgets")
|
|
9
|
+
@Index(["project"])
|
|
10
|
+
export class Budget implements ObjectLiteral {
|
|
11
|
+
@PrimaryGeneratedColumn("increment")
|
|
12
|
+
idBudget!: number;
|
|
13
|
+
|
|
14
|
+
@ManyToOne(() => Project, { nullable: false, onDelete: "CASCADE" })
|
|
15
|
+
@JoinColumn({ name: "idProject" })
|
|
16
|
+
project!: Project;
|
|
17
|
+
|
|
18
|
+
@Column("varchar", { length: 64, nullable: true, unique: true })
|
|
19
|
+
code?: string | null;
|
|
20
|
+
|
|
21
|
+
@Column("varchar", { length: 255 })
|
|
22
|
+
title!: string;
|
|
23
|
+
|
|
24
|
+
@CreateDateColumn({ type: "timestamp" })
|
|
25
|
+
createdAt!: Date;
|
|
26
|
+
|
|
27
|
+
@Column("varchar", { length: 3, default: "MXN" })
|
|
28
|
+
currency!: string;
|
|
29
|
+
|
|
30
|
+
@Column("decimal", { precision: 5, scale: 4, default: 0.16 })
|
|
31
|
+
vatPct!: number; // IVA 0..1
|
|
32
|
+
|
|
33
|
+
@Column("varchar", { length: 32, default: "DRAFT" })
|
|
34
|
+
status!: "DRAFT" | "SENT" | "APPROVED" | "REJECTED" | "BILLED" | string;
|
|
35
|
+
|
|
36
|
+
@Column("text", { nullable: true })
|
|
37
|
+
notes?: string | null;
|
|
38
|
+
|
|
39
|
+
@OneToMany(() => BudgetItem, (bi) => bi.budget, { cascade: true })
|
|
40
|
+
items?: BudgetItem[];
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// apu/entities/BudgetItem.ts
|
|
2
|
+
import {
|
|
3
|
+
Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn, Index,
|
|
4
|
+
} from "typeorm";
|
|
5
|
+
import { Budget } from "./Budget";
|
|
6
|
+
import { Concept } from "./Concept";
|
|
7
|
+
import { Apu } from "./Apu";
|
|
8
|
+
|
|
9
|
+
@Entity("budget_items")
|
|
10
|
+
@Index(["budget"])
|
|
11
|
+
export class BudgetItem implements ObjectLiteral {
|
|
12
|
+
@PrimaryGeneratedColumn("increment")
|
|
13
|
+
idBudgetItem!: number;
|
|
14
|
+
|
|
15
|
+
@ManyToOne(() => Budget, { nullable: false, onDelete: "CASCADE" })
|
|
16
|
+
@JoinColumn({ name: "idBudget" })
|
|
17
|
+
budget!: Budget;
|
|
18
|
+
|
|
19
|
+
@ManyToOne(() => Concept, { nullable: false, onDelete: "RESTRICT" })
|
|
20
|
+
@JoinColumn({ name: "idConcept" })
|
|
21
|
+
concept!: Concept;
|
|
22
|
+
|
|
23
|
+
@ManyToOne(() => Apu, { nullable: false, onDelete: "RESTRICT" })
|
|
24
|
+
@JoinColumn({ name: "idApu" })
|
|
25
|
+
apu!: Apu; // versión usada
|
|
26
|
+
|
|
27
|
+
@Column("decimal", { precision: 18, scale: 6 })
|
|
28
|
+
quantity!: number;
|
|
29
|
+
|
|
30
|
+
@Column("decimal", { precision: 14, scale: 4, nullable: true })
|
|
31
|
+
unitPriceSnapshot?: number | null; // si no hay, se puede recalcular al vuelo
|
|
32
|
+
|
|
33
|
+
@Column("text", { nullable: true })
|
|
34
|
+
notes?: string | null;
|
|
35
|
+
|
|
36
|
+
@Column("int", { default: 0 })
|
|
37
|
+
sortOrder!: number;
|
|
38
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// apu/entities/Client.ts
|
|
2
|
+
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral } from "typeorm";
|
|
3
|
+
|
|
4
|
+
@Entity("clients")
|
|
5
|
+
export class Client implements ObjectLiteral {
|
|
6
|
+
@PrimaryGeneratedColumn("increment")
|
|
7
|
+
idClient!: number;
|
|
8
|
+
|
|
9
|
+
@Column("varchar", { length: 255 })
|
|
10
|
+
displayName!: string;
|
|
11
|
+
|
|
12
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
13
|
+
legalName?: string | null;
|
|
14
|
+
|
|
15
|
+
@Column("varchar", { length: 32, nullable: true })
|
|
16
|
+
rfc?: string | null;
|
|
17
|
+
|
|
18
|
+
@Column("varchar", { length: 64, nullable: true })
|
|
19
|
+
phone?: string | null;
|
|
20
|
+
|
|
21
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
22
|
+
email?: string | null;
|
|
23
|
+
|
|
24
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
25
|
+
addressLine1?: string | null;
|
|
26
|
+
|
|
27
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
28
|
+
addressLine2?: string | null;
|
|
29
|
+
|
|
30
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
31
|
+
city?: string | null;
|
|
32
|
+
|
|
33
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
34
|
+
state?: string | null;
|
|
35
|
+
|
|
36
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
37
|
+
country?: string | null;
|
|
38
|
+
|
|
39
|
+
@Column("varchar", { length: 16, nullable: true })
|
|
40
|
+
postalCode?: string | null;
|
|
41
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// apu/entities/Company.ts
|
|
2
|
+
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral } from "typeorm";
|
|
3
|
+
|
|
4
|
+
@Entity("companies")
|
|
5
|
+
export class Company implements ObjectLiteral {
|
|
6
|
+
@PrimaryGeneratedColumn("increment")
|
|
7
|
+
idCompany!: number;
|
|
8
|
+
|
|
9
|
+
@Column("varchar", { length: 255 })
|
|
10
|
+
displayName!: string;
|
|
11
|
+
|
|
12
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
13
|
+
legalName?: string | null;
|
|
14
|
+
|
|
15
|
+
@Column("varchar", { length: 32, nullable: true })
|
|
16
|
+
rfc?: string | null;
|
|
17
|
+
|
|
18
|
+
@Column("varchar", { length: 64, nullable: true })
|
|
19
|
+
phone?: string | null;
|
|
20
|
+
|
|
21
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
22
|
+
email?: string | null;
|
|
23
|
+
|
|
24
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
25
|
+
website?: string | null;
|
|
26
|
+
|
|
27
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
28
|
+
addressLine1?: string | null;
|
|
29
|
+
|
|
30
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
31
|
+
addressLine2?: string | null;
|
|
32
|
+
|
|
33
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
34
|
+
city?: string | null;
|
|
35
|
+
|
|
36
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
37
|
+
state?: string | null;
|
|
38
|
+
|
|
39
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
40
|
+
country?: string | null;
|
|
41
|
+
|
|
42
|
+
@Column("varchar", { length: 16, nullable: true })
|
|
43
|
+
postalCode?: string | null;
|
|
44
|
+
}
|