@blackcode_sa/metaestetics-api 1.7.10 → 1.7.12
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.d.mts +5 -4
- package/dist/admin/index.d.ts +5 -4
- package/dist/index.d.mts +246 -144
- package/dist/index.d.ts +246 -144
- package/dist/index.js +555 -875
- package/dist/index.mjs +597 -922
- package/package.json +1 -1
- package/src/admin/aggregation/reviews/reviews.aggregation.service.ts +641 -0
- package/src/index.ts +8 -0
- package/src/services/auth.service.ts +4 -0
- package/src/services/clinic/clinic-group.service.ts +49 -0
- package/src/services/clinic/clinic.service.ts +12 -0
- package/src/services/media/media.service.ts +6 -1
- package/src/services/reviews/reviews.service.ts +6 -572
- package/src/types/clinic/index.ts +17 -5
- package/src/validations/clinic.schema.ts +25 -9
- package/src/validations/media.schema.ts +10 -0
|
@@ -261,4 +261,53 @@ export class ClinicGroupService extends BaseService {
|
|
|
261
261
|
|
|
262
262
|
// TODO: Add granular control over admin permissions, e.g. only allow admins to manage certain clinics to tokens directly
|
|
263
263
|
// TODO: Generally refactor admin tokens and invites, also create cloud function to send invites and send updates when sombody uses the token
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Updates the onboarding status for a clinic group
|
|
267
|
+
*
|
|
268
|
+
* @param groupId - The ID of the clinic group to update
|
|
269
|
+
* @param onboardingData - The onboarding data to update
|
|
270
|
+
* @returns The updated clinic group
|
|
271
|
+
*/
|
|
272
|
+
async setOnboarding(
|
|
273
|
+
groupId: string,
|
|
274
|
+
onboardingData: {
|
|
275
|
+
completed?: boolean;
|
|
276
|
+
step?: number;
|
|
277
|
+
}
|
|
278
|
+
): Promise<ClinicGroup> {
|
|
279
|
+
console.log("[CLINIC_GROUP] Updating onboarding status", {
|
|
280
|
+
groupId,
|
|
281
|
+
onboardingData,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
return this.updateClinicGroup(groupId, {
|
|
285
|
+
onboarding: onboardingData,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Sets the current onboarding step for a clinic group
|
|
291
|
+
*
|
|
292
|
+
* @param groupId - The ID of the clinic group to update
|
|
293
|
+
* @param step - The current onboarding step number
|
|
294
|
+
* @returns The updated clinic group
|
|
295
|
+
*/
|
|
296
|
+
async setOnboardingStep(groupId: string, step: number): Promise<ClinicGroup> {
|
|
297
|
+
console.log("[CLINIC_GROUP] Setting onboarding step", { groupId, step });
|
|
298
|
+
|
|
299
|
+
return this.setOnboarding(groupId, { step, completed: false });
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Marks the onboarding process as completed for a clinic group
|
|
304
|
+
*
|
|
305
|
+
* @param groupId - The ID of the clinic group to update
|
|
306
|
+
* @returns The updated clinic group
|
|
307
|
+
*/
|
|
308
|
+
async completeOnboarding(groupId: string): Promise<ClinicGroup> {
|
|
309
|
+
console.log("[CLINIC_GROUP] Completing onboarding", { groupId });
|
|
310
|
+
|
|
311
|
+
return this.setOnboarding(groupId, { completed: true });
|
|
312
|
+
}
|
|
264
313
|
}
|
|
@@ -425,6 +425,18 @@ export class ClinicService extends BaseService {
|
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Activates a clinic.
|
|
430
|
+
*/
|
|
431
|
+
async activateClinic(clinicId: string, adminId: string): Promise<void> {
|
|
432
|
+
// Permission check omitted
|
|
433
|
+
const clinicRef = doc(this.db, CLINICS_COLLECTION, clinicId);
|
|
434
|
+
await updateDoc(clinicRef, {
|
|
435
|
+
isActive: true,
|
|
436
|
+
updatedAt: serverTimestamp(),
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
428
440
|
/**
|
|
429
441
|
* Dohvata kliniku po ID-u
|
|
430
442
|
*/
|
|
@@ -32,6 +32,11 @@ export enum MediaAccessLevel {
|
|
|
32
32
|
CONFIDENTIAL = "confidential",
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Type that allows a field to be either a URL string or a File object
|
|
37
|
+
*/
|
|
38
|
+
export type MediaResource = string | File | Blob;
|
|
39
|
+
|
|
35
40
|
/**
|
|
36
41
|
* Media file metadata interface
|
|
37
42
|
*/
|
|
@@ -49,7 +54,7 @@ export interface MediaMetadata {
|
|
|
49
54
|
updatedAt?: Timestamp; // Firestore Timestamp of last update
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
const MEDIA_METADATA_COLLECTION = "media_metadata";
|
|
57
|
+
export const MEDIA_METADATA_COLLECTION = "media_metadata";
|
|
53
58
|
|
|
54
59
|
export class MediaService extends BaseService {
|
|
55
60
|
constructor(db: Firestore, auth: Auth, app: FirebaseApp) {
|