proflores-db-model 0.2.31 → 0.2.33

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.
Files changed (50) hide show
  1. package/dist/entities/ExpenseDetail.d.ts +2 -0
  2. package/dist/entities/ExpenseDetail.js +6 -0
  3. package/dist/entities/ExpenseTransaction.d.ts +0 -2
  4. package/dist/entities/ExpenseTransaction.js +0 -6
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/models/apu/Apu.d.ts +14 -0
  8. package/dist/models/apu/Apu.js +62 -0
  9. package/dist/models/apu/ApuItem.d.ts +12 -0
  10. package/dist/models/apu/ApuItem.js +55 -0
  11. package/dist/models/apu/Budget.d.ts +15 -0
  12. package/dist/models/apu/Budget.js +64 -0
  13. package/dist/models/apu/BudgetItem.d.ts +14 -0
  14. package/dist/models/apu/BudgetItem.js +59 -0
  15. package/dist/models/apu/Client.d.ts +15 -0
  16. package/dist/models/apu/Client.js +68 -0
  17. package/dist/models/apu/Company.d.ts +16 -0
  18. package/dist/models/apu/Company.js +72 -0
  19. package/dist/models/apu/Concept.d.ts +15 -0
  20. package/dist/models/apu/Concept.js +61 -0
  21. package/dist/models/apu/PriceList.d.ts +12 -0
  22. package/dist/models/apu/PriceList.js +54 -0
  23. package/dist/models/apu/Project.d.ts +19 -0
  24. package/dist/models/apu/Project.js +82 -0
  25. package/dist/models/apu/Resource.d.ts +16 -0
  26. package/dist/models/apu/Resource.js +66 -0
  27. package/dist/models/apu/ResourcePrice.d.ts +13 -0
  28. package/dist/models/apu/ResourcePrice.js +56 -0
  29. package/dist/models/apu/enums/resource-type.enum.d.ts +9 -0
  30. package/dist/models/apu/enums/resource-type.enum.js +13 -0
  31. package/dist/models/apu/index.d.ts +12 -0
  32. package/dist/models/apu/index.js +27 -0
  33. package/package.json +1 -1
  34. package/src/entities/ExpenseDetail.ts +5 -0
  35. package/src/entities/ExpenseTransaction.ts +0 -5
  36. package/src/entities/ProjectOrder.ts +4 -1
  37. package/src/index.ts +2 -1
  38. package/src/models/apu/Apu.ts +40 -0
  39. package/src/models/apu/ApuItem.ts +35 -0
  40. package/src/models/apu/Budget.ts +41 -0
  41. package/src/models/apu/BudgetItem.ts +38 -0
  42. package/src/models/apu/Client.ts +41 -0
  43. package/src/models/apu/Company.ts +44 -0
  44. package/src/models/apu/Concept.ts +39 -0
  45. package/src/models/apu/PriceList.ts +34 -0
  46. package/src/models/apu/Project.ts +55 -0
  47. package/src/models/apu/Resource.ts +44 -0
  48. package/src/models/apu/ResourcePrice.ts +35 -0
  49. package/src/models/apu/enums/resource-type.enum.ts +9 -0
  50. package/src/models/apu/index.ts +12 -0
