test-entity-library-asm 1.9.6 → 1.9.7

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.
@@ -6,6 +6,7 @@ import { Plan } from './Plan';
6
6
  import { ProductTopping } from './ProductTopping';
7
7
  import { TypeFood } from './TypeFood';
8
8
  import { Partner } from './Partner';
9
+ import { PartnerRole } from './PartnerRole';
9
10
  export declare class Company {
10
11
  id: number;
11
12
  name: string;
@@ -27,4 +28,5 @@ export declare class Company {
27
28
  discount_code_users: DiscountCodeUser[];
28
29
  product_toppings: ProductTopping[];
29
30
  partners_company: Partner[];
31
+ roles_company: PartnerRole[];
30
32
  }
@@ -19,6 +19,7 @@ var Plan_1 = require("./Plan");
19
19
  var ProductTopping_1 = require("./ProductTopping");
20
20
  var TypeFood_1 = require("./TypeFood");
21
21
  var Partner_1 = require("./Partner");
22
+ var PartnerRole_1 = require("./PartnerRole");
22
23
  var Company = /** @class */ (function () {
23
24
  function Company() {
24
25
  }
@@ -147,6 +148,10 @@ var Company = /** @class */ (function () {
147
148
  (0, typeorm_1.OneToMany)(function () { return Partner_1.Partner; }, function (partner) { return partner.company; }),
148
149
  __metadata("design:type", Array)
149
150
  ], Company.prototype, "partners_company", void 0);
151
+ __decorate([
152
+ (0, typeorm_1.OneToMany)(function () { return PartnerRole_1.PartnerRole; }, function (partnerRole) { return partnerRole.company; }),
153
+ __metadata("design:type", Array)
154
+ ], Company.prototype, "roles_company", void 0);
150
155
  Company = __decorate([
151
156
  (0, typeorm_1.Entity)({
152
157
  comment: 'Tabla creada para las empresas de comida rápida que deseen registrarse en la plataforma.',
@@ -1,8 +1,10 @@
1
1
  import { PartnerPermission } from './PartnerPermission';
2
2
  import { Partner } from './Partner';
3
+ import { Company } from './Company';
3
4
  export declare class PartnerRole {
4
5
  id: number;
5
6
  code: string;
7
+ company: Company;
6
8
  name: string;
7
9
  description: string;
8
10
  status: number;
@@ -13,6 +13,7 @@ exports.PartnerRole = void 0;
13
13
  var typeorm_1 = require("typeorm");
14
14
  var PartnerPermission_1 = require("./PartnerPermission");
15
15
  var Partner_1 = require("./Partner");
16
+ var Company_1 = require("./Company");
16
17
  var PartnerRole = /** @class */ (function () {
17
18
  function PartnerRole() {
18
19
  }
@@ -26,6 +27,15 @@ var PartnerRole = /** @class */ (function () {
26
27
  (0, typeorm_1.Column)({ length: 10, unique: true, comment: 'Código único del rol.' }),
27
28
  __metadata("design:type", String)
28
29
  ], PartnerRole.prototype, "code", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.ManyToOne)(function () { return Company_1.Company; }, function (company) { return company.roles_company; }, {
32
+ onDelete: 'CASCADE',
33
+ onUpdate: 'NO ACTION',
34
+ nullable: true,
35
+ }),
36
+ (0, typeorm_1.JoinColumn)({ name: 'company' }),
37
+ __metadata("design:type", Company_1.Company)
38
+ ], PartnerRole.prototype, "company", void 0);
29
39
  __decorate([
30
40
  (0, typeorm_1.Column)({
31
41
  length: 40,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,6 +17,7 @@ import { ProductTopping } from './ProductTopping'
17
17
  import { TypeFood } from './TypeFood'
18
18
  import { User } from './User'
19
19
  import { Partner } from './Partner'
20
+ import { PartnerRole } from './PartnerRole'
20
21
 
21
22
  @Entity({
22
23
  comment:
@@ -139,4 +140,7 @@ export class Company {
139
140
 
140
141
  @OneToMany(() => Partner, (partner) => partner.company)
141
142
  partners_company: Partner[]
143
+
144
+ @OneToMany(() => PartnerRole, (partnerRole) => partnerRole.company)
145
+ roles_company: PartnerRole[]
142
146
  }
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  Column,
3
3
  Entity,
4
+ JoinColumn,
4
5
  JoinTable,
5
6
  ManyToMany,
7
+ ManyToOne,
6
8
  PrimaryGeneratedColumn,
7
9
  } from 'typeorm'
8
10
  import { PartnerPermission } from './PartnerPermission'
9
11
  import { Partner } from './Partner'
12
+ import { Company } from './Company'
10
13
 
11
14
  @Entity('partner_role', {
12
15
  comment:
@@ -21,6 +24,14 @@ export class PartnerRole {
21
24
  @Column({ length: 10, unique: true, comment: 'Código único del rol.' })
22
25
  code: string
23
26
 
27
+ @ManyToOne(() => Company, (company) => company.roles_company, {
28
+ onDelete: 'CASCADE',
29
+ onUpdate: 'NO ACTION',
30
+ nullable: true,
31
+ })
32
+ @JoinColumn({ name: 'company' })
33
+ company: Company
34
+
24
35
  @Column({
25
36
  length: 40,
26
37
  comment: