test-entity-library-asm 2.8.8 → 2.8.9

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,7 +1,7 @@
1
- import { MasterNotification, PartnerNotification, ReassignReview, VerifyLocal } from '..';
2
- import { City } from './City';
3
- import { DiscountCodeCompany } from './DiscountCodeCompany';
4
- import { MasterRole } from './MasterRole';
1
+ import { MasterNotification, PartnerNotification, ReassignReview, VerifyLocal } from "..";
2
+ import { City } from "./City";
3
+ import { DiscountCodeCompany } from "./DiscountCodeCompany";
4
+ import { MasterRole } from "./MasterRole";
5
5
  export declare class Master {
6
6
  id: number;
7
7
  code: string;
@@ -24,5 +24,6 @@ export declare class Master {
24
24
  master_notifications: MasterNotification[];
25
25
  reassign_reviews: ReassignReview[];
26
26
  reassign_review_news: ReassignReview[];
27
+ masters_to_notification: MasterNotification[];
27
28
  masters_notification: PartnerNotification[];
28
29
  }
@@ -22,12 +22,12 @@ var Master = /** @class */ (function () {
22
22
  }
23
23
  __decorate([
24
24
  (0, typeorm_1.PrimaryGeneratedColumn)({
25
- comment: 'Número de identificación (ID) único de cada registro.',
25
+ comment: "Número de identificación (ID) único de cada registro.",
26
26
  }),
27
27
  __metadata("design:type", Number)
28
28
  ], Master.prototype, "id", void 0);
29
29
  __decorate([
30
- (0, typeorm_1.Column)({ length: 30, unique: true, comment: 'Código único del master.' }),
30
+ (0, typeorm_1.Column)({ length: 30, unique: true, comment: "Código único del master." }),
31
31
  __metadata("design:type", String)
32
32
  ], Master.prototype, "code", void 0);
33
33
  __decorate([
@@ -35,23 +35,23 @@ var Master = /** @class */ (function () {
35
35
  length: 14,
36
36
  nullable: true,
37
37
  unique: true,
38
- comment: 'Número de documento del master.',
38
+ comment: "Número de documento del master.",
39
39
  }),
40
40
  __metadata("design:type", String)
41
41
  ], Master.prototype, "document", void 0);
42
42
  __decorate([
43
- (0, typeorm_1.Column)({ length: 50, comment: 'Nombre del master.' }),
43
+ (0, typeorm_1.Column)({ length: 50, comment: "Nombre del master." }),
44
44
  __metadata("design:type", String)
45
45
  ], Master.prototype, "name", void 0);
46
46
  __decorate([
47
- (0, typeorm_1.Column)({ length: 50, comment: 'Apellidos del master.' }),
47
+ (0, typeorm_1.Column)({ length: 50, comment: "Apellidos del master." }),
48
48
  __metadata("design:type", String)
49
49
  ], Master.prototype, "surname", void 0);
50
50
  __decorate([
51
51
  (0, typeorm_1.Column)({
52
52
  length: 100,
53
53
  unique: true,
54
- comment: 'Correo electrónico del master.',
54
+ comment: "Correo electrónico del master.",
55
55
  }),
56
56
  __metadata("design:type", String)
57
57
  ], Master.prototype, "email", void 0);
@@ -59,65 +59,65 @@ var Master = /** @class */ (function () {
59
59
  (0, typeorm_1.Column)({
60
60
  length: 12,
61
61
  unique: true,
62
- comment: 'Número de celular del master.',
62
+ comment: "Número de celular del master.",
63
63
  }),
64
64
  __metadata("design:type", String)
65
65
  ], Master.prototype, "phone", void 0);
66
66
  __decorate([
67
67
  (0, typeorm_1.ManyToOne)(function () { return City_1.City; }, function (city) { return city.masters; }, {
68
- onDelete: 'RESTRICT',
69
- onUpdate: 'NO ACTION',
68
+ onDelete: "RESTRICT",
69
+ onUpdate: "NO ACTION",
70
70
  }),
71
- (0, typeorm_1.JoinColumn)({ name: 'city' }),
71
+ (0, typeorm_1.JoinColumn)({ name: "city" }),
72
72
  __metadata("design:type", City_1.City)
73
73
  ], Master.prototype, "city", void 0);
74
74
  __decorate([
75
- (0, typeorm_1.Column)({ nullable: true, length: 100, comment: 'Dirección del master.' }),
75
+ (0, typeorm_1.Column)({ nullable: true, length: 100, comment: "Dirección del master." }),
76
76
  __metadata("design:type", String)
77
77
  ], Master.prototype, "address", void 0);
78
78
  __decorate([
79
79
  (0, typeorm_1.Column)({
80
80
  length: 255,
81
- comment: 'Contraseña almacenada tipo SHA256 del master.',
81
+ comment: "Contraseña almacenada tipo SHA256 del master.",
82
82
  }),
83
83
  __metadata("design:type", String)
84
84
  ], Master.prototype, "password", void 0);
85
85
  __decorate([
86
86
  (0, typeorm_1.Column)({
87
- type: 'longtext',
87
+ type: "longtext",
88
88
  nullable: true,
89
89
  transformer: jsonTransformer_1.jsonTransformer,
90
- comment: 'Campo de tipo JSON donde se guarda información necesaria para el registro.',
90
+ comment: "Campo de tipo JSON donde se guarda información necesaria para el registro.",
91
91
  }),
92
92
  __metadata("design:type", Object)
93
93
  ], Master.prototype, "profile", void 0);
94
94
  __decorate([
95
95
  (0, typeorm_1.Column)({
96
- type: 'datetime',
96
+ type: "datetime",
97
97
  transformer: new dateTransformer_1.DateTransformer(),
98
- comment: 'Fecha de creación del registro.',
98
+ comment: "Fecha de creación del registro.",
99
99
  }),
100
100
  __metadata("design:type", Date)
101
101
  ], Master.prototype, "created", void 0);
102
102
  __decorate([
103
103
  (0, typeorm_1.Column)({
104
- type: 'datetime',
104
+ type: "datetime",
105
105
  transformer: new dateTransformer_1.DateTransformer(),
106
- comment: 'Fecha de actualización del registro.',
106
+ comment: "Fecha de actualización del registro.",
107
107
  }),
108
108
  __metadata("design:type", Date)
109
109
  ], Master.prototype, "updated", void 0);
110
110
  __decorate([
111
111
  (0, typeorm_1.Column)({
112
112
  default: 1,
113
- comment: '¿El master tiene acceso a la plataforma?:\r\n1. Activo: El master tiene acceso.\r\n0. Inactivo: El master no tiene acceso a la plataforma.',
113
+ comment: "¿El master tiene acceso a la plataforma?:\r\n1. Activo: El master tiene acceso.\r\n0. Inactivo: El master no tiene acceso a la plataforma.",
114
114
  }),
115
115
  __metadata("design:type", Number)
116
116
  ], Master.prototype, "status", void 0);
117
117
  __decorate([
118
118
  (0, typeorm_1.Column)({
119
119
  default: 1,
120
- comment: 'Es el estado para verificar si se envía en la papelera o no.',
120
+ comment: "Es el estado para verificar si se envía en la papelera o no.",
121
121
  }),
122
122
  __metadata("design:type", Number)
123
123
  ], Master.prototype, "visible", void 0);
@@ -128,14 +128,14 @@ var Master = /** @class */ (function () {
128
128
  __decorate([
129
129
  (0, typeorm_1.ManyToMany)(function () { return MasterRole_1.MasterRole; }),
130
130
  (0, typeorm_1.JoinTable)({
131
- name: 'master_assigned_role',
131
+ name: "master_assigned_role",
132
132
  joinColumn: {
133
- name: 'master',
134
- referencedColumnName: 'id',
133
+ name: "master",
134
+ referencedColumnName: "id",
135
135
  },
136
136
  inverseJoinColumn: {
137
- name: 'role',
138
- referencedColumnName: 'id',
137
+ name: "role",
138
+ referencedColumnName: "id",
139
139
  },
140
140
  }),
141
141
  __metadata("design:type", Array)
@@ -156,13 +156,28 @@ var Master = /** @class */ (function () {
156
156
  (0, typeorm_1.OneToMany)(function () { return __1.ReassignReview; }, function (reassignReview) { return reassignReview.new_user; }),
157
157
  __metadata("design:type", Array)
158
158
  ], Master.prototype, "reassign_review_news", void 0);
159
+ __decorate([
160
+ (0, typeorm_1.ManyToMany)(function () { return __1.MasterNotification; }),
161
+ (0, typeorm_1.JoinTable)({
162
+ name: "master_to_notification",
163
+ joinColumn: {
164
+ name: "master_notification",
165
+ referencedColumnName: "id",
166
+ },
167
+ inverseJoinColumn: {
168
+ name: "master",
169
+ referencedColumnName: "id",
170
+ },
171
+ }),
172
+ __metadata("design:type", Array)
173
+ ], Master.prototype, "masters_to_notification", void 0);
159
174
  __decorate([
160
175
  (0, typeorm_1.OneToMany)(function () { return __1.PartnerNotification; }, function (partner_notification) { return partner_notification.master; }),
161
176
  __metadata("design:type", Array)
162
177
  ], Master.prototype, "masters_notification", void 0);
163
178
  Master = __decorate([
164
179
  (0, typeorm_1.Entity)({
165
- comment: 'Tabla agregada para los usuarios qué son administradores de la plataforma.',
180
+ comment: "Tabla agregada para los usuarios qué son administradores de la plataforma.",
166
181
  })
167
182
  ], Master);
168
183
  return Master;
@@ -1,11 +1,12 @@
1
- import { Master } from '..';
1
+ import { Master, Partner } from "..";
2
2
  export declare class MasterNotification {
3
3
  id: number;
4
4
  master: Master;
5
+ partner: Partner;
5
6
  name: string;
6
7
  description: string;
7
8
  settings: any;
8
- type: number;
9
9
  status: number;
10
10
  created: Date;
11
+ master_to_notifications: Master[];
11
12
  }
@@ -19,22 +19,32 @@ var MasterNotification = /** @class */ (function () {
19
19
  }
20
20
  __decorate([
21
21
  (0, typeorm_1.PrimaryGeneratedColumn)({
22
- comment: 'ID único para cada notificación',
22
+ comment: "ID único para cada notificación",
23
23
  }),
24
24
  __metadata("design:type", Number)
25
25
  ], MasterNotification.prototype, "id", void 0);
26
26
  __decorate([
27
27
  (0, typeorm_1.ManyToOne)(function () { return __1.Master; }, function (master) { return master.master_notifications; }, {
28
- onDelete: 'CASCADE',
29
- onUpdate: 'NO ACTION',
28
+ onDelete: "CASCADE",
29
+ onUpdate: "NO ACTION",
30
+ nullable: true,
30
31
  }),
31
- (0, typeorm_1.JoinColumn)({ name: 'master' }),
32
+ (0, typeorm_1.JoinColumn)({ name: "master" }),
32
33
  __metadata("design:type", __1.Master)
33
34
  ], MasterNotification.prototype, "master", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.ManyToOne)(function () { return __1.Partner; }, function (partner) { return partner.partner_notifications; }, {
37
+ onDelete: "CASCADE",
38
+ onUpdate: "NO ACTION",
39
+ nullable: true,
40
+ }),
41
+ (0, typeorm_1.JoinColumn)({ name: "partner" }),
42
+ __metadata("design:type", __1.Partner)
43
+ ], MasterNotification.prototype, "partner", void 0);
34
44
  __decorate([
35
45
  (0, typeorm_1.Column)({
36
46
  length: 200,
37
- comment: 'Nombre de la notificación.',
47
+ comment: "Nombre de la notificación.",
38
48
  }),
39
49
  __metadata("design:type", String)
40
50
  ], MasterNotification.prototype, "name", void 0);
@@ -42,44 +52,44 @@ var MasterNotification = /** @class */ (function () {
42
52
  (0, typeorm_1.Column)({
43
53
  length: 400,
44
54
  nullable: true,
45
- comment: 'Descripción de la notificación.',
55
+ comment: "Descripción de la notificación.",
46
56
  }),
47
57
  __metadata("design:type", String)
48
58
  ], MasterNotification.prototype, "description", void 0);
49
59
  __decorate([
50
60
  (0, typeorm_1.Column)({
51
- type: 'text',
61
+ type: "text",
52
62
  nullable: true,
53
63
  transformer: jsonTransformer_1.jsonTransformer,
54
- comment: 'Configuración adicional de la notificación, como enlaces, qué hace después de darle click...',
64
+ comment: "Configuración adicional de la notificación, como enlaces, qué hace después de darle click...",
55
65
  }),
56
66
  __metadata("design:type", Object)
57
67
  ], MasterNotification.prototype, "settings", void 0);
58
68
  __decorate([
59
69
  (0, typeorm_1.Column)({
60
70
  default: 1,
61
- comment: 'Si la notificación está pendiente o leída:\r\n1. Pendiente.\r\n2. Leída.',
62
- }),
63
- __metadata("design:type", Number)
64
- ], MasterNotification.prototype, "type", void 0);
65
- __decorate([
66
- (0, typeorm_1.Column)({
67
- default: 1,
68
- comment: 'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
71
+ comment: "Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.",
69
72
  }),
70
73
  __metadata("design:type", Number)
71
74
  ], MasterNotification.prototype, "status", void 0);
72
75
  __decorate([
73
76
  (0, typeorm_1.Column)({
74
- type: 'datetime',
75
- comment: 'Fecha de creación de la notificación.',
77
+ type: "datetime",
78
+ comment: "Fecha de creación de la notificación.",
76
79
  transformer: new dateTransformer_1.DateTransformer(),
77
80
  }),
78
81
  __metadata("design:type", Date)
79
82
  ], MasterNotification.prototype, "created", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.ManyToMany)(function () { return __1.Master; }),
85
+ (0, typeorm_1.JoinTable)({
86
+ name: "master_to_notification",
87
+ }),
88
+ __metadata("design:type", Array)
89
+ ], MasterNotification.prototype, "master_to_notifications", void 0);
80
90
  MasterNotification = __decorate([
81
- (0, typeorm_1.Entity)('master_notification', {
82
- comment: 'Tabla creada para las notificaciones del master (administrador) de la plataforma.',
91
+ (0, typeorm_1.Entity)("master_notification", {
92
+ comment: "Tabla creada para las notificaciones del master (administrador) de la plataforma.",
83
93
  })
84
94
  ], MasterNotification);
85
95
  return MasterNotification;
@@ -6,7 +6,7 @@ import { PartnerRole } from "./PartnerRole";
6
6
  import { Terminal } from "./Terminal";
7
7
  import { TerminalSession } from "./TerminalSession";
8
8
  import { PartnerNotification } from "./PartnerNotification";
9
- import { VerifyLocal } from "..";
9
+ import { MasterNotification, VerifyLocal } from "..";
10
10
  export declare class Partner {
11
11
  id: number;
12
12
  company: Company;
@@ -35,4 +35,5 @@ export declare class Partner {
35
35
  partners_notification: PartnerNotification[];
36
36
  verifyLocals: VerifyLocal[];
37
37
  partners_to_notification: PartnerNotification[];
38
+ partner_notifications: MasterNotification[];
38
39
  }
@@ -226,6 +226,10 @@ var Partner = /** @class */ (function () {
226
226
  }),
227
227
  __metadata("design:type", Array)
228
228
  ], Partner.prototype, "partners_to_notification", void 0);
229
+ __decorate([
230
+ (0, typeorm_1.OneToMany)(function () { return __1.MasterNotification; }, function (master_notification) { return master_notification.master; }),
231
+ __metadata("design:type", Array)
232
+ ], Partner.prototype, "partner_notifications", void 0);
229
233
  Partner = __decorate([
230
234
  (0, typeorm_1.Entity)({
231
235
  comment: "Tabla agregada para los usuarios qué quieran registrar su local o empresa de comida rápida en la plataforma.\r\n\r\nEste usuario es independiente a los usuarios de la tabla `user` ya que tiene diferentes plataformas.\r\n\r\nTambién van a estar los usuarios qué el administrador/dueño desee agregar como empleados/colaboradores.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "2.8.8",
3
+ "version": "2.8.9",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -7,149 +7,167 @@ import {
7
7
  ManyToOne,
8
8
  OneToMany,
9
9
  PrimaryGeneratedColumn,
10
- } from 'typeorm'
11
- import { MasterNotification, PartnerNotification, ReassignReview, VerifyLocal } from '..'
12
- import { DateTransformer } from '../transformers/dateTransformer'
13
- import { jsonTransformer } from '../transformers/jsonTransformer'
14
- import { City } from './City'
15
- import { DiscountCodeCompany } from './DiscountCodeCompany'
16
- import { MasterRole } from './MasterRole'
10
+ } from "typeorm";
11
+ import {
12
+ MasterNotification,
13
+ PartnerNotification,
14
+ ReassignReview,
15
+ VerifyLocal,
16
+ } from "..";
17
+ import { DateTransformer } from "../transformers/dateTransformer";
18
+ import { jsonTransformer } from "../transformers/jsonTransformer";
19
+ import { City } from "./City";
20
+ import { DiscountCodeCompany } from "./DiscountCodeCompany";
21
+ import { MasterRole } from "./MasterRole";
17
22
 
18
23
  @Entity({
19
24
  comment:
20
- 'Tabla agregada para los usuarios qué son administradores de la plataforma.',
25
+ "Tabla agregada para los usuarios qué son administradores de la plataforma.",
21
26
  })
22
27
  export class Master {
23
28
  @PrimaryGeneratedColumn({
24
- comment: 'Número de identificación (ID) único de cada registro.',
29
+ comment: "Número de identificación (ID) único de cada registro.",
25
30
  })
26
- id: number
31
+ id: number;
27
32
 
28
- @Column({ length: 30, unique: true, comment: 'Código único del master.' })
29
- code: string
33
+ @Column({ length: 30, unique: true, comment: "Código único del master." })
34
+ code: string;
30
35
 
31
36
  @Column({
32
37
  length: 14,
33
38
  nullable: true,
34
39
  unique: true,
35
- comment: 'Número de documento del master.',
40
+ comment: "Número de documento del master.",
36
41
  })
37
- document: string
42
+ document: string;
38
43
 
39
- @Column({ length: 50, comment: 'Nombre del master.' })
40
- name: string
44
+ @Column({ length: 50, comment: "Nombre del master." })
45
+ name: string;
41
46
 
42
- @Column({ length: 50, comment: 'Apellidos del master.' })
43
- surname: string
47
+ @Column({ length: 50, comment: "Apellidos del master." })
48
+ surname: string;
44
49
 
45
50
  @Column({
46
51
  length: 100,
47
52
  unique: true,
48
- comment: 'Correo electrónico del master.',
53
+ comment: "Correo electrónico del master.",
49
54
  })
50
- email: string
55
+ email: string;
51
56
 
52
57
  @Column({
53
58
  length: 12,
54
59
  unique: true,
55
- comment: 'Número de celular del master.',
60
+ comment: "Número de celular del master.",
56
61
  })
57
- phone: string
62
+ phone: string;
58
63
 
59
64
  @ManyToOne(() => City, (city) => city.masters, {
60
- onDelete: 'RESTRICT',
61
- onUpdate: 'NO ACTION',
65
+ onDelete: "RESTRICT",
66
+ onUpdate: "NO ACTION",
62
67
  })
63
- @JoinColumn({ name: 'city' })
64
- city: City
68
+ @JoinColumn({ name: "city" })
69
+ city: City;
65
70
 
66
- @Column({ nullable: true, length: 100, comment: 'Dirección del master.' })
67
- address: string
71
+ @Column({ nullable: true, length: 100, comment: "Dirección del master." })
72
+ address: string;
68
73
 
69
74
  @Column({
70
75
  length: 255,
71
- comment: 'Contraseña almacenada tipo SHA256 del master.',
76
+ comment: "Contraseña almacenada tipo SHA256 del master.",
72
77
  })
73
- password: string
78
+ password: string;
74
79
 
75
80
  @Column({
76
- type: 'longtext',
81
+ type: "longtext",
77
82
  nullable: true,
78
83
  transformer: jsonTransformer,
79
84
  comment:
80
- 'Campo de tipo JSON donde se guarda información necesaria para el registro.',
85
+ "Campo de tipo JSON donde se guarda información necesaria para el registro.",
81
86
  })
82
- profile: any
87
+ profile: any;
83
88
 
84
89
  @Column({
85
- type: 'datetime',
90
+ type: "datetime",
86
91
  transformer: new DateTransformer(),
87
- comment: 'Fecha de creación del registro.',
92
+ comment: "Fecha de creación del registro.",
88
93
  })
89
- created: Date
94
+ created: Date;
90
95
 
91
96
  @Column({
92
- type: 'datetime',
97
+ type: "datetime",
93
98
  transformer: new DateTransformer(),
94
- comment: 'Fecha de actualización del registro.',
99
+ comment: "Fecha de actualización del registro.",
95
100
  })
96
- updated: Date
101
+ updated: Date;
97
102
 
98
103
  @Column({
99
104
  default: 1,
100
105
  comment:
101
- '¿El master tiene acceso a la plataforma?:\r\n1. Activo: El master tiene acceso.\r\n0. Inactivo: El master no tiene acceso a la plataforma.',
106
+ "¿El master tiene acceso a la plataforma?:\r\n1. Activo: El master tiene acceso.\r\n0. Inactivo: El master no tiene acceso a la plataforma.",
102
107
  })
103
- status: number
108
+ status: number;
104
109
 
105
110
  @Column({
106
111
  default: 1,
107
- comment:
108
- 'Es el estado para verificar si se envía en la papelera o no.',
112
+ comment: "Es el estado para verificar si se envía en la papelera o no.",
109
113
  })
110
- visible: number
114
+ visible: number;
111
115
 
112
116
  @OneToMany(
113
117
  () => DiscountCodeCompany,
114
118
  (discountCodeCompany) => discountCodeCompany.updated_by
115
119
  )
116
- discount_code_companies: DiscountCodeCompany[]
120
+ discount_code_companies: DiscountCodeCompany[];
117
121
 
118
122
  @ManyToMany(() => MasterRole)
119
123
  @JoinTable({
120
- name: 'master_assigned_role',
124
+ name: "master_assigned_role",
121
125
  joinColumn: {
122
- name: 'master',
123
- referencedColumnName: 'id',
126
+ name: "master",
127
+ referencedColumnName: "id",
124
128
  },
125
129
  inverseJoinColumn: {
126
- name: 'role',
127
- referencedColumnName: 'id',
130
+ name: "role",
131
+ referencedColumnName: "id",
128
132
  },
129
133
  })
130
- masters_roles: MasterRole[]
134
+ masters_roles: MasterRole[];
131
135
 
132
136
  @OneToMany(() => VerifyLocal, (verifyLocal) => verifyLocal.partner)
133
- verifyLocals: VerifyLocal[]
137
+ verifyLocals: VerifyLocal[];
134
138
 
135
139
  @OneToMany(
136
140
  () => MasterNotification,
137
141
  (masterNotification) => masterNotification.master
138
142
  )
139
- master_notifications: MasterNotification[]
143
+ master_notifications: MasterNotification[];
140
144
 
141
145
  @OneToMany(
142
146
  () => ReassignReview,
143
147
  (reassignReview) => reassignReview.previous_master
144
148
  )
145
- reassign_reviews: ReassignReview[]
149
+ reassign_reviews: ReassignReview[];
146
150
 
147
151
  @OneToMany(() => ReassignReview, (reassignReview) => reassignReview.new_user)
148
- reassign_review_news: ReassignReview[]
152
+ reassign_review_news: ReassignReview[];
153
+
154
+ @ManyToMany(() => MasterNotification)
155
+ @JoinTable({
156
+ name: "master_to_notification",
157
+ joinColumn: {
158
+ name: "master_notification",
159
+ referencedColumnName: "id",
160
+ },
161
+ inverseJoinColumn: {
162
+ name: "master",
163
+ referencedColumnName: "id",
164
+ },
165
+ })
166
+ masters_to_notification: MasterNotification[];
149
167
 
150
168
  @OneToMany(
151
169
  () => PartnerNotification,
152
170
  (partner_notification) => partner_notification.master
153
171
  )
154
- masters_notification: PartnerNotification[]
172
+ masters_notification: PartnerNotification[];
155
173
  }
@@ -2,70 +2,80 @@ import {
2
2
  Column,
3
3
  Entity,
4
4
  JoinColumn,
5
+ JoinTable,
6
+ ManyToMany,
5
7
  ManyToOne,
6
8
  PrimaryGeneratedColumn,
7
- } from 'typeorm'
8
- import { Master } from '..'
9
- import { DateTransformer } from '../transformers/dateTransformer'
10
- import { jsonTransformer } from '../transformers/jsonTransformer'
9
+ } from "typeorm";
10
+ import { Master, Partner } from "..";
11
+ import { DateTransformer } from "../transformers/dateTransformer";
12
+ import { jsonTransformer } from "../transformers/jsonTransformer";
11
13
 
12
- @Entity('master_notification', {
14
+ @Entity("master_notification", {
13
15
  comment:
14
- 'Tabla creada para las notificaciones del master (administrador) de la plataforma.',
16
+ "Tabla creada para las notificaciones del master (administrador) de la plataforma.",
15
17
  })
16
18
  export class MasterNotification {
17
19
  @PrimaryGeneratedColumn({
18
- comment: 'ID único para cada notificación',
20
+ comment: "ID único para cada notificación",
19
21
  })
20
- id: number
22
+ id: number;
21
23
 
22
24
  @ManyToOne(() => Master, (master) => master.master_notifications, {
23
- onDelete: 'CASCADE',
24
- onUpdate: 'NO ACTION',
25
+ onDelete: "CASCADE",
26
+ onUpdate: "NO ACTION",
27
+ nullable: true,
25
28
  })
26
- @JoinColumn({ name: 'master' })
27
- master: Master
29
+ @JoinColumn({ name: "master" })
30
+ master: Master;
31
+
32
+ @ManyToOne(() => Partner, (partner) => partner.partner_notifications, {
33
+ onDelete: "CASCADE",
34
+ onUpdate: "NO ACTION",
35
+ nullable: true,
36
+ })
37
+ @JoinColumn({ name: "partner" })
38
+ partner: Partner;
28
39
 
29
40
  @Column({
30
41
  length: 200,
31
- comment: 'Nombre de la notificación.',
42
+ comment: "Nombre de la notificación.",
32
43
  })
33
- name: string
44
+ name: string;
34
45
 
35
46
  @Column({
36
47
  length: 400,
37
48
  nullable: true,
38
- comment: 'Descripción de la notificación.',
49
+ comment: "Descripción de la notificación.",
39
50
  })
40
- description: string
51
+ description: string;
41
52
 
42
53
  @Column({
43
- type: 'text',
54
+ type: "text",
44
55
  nullable: true,
45
56
  transformer: jsonTransformer,
46
57
  comment:
47
- 'Configuración adicional de la notificación, como enlaces, qué hace después de darle click...',
58
+ "Configuración adicional de la notificación, como enlaces, qué hace después de darle click...",
48
59
  })
49
- settings: any
60
+ settings: any;
50
61
 
51
62
  @Column({
52
63
  default: 1,
53
64
  comment:
54
- 'Si la notificación está pendiente o leída:\r\n1. Pendiente.\r\n2. Leída.',
65
+ "Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.",
55
66
  })
56
- type: number
67
+ status: number;
57
68
 
58
69
  @Column({
59
- default: 1,
60
- comment:
61
- 'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
70
+ type: "datetime",
71
+ comment: "Fecha de creación de la notificación.",
72
+ transformer: new DateTransformer(),
62
73
  })
63
- status: number
74
+ created: Date;
64
75
 
65
- @Column({
66
- type: 'datetime',
67
- comment: 'Fecha de creación de la notificación.',
68
- transformer: new DateTransformer(),
76
+ @ManyToMany(() => Master)
77
+ @JoinTable({
78
+ name: "master_to_notification",
69
79
  })
70
- created: Date
80
+ master_to_notifications: Master[];
71
81
  }
@@ -19,7 +19,7 @@ import { Terminal } from "./Terminal";
19
19
  import { TerminalSession } from "./TerminalSession";
20
20
  import { DateTransformer } from "../transformers/dateTransformer";
21
21
  import { PartnerNotification } from "./PartnerNotification";
22
- import { VerifyLocal } from "..";
22
+ import { MasterNotification, VerifyLocal } from "..";
23
23
 
24
24
  @Entity({
25
25
  comment:
@@ -211,4 +211,10 @@ export class Partner {
211
211
  },
212
212
  })
213
213
  partners_to_notification: PartnerNotification[];
214
+
215
+ @OneToMany(
216
+ () => MasterNotification,
217
+ (master_notification) => master_notification.master
218
+ )
219
+ partner_notifications: MasterNotification[];
214
220
  }