@@ -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
+ }
@@ -0,0 +1,39 @@
1
+ // apu/entities/Concept.ts
2
+ import {
3
+ Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, OneToMany, JoinColumn, Index,
4
+ } from "typeorm";
5
+ import { UnitOfMeasure } from "../../entities/UnitOfMesure"; // <-- ajusta tu ruta real
6
+ import { Apu } from "./Apu";
7
+ import { BudgetItem } from "./BudgetItem";
8
+
9
+ @Entity("concepts")
10
+ @Index(["code"], { unique: true })
11
+ export class Concept implements ObjectLiteral {
12
+ @PrimaryGeneratedColumn("increment")
13
+ idConcept!: number;
14
+
15
+ @Column("varchar", { length: 64, nullable: true, unique: true })
16
+ code?: string | null; // clave del concepto (PU-XXXX)
17
+
18
+ @Column("varchar", { length: 255 })
19
+ title!: string;
20
+
21
+ @Column("text", { nullable: true })
22
+ description?: string | null;
23
+
24
+ @ManyToOne(() => UnitOfMeasure, { nullable: false })
25
+ @JoinColumn({ name: "idUnitOfMeasure" })
26
+ unit!: UnitOfMeasure;
27
+
28
+ @Column("varchar", { length: 64, nullable: true })
29
+ category?: string | null;
30
+
31
+ @Column({ type: "boolean", default: true })
32
+ isActive!: boolean;
33
+
34
+ @OneToMany(() => Apu, (a) => a.concept, { cascade: true })
35
+ apus?: Apu[];
36
+
37
+ @OneToMany(() => BudgetItem, (bi) => bi.concept)
38
+ budgetItems?: BudgetItem[];
39
+ }
@@ -0,0 +1,34 @@
1
+ // apu/entities/PriceList.ts
2
+ import {
3
+ Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany,
4
+ Index,
5
+ } from "typeorm";
6
+ import { ResourcePrice } from "./ResourcePrice";
7
+
8
+ @Entity("price_lists")
9
+ export class PriceList implements ObjectLiteral {
10
+ @PrimaryGeneratedColumn("increment")
11
+ idPriceList!: number;
12
+
13
+ @Column("varchar", { length: 255 })
14
+ name!: string;
15
+
16
+ @Column("varchar", { length: 64, nullable: true })
17
+ region?: string | null;
18
+
19
+ @Column("varchar", { length: 3, default: "MXN" })
20
+ currency!: string;
21
+
22
+ @Column("date")
23
+ validFrom!: string;
24
+
25
+ @Column("date", { nullable: true })
26
+ validTo?: string | null;
27
+
28
+ @Index()
29
+ @Column({ type: "boolean", default: false })
30
+ isDefault!: boolean;
31
+
32
+ @OneToMany(() => ResourcePrice, (rp) => rp.priceList)
33
+ resourcePrices?: ResourcePrice[];
34
+ }
@@ -0,0 +1,55 @@
1
+ // apu/entities/Project.ts
2
+ import {
3
+ Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn, Index,
4
+ } from "typeorm";
5
+ import { Company } from "./Company";
6
+ import { Client } from "./Client";
7
+
8
+ @Entity("projects")
9
+ @Index(["company"])
10
+ @Index(["client"])
11
+ export class Project implements ObjectLiteral {
12
+ @PrimaryGeneratedColumn("increment")
13
+ idProject!: number;
14
+
15
+ @ManyToOne(() => Company, { nullable: false, onDelete: "RESTRICT" })
16
+ @JoinColumn({ name: "idCompany" })
17
+ company!: Company;
18
+
19
+ @ManyToOne(() => Client, { nullable: true, onDelete: "SET NULL" })
20
+ @JoinColumn({ name: "idClient" })
21
+ client?: Client | null;
22
+
23
+ @Column("varchar", { length: 64, nullable: true, unique: true })
24
+ code?: string | null;
25
+
26
+ @Column("varchar", { length: 255 })
27
+ name!: string;
28
+
29
+ @Column("text", { nullable: true })
30
+ description?: string | null;
31
+
32
+ @Column("varchar", { length: 255, nullable: true })
33
+ siteAddress?: string | null;
34
+
35
+ @Column("varchar", { length: 128, nullable: true })
36
+ city?: string | null;
37
+
38
+ @Column("varchar", { length: 128, nullable: true })
39
+ state?: string | null;
40
+
41
+ @Column("varchar", { length: 128, nullable: true })
42
+ country?: string | null;
43
+
44
+ @Column("varchar", { length: 16, nullable: true })
45
+ postalCode?: string | null;
46
+
47
+ @Column("varchar", { length: 64, nullable: true })
48
+ region?: string | null;
49
+
50
+ @Column("date", { nullable: true })
51
+ startDate?: string | null;
52
+
53
+ @Column("date", { nullable: true })
54
+ endDate?: string | null;
55
+ }
@@ -0,0 +1,44 @@
1
+ // apu/entities/Resource.ts
2
+ import {
3
+ Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, OneToMany, JoinColumn, Index,
4
+ } from "typeorm";
5
+ import { ResourceType } from "./enums/resource-type.enum";
6
+ import { UnitOfMeasure } from "../../entities/UnitOfMesure";
7
+ import { ResourcePrice } from "./ResourcePrice";
8
+ import { ApuItem } from "./ApuItem";
9
+
10
+ @Entity("resources")
11
+ @Index(["type"])
12
+ export class Resource implements ObjectLiteral {
13
+ @PrimaryGeneratedColumn("increment")
14
+ idResource!: number;
15
+
16
+ @Column("varchar", { length: 64, nullable: true, unique: true })
17
+ code?: string | null;
18
+
19
+ @Column("varchar", { length: 255 })
20
+ name!: string;
21
+
22
+ @Column({
23
+ type: "enum",
24
+ enum: ResourceType,
25
+ enumName: "resource_type",
26
+ })
27
+ type!: ResourceType;
28
+
29
+ @ManyToOne(() => UnitOfMeasure, { nullable: false })
30
+ @JoinColumn({ name: "idUnitOfMeasure" })
31
+ unit!: UnitOfMeasure;
32
+
33
+ @Column("varchar", { length: 64, nullable: true })
34
+ satClave?: string | null;
35
+
36
+ @Column("text", { nullable: true })
37
+ notes?: string | null;
38
+
39
+ @OneToMany(() => ResourcePrice, (rp) => rp.resource)
40
+ prices?: ResourcePrice[];
41
+
42
+ @OneToMany(() => ApuItem, (ai) => ai.resource)
43
+ apuItems?: ApuItem[];
44
+ }
@@ -0,0 +1,35 @@
1
+ // apu/entities/ResourcePrice.ts
2
+ import {
3
+ Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn, Index, Unique,
4
+ } from "typeorm";
5
+ import { Resource } from "./Resource";
6
+ import { PriceList } from "./PriceList";
7
+ import { Supplier } from "../../entities/Suppliers";
8
+
9
+ @Entity("resource_prices")
10
+ @Unique("uq_resource_price_effective", ["resource", "priceList", "effectiveFrom"])
11
+ @Index(["resource", "priceList", "effectiveFrom"])
12
+ export class ResourcePrice implements ObjectLiteral {
13
+ @PrimaryGeneratedColumn("increment")
14
+ idResourcePrice!: number;
15
+
16
+ @ManyToOne(() => Resource, { nullable: false, onDelete: "CASCADE" })
17
+ @JoinColumn({ name: "idResource" })
18
+ resource!: Resource;
19
+
20
+ @ManyToOne(() => PriceList, { nullable: false, onDelete: "CASCADE" })
21
+ @JoinColumn({ name: "idPriceList" })
22
+ priceList!: PriceList;
23
+
24
+ @ManyToOne(() => Supplier, { nullable: true })
25
+ @JoinColumn({ name: "idSupplier" })
26
+ supplier?: Supplier | null;
27
+
28
+ @Column("decimal", { precision: 14, scale: 4 })
29
+ unitCost!: number;
30
+ @Column("date")
31
+ effectiveFrom!: string;
32
+
33
+ @Column("date", { nullable: true })
34
+ effectiveTo?: string | null;
35
+ }
@@ -0,0 +1,9 @@
1
+ export enum ResourceType {
2
+ MATERIAL = "MATERIAL",
3
+ LABOR = "LABOR",
4
+ EQUIPMENT = "EQUIPMENT",
5
+ TRANSPORT = "TRANSPORT",
6
+ TOOL = "TOOL",
7
+ SUBCONTRACT = "SUBCONTRACT",
8
+ OTHER = "OTHER",
9
+ }
@@ -0,0 +1,12 @@
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';