@infrab4a/connect 0.14.1-beta.0 → 0.14.1
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/bundles/infrab4a-connect.umd.js +7 -10
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/lib/domain/users/use-cases/register.js +3 -3
- package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +6 -8
- package/fesm2015/infrab4a-connect.js +7 -9
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -1044,11 +1044,11 @@
|
|
|
1044
1044
|
return [4 /*yield*/, this.userRepository.checkIfExistsByField('cpf', params.cpf)];
|
|
1045
1045
|
case 1:
|
|
1046
1046
|
if (_a.sent())
|
|
1047
|
-
throw new UserAlreadyRegisteredError("
|
|
1047
|
+
throw new UserAlreadyRegisteredError("Usu\u00E1rio com CPF " + params.cpf + " j\u00E1 registrado.");
|
|
1048
1048
|
return [4 /*yield*/, this.userRepository.checkIfExistsByField('email', params.email)];
|
|
1049
1049
|
case 2:
|
|
1050
1050
|
if (_a.sent())
|
|
1051
|
-
throw new UserAlreadyRegisteredError("
|
|
1051
|
+
throw new UserAlreadyRegisteredError("Usu\u00E1rio com e-mail " + params.email + " j\u00E1 registrado.");
|
|
1052
1052
|
return [4 /*yield*/, this.registerService.register({
|
|
1053
1053
|
birthday: params.birthday,
|
|
1054
1054
|
email: email,
|
|
@@ -1578,23 +1578,20 @@
|
|
|
1578
1578
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
1579
1579
|
_this.makeFirestoreWhere = function (queryReference, filter) { return Object.keys(filter).reduce(function (query, fieldName) { return _this.buildWhereSentence(query, fieldName, filter[fieldName]); }, queryReference); };
|
|
1580
1580
|
_this.buildWhereSentence = function (queryReference, fieldName, options) {
|
|
1581
|
-
var _b;
|
|
1582
1581
|
if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
|
|
1583
1582
|
return queryReference;
|
|
1584
|
-
var plainInstance = new _this.model((_b = {}, _b[fieldName] = options === null || options === void 0 ? void 0 : options.value, _b)).toPlain();
|
|
1585
|
-
var firestoreFieldName = Object.keys(plainInstance).find(function (key) { return plainInstance[key] === (options === null || options === void 0 ? void 0 : options.value); });
|
|
1586
1583
|
if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
|
|
1587
1584
|
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1588
|
-
return queryReference.where(
|
|
1589
|
-
queryReference = queryReference.where(
|
|
1590
|
-
queryReference = queryReference.where(
|
|
1585
|
+
return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
|
|
1586
|
+
queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
|
|
1587
|
+
queryReference = queryReference.where(fieldName.toString(), '<=', options.value + "~");
|
|
1591
1588
|
return queryReference;
|
|
1592
1589
|
}
|
|
1593
1590
|
if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1594
|
-
return queryReference.where(
|
|
1591
|
+
return queryReference.where(fieldName.toString(), 'array-contains', options.value);
|
|
1595
1592
|
if (lodash.isObject(options) && lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) && lodash.isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
1596
1593
|
return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName + "." + key, options[key]); }, queryReference);
|
|
1597
|
-
return queryReference.where(
|
|
1594
|
+
return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1598
1595
|
};
|
|
1599
1596
|
return _this;
|
|
1600
1597
|
}
|