@asumano/worklip-typeorm-db 1.1.77 → 1.1.79

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 (53) hide show
  1. package/dist/entities/BillingUsageSnapshot.d.ts +6 -6
  2. package/dist/entities/BillingUsageSnapshot.js +2 -2
  3. package/dist/entities/Company.d.ts +1 -2
  4. package/dist/entities/Company.js +0 -4
  5. package/dist/entities/GlobalSection.d.ts +17 -0
  6. package/dist/entities/GlobalSection.js +122 -0
  7. package/dist/entities/GlobalSectionItem.d.ts +16 -0
  8. package/dist/entities/{GlobalTemplateSectionItem.js → GlobalSectionItem.js} +47 -28
  9. package/dist/entities/GlobalTemplate.d.ts +3 -0
  10. package/dist/entities/GlobalTemplate.js +18 -0
  11. package/dist/entities/GlobalTemplateSection.d.ts +5 -5
  12. package/dist/entities/GlobalTemplateSection.js +35 -35
  13. package/dist/entities/Section.d.ts +19 -0
  14. package/dist/entities/Section.js +138 -0
  15. package/dist/entities/SectionItem.d.ts +16 -0
  16. package/dist/entities/{TemplateSectionItem.js → SectionItem.js} +48 -28
  17. package/dist/entities/ServiceOrder.d.ts +0 -2
  18. package/dist/entities/ServiceOrder.js +1 -6
  19. package/dist/entities/SubscriptionAddon.js +1 -1
  20. package/dist/entities/SubscriptionPlan.d.ts +9 -9
  21. package/dist/entities/SubscriptionPlan.js +2 -2
  22. package/dist/entities/Template.d.ts +3 -0
  23. package/dist/entities/Template.js +18 -0
  24. package/dist/entities/TemplateSection.d.ts +5 -5
  25. package/dist/entities/TemplateSection.js +48 -34
  26. package/dist/entities/UsageAlert.js +1 -1
  27. package/dist/entities/Workshop.d.ts +2 -2
  28. package/dist/entities/Workshop.js +5 -5
  29. package/dist/entities.index.d.ts +8 -7
  30. package/dist/entities.index.js +20 -16
  31. package/dist/views/{GlobalTemplateSectionItems.d.ts → GlobalSectionItems.d.ts} +6 -3
  32. package/dist/views/{TemplateSections.js → GlobalSectionItems.js} +31 -21
  33. package/dist/views/GlobalSections.d.ts +16 -0
  34. package/dist/views/{TemplateSectionItems.js → GlobalSections.js} +30 -24
  35. package/dist/views/GlobalTemplates.d.ts +5 -1
  36. package/dist/views/GlobalTemplates.js +17 -1
  37. package/dist/views/{TemplateSectionItems.d.ts → SectionItems.d.ts} +5 -2
  38. package/dist/views/{GlobalTemplateSectionItems.js → SectionItems.js} +42 -19
  39. package/dist/views/Sections.d.ts +19 -0
  40. package/dist/views/{GlobalTemplateSections.js → Sections.js} +48 -17
  41. package/dist/views/SubscriptionPlans.d.ts +1 -1
  42. package/dist/views/SubscriptionPlans.js +1 -1
  43. package/dist/views/Templates.d.ts +5 -1
  44. package/dist/views/Templates.js +17 -1
  45. package/dist/visit.summary.d.ts +4 -0
  46. package/dist/visit.summary.js +56 -1
  47. package/package.json +1 -1
  48. package/dist/entities/GlobalTemplateSectionItem.d.ts +0 -13
  49. package/dist/entities/TemplateSectionItem.d.ts +0 -13
  50. package/dist/entities/VoiceNoteLog.d.ts +0 -38
  51. package/dist/entities/VoiceNoteLog.js +0 -143
  52. package/dist/views/GlobalTemplateSections.d.ts +0 -12
  53. package/dist/views/TemplateSections.d.ts +0 -14
