test-entity-library-asm 2.7.13 → 2.7.15
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.
- package/dist/CustomRepository.d.ts +5 -1
- package/dist/CustomRepository.js +186 -1
- package/dist/interfaces.d.ts +6 -0
- package/dist/views/ViewLocalsCompanies.d.ts +2 -0
- package/dist/views/ViewLocalsCompanies.js +8 -0
- package/package.json +1 -1
- package/src/CustomRepository.ts +228 -1
- package/src/interfaces.ts +7 -0
- package/src/views/ViewLocalsCompanies.ts +6 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataSource, EntityTarget, Repository, ObjectLiteral } from 'typeorm';
|
|
2
|
-
import { IBasicLazyEvent, IPropsDiscountUserOrCompany, IPropsQueryVerifyLocal } from './interfaces';
|
|
2
|
+
import { IBasicCompany, IBasicLazyEvent, IPropsDiscountUserOrCompany, IPropsQueryVerifyLocal } from './interfaces';
|
|
3
3
|
export declare class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
|
|
4
4
|
constructor(target: EntityTarget<T>, dataSource: DataSource);
|
|
5
5
|
getVerifyLocals({ status, lazyEvent }: IPropsQueryVerifyLocal): Promise<{
|
|
@@ -14,5 +14,9 @@ export declare class CustomRepository<T extends ObjectLiteral> extends Repositor
|
|
|
14
14
|
data: T[];
|
|
15
15
|
totalRecords: number;
|
|
16
16
|
}>;
|
|
17
|
+
getLocalsCompanyInformation({ company, status, visible, lazyEvent, }: IBasicCompany): Promise<false | {
|
|
18
|
+
data: T[];
|
|
19
|
+
totalRecords: number;
|
|
20
|
+
}>;
|
|
17
21
|
anyOtherRepository(args: any): Promise<void>;
|
|
18
22
|
}
|
package/dist/CustomRepository.js
CHANGED
|
@@ -184,7 +184,7 @@ var CustomRepository = /** @class */ (function (_super) {
|
|
|
184
184
|
// DOC: Filtro global
|
|
185
185
|
if (lazyEvent.filters['global'] && lazyEvent.filters['global'].value) {
|
|
186
186
|
globalValue = "%".concat(lazyEvent.filters['global'].value.toLowerCase(), "%");
|
|
187
|
-
queryBuilder.andWhere('LOWER(discount_code_user.local_name) LIKE :globalValue OR LOWER(partner_surname) LIKE :globalValue OR LOWER(discount_code_user.code) LIKE :globalValue OR LOWER(discount_code_user.discount) LIKE :globalValue OR LOWER(partner_name) LIKE :globalValue', {
|
|
187
|
+
queryBuilder.andWhere('(LOWER(discount_code_user.local_name) LIKE :globalValue OR LOWER(partner_surname) LIKE :globalValue OR LOWER(discount_code_user.code) LIKE :globalValue OR LOWER(discount_code_user.discount) LIKE :globalValue OR LOWER(partner_name) LIKE :globalValue)', {
|
|
188
188
|
globalValue: globalValue ||
|
|
189
189
|
(0, utils_1.getStatusBasic)(lazyEvent.filters['global'].value.toLowerCase()) ||
|
|
190
190
|
(0, utils_1.getSeverityNameDiscountType)(lazyEvent.filters['global'].value.toLowerCase()),
|
|
@@ -520,6 +520,191 @@ var CustomRepository = /** @class */ (function (_super) {
|
|
|
520
520
|
});
|
|
521
521
|
});
|
|
522
522
|
};
|
|
523
|
+
CustomRepository.prototype.getLocalsCompanyInformation = function (_a) {
|
|
524
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
525
|
+
var timezone_2, queryBuilder_2, globalValue, filters_2, order, _c, locals, totalRecords, error_2;
|
|
526
|
+
var company = _b.company, status = _b.status, visible = _b.visible, lazyEvent = _b.lazyEvent;
|
|
527
|
+
return __generator(this, function (_d) {
|
|
528
|
+
switch (_d.label) {
|
|
529
|
+
case 0:
|
|
530
|
+
_d.trys.push([0, 2, , 3]);
|
|
531
|
+
timezone_2 = (0, _1.getTimezoneOffset)((0, _1.getTimeZone)());
|
|
532
|
+
queryBuilder_2 = this
|
|
533
|
+
.createQueryBuilder('view_locals_companies')
|
|
534
|
+
.skip(lazyEvent.first)
|
|
535
|
+
.take(lazyEvent.rows);
|
|
536
|
+
// DOC: Filtro global
|
|
537
|
+
if (lazyEvent.filters['global'] && lazyEvent.filters['global'].value) {
|
|
538
|
+
globalValue = "%".concat(lazyEvent.filters['global'].value.toLowerCase(), "%");
|
|
539
|
+
queryBuilder_2.andWhere('(LOWER(view_locals_companies.name_local) LIKE :globalValue OR LOWER(view_locals_companies.country_name) LIKE :globalValue OR LOWER(view_locals_companies.city_name) LIKE :globalValue OR LOWER(view_locals_companies.address) LIKE :globalValue OR LOWER(view_locals_companies.cellphone) LIKE :globalValue OR LOWER(view_locals_companies.email) LIKE :globalValue OR LOWER(view_locals_companies.pos_system_name) LIKE :globalValue OR LOWER(view_locals_companies.created_local) LIKE :globalValue OR LOWER(view_locals_companies.updated_local) LIKE :globalValue)', {
|
|
540
|
+
globalValue: globalValue ||
|
|
541
|
+
(0, utils_1.getStatusBasic)(lazyEvent.filters['global'].value.toLowerCase()),
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
// DOC: Filtro por estado FILTRO POR DEFECTO
|
|
545
|
+
if (status !== null && status >= 0) {
|
|
546
|
+
queryBuilder_2.andWhere('view_locals_companies.status = :status', {
|
|
547
|
+
status: status,
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
// DOC: Filtro por company FILTRO POR DEFECTO
|
|
551
|
+
if (company !== null && company >= 0) {
|
|
552
|
+
queryBuilder_2.andWhere('view_locals_companies.company = :company', {
|
|
553
|
+
company: company,
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
if (visible !== null) {
|
|
557
|
+
queryBuilder_2.andWhere('view_locals_companies.visible = :visible', {
|
|
558
|
+
visible: visible,
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
filters_2 = lazyEvent.filters;
|
|
562
|
+
Object.keys(filters_2).forEach(function (key) {
|
|
563
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
564
|
+
var _l, _m;
|
|
565
|
+
var value = filters_2[key].value;
|
|
566
|
+
if ((Array.isArray(value) && value.length > 0) ||
|
|
567
|
+
(!Array.isArray(value) && value && key !== 'global')) {
|
|
568
|
+
var matchMode = filters_2[key].matchMode;
|
|
569
|
+
if (!Array.isArray(value) && value) {
|
|
570
|
+
value = filters_2[key].value.toLowerCase();
|
|
571
|
+
}
|
|
572
|
+
var accessKey = key.split('.').length > 1 ? "".concat(key) : "view_locals_companies.".concat(key);
|
|
573
|
+
switch (matchMode) {
|
|
574
|
+
case 'custom':
|
|
575
|
+
if (key === 'total_partners' && matchMode === 'custom') {
|
|
576
|
+
var _o = value || [null, null], from = _o[0], to = _o[1];
|
|
577
|
+
if (from !== null && to === null) {
|
|
578
|
+
queryBuilder_2.andWhere("view_locals_companies.".concat(key, " >= :from"), {
|
|
579
|
+
from: from,
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
else if (from === null && to !== null) {
|
|
583
|
+
queryBuilder_2.andWhere("view_locals_companies.".concat(key, " <= :to"), {
|
|
584
|
+
to: to,
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
else if (from !== null && to !== null) {
|
|
588
|
+
queryBuilder_2.andWhere("view_locals_companies.".concat(key, " BETWEEN :from AND :to"), { from: from, to: to });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
break;
|
|
592
|
+
case 'contains':
|
|
593
|
+
queryBuilder_2.andWhere("".concat(accessKey, " LIKE :").concat(key), (_a = {},
|
|
594
|
+
_a[key] = "%".concat(value, "%"),
|
|
595
|
+
_a));
|
|
596
|
+
break;
|
|
597
|
+
case 'startsWith':
|
|
598
|
+
queryBuilder_2.andWhere("".concat(accessKey, " LIKE :").concat(key), (_b = {},
|
|
599
|
+
_b[key] = "".concat(value, "%"),
|
|
600
|
+
_b));
|
|
601
|
+
break;
|
|
602
|
+
case 'endsWith':
|
|
603
|
+
queryBuilder_2.andWhere("".concat(accessKey, " LIKE :").concat(key), (_c = {},
|
|
604
|
+
_c[key] = "".concat(value, "%"),
|
|
605
|
+
_c));
|
|
606
|
+
break;
|
|
607
|
+
case 'equals':
|
|
608
|
+
if (key === 'status') {
|
|
609
|
+
queryBuilder_2.andWhere('view_locals_companies.status = :status', {
|
|
610
|
+
status: (0, utils_1.getStatusBasic)((_l = filters_2[key].value) !== null && _l !== void 0 ? _l : ''),
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
else if (key === 'typeText') {
|
|
614
|
+
queryBuilder_2.andWhere('view_locals_companies.type = :type', {
|
|
615
|
+
type: (0, utils_1.getSeverityNameDiscountType)((_m = filters_2[key].value) !== null && _m !== void 0 ? _m : ''),
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
else if (key === 'has_square') {
|
|
619
|
+
var hasSI = filters_2[key].value.includes('SI');
|
|
620
|
+
var hasNO = filters_2[key].value.includes('NO');
|
|
621
|
+
var queryPlazolet = hasSI && hasNO
|
|
622
|
+
? ''
|
|
623
|
+
: hasSI
|
|
624
|
+
? 'view_locals_companies.has_square IS NOT NULL'
|
|
625
|
+
: hasNO
|
|
626
|
+
? 'view_locals_companies.has_square IS NULL'
|
|
627
|
+
: '';
|
|
628
|
+
if (queryPlazolet !== '') {
|
|
629
|
+
queryBuilder_2.andWhere(queryPlazolet);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
queryBuilder_2.andWhere("".concat(accessKey, " = :").concat(key), (_d = {},
|
|
634
|
+
_d[key] = value,
|
|
635
|
+
_d));
|
|
636
|
+
}
|
|
637
|
+
break;
|
|
638
|
+
case 'notContains':
|
|
639
|
+
queryBuilder_2.andWhere("".concat(accessKey, " NOT LIKE :").concat(key), (_e = {},
|
|
640
|
+
_e[key] = "%".concat(value, "%"),
|
|
641
|
+
_e));
|
|
642
|
+
break;
|
|
643
|
+
case 'notEquals':
|
|
644
|
+
queryBuilder_2.andWhere("".concat(accessKey, " != :").concat(key), (_f = {},
|
|
645
|
+
_f[key] = value,
|
|
646
|
+
_f));
|
|
647
|
+
break;
|
|
648
|
+
case 'dateIs':
|
|
649
|
+
queryBuilder_2.andWhere("".concat(key !== 'expiration' && key !== 'start'
|
|
650
|
+
? 'DATE(CONVERT_TZ('
|
|
651
|
+
: '', " ").concat(accessKey, " ").concat(key !== 'expiration' && key !== 'start'
|
|
652
|
+
? ", '+00:00', '".concat(timezone_2, "'))")
|
|
653
|
+
: '', " = :").concat(key), (_g = {},
|
|
654
|
+
_g[key] = value.split('T')[0],
|
|
655
|
+
_g));
|
|
656
|
+
break;
|
|
657
|
+
case 'dateIsNot':
|
|
658
|
+
queryBuilder_2.andWhere("".concat(key !== 'expiration' && key !== 'start'
|
|
659
|
+
? 'DATE(CONVERT_TZ('
|
|
660
|
+
: '', " ").concat(accessKey, " ").concat(key !== 'expiration' && key !== 'start'
|
|
661
|
+
? ", '+00:00', '".concat(timezone_2, "'))")
|
|
662
|
+
: '', " != :").concat(key), (_h = {},
|
|
663
|
+
_h[key] = value.split('T')[0],
|
|
664
|
+
_h));
|
|
665
|
+
break;
|
|
666
|
+
case 'dateBefore':
|
|
667
|
+
queryBuilder_2.andWhere("".concat(key !== 'expiration' && key !== 'start'
|
|
668
|
+
? 'DATE(CONVERT_TZ('
|
|
669
|
+
: '', " ").concat(accessKey, " ").concat(key !== 'expiration' && key !== 'start'
|
|
670
|
+
? ", '+00:00', '".concat(timezone_2, "'))")
|
|
671
|
+
: '', " < :").concat(key), (_j = {},
|
|
672
|
+
_j[key] = value.split('T')[0],
|
|
673
|
+
_j));
|
|
674
|
+
break;
|
|
675
|
+
case 'dateAfter':
|
|
676
|
+
queryBuilder_2.andWhere("".concat(key !== 'expiration' && key !== 'start'
|
|
677
|
+
? 'DATE(CONVERT_TZ('
|
|
678
|
+
: '', " ").concat(accessKey, " ").concat(key !== 'expiration' && key !== 'start'
|
|
679
|
+
? ", '+00:00', '".concat(timezone_2, "'))")
|
|
680
|
+
: '', " > :").concat(key), (_k = {},
|
|
681
|
+
_k[key] = value.split('T')[0],
|
|
682
|
+
_k));
|
|
683
|
+
break;
|
|
684
|
+
default:
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
if (lazyEvent.sortField) {
|
|
690
|
+
order = lazyEvent.sortOrder === 1 ? 'ASC' : 'DESC';
|
|
691
|
+
queryBuilder_2.orderBy("view_locals_companies.".concat(lazyEvent.sortField), order);
|
|
692
|
+
}
|
|
693
|
+
return [4 /*yield*/, queryBuilder_2.getManyAndCount()];
|
|
694
|
+
case 1:
|
|
695
|
+
_c = _d.sent(), locals = _c[0], totalRecords = _c[1];
|
|
696
|
+
return [2 /*return*/, {
|
|
697
|
+
data: locals,
|
|
698
|
+
totalRecords: totalRecords,
|
|
699
|
+
}];
|
|
700
|
+
case 2:
|
|
701
|
+
error_2 = _d.sent();
|
|
702
|
+
return [2 /*return*/, false];
|
|
703
|
+
case 3: return [2 /*return*/];
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
});
|
|
707
|
+
};
|
|
523
708
|
CustomRepository.prototype.anyOtherRepository = function (args) {
|
|
524
709
|
return __awaiter(this, void 0, void 0, function () {
|
|
525
710
|
return __generator(this, function (_a) {
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ export interface IBasicLazyEvent {
|
|
|
23
23
|
filters: any;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
export interface IBasicCompany extends IBasicLazyEvent {
|
|
27
|
+
status: number | null;
|
|
28
|
+
company: number | null;
|
|
29
|
+
visible?: number | null;
|
|
30
|
+
owner?: number | null;
|
|
31
|
+
}
|
|
26
32
|
export interface IPropsQueryVerifyLocal {
|
|
27
33
|
status: number;
|
|
28
34
|
lazyEvent: {
|
|
@@ -89,6 +89,14 @@ var ViewLocalsCompanies = /** @class */ (function () {
|
|
|
89
89
|
(0, typeorm_1.ViewColumn)(),
|
|
90
90
|
__metadata("design:type", String)
|
|
91
91
|
], ViewLocalsCompanies.prototype, "email", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.ViewColumn)(),
|
|
94
|
+
__metadata("design:type", Number)
|
|
95
|
+
], ViewLocalsCompanies.prototype, "isVerifyPhone", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.ViewColumn)(),
|
|
98
|
+
__metadata("design:type", Number)
|
|
99
|
+
], ViewLocalsCompanies.prototype, "isVerifyEmail", void 0);
|
|
92
100
|
__decorate([
|
|
93
101
|
(0, typeorm_1.ViewColumn)(),
|
|
94
102
|
__metadata("design:type", String)
|
package/package.json
CHANGED
package/src/CustomRepository.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataSource, EntityTarget, Repository, ObjectLiteral } from 'typeorm'
|
|
2
2
|
import {
|
|
3
|
+
IBasicCompany,
|
|
3
4
|
IBasicLazyEvent,
|
|
4
5
|
IPropsDiscountUserOrCompany,
|
|
5
6
|
IPropsQueryVerifyLocal,
|
|
@@ -172,7 +173,7 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
|
|
|
172
173
|
if (lazyEvent.filters['global'] && lazyEvent.filters['global'].value) {
|
|
173
174
|
const globalValue = `%${lazyEvent.filters['global'].value.toLowerCase()}%`
|
|
174
175
|
queryBuilder.andWhere(
|
|
175
|
-
'LOWER(discount_code_user.local_name) LIKE :globalValue OR LOWER(partner_surname) LIKE :globalValue OR LOWER(discount_code_user.code) LIKE :globalValue OR LOWER(discount_code_user.discount) LIKE :globalValue OR LOWER(partner_name) LIKE :globalValue',
|
|
176
|
+
'(LOWER(discount_code_user.local_name) LIKE :globalValue OR LOWER(partner_surname) LIKE :globalValue OR LOWER(discount_code_user.code) LIKE :globalValue OR LOWER(discount_code_user.discount) LIKE :globalValue OR LOWER(partner_name) LIKE :globalValue)',
|
|
176
177
|
{
|
|
177
178
|
globalValue:
|
|
178
179
|
globalValue ||
|
|
@@ -596,6 +597,232 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
|
|
|
596
597
|
}
|
|
597
598
|
}
|
|
598
599
|
|
|
600
|
+
async getLocalsCompanyInformation({
|
|
601
|
+
company,
|
|
602
|
+
status,
|
|
603
|
+
visible,
|
|
604
|
+
lazyEvent,
|
|
605
|
+
}: IBasicCompany) {
|
|
606
|
+
try {
|
|
607
|
+
|
|
608
|
+
const timezone = getTimezoneOffset(getTimeZone())
|
|
609
|
+
|
|
610
|
+
const queryBuilder = this
|
|
611
|
+
.createQueryBuilder('view_locals_companies')
|
|
612
|
+
.skip(lazyEvent.first)
|
|
613
|
+
.take(lazyEvent.rows)
|
|
614
|
+
|
|
615
|
+
// DOC: Filtro global
|
|
616
|
+
if (lazyEvent.filters['global'] && lazyEvent.filters['global'].value) {
|
|
617
|
+
const globalValue = `%${lazyEvent.filters['global'].value.toLowerCase()}%`
|
|
618
|
+
queryBuilder.andWhere(
|
|
619
|
+
'(LOWER(view_locals_companies.name_local) LIKE :globalValue OR LOWER(view_locals_companies.country_name) LIKE :globalValue OR LOWER(view_locals_companies.city_name) LIKE :globalValue OR LOWER(view_locals_companies.address) LIKE :globalValue OR LOWER(view_locals_companies.cellphone) LIKE :globalValue OR LOWER(view_locals_companies.email) LIKE :globalValue OR LOWER(view_locals_companies.pos_system_name) LIKE :globalValue OR LOWER(view_locals_companies.created_local) LIKE :globalValue OR LOWER(view_locals_companies.updated_local) LIKE :globalValue)',
|
|
620
|
+
{
|
|
621
|
+
globalValue:
|
|
622
|
+
globalValue ||
|
|
623
|
+
getStatusBasic(lazyEvent.filters['global'].value.toLowerCase()),
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// DOC: Filtro por estado FILTRO POR DEFECTO
|
|
629
|
+
if (status !== null && status >= 0) {
|
|
630
|
+
queryBuilder.andWhere('view_locals_companies.status = :status', {
|
|
631
|
+
status: status,
|
|
632
|
+
})
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// DOC: Filtro por company FILTRO POR DEFECTO
|
|
636
|
+
if (company !== null && company >= 0) {
|
|
637
|
+
queryBuilder.andWhere('view_locals_companies.company = :company', {
|
|
638
|
+
company: company,
|
|
639
|
+
})
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
if (visible !== null) {
|
|
643
|
+
queryBuilder.andWhere('view_locals_companies.visible = :visible', {
|
|
644
|
+
visible: visible,
|
|
645
|
+
})
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
const filters = lazyEvent.filters
|
|
649
|
+
Object.keys(filters).forEach((key) => {
|
|
650
|
+
let value = filters[key].value
|
|
651
|
+
if (
|
|
652
|
+
(Array.isArray(value) && value.length > 0) ||
|
|
653
|
+
(!Array.isArray(value) && value && key !== 'global')
|
|
654
|
+
) {
|
|
655
|
+
const matchMode = filters[key].matchMode
|
|
656
|
+
if (!Array.isArray(value) && value) {
|
|
657
|
+
value = filters[key].value.toLowerCase()
|
|
658
|
+
}
|
|
659
|
+
const accessKey =
|
|
660
|
+
key.split('.').length > 1 ? `${key}` : `view_locals_companies.${key}`
|
|
661
|
+
|
|
662
|
+
switch (matchMode) {
|
|
663
|
+
case 'custom':
|
|
664
|
+
if (key === 'total_partners' && matchMode === 'custom') {
|
|
665
|
+
const [from, to] = value || [null, null]
|
|
666
|
+
|
|
667
|
+
if (from !== null && to === null) {
|
|
668
|
+
queryBuilder.andWhere(`view_locals_companies.${key} >= :from`, {
|
|
669
|
+
from,
|
|
670
|
+
})
|
|
671
|
+
} else if (from === null && to !== null) {
|
|
672
|
+
queryBuilder.andWhere(`view_locals_companies.${key} <= :to`, {
|
|
673
|
+
to,
|
|
674
|
+
})
|
|
675
|
+
} else if (from !== null && to !== null) {
|
|
676
|
+
queryBuilder.andWhere(
|
|
677
|
+
`view_locals_companies.${key} BETWEEN :from AND :to`,
|
|
678
|
+
{ from, to }
|
|
679
|
+
)
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
break
|
|
683
|
+
case 'contains':
|
|
684
|
+
queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
|
|
685
|
+
[key]: `%${value}%`,
|
|
686
|
+
})
|
|
687
|
+
break
|
|
688
|
+
case 'startsWith':
|
|
689
|
+
queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
|
|
690
|
+
[key]: `${value}%`,
|
|
691
|
+
})
|
|
692
|
+
break
|
|
693
|
+
case 'endsWith':
|
|
694
|
+
queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
|
|
695
|
+
[key]: `${value}%`,
|
|
696
|
+
})
|
|
697
|
+
break
|
|
698
|
+
case 'equals':
|
|
699
|
+
if (key === 'status') {
|
|
700
|
+
queryBuilder.andWhere('view_locals_companies.status = :status', {
|
|
701
|
+
status: getStatusBasic(filters[key].value ?? ''),
|
|
702
|
+
})
|
|
703
|
+
} else if (key === 'typeText') {
|
|
704
|
+
queryBuilder.andWhere('view_locals_companies.type = :type', {
|
|
705
|
+
type: getSeverityNameDiscountType(filters[key].value ?? ''),
|
|
706
|
+
})
|
|
707
|
+
} else if (key === 'has_square') {
|
|
708
|
+
const hasSI = filters[key].value.includes('SI')
|
|
709
|
+
const hasNO = filters[key].value.includes('NO')
|
|
710
|
+
|
|
711
|
+
const queryPlazolet =
|
|
712
|
+
hasSI && hasNO
|
|
713
|
+
? ''
|
|
714
|
+
: hasSI
|
|
715
|
+
? 'view_locals_companies.has_square IS NOT NULL'
|
|
716
|
+
: hasNO
|
|
717
|
+
? 'view_locals_companies.has_square IS NULL'
|
|
718
|
+
: ''
|
|
719
|
+
if (queryPlazolet !== '') {
|
|
720
|
+
queryBuilder.andWhere(queryPlazolet)
|
|
721
|
+
}
|
|
722
|
+
} else {
|
|
723
|
+
queryBuilder.andWhere(`${accessKey} = :${key}`, {
|
|
724
|
+
[key]: value,
|
|
725
|
+
})
|
|
726
|
+
}
|
|
727
|
+
break
|
|
728
|
+
case 'notContains':
|
|
729
|
+
queryBuilder.andWhere(`${accessKey} NOT LIKE :${key}`, {
|
|
730
|
+
[key]: `%${value}%`,
|
|
731
|
+
})
|
|
732
|
+
break
|
|
733
|
+
case 'notEquals':
|
|
734
|
+
queryBuilder.andWhere(`${accessKey} != :${key}`, {
|
|
735
|
+
[key]: value,
|
|
736
|
+
})
|
|
737
|
+
break
|
|
738
|
+
case 'dateIs':
|
|
739
|
+
queryBuilder.andWhere(
|
|
740
|
+
`${
|
|
741
|
+
key !== 'expiration' && key !== 'start'
|
|
742
|
+
? 'DATE(CONVERT_TZ('
|
|
743
|
+
: ''
|
|
744
|
+
} ${accessKey} ${
|
|
745
|
+
key !== 'expiration' && key !== 'start'
|
|
746
|
+
? `, '+00:00', '${timezone}'))`
|
|
747
|
+
: ''
|
|
748
|
+
} = :${key}`,
|
|
749
|
+
{
|
|
750
|
+
[key]: value.split('T')[0],
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
break
|
|
754
|
+
case 'dateIsNot':
|
|
755
|
+
queryBuilder.andWhere(
|
|
756
|
+
`${
|
|
757
|
+
key !== 'expiration' && key !== 'start'
|
|
758
|
+
? 'DATE(CONVERT_TZ('
|
|
759
|
+
: ''
|
|
760
|
+
} ${accessKey} ${
|
|
761
|
+
key !== 'expiration' && key !== 'start'
|
|
762
|
+
? `, '+00:00', '${timezone}'))`
|
|
763
|
+
: ''
|
|
764
|
+
} != :${key}`,
|
|
765
|
+
{
|
|
766
|
+
[key]: value.split('T')[0],
|
|
767
|
+
}
|
|
768
|
+
)
|
|
769
|
+
break
|
|
770
|
+
case 'dateBefore':
|
|
771
|
+
queryBuilder.andWhere(
|
|
772
|
+
`${
|
|
773
|
+
key !== 'expiration' && key !== 'start'
|
|
774
|
+
? 'DATE(CONVERT_TZ('
|
|
775
|
+
: ''
|
|
776
|
+
} ${accessKey} ${
|
|
777
|
+
key !== 'expiration' && key !== 'start'
|
|
778
|
+
? `, '+00:00', '${timezone}'))`
|
|
779
|
+
: ''
|
|
780
|
+
} < :${key}`,
|
|
781
|
+
{
|
|
782
|
+
[key]: value.split('T')[0],
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
break
|
|
786
|
+
case 'dateAfter':
|
|
787
|
+
queryBuilder.andWhere(
|
|
788
|
+
`${
|
|
789
|
+
key !== 'expiration' && key !== 'start'
|
|
790
|
+
? 'DATE(CONVERT_TZ('
|
|
791
|
+
: ''
|
|
792
|
+
} ${accessKey} ${
|
|
793
|
+
key !== 'expiration' && key !== 'start'
|
|
794
|
+
? `, '+00:00', '${timezone}'))`
|
|
795
|
+
: ''
|
|
796
|
+
} > :${key}`,
|
|
797
|
+
{
|
|
798
|
+
[key]: value.split('T')[0],
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
break
|
|
802
|
+
default:
|
|
803
|
+
break
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
})
|
|
807
|
+
|
|
808
|
+
if (lazyEvent.sortField) {
|
|
809
|
+
const order = lazyEvent.sortOrder === 1 ? 'ASC' : 'DESC'
|
|
810
|
+
queryBuilder.orderBy(
|
|
811
|
+
`view_locals_companies.${lazyEvent.sortField}`,
|
|
812
|
+
order
|
|
813
|
+
)
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
const [locals, totalRecords] = await queryBuilder.getManyAndCount()
|
|
817
|
+
return {
|
|
818
|
+
data: locals,
|
|
819
|
+
totalRecords,
|
|
820
|
+
}
|
|
821
|
+
} catch (error) {
|
|
822
|
+
return false
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
599
826
|
async anyOtherRepository(args: any) {
|
|
600
827
|
// Implementa otro método personalizado aquí
|
|
601
828
|
}
|
package/src/interfaces.ts
CHANGED
|
@@ -27,6 +27,13 @@ export interface IBasicLazyEvent {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export interface IBasicCompany extends IBasicLazyEvent {
|
|
31
|
+
status: number | null
|
|
32
|
+
company: number | null
|
|
33
|
+
visible?: number | null
|
|
34
|
+
owner?: number | null
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
export interface IPropsQueryVerifyLocal {
|
|
31
38
|
status: number
|
|
32
39
|
lazyEvent: {
|
|
@@ -66,6 +66,12 @@ export class ViewLocalsCompanies {
|
|
|
66
66
|
@ViewColumn()
|
|
67
67
|
email: string
|
|
68
68
|
|
|
69
|
+
@ViewColumn()
|
|
70
|
+
isVerifyPhone: number
|
|
71
|
+
|
|
72
|
+
@ViewColumn()
|
|
73
|
+
isVerifyEmail: number
|
|
74
|
+
|
|
69
75
|
@ViewColumn()
|
|
70
76
|
address: string
|
|
71
77
|
|
|
@@ -74,5 +80,4 @@ export class ViewLocalsCompanies {
|
|
|
74
80
|
|
|
75
81
|
@ViewColumn()
|
|
76
82
|
company: number
|
|
77
|
-
|
|
78
83
|
}
|