@blackcode_sa/metaestetics-api 1.6.16 → 1.6.18
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/admin/index.js +1 -3
- package/dist/admin/index.mjs +1 -3
- package/dist/index.d.mts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +167 -22
- package/dist/index.mjs +238 -86
- package/package.json +1 -1
- package/src/admin/aggregation/appointment/appointment.aggregation.service.ts +0 -2
- package/src/admin/users/user-profile.admin.ts +404 -0
- package/src/config/firebase.ts +17 -1
- package/src/services/appointment/appointment.service.ts +238 -0
- package/src/services/auth.v2.service.ts +959 -0
- package/src/services/user.v2.service.ts +466 -0
package/dist/index.mjs
CHANGED
|
@@ -471,17 +471,21 @@ import { getFirestore } from "firebase/firestore";
|
|
|
471
471
|
import { getAuth } from "firebase/auth";
|
|
472
472
|
import { getAnalytics } from "firebase/analytics";
|
|
473
473
|
import { Platform } from "react-native";
|
|
474
|
+
import { getStorage } from "firebase/storage";
|
|
475
|
+
import { getFunctions } from "firebase/functions";
|
|
474
476
|
var firebaseInstance = null;
|
|
475
477
|
var initializeFirebase = (config) => {
|
|
476
478
|
if (!firebaseInstance) {
|
|
477
479
|
const app = initializeApp(config);
|
|
478
480
|
const db = getFirestore(app);
|
|
479
481
|
const auth = getAuth(app);
|
|
482
|
+
const storage = getStorage(app);
|
|
483
|
+
const functions = getFunctions(app);
|
|
480
484
|
let analytics = null;
|
|
481
485
|
if (typeof window !== "undefined" && Platform.OS === "web") {
|
|
482
486
|
analytics = getAnalytics(app);
|
|
483
487
|
}
|
|
484
|
-
firebaseInstance = { app, db, auth, analytics };
|
|
488
|
+
firebaseInstance = { app, db, auth, analytics, storage, functions };
|
|
485
489
|
}
|
|
486
490
|
return firebaseInstance;
|
|
487
491
|
};
|
|
@@ -846,13 +850,13 @@ var FirebaseErrorCode = /* @__PURE__ */ ((FirebaseErrorCode2) => {
|
|
|
846
850
|
})(FirebaseErrorCode || {});
|
|
847
851
|
|
|
848
852
|
// src/services/base.service.ts
|
|
849
|
-
import { getStorage } from "firebase/storage";
|
|
853
|
+
import { getStorage as getStorage2 } from "firebase/storage";
|
|
850
854
|
var BaseService = class {
|
|
851
855
|
constructor(db, auth, app) {
|
|
852
856
|
this.db = db;
|
|
853
857
|
this.auth = auth;
|
|
854
858
|
this.app = app;
|
|
855
|
-
this.storage =
|
|
859
|
+
this.storage = getStorage2(app);
|
|
856
860
|
}
|
|
857
861
|
/**
|
|
858
862
|
* Generiše jedinstveni ID za dokumente
|
|
@@ -5036,7 +5040,7 @@ import { z as z16 } from "zod";
|
|
|
5036
5040
|
|
|
5037
5041
|
// src/services/clinic/utils/photos.utils.ts
|
|
5038
5042
|
import {
|
|
5039
|
-
getStorage as
|
|
5043
|
+
getStorage as getStorage3,
|
|
5040
5044
|
ref as ref2,
|
|
5041
5045
|
uploadBytes as uploadBytes2,
|
|
5042
5046
|
getDownloadURL as getDownloadURL2,
|
|
@@ -5050,7 +5054,7 @@ async function uploadPhoto(photo, entityType, entityId, photoType, app, fileName
|
|
|
5050
5054
|
console.log(
|
|
5051
5055
|
`[PHOTO_UTILS] Uploading ${photoType} for ${entityType}/${entityId}`
|
|
5052
5056
|
);
|
|
5053
|
-
const storage =
|
|
5057
|
+
const storage = getStorage3(app);
|
|
5054
5058
|
const storageFileName = fileName || `${photoType}-${Date.now()}`;
|
|
5055
5059
|
const storageRef = ref2(
|
|
5056
5060
|
storage,
|
|
@@ -8085,20 +8089,20 @@ var ProcedureService = class extends BaseService {
|
|
|
8085
8089
|
const proceduresCollection = collection15(this.db, PROCEDURES_COLLECTION);
|
|
8086
8090
|
let proceduresQuery = query15(proceduresCollection);
|
|
8087
8091
|
if (pagination && pagination > 0) {
|
|
8088
|
-
const { limit:
|
|
8092
|
+
const { limit: limit13, startAfter: startAfter13 } = await import("firebase/firestore");
|
|
8089
8093
|
if (lastDoc) {
|
|
8090
8094
|
proceduresQuery = query15(
|
|
8091
8095
|
proceduresCollection,
|
|
8092
8096
|
orderBy4("name"),
|
|
8093
8097
|
// Use imported orderBy
|
|
8094
|
-
|
|
8095
|
-
|
|
8098
|
+
startAfter13(lastDoc),
|
|
8099
|
+
limit13(pagination)
|
|
8096
8100
|
);
|
|
8097
8101
|
} else {
|
|
8098
8102
|
proceduresQuery = query15(
|
|
8099
8103
|
proceduresCollection,
|
|
8100
8104
|
orderBy4("name"),
|
|
8101
|
-
|
|
8105
|
+
limit13(pagination)
|
|
8102
8106
|
);
|
|
8103
8107
|
}
|
|
8104
8108
|
} else {
|
|
@@ -12249,9 +12253,16 @@ import {
|
|
|
12249
12253
|
Timestamp as Timestamp28,
|
|
12250
12254
|
serverTimestamp as serverTimestamp24,
|
|
12251
12255
|
arrayUnion as arrayUnion8,
|
|
12252
|
-
arrayRemove as arrayRemove7
|
|
12256
|
+
arrayRemove as arrayRemove7,
|
|
12257
|
+
where as where26,
|
|
12258
|
+
orderBy as orderBy13,
|
|
12259
|
+
collection as collection26,
|
|
12260
|
+
query as query26,
|
|
12261
|
+
limit as limit11,
|
|
12262
|
+
startAfter as startAfter11,
|
|
12263
|
+
getDocs as getDocs26
|
|
12253
12264
|
} from "firebase/firestore";
|
|
12254
|
-
import { getFunctions } from "firebase/functions";
|
|
12265
|
+
import { getFunctions as getFunctions2 } from "firebase/functions";
|
|
12255
12266
|
|
|
12256
12267
|
// src/services/appointment/utils/appointment.utils.ts
|
|
12257
12268
|
import {
|
|
@@ -12479,7 +12490,7 @@ var AppointmentService = class extends BaseService {
|
|
|
12479
12490
|
this.practitionerService = practitionerService;
|
|
12480
12491
|
this.clinicService = clinicService;
|
|
12481
12492
|
this.filledDocumentService = filledDocumentService;
|
|
12482
|
-
this.functions =
|
|
12493
|
+
this.functions = getFunctions2(app, "europe-west6");
|
|
12483
12494
|
}
|
|
12484
12495
|
/**
|
|
12485
12496
|
* Gets available booking slots for a specific clinic, practitioner, and procedure using HTTP request.
|
|
@@ -13162,20 +13173,161 @@ var AppointmentService = class extends BaseService {
|
|
|
13162
13173
|
};
|
|
13163
13174
|
return this.updateAppointment(appointmentId, updateData);
|
|
13164
13175
|
}
|
|
13176
|
+
/**
|
|
13177
|
+
* Gets upcoming appointments for a specific patient.
|
|
13178
|
+
* These include appointments with statuses: PENDING, CONFIRMED, CHECKED_IN, IN_PROGRESS
|
|
13179
|
+
*
|
|
13180
|
+
* @param patientId ID of the patient
|
|
13181
|
+
* @param options Optional parameters for filtering and pagination
|
|
13182
|
+
* @returns Found appointments and the last document for pagination
|
|
13183
|
+
*/
|
|
13184
|
+
async getUpcomingPatientAppointments(patientId, options) {
|
|
13185
|
+
try {
|
|
13186
|
+
console.log(
|
|
13187
|
+
`[APPOINTMENT_SERVICE] Getting upcoming appointments for patient: ${patientId}`
|
|
13188
|
+
);
|
|
13189
|
+
const effectiveStartDate = (options == null ? void 0 : options.startDate) || /* @__PURE__ */ new Date();
|
|
13190
|
+
const upcomingStatuses = [
|
|
13191
|
+
"pending" /* PENDING */,
|
|
13192
|
+
"confirmed" /* CONFIRMED */,
|
|
13193
|
+
"checked_in" /* CHECKED_IN */,
|
|
13194
|
+
"in_progress" /* IN_PROGRESS */,
|
|
13195
|
+
"rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */
|
|
13196
|
+
];
|
|
13197
|
+
const constraints = [];
|
|
13198
|
+
constraints.push(where26("patientId", "==", patientId));
|
|
13199
|
+
constraints.push(where26("status", "in", upcomingStatuses));
|
|
13200
|
+
constraints.push(
|
|
13201
|
+
where26(
|
|
13202
|
+
"appointmentStartTime",
|
|
13203
|
+
">=",
|
|
13204
|
+
Timestamp28.fromDate(effectiveStartDate)
|
|
13205
|
+
)
|
|
13206
|
+
);
|
|
13207
|
+
if (options == null ? void 0 : options.endDate) {
|
|
13208
|
+
constraints.push(
|
|
13209
|
+
where26(
|
|
13210
|
+
"appointmentStartTime",
|
|
13211
|
+
"<=",
|
|
13212
|
+
Timestamp28.fromDate(options.endDate)
|
|
13213
|
+
)
|
|
13214
|
+
);
|
|
13215
|
+
}
|
|
13216
|
+
constraints.push(orderBy13("appointmentStartTime", "asc"));
|
|
13217
|
+
if (options == null ? void 0 : options.limit) {
|
|
13218
|
+
constraints.push(limit11(options.limit));
|
|
13219
|
+
}
|
|
13220
|
+
if (options == null ? void 0 : options.startAfter) {
|
|
13221
|
+
constraints.push(startAfter11(options.startAfter));
|
|
13222
|
+
}
|
|
13223
|
+
const q = query26(
|
|
13224
|
+
collection26(this.db, APPOINTMENTS_COLLECTION),
|
|
13225
|
+
...constraints
|
|
13226
|
+
);
|
|
13227
|
+
const querySnapshot = await getDocs26(q);
|
|
13228
|
+
const appointments = querySnapshot.docs.map(
|
|
13229
|
+
(doc33) => doc33.data()
|
|
13230
|
+
);
|
|
13231
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
13232
|
+
console.log(
|
|
13233
|
+
`[APPOINTMENT_SERVICE] Found ${appointments.length} upcoming appointments for patient ${patientId}`
|
|
13234
|
+
);
|
|
13235
|
+
return { appointments, lastDoc };
|
|
13236
|
+
} catch (error) {
|
|
13237
|
+
console.error(
|
|
13238
|
+
`[APPOINTMENT_SERVICE] Error getting upcoming appointments for patient ${patientId}:`,
|
|
13239
|
+
error
|
|
13240
|
+
);
|
|
13241
|
+
throw error;
|
|
13242
|
+
}
|
|
13243
|
+
}
|
|
13244
|
+
/**
|
|
13245
|
+
* Gets past appointments for a specific patient.
|
|
13246
|
+
* These include appointments with statuses: COMPLETED, CANCELED_PATIENT,
|
|
13247
|
+
* CANCELED_PATIENT_RESCHEDULED, CANCELED_CLINIC, NO_SHOW
|
|
13248
|
+
*
|
|
13249
|
+
* @param patientId ID of the patient
|
|
13250
|
+
* @param options Optional parameters for filtering and pagination
|
|
13251
|
+
* @returns Found appointments and the last document for pagination
|
|
13252
|
+
*/
|
|
13253
|
+
async getPastPatientAppointments(patientId, options) {
|
|
13254
|
+
try {
|
|
13255
|
+
console.log(
|
|
13256
|
+
`[APPOINTMENT_SERVICE] Getting past appointments for patient: ${patientId}`
|
|
13257
|
+
);
|
|
13258
|
+
const effectiveEndDate = (options == null ? void 0 : options.endDate) || /* @__PURE__ */ new Date();
|
|
13259
|
+
const pastStatuses = ["completed" /* COMPLETED */];
|
|
13260
|
+
if (options == null ? void 0 : options.showCanceled) {
|
|
13261
|
+
pastStatuses.push(
|
|
13262
|
+
"canceled_patient" /* CANCELED_PATIENT */,
|
|
13263
|
+
"canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */,
|
|
13264
|
+
"canceled_clinic" /* CANCELED_CLINIC */
|
|
13265
|
+
);
|
|
13266
|
+
}
|
|
13267
|
+
if (options == null ? void 0 : options.showNoShow) {
|
|
13268
|
+
pastStatuses.push("no_show" /* NO_SHOW */);
|
|
13269
|
+
}
|
|
13270
|
+
const constraints = [];
|
|
13271
|
+
constraints.push(where26("patientId", "==", patientId));
|
|
13272
|
+
constraints.push(where26("status", "in", pastStatuses));
|
|
13273
|
+
if (options == null ? void 0 : options.startDate) {
|
|
13274
|
+
constraints.push(
|
|
13275
|
+
where26(
|
|
13276
|
+
"appointmentStartTime",
|
|
13277
|
+
">=",
|
|
13278
|
+
Timestamp28.fromDate(options.startDate)
|
|
13279
|
+
)
|
|
13280
|
+
);
|
|
13281
|
+
}
|
|
13282
|
+
constraints.push(
|
|
13283
|
+
where26(
|
|
13284
|
+
"appointmentStartTime",
|
|
13285
|
+
"<=",
|
|
13286
|
+
Timestamp28.fromDate(effectiveEndDate)
|
|
13287
|
+
)
|
|
13288
|
+
);
|
|
13289
|
+
constraints.push(orderBy13("appointmentStartTime", "desc"));
|
|
13290
|
+
if (options == null ? void 0 : options.limit) {
|
|
13291
|
+
constraints.push(limit11(options.limit));
|
|
13292
|
+
}
|
|
13293
|
+
if (options == null ? void 0 : options.startAfter) {
|
|
13294
|
+
constraints.push(startAfter11(options.startAfter));
|
|
13295
|
+
}
|
|
13296
|
+
const q = query26(
|
|
13297
|
+
collection26(this.db, APPOINTMENTS_COLLECTION),
|
|
13298
|
+
...constraints
|
|
13299
|
+
);
|
|
13300
|
+
const querySnapshot = await getDocs26(q);
|
|
13301
|
+
const appointments = querySnapshot.docs.map(
|
|
13302
|
+
(doc33) => doc33.data()
|
|
13303
|
+
);
|
|
13304
|
+
const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
|
|
13305
|
+
console.log(
|
|
13306
|
+
`[APPOINTMENT_SERVICE] Found ${appointments.length} past appointments for patient ${patientId}`
|
|
13307
|
+
);
|
|
13308
|
+
return { appointments, lastDoc };
|
|
13309
|
+
} catch (error) {
|
|
13310
|
+
console.error(
|
|
13311
|
+
`[APPOINTMENT_SERVICE] Error getting past appointments for patient ${patientId}:`,
|
|
13312
|
+
error
|
|
13313
|
+
);
|
|
13314
|
+
throw error;
|
|
13315
|
+
}
|
|
13316
|
+
}
|
|
13165
13317
|
};
|
|
13166
13318
|
|
|
13167
13319
|
// src/services/patient/patientRequirements.service.ts
|
|
13168
13320
|
import {
|
|
13169
|
-
collection as
|
|
13170
|
-
getDocs as
|
|
13171
|
-
query as
|
|
13172
|
-
where as
|
|
13321
|
+
collection as collection27,
|
|
13322
|
+
getDocs as getDocs27,
|
|
13323
|
+
query as query27,
|
|
13324
|
+
where as where27,
|
|
13173
13325
|
doc as doc27,
|
|
13174
13326
|
updateDoc as updateDoc26,
|
|
13175
13327
|
Timestamp as Timestamp29,
|
|
13176
|
-
orderBy as
|
|
13177
|
-
limit as
|
|
13178
|
-
startAfter as
|
|
13328
|
+
orderBy as orderBy14,
|
|
13329
|
+
limit as limit12,
|
|
13330
|
+
startAfter as startAfter12,
|
|
13179
13331
|
getDoc as getDoc29
|
|
13180
13332
|
} from "firebase/firestore";
|
|
13181
13333
|
|
|
@@ -13207,7 +13359,7 @@ var PatientRequirementsService = class extends BaseService {
|
|
|
13207
13359
|
super(db, auth, app);
|
|
13208
13360
|
}
|
|
13209
13361
|
getPatientRequirementsCollectionRef(patientId) {
|
|
13210
|
-
return
|
|
13362
|
+
return collection27(
|
|
13211
13363
|
this.db,
|
|
13212
13364
|
`patients/${patientId}/${PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME}`
|
|
13213
13365
|
);
|
|
@@ -13245,22 +13397,22 @@ var PatientRequirementsService = class extends BaseService {
|
|
|
13245
13397
|
*/
|
|
13246
13398
|
async getAllPatientRequirementInstances(patientId, filters, pageLimit = 20, lastVisible) {
|
|
13247
13399
|
const collRef = this.getPatientRequirementsCollectionRef(patientId);
|
|
13248
|
-
let q =
|
|
13400
|
+
let q = query27(collRef, orderBy14("createdAt", "desc"));
|
|
13249
13401
|
const queryConstraints = [];
|
|
13250
13402
|
if ((filters == null ? void 0 : filters.appointmentId) && filters.appointmentId !== "all") {
|
|
13251
13403
|
queryConstraints.push(
|
|
13252
|
-
|
|
13404
|
+
where27("appointmentId", "==", filters.appointmentId)
|
|
13253
13405
|
);
|
|
13254
13406
|
}
|
|
13255
13407
|
if ((filters == null ? void 0 : filters.statuses) && filters.statuses.length > 0) {
|
|
13256
|
-
queryConstraints.push(
|
|
13408
|
+
queryConstraints.push(where27("overallStatus", "in", filters.statuses));
|
|
13257
13409
|
}
|
|
13258
13410
|
if (lastVisible) {
|
|
13259
|
-
queryConstraints.push(
|
|
13411
|
+
queryConstraints.push(startAfter12(lastVisible));
|
|
13260
13412
|
}
|
|
13261
|
-
queryConstraints.push(
|
|
13262
|
-
q =
|
|
13263
|
-
const snapshot = await
|
|
13413
|
+
queryConstraints.push(limit12(pageLimit));
|
|
13414
|
+
q = query27(collRef, ...queryConstraints);
|
|
13415
|
+
const snapshot = await getDocs27(q);
|
|
13264
13416
|
let requirements = snapshot.docs.map((docSnap) => {
|
|
13265
13417
|
const data = docSnap.data();
|
|
13266
13418
|
return { id: docSnap.id, ...data };
|
|
@@ -13373,13 +13525,13 @@ var PatientRequirementsService = class extends BaseService {
|
|
|
13373
13525
|
// src/backoffice/services/brand.service.ts
|
|
13374
13526
|
import {
|
|
13375
13527
|
addDoc as addDoc3,
|
|
13376
|
-
collection as
|
|
13528
|
+
collection as collection28,
|
|
13377
13529
|
doc as doc28,
|
|
13378
13530
|
getDoc as getDoc30,
|
|
13379
|
-
getDocs as
|
|
13380
|
-
query as
|
|
13531
|
+
getDocs as getDocs28,
|
|
13532
|
+
query as query28,
|
|
13381
13533
|
updateDoc as updateDoc27,
|
|
13382
|
-
where as
|
|
13534
|
+
where as where28
|
|
13383
13535
|
} from "firebase/firestore";
|
|
13384
13536
|
|
|
13385
13537
|
// src/backoffice/types/brand.types.ts
|
|
@@ -13391,7 +13543,7 @@ var BrandService = class extends BaseService {
|
|
|
13391
13543
|
* Gets reference to brands collection
|
|
13392
13544
|
*/
|
|
13393
13545
|
getBrandsRef() {
|
|
13394
|
-
return
|
|
13546
|
+
return collection28(this.db, BRANDS_COLLECTION);
|
|
13395
13547
|
}
|
|
13396
13548
|
/**
|
|
13397
13549
|
* Creates a new brand
|
|
@@ -13411,8 +13563,8 @@ var BrandService = class extends BaseService {
|
|
|
13411
13563
|
* Gets all active brands
|
|
13412
13564
|
*/
|
|
13413
13565
|
async getAll() {
|
|
13414
|
-
const q =
|
|
13415
|
-
const snapshot = await
|
|
13566
|
+
const q = query28(this.getBrandsRef(), where28("isActive", "==", true));
|
|
13567
|
+
const snapshot = await getDocs28(q);
|
|
13416
13568
|
return snapshot.docs.map(
|
|
13417
13569
|
(doc33) => ({
|
|
13418
13570
|
id: doc33.id,
|
|
@@ -13457,13 +13609,13 @@ var BrandService = class extends BaseService {
|
|
|
13457
13609
|
// src/backoffice/services/category.service.ts
|
|
13458
13610
|
import {
|
|
13459
13611
|
addDoc as addDoc4,
|
|
13460
|
-
collection as
|
|
13612
|
+
collection as collection29,
|
|
13461
13613
|
doc as doc29,
|
|
13462
13614
|
getDoc as getDoc31,
|
|
13463
|
-
getDocs as
|
|
13464
|
-
query as
|
|
13615
|
+
getDocs as getDocs29,
|
|
13616
|
+
query as query29,
|
|
13465
13617
|
updateDoc as updateDoc28,
|
|
13466
|
-
where as
|
|
13618
|
+
where as where29
|
|
13467
13619
|
} from "firebase/firestore";
|
|
13468
13620
|
|
|
13469
13621
|
// src/backoffice/types/category.types.ts
|
|
@@ -13475,7 +13627,7 @@ var CategoryService = class extends BaseService {
|
|
|
13475
13627
|
* Referenca na Firestore kolekciju kategorija
|
|
13476
13628
|
*/
|
|
13477
13629
|
get categoriesRef() {
|
|
13478
|
-
return
|
|
13630
|
+
return collection29(this.db, CATEGORIES_COLLECTION);
|
|
13479
13631
|
}
|
|
13480
13632
|
/**
|
|
13481
13633
|
* Kreira novu kategoriju u sistemu
|
|
@@ -13498,8 +13650,8 @@ var CategoryService = class extends BaseService {
|
|
|
13498
13650
|
* @returns Lista aktivnih kategorija
|
|
13499
13651
|
*/
|
|
13500
13652
|
async getAll() {
|
|
13501
|
-
const q =
|
|
13502
|
-
const snapshot = await
|
|
13653
|
+
const q = query29(this.categoriesRef, where29("isActive", "==", true));
|
|
13654
|
+
const snapshot = await getDocs29(q);
|
|
13503
13655
|
return snapshot.docs.map(
|
|
13504
13656
|
(doc33) => ({
|
|
13505
13657
|
id: doc33.id,
|
|
@@ -13513,12 +13665,12 @@ var CategoryService = class extends BaseService {
|
|
|
13513
13665
|
* @returns Lista kategorija koje pripadaju traženoj familiji
|
|
13514
13666
|
*/
|
|
13515
13667
|
async getAllByFamily(family) {
|
|
13516
|
-
const q =
|
|
13668
|
+
const q = query29(
|
|
13517
13669
|
this.categoriesRef,
|
|
13518
|
-
|
|
13519
|
-
|
|
13670
|
+
where29("family", "==", family),
|
|
13671
|
+
where29("isActive", "==", true)
|
|
13520
13672
|
);
|
|
13521
|
-
const snapshot = await
|
|
13673
|
+
const snapshot = await getDocs29(q);
|
|
13522
13674
|
return snapshot.docs.map(
|
|
13523
13675
|
(doc33) => ({
|
|
13524
13676
|
id: doc33.id,
|
|
@@ -13567,13 +13719,13 @@ var CategoryService = class extends BaseService {
|
|
|
13567
13719
|
// src/backoffice/services/subcategory.service.ts
|
|
13568
13720
|
import {
|
|
13569
13721
|
addDoc as addDoc5,
|
|
13570
|
-
collection as
|
|
13722
|
+
collection as collection30,
|
|
13571
13723
|
doc as doc30,
|
|
13572
13724
|
getDoc as getDoc32,
|
|
13573
|
-
getDocs as
|
|
13574
|
-
query as
|
|
13725
|
+
getDocs as getDocs30,
|
|
13726
|
+
query as query30,
|
|
13575
13727
|
updateDoc as updateDoc29,
|
|
13576
|
-
where as
|
|
13728
|
+
where as where30
|
|
13577
13729
|
} from "firebase/firestore";
|
|
13578
13730
|
|
|
13579
13731
|
// src/backoffice/types/subcategory.types.ts
|
|
@@ -13586,7 +13738,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
13586
13738
|
* @param categoryId - ID roditeljske kategorije
|
|
13587
13739
|
*/
|
|
13588
13740
|
getSubcategoriesRef(categoryId) {
|
|
13589
|
-
return
|
|
13741
|
+
return collection30(
|
|
13590
13742
|
this.db,
|
|
13591
13743
|
CATEGORIES_COLLECTION,
|
|
13592
13744
|
categoryId,
|
|
@@ -13620,11 +13772,11 @@ var SubcategoryService = class extends BaseService {
|
|
|
13620
13772
|
* @returns Lista aktivnih podkategorija
|
|
13621
13773
|
*/
|
|
13622
13774
|
async getAllByCategoryId(categoryId) {
|
|
13623
|
-
const q =
|
|
13775
|
+
const q = query30(
|
|
13624
13776
|
this.getSubcategoriesRef(categoryId),
|
|
13625
|
-
|
|
13777
|
+
where30("isActive", "==", true)
|
|
13626
13778
|
);
|
|
13627
|
-
const snapshot = await
|
|
13779
|
+
const snapshot = await getDocs30(q);
|
|
13628
13780
|
return snapshot.docs.map(
|
|
13629
13781
|
(doc33) => ({
|
|
13630
13782
|
id: doc33.id,
|
|
@@ -13676,13 +13828,13 @@ var SubcategoryService = class extends BaseService {
|
|
|
13676
13828
|
// src/backoffice/services/technology.service.ts
|
|
13677
13829
|
import {
|
|
13678
13830
|
addDoc as addDoc6,
|
|
13679
|
-
collection as
|
|
13831
|
+
collection as collection31,
|
|
13680
13832
|
doc as doc31,
|
|
13681
13833
|
getDoc as getDoc33,
|
|
13682
|
-
getDocs as
|
|
13683
|
-
query as
|
|
13834
|
+
getDocs as getDocs31,
|
|
13835
|
+
query as query31,
|
|
13684
13836
|
updateDoc as updateDoc30,
|
|
13685
|
-
where as
|
|
13837
|
+
where as where31,
|
|
13686
13838
|
arrayUnion as arrayUnion9,
|
|
13687
13839
|
arrayRemove as arrayRemove8
|
|
13688
13840
|
} from "firebase/firestore";
|
|
@@ -13695,7 +13847,7 @@ var TechnologyService = class extends BaseService {
|
|
|
13695
13847
|
* Vraća referencu na Firestore kolekciju tehnologija
|
|
13696
13848
|
*/
|
|
13697
13849
|
getTechnologiesRef() {
|
|
13698
|
-
return
|
|
13850
|
+
return collection31(this.db, TECHNOLOGIES_COLLECTION);
|
|
13699
13851
|
}
|
|
13700
13852
|
/**
|
|
13701
13853
|
* Kreira novu tehnologiju
|
|
@@ -13726,8 +13878,8 @@ var TechnologyService = class extends BaseService {
|
|
|
13726
13878
|
* @returns Lista aktivnih tehnologija
|
|
13727
13879
|
*/
|
|
13728
13880
|
async getAll() {
|
|
13729
|
-
const q =
|
|
13730
|
-
const snapshot = await
|
|
13881
|
+
const q = query31(this.getTechnologiesRef(), where31("isActive", "==", true));
|
|
13882
|
+
const snapshot = await getDocs31(q);
|
|
13731
13883
|
return snapshot.docs.map(
|
|
13732
13884
|
(doc33) => ({
|
|
13733
13885
|
id: doc33.id,
|
|
@@ -13741,12 +13893,12 @@ var TechnologyService = class extends BaseService {
|
|
|
13741
13893
|
* @returns Lista aktivnih tehnologija
|
|
13742
13894
|
*/
|
|
13743
13895
|
async getAllByFamily(family) {
|
|
13744
|
-
const q =
|
|
13896
|
+
const q = query31(
|
|
13745
13897
|
this.getTechnologiesRef(),
|
|
13746
|
-
|
|
13747
|
-
|
|
13898
|
+
where31("isActive", "==", true),
|
|
13899
|
+
where31("family", "==", family)
|
|
13748
13900
|
);
|
|
13749
|
-
const snapshot = await
|
|
13901
|
+
const snapshot = await getDocs31(q);
|
|
13750
13902
|
return snapshot.docs.map(
|
|
13751
13903
|
(doc33) => ({
|
|
13752
13904
|
id: doc33.id,
|
|
@@ -13760,12 +13912,12 @@ var TechnologyService = class extends BaseService {
|
|
|
13760
13912
|
* @returns Lista aktivnih tehnologija
|
|
13761
13913
|
*/
|
|
13762
13914
|
async getAllByCategoryId(categoryId) {
|
|
13763
|
-
const q =
|
|
13915
|
+
const q = query31(
|
|
13764
13916
|
this.getTechnologiesRef(),
|
|
13765
|
-
|
|
13766
|
-
|
|
13917
|
+
where31("isActive", "==", true),
|
|
13918
|
+
where31("categoryId", "==", categoryId)
|
|
13767
13919
|
);
|
|
13768
|
-
const snapshot = await
|
|
13920
|
+
const snapshot = await getDocs31(q);
|
|
13769
13921
|
return snapshot.docs.map(
|
|
13770
13922
|
(doc33) => ({
|
|
13771
13923
|
id: doc33.id,
|
|
@@ -13779,12 +13931,12 @@ var TechnologyService = class extends BaseService {
|
|
|
13779
13931
|
* @returns Lista aktivnih tehnologija
|
|
13780
13932
|
*/
|
|
13781
13933
|
async getAllBySubcategoryId(subcategoryId) {
|
|
13782
|
-
const q =
|
|
13934
|
+
const q = query31(
|
|
13783
13935
|
this.getTechnologiesRef(),
|
|
13784
|
-
|
|
13785
|
-
|
|
13936
|
+
where31("isActive", "==", true),
|
|
13937
|
+
where31("subcategoryId", "==", subcategoryId)
|
|
13786
13938
|
);
|
|
13787
|
-
const snapshot = await
|
|
13939
|
+
const snapshot = await getDocs31(q);
|
|
13788
13940
|
return snapshot.docs.map(
|
|
13789
13941
|
(doc33) => ({
|
|
13790
13942
|
id: doc33.id,
|
|
@@ -14106,13 +14258,13 @@ var TechnologyService = class extends BaseService {
|
|
|
14106
14258
|
// src/backoffice/services/product.service.ts
|
|
14107
14259
|
import {
|
|
14108
14260
|
addDoc as addDoc7,
|
|
14109
|
-
collection as
|
|
14261
|
+
collection as collection32,
|
|
14110
14262
|
doc as doc32,
|
|
14111
14263
|
getDoc as getDoc34,
|
|
14112
|
-
getDocs as
|
|
14113
|
-
query as
|
|
14264
|
+
getDocs as getDocs32,
|
|
14265
|
+
query as query32,
|
|
14114
14266
|
updateDoc as updateDoc31,
|
|
14115
|
-
where as
|
|
14267
|
+
where as where32
|
|
14116
14268
|
} from "firebase/firestore";
|
|
14117
14269
|
|
|
14118
14270
|
// src/backoffice/types/product.types.ts
|
|
@@ -14126,7 +14278,7 @@ var ProductService = class extends BaseService {
|
|
|
14126
14278
|
* @returns Firestore collection reference
|
|
14127
14279
|
*/
|
|
14128
14280
|
getProductsRef(technologyId) {
|
|
14129
|
-
return
|
|
14281
|
+
return collection32(
|
|
14130
14282
|
this.db,
|
|
14131
14283
|
TECHNOLOGIES_COLLECTION,
|
|
14132
14284
|
technologyId,
|
|
@@ -14156,11 +14308,11 @@ var ProductService = class extends BaseService {
|
|
|
14156
14308
|
* Gets all products for a technology
|
|
14157
14309
|
*/
|
|
14158
14310
|
async getAllByTechnology(technologyId) {
|
|
14159
|
-
const q =
|
|
14311
|
+
const q = query32(
|
|
14160
14312
|
this.getProductsRef(technologyId),
|
|
14161
|
-
|
|
14313
|
+
where32("isActive", "==", true)
|
|
14162
14314
|
);
|
|
14163
|
-
const snapshot = await
|
|
14315
|
+
const snapshot = await getDocs32(q);
|
|
14164
14316
|
return snapshot.docs.map(
|
|
14165
14317
|
(doc33) => ({
|
|
14166
14318
|
id: doc33.id,
|
|
@@ -14172,16 +14324,16 @@ var ProductService = class extends BaseService {
|
|
|
14172
14324
|
* Gets all products for a brand by filtering through all technologies
|
|
14173
14325
|
*/
|
|
14174
14326
|
async getAllByBrand(brandId) {
|
|
14175
|
-
const allTechnologiesRef =
|
|
14176
|
-
const technologiesSnapshot = await
|
|
14327
|
+
const allTechnologiesRef = collection32(this.db, TECHNOLOGIES_COLLECTION);
|
|
14328
|
+
const technologiesSnapshot = await getDocs32(allTechnologiesRef);
|
|
14177
14329
|
const products = [];
|
|
14178
14330
|
for (const techDoc of technologiesSnapshot.docs) {
|
|
14179
|
-
const q =
|
|
14331
|
+
const q = query32(
|
|
14180
14332
|
this.getProductsRef(techDoc.id),
|
|
14181
|
-
|
|
14182
|
-
|
|
14333
|
+
where32("brandId", "==", brandId),
|
|
14334
|
+
where32("isActive", "==", true)
|
|
14183
14335
|
);
|
|
14184
|
-
const snapshot = await
|
|
14336
|
+
const snapshot = await getDocs32(q);
|
|
14185
14337
|
products.push(
|
|
14186
14338
|
...snapshot.docs.map(
|
|
14187
14339
|
(doc33) => ({
|
package/package.json
CHANGED
|
@@ -566,8 +566,6 @@ export class AppointmentAggregationService {
|
|
|
566
566
|
originalNotifyAtValue: notifyAtValue,
|
|
567
567
|
originalTimeframeUnit: template.timeframe.unit,
|
|
568
568
|
updatedAt: admin.firestore.Timestamp.now() as any, // Use current server timestamp
|
|
569
|
-
notificationId: undefined,
|
|
570
|
-
actionTakenAt: undefined,
|
|
571
569
|
};
|
|
572
570
|
return instructionObject;
|
|
573
571
|
});
|