@@ -8,14 +8,14 @@ export declare class BillingUsageSnapshot {
8
8
  whatsapp_messages: number;
9
9
  emails_sent: number;
10
10
  /**
11
- * DOC: Segundos de audio COBRADOS (`voice_note_log.billed_seconds`) del mes.
11
+ * DOC: Visitas CREADAS en el ciclo (`service_order.created`), sin contar las descartadas.
12
12
  *
13
- * En segundos y no en minutos aunque el plan se venda por minutos: el proveedor factura por
14
- * segundos y con un mínimo por petición, así que guardar minutos obligaría a redondear acá y
15
- * la foto del consumo dejaría de cuadrar con lo que se pagó. Se divide entre 60 solo al
16
- * mostrarlo.
13
+ * Es un recurso de flujo, así que se congela acá al cerrar el ciclo: descartar una visita
14
+ * más adelante ya no puede mover el consumo de un mes que se facturó.
15
+ *
16
+ * Reemplazó a `voice_note_seconds`, que se fue con las notas de voz al dejar de cobrarse.
17
17
  */
18
- voice_note_seconds: number;
18
+ visits_count: number;
19
19
  users_count: number;
20
20
  workshops_count: number;
21
21
  created: Date;
@@ -74,10 +74,10 @@ __decorate([
74
74
  (0, typeorm_1.Column)({
75
75
  type: "int",
76
76
  default: 0,
77
- comment: "Cuántos segundos de audio cobrados (voice_note_log) consumió la empresa para el mes y año.",
77
+ comment: "Cuántas visitas (service_order) creó la empresa en el ciclo, sin contar las descartadas.",
78
78
  }),
79
79
  __metadata("design:type", Number)
80
- ], BillingUsageSnapshot.prototype, "voice_note_seconds", void 0);
80
+ ], BillingUsageSnapshot.prototype, "visits_count", void 0);
81
81
  __decorate([
82
82
  (0, typeorm_1.Column)({
83
83
  type: "int",
@@ -2,7 +2,7 @@ import { Vehicle } from "./Vehicle";
2
2
  import { Client } from "./Client";
3
3
  import { Associate } from "./Associate";
4
4
  import { Workshop } from "./Workshop";
5
- import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, CompanySubscription, CompanyVehicleType, Country, EmailLog, MediaFile, PaymentMethod, ServiceOrderApproval, UsageAlert, VoiceNoteLog, WhatsappLog } from "..";
5
+ import { BillingInvoice, BillingUsageSnapshot, CompanyBrand, CompanySubscription, CompanyVehicleType, Country, EmailLog, MediaFile, PaymentMethod, ServiceOrderApproval, UsageAlert, WhatsappLog } from "..";
6
6
  export declare class Company {
7
7
  id: number;
8
8
  country: Country;
@@ -26,7 +26,6 @@ export declare class Company {
26
26
  service_order_approvals: ServiceOrderApproval[];
27
27
  whatsapp_logs: WhatsappLog[];
28
28
  email_logs: EmailLog[];
29
- voice_note_logs: VoiceNoteLog[];
30
29
  billing_invoices: BillingInvoice[];
31
30
  usage_alerts: UsageAlert[];
32
31
  company_subscriptions: CompanySubscription[];
@@ -154,10 +154,6 @@ __decorate([
154
154
  (0, typeorm_1.OneToMany)(() => __1.EmailLog, (emailLog) => emailLog.company),
155
155
  __metadata("design:type", Array)
156
156
  ], Company.prototype, "email_logs", void 0);
157
- __decorate([
158
- (0, typeorm_1.OneToMany)(() => __1.VoiceNoteLog, (voiceNoteLog) => voiceNoteLog.company),
159
- __metadata("design:type", Array)
160
- ], Company.prototype, "voice_note_logs", void 0);
161
157
  __decorate([
162
158
  (0, typeorm_1.OneToMany)(() => __1.BillingInvoice, (billingInvoice) => billingInvoice.company),
163
159
  __metadata("design:type", Array)
@@ -0,0 +1,17 @@
1
+ import { GlobalSectionItem } from "./GlobalSectionItem";
2
+ import { GlobalTemplateSection } from "./GlobalTemplateSection";
3
+ import { Master } from "./Master";
4
+ export declare class GlobalSection {
5
+ id: number;
6
+ code: string;
7
+ name: string;
8
+ description: string | null;
9
+ details: any | null;
10
+ created: Date;
11
+ created_by: Master;
12
+ updated: Date | null;
13
+ updated_by: Master | null;
14
+ status: number;
15
+ global_section_items: GlobalSectionItem[];
16
+ global_template_sections: GlobalTemplateSection[];
17
+ }
@@ -0,0 +1,122 @@
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.GlobalSection = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const GlobalSectionItem_1 = require("./GlobalSectionItem");
15
+ const GlobalTemplateSection_1 = require("./GlobalTemplateSection");
16
+ const Master_1 = require("./Master");
17
+ // DOC: Espejo de Section para el catálogo de Worklip. Dos diferencias con la del taller:
18
+ // no tiene `workshop` —el catálogo global no es de nadie— y la autoría apunta a `master`.
19
+ let GlobalSection = class GlobalSection {
20
+ };
21
+ exports.GlobalSection = GlobalSection;
22
+ __decorate([
23
+ (0, typeorm_1.PrimaryGeneratedColumn)({
24
+ type: "int",
25
+ comment: "Número de identificación (ID) único de cada registro.",
26
+ }),
27
+ __metadata("design:type", Number)
28
+ ], GlobalSection.prototype, "id", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({
31
+ length: 15,
32
+ type: "varchar",
33
+ unique: true,
34
+ comment: "Código único de la sección global.",
35
+ }),
36
+ __metadata("design:type", String)
37
+ ], GlobalSection.prototype, "code", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({
40
+ length: 100,
41
+ type: "varchar",
42
+ comment: "Nombre de la sección global.",
43
+ }),
44
+ __metadata("design:type", String)
45
+ ], GlobalSection.prototype, "name", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({
48
+ length: 255,
49
+ type: "varchar",
50
+ default: null,
51
+ nullable: true,
52
+ comment: "Descripción de la sección. NULL si no se escribió ninguna.",
53
+ }),
54
+ __metadata("design:type", Object)
55
+ ], GlobalSection.prototype, "description", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({
58
+ type: "json",
59
+ nullable: true,
60
+ default: null,
61
+ comment: "Elementos adicionales que tenga la sección.",
62
+ }),
63
+ __metadata("design:type", Object)
64
+ ], GlobalSection.prototype, "details", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({
67
+ type: "datetime",
68
+ comment: "Fecha de creación de la sección global.",
69
+ default: () => "CURRENT_TIMESTAMP",
70
+ }),
71
+ __metadata("design:type", Date)
72
+ ], GlobalSection.prototype, "created", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
75
+ onDelete: "RESTRICT",
76
+ onUpdate: "NO ACTION",
77
+ }),
78
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
79
+ __metadata("design:type", Master_1.Master)
80
+ ], GlobalSection.prototype, "created_by", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({
83
+ type: "datetime",
84
+ default: null,
85
+ nullable: true,
86
+ comment: "Fecha de actualización de la sección global.",
87
+ onUpdate: "CURRENT_TIMESTAMP",
88
+ }),
89
+ __metadata("design:type", Object)
90
+ ], GlobalSection.prototype, "updated", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
93
+ onDelete: "RESTRICT",
94
+ onUpdate: "NO ACTION",
95
+ nullable: true,
96
+ }),
97
+ (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
98
+ __metadata("design:type", Object)
99
+ ], GlobalSection.prototype, "updated_by", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.Column)({
102
+ default: 1,
103
+ type: "int",
104
+ width: 1,
105
+ comment: "¿El elemento se encuentra visible en la plataforma?\n0: Inactivo.\n1: Activo.",
106
+ }),
107
+ __metadata("design:type", Number)
108
+ ], GlobalSection.prototype, "status", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.OneToMany)(() => GlobalSectionItem_1.GlobalSectionItem, (globalSectionItem) => globalSectionItem.section),
111
+ __metadata("design:type", Array)
112
+ ], GlobalSection.prototype, "global_section_items", void 0);
113
+ __decorate([
114
+ (0, typeorm_1.OneToMany)(() => GlobalTemplateSection_1.GlobalTemplateSection, (globalTemplateSection) => globalTemplateSection.section),
115
+ __metadata("design:type", Array)
116
+ ], GlobalSection.prototype, "global_template_sections", void 0);
117
+ exports.GlobalSection = GlobalSection = __decorate([
118
+ (0, typeorm_1.Entity)({
119
+ comment: "Catálogo global de secciones que sirven de base para los talleres.",
120
+ name: "global_section",
121
+ })
122
+ ], GlobalSection);
@@ -0,0 +1,16 @@
1
+ import { GlobalSection } from "./GlobalSection";
2
+ import { Master } from "./Master";
3
+ export declare class GlobalSectionItem {
4
+ id: number;
5
+ code: string;
6
+ section: GlobalSection;
7
+ name: string;
8
+ observation: string | null;
9
+ details: any | null;
10
+ order: number;
11
+ created: Date;
12
+ created_by: Master;
13
+ updated: Date | null;
14
+ updated_by: Master | null;
15
+ status: number;
16
+ }
@@ -9,19 +9,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.GlobalTemplateSectionItem = void 0;
12
+ exports.GlobalSectionItem = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
- const GlobalTemplateSection_1 = require("./GlobalTemplateSection");
15
- let GlobalTemplateSectionItem = class GlobalTemplateSectionItem {
14
+ const GlobalSection_1 = require("./GlobalSection");
15
+ const Master_1 = require("./Master");
16
+ // DOC: Espejo de SectionItem para el catálogo de Worklip.
17
+ let GlobalSectionItem = class GlobalSectionItem {
16
18
  };
17
- exports.GlobalTemplateSectionItem = GlobalTemplateSectionItem;
19
+ exports.GlobalSectionItem = GlobalSectionItem;
18
20
  __decorate([
19
21
  (0, typeorm_1.PrimaryGeneratedColumn)({
20
22
  type: "int",
21
23
  comment: "Número de identificación (ID) único de cada registro.",
22
24
  }),
23
25
  __metadata("design:type", Number)
24
- ], GlobalTemplateSectionItem.prototype, "id", void 0);
26
+ ], GlobalSectionItem.prototype, "id", void 0);
25
27
  __decorate([
26
28
  (0, typeorm_1.Column)({
27
29
  length: 15,
@@ -30,15 +32,15 @@ __decorate([
30
32
  comment: "Código único del item global para la sección.",
31
33
  }),
32
34
  __metadata("design:type", String)
33
- ], GlobalTemplateSectionItem.prototype, "code", void 0);
35
+ ], GlobalSectionItem.prototype, "code", void 0);
34
36
  __decorate([
35
- (0, typeorm_1.ManyToOne)(() => GlobalTemplateSection_1.GlobalTemplateSection, (globalTemplateSection) => globalTemplateSection.global_template_section_items, {
37
+ (0, typeorm_1.ManyToOne)(() => GlobalSection_1.GlobalSection, (globalSection) => globalSection.global_section_items, {
36
38
  onDelete: "CASCADE",
37
39
  onUpdate: "NO ACTION",
38
40
  }),
39
41
  (0, typeorm_1.JoinColumn)({ name: "section" }),
40
- __metadata("design:type", GlobalTemplateSection_1.GlobalTemplateSection)
41
- ], GlobalTemplateSectionItem.prototype, "section", void 0);
42
+ __metadata("design:type", GlobalSection_1.GlobalSection)
43
+ ], GlobalSectionItem.prototype, "section", void 0);
42
44
  __decorate([
43
45
  (0, typeorm_1.Column)({
44
46
  length: 100,
@@ -46,7 +48,7 @@ __decorate([
46
48
  comment: "Nombre del item global.",
47
49
  }),
48
50
  __metadata("design:type", String)
49
- ], GlobalTemplateSectionItem.prototype, "name", void 0);
51
+ ], GlobalSectionItem.prototype, "name", void 0);
50
52
  __decorate([
51
53
  (0, typeorm_1.Column)({
52
54
  length: 255,
@@ -56,23 +58,23 @@ __decorate([
56
58
  comment: "Observaciones/ayuda del item.",
57
59
  }),
58
60
  __metadata("design:type", Object)
59
- ], GlobalTemplateSectionItem.prototype, "observation", void 0);
60
- __decorate([
61
- (0, typeorm_1.Column)({
62
- type: "int",
63
- comment: "Orden en el que se van a mostrar los items.",
64
- }),
65
- __metadata("design:type", Number)
66
- ], GlobalTemplateSectionItem.prototype, "order", void 0);
61
+ ], GlobalSectionItem.prototype, "observation", void 0);
67
62
  __decorate([
68
63
  (0, typeorm_1.Column)({
69
64
  type: "json",
70
65
  nullable: true,
71
66
  default: null,
72
- comment: "Elementos adicionales que tenga la sección.",
67
+ comment: "Elementos adicionales que tenga el item.",
73
68
  }),
74
69
  __metadata("design:type", Object)
75
- ], GlobalTemplateSectionItem.prototype, "details", void 0);
70
+ ], GlobalSectionItem.prototype, "details", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({
73
+ type: "int",
74
+ comment: "Orden en el que se va a mostrar el item dentro de la sección.",
75
+ }),
76
+ __metadata("design:type", Number)
77
+ ], GlobalSectionItem.prototype, "order", void 0);
76
78
  __decorate([
77
79
  (0, typeorm_1.Column)({
78
80
  type: "datetime",
@@ -80,7 +82,15 @@ __decorate([
80
82
  default: () => "CURRENT_TIMESTAMP",
81
83
  }),
82
84
  __metadata("design:type", Date)
83
- ], GlobalTemplateSectionItem.prototype, "created", void 0);
85
+ ], GlobalSectionItem.prototype, "created", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
88
+ onDelete: "RESTRICT",
89
+ onUpdate: "NO ACTION",
90
+ }),
91
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
92
+ __metadata("design:type", Master_1.Master)
93
+ ], GlobalSectionItem.prototype, "created_by", void 0);
84
94
  __decorate([
85
95
  (0, typeorm_1.Column)({
86
96
  type: "datetime",
@@ -90,7 +100,16 @@ __decorate([
90
100
  onUpdate: "CURRENT_TIMESTAMP",
91
101
  }),
92
102
  __metadata("design:type", Object)
93
- ], GlobalTemplateSectionItem.prototype, "updated", void 0);
103
+ ], GlobalSectionItem.prototype, "updated", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
106
+ onDelete: "RESTRICT",
107
+ onUpdate: "NO ACTION",
108
+ nullable: true,
109
+ }),
110
+ (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
111
+ __metadata("design:type", Object)
112
+ ], GlobalSectionItem.prototype, "updated_by", void 0);
94
113
  __decorate([
95
114
  (0, typeorm_1.Column)({
96
115
  default: 1,
@@ -99,11 +118,11 @@ __decorate([
99
118
  comment: "¿El elemento se encuentra visible en la plataforma?\n0: Inactivo.\n1: Activo.",
100
119
  }),
101
120
  __metadata("design:type", Number)
102
- ], GlobalTemplateSectionItem.prototype, "status", void 0);
103
- exports.GlobalTemplateSectionItem = GlobalTemplateSectionItem = __decorate([
121
+ ], GlobalSectionItem.prototype, "status", void 0);
122
+ exports.GlobalSectionItem = GlobalSectionItem = __decorate([
104
123
  (0, typeorm_1.Entity)({
105
- comment: "Items globales de las secciones para todos los concesionarios/talleres.",
106
- name: "global_template_section_item",
124
+ comment: "Items de las secciones globales.",
125
+ name: "global_section_item",
107
126
  }),
108
- (0, typeorm_1.Unique)("item_order_template", ["section", "order"])
109
- ], GlobalTemplateSectionItem);
127
+ (0, typeorm_1.Unique)("item_order_section", ["section", "order"])
128
+ ], GlobalSectionItem);
@@ -1,12 +1,15 @@
1
1
  import { GlobalTemplateSection } from "./GlobalTemplateSection";
