proflores-db-model 0.2.35 → 0.2.37
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.
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Budget } from
|
|
1
|
+
import { Budget } from "../apu";
|
|
2
2
|
export declare class BudgetSnapshot {
|
|
3
3
|
idSnapshot: number;
|
|
4
4
|
budget: Budget;
|
|
5
|
-
idBudget: number;
|
|
6
5
|
payload: Record<string, any>;
|
|
7
6
|
pdfHash?: string | null;
|
|
8
7
|
idPriceList?: number;
|
|
9
8
|
currency: string;
|
|
10
9
|
total: number;
|
|
11
10
|
createdAt: Date;
|
|
12
|
-
generatedBy?: string;
|
|
13
|
-
notes?: string;
|
|
11
|
+
generatedBy?: string | null;
|
|
12
|
+
notes?: string | null;
|
|
14
13
|
}
|
|
@@ -10,58 +10,58 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BudgetSnapshot = void 0;
|
|
13
|
+
// apu/entities/BudgetSnapshot.ts
|
|
13
14
|
const typeorm_1 = require("typeorm");
|
|
14
15
|
const apu_1 = require("../apu");
|
|
15
16
|
let BudgetSnapshot = class BudgetSnapshot {
|
|
16
17
|
};
|
|
17
18
|
exports.BudgetSnapshot = BudgetSnapshot;
|
|
18
19
|
__decorate([
|
|
19
|
-
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
20
21
|
__metadata("design:type", Number)
|
|
21
22
|
], BudgetSnapshot.prototype, "idSnapshot", void 0);
|
|
22
23
|
__decorate([
|
|
23
|
-
(0, typeorm_1.ManyToOne)(() => apu_1.Budget, { onDelete:
|
|
24
|
-
(0, typeorm_1.JoinColumn)({ name:
|
|
24
|
+
(0, typeorm_1.ManyToOne)(() => apu_1.Budget, { nullable: false, onDelete: "CASCADE" }),
|
|
25
|
+
(0, typeorm_1.JoinColumn)({ name: "idBudget" }),
|
|
25
26
|
__metadata("design:type", apu_1.Budget)
|
|
26
27
|
], BudgetSnapshot.prototype, "budget", void 0);
|
|
27
28
|
__decorate([
|
|
28
|
-
(0, typeorm_1.
|
|
29
|
-
__metadata("design:type", Number)
|
|
30
|
-
], BudgetSnapshot.prototype, "idBudget", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, typeorm_1.Column)({ type: 'jsonb' }),
|
|
29
|
+
(0, typeorm_1.Column)("jsonb"),
|
|
33
30
|
__metadata("design:type", Object)
|
|
34
31
|
], BudgetSnapshot.prototype, "payload", void 0);
|
|
35
32
|
__decorate([
|
|
36
|
-
(0, typeorm_1.Column)(
|
|
33
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true }),
|
|
37
34
|
__metadata("design:type", Object)
|
|
38
35
|
], BudgetSnapshot.prototype, "pdfHash", void 0);
|
|
39
36
|
__decorate([
|
|
40
|
-
(0, typeorm_1.Column)(
|
|
37
|
+
(0, typeorm_1.Column)("int", { nullable: true }),
|
|
41
38
|
__metadata("design:type", Number)
|
|
42
39
|
], BudgetSnapshot.prototype, "idPriceList", void 0);
|
|
43
40
|
__decorate([
|
|
44
|
-
(0, typeorm_1.Column)(
|
|
41
|
+
(0, typeorm_1.Column)("varchar", { length: 10, default: "MXN" }),
|
|
45
42
|
__metadata("design:type", String)
|
|
46
43
|
], BudgetSnapshot.prototype, "currency", void 0);
|
|
47
44
|
__decorate([
|
|
48
|
-
(0, typeorm_1.Column)(
|
|
45
|
+
(0, typeorm_1.Column)("decimal", { precision: 20, scale: 4 }),
|
|
49
46
|
__metadata("design:type", Number)
|
|
50
47
|
], BudgetSnapshot.prototype, "total", void 0);
|
|
51
48
|
__decorate([
|
|
52
|
-
(0, typeorm_1.CreateDateColumn)({ type:
|
|
49
|
+
(0, typeorm_1.CreateDateColumn)({ type: "timestamptz" }),
|
|
53
50
|
__metadata("design:type", Date)
|
|
54
51
|
], BudgetSnapshot.prototype, "createdAt", void 0);
|
|
55
52
|
__decorate([
|
|
56
|
-
(0, typeorm_1.Column)(
|
|
57
|
-
__metadata("design:type",
|
|
53
|
+
(0, typeorm_1.Column)("varchar", { length: 128, nullable: true }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
58
55
|
], BudgetSnapshot.prototype, "generatedBy", void 0);
|
|
59
56
|
__decorate([
|
|
60
|
-
(0, typeorm_1.Column)(
|
|
61
|
-
__metadata("design:type",
|
|
57
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
58
|
+
__metadata("design:type", Object)
|
|
62
59
|
], BudgetSnapshot.prototype, "notes", void 0);
|
|
63
60
|
exports.BudgetSnapshot = BudgetSnapshot = __decorate([
|
|
64
|
-
(0, typeorm_1.Entity)(
|
|
65
|
-
(0, typeorm_1.Index)([
|
|
66
|
-
|
|
61
|
+
(0, typeorm_1.Entity)("budget_snapshots"),
|
|
62
|
+
(0, typeorm_1.Index)(["budget"]) // como @Index(["apu"]) en tu ApuItem
|
|
63
|
+
,
|
|
64
|
+
(0, typeorm_1.Index)(["createdAt"]),
|
|
65
|
+
(0, typeorm_1.Index)(["pdfHash"]),
|
|
66
|
+
(0, typeorm_1.Check)(`"total" >= 0`)
|
|
67
67
|
], BudgetSnapshot);
|
package/package.json
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// apu/entities/BudgetSnapshot.ts
|
|
2
|
+
import {
|
|
3
|
+
Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn,
|
|
4
|
+
Index, CreateDateColumn, Check,
|
|
5
|
+
} from "typeorm";
|
|
6
|
+
import { Budget } from "../apu";
|
|
7
|
+
|
|
8
|
+
@Entity("budget_snapshots")
|
|
9
|
+
@Index(["budget"]) // como @Index(["apu"]) en tu ApuItem
|
|
10
|
+
@Index(["createdAt"])
|
|
11
|
+
@Index(["pdfHash"])
|
|
12
|
+
@Check(`"total" >= 0`)
|
|
7
13
|
export class BudgetSnapshot {
|
|
8
|
-
@PrimaryGeneratedColumn()
|
|
14
|
+
@PrimaryGeneratedColumn("increment")
|
|
9
15
|
idSnapshot!: number;
|
|
10
16
|
|
|
11
|
-
@ManyToOne(() => Budget, { onDelete:
|
|
12
|
-
@JoinColumn({ name:
|
|
13
|
-
budget!: Budget;
|
|
14
|
-
|
|
15
|
-
@RelationId((s: BudgetSnapshot) => s.budget)
|
|
16
|
-
idBudget!: number;
|
|
17
|
+
@ManyToOne(() => Budget, { nullable: false, onDelete: "CASCADE" })
|
|
18
|
+
@JoinColumn({ name: "idBudget" })
|
|
19
|
+
budget!: Budget; // FK real en DB: idBudget
|
|
17
20
|
|
|
18
|
-
@Column(
|
|
19
|
-
payload!: Record<string, any>;
|
|
21
|
+
@Column("jsonb")
|
|
22
|
+
payload!: Record<string, any>; // DTO congelado
|
|
20
23
|
|
|
21
|
-
//
|
|
22
|
-
@Column(
|
|
24
|
+
// Usa 64 si guardas SHA-256 sin "0x"; si usaras "0x" cámbialo a length: 66
|
|
25
|
+
@Column("varchar", { length: 64, nullable: true })
|
|
23
26
|
pdfHash?: string | null;
|
|
24
27
|
|
|
25
|
-
@Column(
|
|
28
|
+
@Column("int", { nullable: true })
|
|
26
29
|
idPriceList?: number;
|
|
27
30
|
|
|
28
|
-
@Column(
|
|
31
|
+
@Column("varchar", { length: 10, default: "MXN" })
|
|
29
32
|
currency!: string;
|
|
30
33
|
|
|
31
|
-
@Column(
|
|
34
|
+
@Column("decimal", { precision: 20, scale: 4 })
|
|
32
35
|
total!: number;
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
@CreateDateColumn({ type: 'timestamptz' })
|
|
37
|
+
@CreateDateColumn({ type: "timestamptz" })
|
|
36
38
|
createdAt!: Date;
|
|
37
39
|
|
|
38
|
-
@Column(
|
|
39
|
-
generatedBy?: string;
|
|
40
|
+
@Column("varchar", { length: 128, nullable: true })
|
|
41
|
+
generatedBy?: string | null;
|
|
40
42
|
|
|
41
|
-
@Column(
|
|
42
|
-
notes?: string;
|
|
43
|
+
@Column("text", { nullable: true })
|
|
44
|
+
notes?: string | null;
|
|
43
45
|
}
|