test-entity-library-asm 2.3.6 → 2.3.8

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.
@@ -69,6 +69,7 @@ var CustomRepository = /** @class */ (function (_super) {
69
69
  queryBuilder = this.createQueryBuilder('verify_local')
70
70
  .skip(lazyEvent.first)
71
71
  .take(lazyEvent.rows);
72
+ // Filtro global
72
73
  if (lazyEvent.filters['global'] && lazyEvent.filters['global'].value) {
73
74
  globalValue = "%".concat(lazyEvent.filters['global'].value.toLowerCase(), "%");
74
75
  queryBuilder.andWhere('LOWER(JSON_UNQUOTE(JSON_EXTRACT(verify_local.local_information, "$.name"))) LIKE :globalValue OR LOWER(JSON_UNQUOTE(JSON_EXTRACT(verify_local.local_information, "$.addressElement"))) LIKE :globalValue', { globalValue: globalValue });
@@ -8,6 +8,7 @@ import { Plan } from './Plan';
8
8
  import { ProductTopping } from './ProductTopping';
9
9
  export declare class Company {
10
10
  id: number;
11
+ code: string;
11
12
  name: string;
12
13
  city: City;
13
14
  partner: Partner;
@@ -28,6 +28,10 @@ var Company = /** @class */ (function () {
28
28
  }),
29
29
  __metadata("design:type", Number)
30
30
  ], Company.prototype, "id", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({ length: 30, unique: true, comment: 'Código único de la empresa.' }),
33
+ __metadata("design:type", String)
34
+ ], Company.prototype, "code", void 0);
31
35
  __decorate([
32
36
  (0, typeorm_1.Column)({ length: 50, comment: 'Nombre de la empresa.' }),
33
37
  __metadata("design:type", String)
@@ -1,9 +1,11 @@
1
1
  import { CodeRedemptionHistoryUser } from './CodeRedemptionHistoryUser';
2
2
  import { Company } from './Company';
3
3
  import { Partner } from './Partner';
4
+ import { Local } from '..';
4
5
  export declare class DiscountCodeUser {
5
6
  id: number;
6
7
  company: Company;
8
+ local: Local;
7
9
  code: string;
8
10
  discount: string;
9
11
  type: number;
@@ -14,6 +14,7 @@ var typeorm_1 = require("typeorm");
14
14
  var CodeRedemptionHistoryUser_1 = require("./CodeRedemptionHistoryUser");
15
15
  var Company_1 = require("./Company");
16
16
  var Partner_1 = require("./Partner");
17
+ var __1 = require("..");
17
18
  var DiscountCodeUser = /** @class */ (function () {
18
19
  function DiscountCodeUser() {
19
20
  }
@@ -31,6 +32,15 @@ var DiscountCodeUser = /** @class */ (function () {
31
32
  (0, typeorm_1.JoinColumn)({ name: 'company' }),
32
33
  __metadata("design:type", Company_1.Company)
33
34
  ], DiscountCodeUser.prototype, "company", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.ManyToOne)(function () { return __1.Local; }, function (local) { return local.discount_code_locals; }, {
37
+ onDelete: 'CASCADE',
38
+ onUpdate: 'NO ACTION',
39
+ nullable: true,
40
+ }),
41
+ (0, typeorm_1.JoinColumn)({ name: 'local' }),
42
+ __metadata("design:type", __1.Local)
43
+ ], DiscountCodeUser.prototype, "local", void 0);
34
44
  __decorate([
35
45
  (0, typeorm_1.Column)({ length: 10, comment: 'Código del descuento para compartirlo.' }),
36
46
  __metadata("design:type", String)
@@ -10,7 +10,7 @@ import { Terminal } from './Terminal';
10
10
  import { User } from './User';
11
11
  import { Partner } from './Partner';
12
12
  import { BusinessTypeProduct } from './BusinessTypeProduct';
13
- import { PosSystem } from '..';
13
+ import { DiscountCodeUser, PosSystem } from '..';
14
14
  export declare class Local {
15
15
  id: number;
16
16
  company: Company;
@@ -36,4 +36,5 @@ export declare class Local {
36
36
  terminals: Terminal[];
37
37
  users_favorite_local: User[];
38
38
  business_type_products: BusinessTypeProduct[];
39
+ discount_code_locals: DiscountCodeUser[];
39
40
  }
@@ -187,6 +187,10 @@ var Local = /** @class */ (function () {
187
187
  }),
188
188
  __metadata("design:type", Array)
189
189
  ], Local.prototype, "business_type_products", void 0);
190
+ __decorate([
191
+ (0, typeorm_1.OneToMany)(function () { return __1.DiscountCodeUser; }, function (discountCodeUser) { return discountCodeUser.local; }),
192
+ __metadata("design:type", Array)
193
+ ], Local.prototype, "discount_code_locals", void 0);
190
194
  Local = __decorate([
191
195
  (0, typeorm_1.Entity)({ comment: 'Locales disponibles de las empresas (company).' })
192
196
  ], Local);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,6 +12,7 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
12
12
  .skip(lazyEvent.first)
13
13
  .take(lazyEvent.rows)
14
14
 
15
+ // Filtro global
15
16
  if (lazyEvent.filters['global'] && lazyEvent.filters['global'].value) {
16
17
  const globalValue = `%${lazyEvent.filters['global'].value.toLowerCase()}%`
17
18
  queryBuilder.andWhere(
@@ -25,6 +25,9 @@ export class Company {
25
25
  })
26
26
  id: number
27
27
 
28
+ @Column({ length: 30, unique: true, comment: 'Código único de la empresa.' })
29
+ code: string
30
+
28
31
  @Column({ length: 50, comment: 'Nombre de la empresa.' })
29
32
  name: string
30
33
 
@@ -9,6 +9,7 @@ import {
9
9
  import { CodeRedemptionHistoryUser } from './CodeRedemptionHistoryUser'
10
10
  import { Company } from './Company'
11
11
  import { Partner } from './Partner'
12
+ import { Local } from '..'
12
13
 
13
14
  @Entity('discount_code_user', {
14
15
  comment: 'Códigos de descuento para los usuarios.',
@@ -26,6 +27,14 @@ export class DiscountCodeUser {
26
27
  @JoinColumn({ name: 'company' })
27
28
  company: Company
28
29
 
30
+ @ManyToOne(() => Local, (local) => local.discount_code_locals, {
31
+ onDelete: 'CASCADE',
32
+ onUpdate: 'NO ACTION',
33
+ nullable: true,
34
+ })
35
+ @JoinColumn({ name: 'local' })
36
+ local: Local
37
+
29
38
  @Column({ length: 10, comment: 'Código del descuento para compartirlo.' })
30
39
  code: string
31
40
 
@@ -20,7 +20,7 @@ import { Terminal } from './Terminal'
20
20
  import { User } from './User'
21
21
  import { Partner } from './Partner'
22
22
  import { BusinessTypeProduct } from './BusinessTypeProduct'
23
- import { PosSystem } from '..'
23
+ import { DiscountCodeUser, PosSystem } from '..'
24
24
  import { jsonTransformer } from '../transformers/jsonTransformer'
25
25
 
26
26
  @Entity({ comment: 'Locales disponibles de las empresas (company).' })
@@ -165,4 +165,8 @@ export class Local {
165
165
  },
166
166
  })
167
167
  business_type_products: BusinessTypeProduct[]
168
+
169
+ @OneToMany(() => DiscountCodeUser, (discountCodeUser) => discountCodeUser.local)
170
+ discount_code_locals: DiscountCodeUser[]
168
171
  }
172
+