@infrab4a/connect 0.12.0 → 0.13.0-beta.0

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.
@@ -1816,11 +1816,36 @@
1816
1816
  return SubscriptionFirestoreRepository;
1817
1817
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1818
1818
 
1819
+ var UserSearch = /** @class */ (function (_super) {
1820
+ __extends(UserSearch, _super);
1821
+ function UserSearch() {
1822
+ return _super !== null && _super.apply(this, arguments) || this;
1823
+ }
1824
+ UserSearch.prototype.identifierFields = function () {
1825
+ return ['id'];
1826
+ };
1827
+ return UserSearch;
1828
+ }(BaseModel));
1829
+
1830
+ var UserSearchFirestoreRepository = /** @class */ (function (_super) {
1831
+ __extends(UserSearchFirestoreRepository, _super);
1832
+ function UserSearchFirestoreRepository(firestore) {
1833
+ var _this = _super.call(this) || this;
1834
+ _this.firestore = firestore;
1835
+ _this.collectionName = 'userSearch';
1836
+ _this.model = UserSearch;
1837
+ return _this;
1838
+ }
1839
+ return UserSearchFirestoreRepository;
1840
+ }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1841
+
1819
1842
  var UserFirestoreRepository = /** @class */ (function (_super_1) {
1820
1843
  __extends(UserFirestoreRepository, _super_1);
1821
- function UserFirestoreRepository(firestore) {
1844
+ function UserFirestoreRepository(firestore, userSearchFirestoreRepository) {
1845
+ if (userSearchFirestoreRepository === void 0) { userSearchFirestoreRepository = new UserSearchFirestoreRepository(firestore); }
1822
1846
  var _this = _super_1.call(this) || this;
1823
1847
  _this.firestore = firestore;
1848
+ _this.userSearchFirestoreRepository = userSearchFirestoreRepository;
1824
1849
  _this.collectionName = 'users';
1825
1850
  _this.model = User;
1826
1851
  return _this;
@@ -1849,6 +1874,20 @@
1849
1874
  });
1850
1875
  });
1851
1876
  };
1877
+ UserFirestoreRepository.prototype.checkIfExistsByField = function (field, value) {
1878
+ return __awaiter(this, void 0, void 0, function () {
1879
+ var result;
1880
+ var _a;
1881
+ return __generator(this, function (_b) {
1882
+ switch (_b.label) {
1883
+ case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find([(_a = {}, _a[field] = { operator: exports.Where.EQUALS, value: value }, _a)])];
1884
+ case 1:
1885
+ result = _b.sent();
1886
+ return [2 /*return*/, result.count > 0];
1887
+ }
1888
+ });
1889
+ });
1890
+ };
1852
1891
  UserFirestoreRepository.prototype.buildModelInstance = function () {
1853
1892
  var _a = _super_1.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
1854
1893
  return {
@@ -2496,6 +2535,7 @@
2496
2535
  exports.UserFirestoreRepository = UserFirestoreRepository;
2497
2536
  exports.UserPaymentMethod = UserPaymentMethod;
2498
2537
  exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreRepository;
2538
+ exports.UserSearchFirestoreRepository = UserSearchFirestoreRepository;
2499
2539
  exports.Variant = Variant;
2500
2540
  exports.WeakPasswordError = WeakPasswordError;
2501
2541
  exports.withCreateFirestore = withCreateFirestore;