@asumano/worklip-typeorm-db 1.1.78 → 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 (37) hide show
  1. package/dist/entities/GlobalSection.d.ts +17 -0
  2. package/dist/entities/GlobalSection.js +122 -0
  3. package/dist/entities/GlobalSectionItem.d.ts +16 -0
  4. package/dist/entities/{GlobalTemplateSectionItem.js → GlobalSectionItem.js} +47 -28
  5. package/dist/entities/GlobalTemplate.d.ts +3 -0
  6. package/dist/entities/GlobalTemplate.js +18 -0
  7. package/dist/entities/GlobalTemplateSection.d.ts +5 -5
  8. package/dist/entities/GlobalTemplateSection.js +35 -35
  9. package/dist/entities/Section.d.ts +19 -0
  10. package/dist/entities/Section.js +138 -0
  11. package/dist/entities/SectionItem.d.ts +16 -0
  12. package/dist/entities/{TemplateSectionItem.js → SectionItem.js} +48 -28
  13. package/dist/entities/Template.d.ts +3 -0
  14. package/dist/entities/Template.js +18 -0
  15. package/dist/entities/TemplateSection.d.ts +5 -5
  16. package/dist/entities/TemplateSection.js +48 -34
  17. package/dist/entities/Workshop.d.ts +2 -0
  18. package/dist/entities/Workshop.js +5 -0
  19. package/dist/entities.index.d.ts +8 -6
  20. package/dist/entities.index.js +20 -14
  21. package/dist/views/{GlobalTemplateSectionItems.d.ts → GlobalSectionItems.d.ts} +6 -3
  22. package/dist/views/{TemplateSections.js → GlobalSectionItems.js} +31 -21
  23. package/dist/views/GlobalSections.d.ts +16 -0
  24. package/dist/views/{TemplateSectionItems.js → GlobalSections.js} +30 -24
  25. package/dist/views/GlobalTemplates.d.ts +5 -1
  26. package/dist/views/GlobalTemplates.js +17 -1
  27. package/dist/views/{TemplateSectionItems.d.ts → SectionItems.d.ts} +5 -2
  28. package/dist/views/{GlobalTemplateSectionItems.js → SectionItems.js} +42 -19
  29. package/dist/views/Sections.d.ts +19 -0
  30. package/dist/views/{GlobalTemplateSections.js → Sections.js} +48 -17
  31. package/dist/views/Templates.d.ts +5 -1
  32. package/dist/views/Templates.js +17 -1
  33. package/package.json +1 -1
  34. package/dist/entities/GlobalTemplateSectionItem.d.ts +0 -13
  35. package/dist/entities/TemplateSectionItem.d.ts +0 -13
  36. package/dist/views/GlobalTemplateSections.d.ts +0 -12
  37. package/dist/views/TemplateSections.d.ts +0 -14