2
2
  import { VehicleType } from "./VehicleType";
3
+ import { Master } from "./Master";
3
4
  export declare class GlobalTemplate {
4
5
  id: number;
5
6
  code: string;
6
7
  vehicle_type: VehicleType;
7
8
  name: string;
8
9
  created: Date;
10
+ created_by: Master;
9
11
  updated: Date | null;
12
+ updated_by: Master | null;
10
13
  status: number;
11
14
  global_template_sections: GlobalTemplateSection[];
12
15
  }
@@ -13,6 +13,7 @@ exports.GlobalTemplate = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const GlobalTemplateSection_1 = require("./GlobalTemplateSection");
15
15
  const VehicleType_1 = require("./VehicleType");
16
+ const Master_1 = require("./Master");
16
17
  let GlobalTemplate = class GlobalTemplate {
17
18
  };
18
19
  exports.GlobalTemplate = GlobalTemplate;
@@ -56,6 +57,14 @@ __decorate([
56
57
  }),
57
58
  __metadata("design:type", Date)
58
59
  ], GlobalTemplate.prototype, "created", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
62
+ onDelete: "RESTRICT",
63
+ onUpdate: "NO ACTION",
64
+ }),
65
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
66
+ __metadata("design:type", Master_1.Master)
67
+ ], GlobalTemplate.prototype, "created_by", void 0);
59
68
  __decorate([
60
69
  (0, typeorm_1.Column)({
61
70
  type: "datetime",
@@ -66,6 +75,15 @@ __decorate([
66
75
  }),
67
76
  __metadata("design:type", Object)
68
77
  ], GlobalTemplate.prototype, "updated", void 0);
78
+ __decorate([
79
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
80
+ onDelete: "RESTRICT",
81
+ onUpdate: "NO ACTION",
82
+ nullable: true,
83
+ }),
84
+ (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
85
+ __metadata("design:type", Object)
86
+ ], GlobalTemplate.prototype, "updated_by", void 0);
69
87
  __decorate([
70
88
  (0, typeorm_1.Column)({
71
89
  default: 1,
@@ -1,14 +1,14 @@
1
1
  import { GlobalTemplate } from "./GlobalTemplate";
2
- import { GlobalTemplateSectionItem } from "./GlobalTemplateSectionItem";
2
+ import { GlobalSection } from "./GlobalSection";
3
+ import { Master } from "./Master";
3
4
  export declare class GlobalTemplateSection {
4
5
  id: number;
5
- code: string;
6
6
  template: GlobalTemplate;
7
- name: string;
7
+ section: GlobalSection;
8
8
  order: number;
9
- details: any | null;
10
9
  created: Date;
10
+ created_by: Master;
11
11
  updated: Date | null;
12
+ updated_by: Master | null;
12
13
  status: number;
13
- global_template_section_items: GlobalTemplateSectionItem[];
14
14
  }
@@ -12,7 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GlobalTemplateSection = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const GlobalTemplate_1 = require("./GlobalTemplate");
15
- const GlobalTemplateSectionItem_1 = require("./GlobalTemplateSectionItem");
15
+ const GlobalSection_1 = require("./GlobalSection");
16
+ const Master_1 = require("./Master");
17
+ // DOC: EL PIVOTE del lado administrativo. ⚠️ Igual que TemplateSection, este nombre ANTES era la
18
+ // sección global y ahora es el enlace. Ver TemplateSection para el porqué de los dos UNIQUE
19
+ // y del RESTRICT.
16
20
  let GlobalTemplateSection = class GlobalTemplateSection {
17
21
  };
18
22
  exports.GlobalTemplateSection = GlobalTemplateSection;
@@ -23,15 +27,6 @@ __decorate([
23
27
  }),
24
28
  __metadata("design:type", Number)
25
29
  ], GlobalTemplateSection.prototype, "id", void 0);
26
- __decorate([
27
- (0, typeorm_1.Column)({
28
- length: 15,
29
- type: "varchar",
30
- unique: true,
31
- comment: "Código único de la sección global.",
32
- }),
33
- __metadata("design:type", String)
34
- ], GlobalTemplateSection.prototype, "code", void 0);
35
30
  __decorate([
36
31
  (0, typeorm_1.ManyToOne)(() => GlobalTemplate_1.GlobalTemplate, (globalTemplate) => globalTemplate.global_template_sections, {
37
32
  onDelete: "CASCADE",
@@ -41,64 +36,69 @@ __decorate([
41
36
  __metadata("design:type", GlobalTemplate_1.GlobalTemplate)
42
37
  ], GlobalTemplateSection.prototype, "template", void 0);
43
38
  __decorate([
44
- (0, typeorm_1.Column)({
45
- length: 100,
46
- type: "varchar",
47
- comment: "Nombre de la sección global.",
39
+ (0, typeorm_1.ManyToOne)(() => GlobalSection_1.GlobalSection, (globalSection) => globalSection.global_template_sections, {
40
+ onDelete: "RESTRICT",
41
+ onUpdate: "NO ACTION",
48
42
  }),
49
- __metadata("design:type", String)
50
- ], GlobalTemplateSection.prototype, "name", void 0);
43
+ (0, typeorm_1.JoinColumn)({ name: "section" }),
44
+ __metadata("design:type", GlobalSection_1.GlobalSection)
45
+ ], GlobalTemplateSection.prototype, "section", void 0);
51
46
  __decorate([
52
47
  (0, typeorm_1.Column)({
53
48
  type: "int",
54
- comment: "Orden en el que se van a mostrar las secciones.",
49
+ comment: "Orden de la sección DENTRO de esta plantilla global.",
55
50
  }),
56
51
  __metadata("design:type", Number)
57
52
  ], GlobalTemplateSection.prototype, "order", void 0);
58
- __decorate([
59
- (0, typeorm_1.Column)({
60
- type: "json",
61
- nullable: true,
62
- default: null,
63
- comment: "Elementos adicionales que tenga la sección.",
64
- }),
65
- __metadata("design:type", Object)
66
- ], GlobalTemplateSection.prototype, "details", void 0);
67
53
  __decorate([
68
54
  (0, typeorm_1.Column)({
69
55
  type: "datetime",
70
- comment: "Fecha de creación de la sección global.",
56
+ comment: "Fecha en la que se enlazó la sección a la plantilla.",
71
57
  default: () => "CURRENT_TIMESTAMP",
72
58
  }),
73
59
  __metadata("design:type", Date)
74
60
  ], GlobalTemplateSection.prototype, "created", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
63
+ onDelete: "RESTRICT",
64
+ onUpdate: "NO ACTION",
65
+ }),
66
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
67
+ __metadata("design:type", Master_1.Master)
68
+ ], GlobalTemplateSection.prototype, "created_by", void 0);
75
69
  __decorate([
76
70
  (0, typeorm_1.Column)({
77
71
  type: "datetime",
78
72
  default: null,
79
73
  nullable: true,
80
- comment: "Fecha de actualización de la sección global.",
74
+ comment: "Fecha del último cambio de orden o de estado del enlace.",
81
75
  onUpdate: "CURRENT_TIMESTAMP",
82
76
  }),
83
77
  __metadata("design:type", Object)
84
78
  ], GlobalTemplateSection.prototype, "updated", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.ManyToOne)(() => Master_1.Master, {
81
+ onDelete: "RESTRICT",
82
+ onUpdate: "NO ACTION",
83
+ nullable: true,
84
+ }),
85
+ (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
86
+ __metadata("design:type", Object)
87
+ ], GlobalTemplateSection.prototype, "updated_by", void 0);
85
88
  __decorate([
86
89
  (0, typeorm_1.Column)({
87
90
  default: 1,
88
91
  type: "int",
89
92
  width: 1,
90
- comment: "¿El elemento se encuentra visible en la plataforma?\n0: Inactivo.\n1: Activo.",
93
+ comment: "¿La sección está activa DENTRO de esta plantilla global?\n0: Inactivo.\n1: Activo.",
91
94
  }),
92
95
  __metadata("design:type", Number)
93
96
  ], GlobalTemplateSection.prototype, "status", void 0);
94
- __decorate([
95
- (0, typeorm_1.OneToMany)(() => GlobalTemplateSectionItem_1.GlobalTemplateSectionItem, (globalTemplateSectionItem) => globalTemplateSectionItem.section),
96
- __metadata("design:type", Array)
97
- ], GlobalTemplateSection.prototype, "global_template_section_items", void 0);
98
97
  exports.GlobalTemplateSection = GlobalTemplateSection = __decorate([
99
98
  (0, typeorm_1.Entity)({
100
- comment: "Secciones globales de las plantillas para todos los concesionarios/talleres.",
99
+ comment: "Enlace entre plantilla global y sección global.",
101
100
  name: "global_template_section",
102
101
  }),
103
- (0, typeorm_1.Unique)("section_order_template", ["template", "order"])
102
+ (0, typeorm_1.Unique)("global_template_section_unique", ["template", "section"]),
103
+ (0, typeorm_1.Unique)("global_section_order_template", ["template", "order"])
104
104
  ], GlobalTemplateSection);
@@ -0,0 +1,19 @@
1
+ import { Workshop } from "./Workshop";
2
+ import { SectionItem } from "./SectionItem";
3
+ import { TemplateSection } from "./TemplateSection";
4
+ import { Associate } from "./Associate";
5
+ export declare class Section {
6
+ id: number;
7
+ code: string;
8
+ workshop: Workshop;
9
+ name: string;
10
+ description: string | null;
11
+ details: any | null;
12
+ created: Date;
13
+ created_by: Associate;
14
+ updated: Date | null;
15
+ updated_by: Associate | null;
16
+ status: number;
17
+ section_items: SectionItem[];
18
+ template_sections: TemplateSection[];
19
+ }