@@ -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
+ }
@@ -0,0 +1,138 @@
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.Section = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Workshop_1 = require("./Workshop");
15
+ const SectionItem_1 = require("./SectionItem");
16
+ const TemplateSection_1 = require("./TemplateSection");
17
+ const Associate_1 = require("./Associate");
18
+ // DOC: Una sección del CATÁLOGO del taller. Antes se llamaba TemplateSection y colgaba de una
19
+ // plantilla; ahora vive sola y las plantillas la enlazan a través de TemplateSection, que
20
+ // pasó a ser el pivote.
21
+ //
22
+ // Lo que se edita acá cambia en TODAS las plantillas que la usen: es una referencia viva,
23
+ // no una copia. Las visitas ya creadas no se enteran, porque congelan la plantilla en su
24
+ // propio JSON (`service_order.data`).
25
+ //
26
+ // No tiene `order`: el orden es "de esta sección EN esta plantilla" y vive en el pivote.
27
+ let Section = class Section {
28
+ };
29
+ exports.Section = Section;
30
+ __decorate([
31
+ (0, typeorm_1.PrimaryGeneratedColumn)({
32
+ type: "int",
33
+ comment: "Número de identificación (ID) único de cada registro.",
34
+ }),
35
+ __metadata("design:type", Number)
36
+ ], Section.prototype, "id", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({
39
+ length: 15,
40
+ type: "varchar",
41
+ unique: true,
42
+ comment: "Código único de la sección.",
43
+ }),
44
+ __metadata("design:type", String)
45
+ ], Section.prototype, "code", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, (workshop) => workshop.sections, {
48
+ onDelete: "CASCADE",
49
+ onUpdate: "NO ACTION",
50
+ }),
51
+ (0, typeorm_1.JoinColumn)({ name: "workshop" }),
52
+ __metadata("design:type", Workshop_1.Workshop)
53
+ ], Section.prototype, "workshop", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({
56
+ length: 100,
57
+ type: "varchar",
58
+ comment: "Nombre de la sección.",
59
+ }),
60
+ __metadata("design:type", String)
61
+ ], Section.prototype, "name", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.Column)({
64
+ length: 255,
65
+ type: "varchar",
66
+ default: null,
67
+ nullable: true,
68
+ comment: "Descripción de la sección. NULL si no se escribió ninguna.",
69
+ }),
70
+ __metadata("design:type", Object)
71
+ ], Section.prototype, "description", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)({
74
+ type: "json",
75
+ nullable: true,
76
+ default: null,
77
+ comment: "Elementos adicionales que tenga la sección.",
78
+ }),
79
+ __metadata("design:type", Object)
80
+ ], Section.prototype, "details", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({
83
+ type: "datetime",
84
+ comment: "Fecha de creación de la sección.",
85
+ default: () => "CURRENT_TIMESTAMP",
86
+ }),
87
+ __metadata("design:type", Date)
88
+ ], Section.prototype, "created", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
91
+ onDelete: "RESTRICT",
92
+ onUpdate: "NO ACTION",
93
+ }),
94
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
95
+ __metadata("design:type", Associate_1.Associate)
96
+ ], Section.prototype, "created_by", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.Column)({
99
+ type: "datetime",
100
+ default: null,
101
+ nullable: true,
102
+ comment: "Fecha de actualización de la sección.",
103
+ onUpdate: "CURRENT_TIMESTAMP",
104
+ }),
105
+ __metadata("design:type", Object)
106
+ ], Section.prototype, "updated", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
109
+ onDelete: "RESTRICT",
110
+ onUpdate: "NO ACTION",
111
+ nullable: true,
112
+ }),
113
+ (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
114
+ __metadata("design:type", Object)
115
+ ], Section.prototype, "updated_by", void 0);
116
+ __decorate([
117
+ (0, typeorm_1.Column)({
118
+ default: 1,
119
+ type: "int",
120
+ width: 1,
121
+ comment: "¿El elemento se encuentra visible en la plataforma?\n0: Inactivo.\n1: Activo.\nApagarla acá la apaga en TODAS las plantillas que la usen.",
122
+ }),
123
+ __metadata("design:type", Number)
124
+ ], Section.prototype, "status", void 0);
125
+ __decorate([
126
+ (0, typeorm_1.OneToMany)(() => SectionItem_1.SectionItem, (sectionItem) => sectionItem.section),
127
+ __metadata("design:type", Array)
128
+ ], Section.prototype, "section_items", void 0);
129
+ __decorate([
130
+ (0, typeorm_1.OneToMany)(() => TemplateSection_1.TemplateSection, (templateSection) => templateSection.section),
131
+ __metadata("design:type", Array)
132
+ ], Section.prototype, "template_sections", void 0);
133
+ exports.Section = Section = __decorate([
134
+ (0, typeorm_1.Entity)({
135
+ comment: "Catálogo de secciones del taller. Una sección puede estar en muchas plantillas.",
136
+ name: "section",
137
+ })
138
+ ], Section);
@@ -0,0 +1,16 @@
1
+ import { Section } from "./Section";
2
+ import { Associate } from "./Associate";
3
+ export declare class SectionItem {
4
+ id: number;
5
+ code: string;
6
+ section: Section;
7
+ name: string;
8
+ observation: string | null;
9
+ details: any | null;
10
+ order: number;
11
+ created: Date;
12
+ created_by: Associate;
13
+ updated: Date | null;
14
+ updated_by: Associate | null;
15
+ status: number;
16
+ }