@blackcode_sa/metaestetics-api 1.14.11 → 1.14.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/index.js +34 -5
- package/dist/index.mjs +92 -59
- package/package.json +1 -1
- package/src/services/auth/auth.service.ts +40 -5
package/dist/index.js
CHANGED
|
@@ -15996,7 +15996,7 @@ var AuthService = class extends BaseService {
|
|
|
15996
15996
|
* @returns Object containing user and claimed practitioner
|
|
15997
15997
|
*/
|
|
15998
15998
|
async claimDraftProfilesWithGoogle(idToken, practitionerIds) {
|
|
15999
|
-
var _a, _b;
|
|
15999
|
+
var _a, _b, _c;
|
|
16000
16000
|
try {
|
|
16001
16001
|
console.log("[AUTH] Starting claim draft profiles with Google", {
|
|
16002
16002
|
practitionerIdsCount: practitionerIds.length,
|
|
@@ -16021,11 +16021,40 @@ var AuthService = class extends BaseService {
|
|
|
16021
16021
|
console.log("[AUTH] User document does not exist, creating it...");
|
|
16022
16022
|
}
|
|
16023
16023
|
if (!user) {
|
|
16024
|
-
console.log("[AUTH] Creating user document for:", firebaseUser.uid);
|
|
16025
|
-
|
|
16026
|
-
|
|
16024
|
+
console.log("[AUTH] Creating user document DIRECTLY for:", firebaseUser.uid);
|
|
16025
|
+
console.log("[AUTH] Using THIS.auth.currentUser:", ((_c = this.auth.currentUser) == null ? void 0 : _c.uid) || "NULL");
|
|
16026
|
+
console.log("[AUTH] Using THIS.db:", this.db ? "EXISTS" : "NULL");
|
|
16027
|
+
const userData = {
|
|
16028
|
+
uid: firebaseUser.uid,
|
|
16029
|
+
email: firebaseUser.email,
|
|
16030
|
+
roles: ["practitioner" /* PRACTITIONER */],
|
|
16031
|
+
isAnonymous: firebaseUser.isAnonymous || false,
|
|
16032
|
+
createdAt: (0, import_firestore40.serverTimestamp)(),
|
|
16033
|
+
updatedAt: (0, import_firestore40.serverTimestamp)(),
|
|
16034
|
+
lastLoginAt: (0, import_firestore40.serverTimestamp)()
|
|
16035
|
+
};
|
|
16036
|
+
console.log("[AUTH] Attempting setDoc directly with userData:", {
|
|
16037
|
+
uid: userData.uid,
|
|
16038
|
+
email: userData.email,
|
|
16039
|
+
roles: userData.roles
|
|
16027
16040
|
});
|
|
16028
|
-
|
|
16041
|
+
try {
|
|
16042
|
+
await (0, import_firestore40.setDoc)((0, import_firestore40.doc)(this.db, USERS_COLLECTION, firebaseUser.uid), userData);
|
|
16043
|
+
console.log("[AUTH] \u2705 setDoc SUCCEEDED directly!");
|
|
16044
|
+
const userDoc = await (0, import_firestore40.getDoc)((0, import_firestore40.doc)(this.db, USERS_COLLECTION, firebaseUser.uid));
|
|
16045
|
+
if (!userDoc.exists()) {
|
|
16046
|
+
throw new Error("User document was not created");
|
|
16047
|
+
}
|
|
16048
|
+
user = userDoc.data();
|
|
16049
|
+
console.log("[AUTH] User document created successfully:", user.uid);
|
|
16050
|
+
} catch (error) {
|
|
16051
|
+
console.error("[AUTH] \u274C setDoc FAILED directly:", {
|
|
16052
|
+
errorCode: error == null ? void 0 : error.code,
|
|
16053
|
+
errorMessage: error == null ? void 0 : error.message,
|
|
16054
|
+
uid: firebaseUser.uid
|
|
16055
|
+
});
|
|
16056
|
+
throw error;
|
|
16057
|
+
}
|
|
16029
16058
|
}
|
|
16030
16059
|
let practitioner;
|
|
16031
16060
|
if (practitionerIds.length === 1) {
|
package/dist/index.mjs
CHANGED
|
@@ -7122,9 +7122,13 @@ import {
|
|
|
7122
7122
|
} from "firebase/auth";
|
|
7123
7123
|
import {
|
|
7124
7124
|
collection as collection21,
|
|
7125
|
+
doc as doc25,
|
|
7126
|
+
getDoc as getDoc27,
|
|
7127
|
+
setDoc as setDoc16,
|
|
7125
7128
|
query as query21,
|
|
7126
7129
|
getDocs as getDocs21,
|
|
7127
|
-
runTransaction
|
|
7130
|
+
runTransaction,
|
|
7131
|
+
serverTimestamp as serverTimestamp21
|
|
7128
7132
|
} from "firebase/firestore";
|
|
7129
7133
|
|
|
7130
7134
|
// src/types/user/index.ts
|
|
@@ -16083,7 +16087,7 @@ var AuthService = class extends BaseService {
|
|
|
16083
16087
|
* @returns Object containing user and claimed practitioner
|
|
16084
16088
|
*/
|
|
16085
16089
|
async claimDraftProfilesWithGoogle(idToken, practitionerIds) {
|
|
16086
|
-
var _a, _b;
|
|
16090
|
+
var _a, _b, _c;
|
|
16087
16091
|
try {
|
|
16088
16092
|
console.log("[AUTH] Starting claim draft profiles with Google", {
|
|
16089
16093
|
practitionerIdsCount: practitionerIds.length,
|
|
@@ -16108,11 +16112,40 @@ var AuthService = class extends BaseService {
|
|
|
16108
16112
|
console.log("[AUTH] User document does not exist, creating it...");
|
|
16109
16113
|
}
|
|
16110
16114
|
if (!user) {
|
|
16111
|
-
console.log("[AUTH] Creating user document for:", firebaseUser.uid);
|
|
16112
|
-
|
|
16113
|
-
|
|
16115
|
+
console.log("[AUTH] Creating user document DIRECTLY for:", firebaseUser.uid);
|
|
16116
|
+
console.log("[AUTH] Using THIS.auth.currentUser:", ((_c = this.auth.currentUser) == null ? void 0 : _c.uid) || "NULL");
|
|
16117
|
+
console.log("[AUTH] Using THIS.db:", this.db ? "EXISTS" : "NULL");
|
|
16118
|
+
const userData = {
|
|
16119
|
+
uid: firebaseUser.uid,
|
|
16120
|
+
email: firebaseUser.email,
|
|
16121
|
+
roles: ["practitioner" /* PRACTITIONER */],
|
|
16122
|
+
isAnonymous: firebaseUser.isAnonymous || false,
|
|
16123
|
+
createdAt: serverTimestamp21(),
|
|
16124
|
+
updatedAt: serverTimestamp21(),
|
|
16125
|
+
lastLoginAt: serverTimestamp21()
|
|
16126
|
+
};
|
|
16127
|
+
console.log("[AUTH] Attempting setDoc directly with userData:", {
|
|
16128
|
+
uid: userData.uid,
|
|
16129
|
+
email: userData.email,
|
|
16130
|
+
roles: userData.roles
|
|
16114
16131
|
});
|
|
16115
|
-
|
|
16132
|
+
try {
|
|
16133
|
+
await setDoc16(doc25(this.db, USERS_COLLECTION, firebaseUser.uid), userData);
|
|
16134
|
+
console.log("[AUTH] \u2705 setDoc SUCCEEDED directly!");
|
|
16135
|
+
const userDoc = await getDoc27(doc25(this.db, USERS_COLLECTION, firebaseUser.uid));
|
|
16136
|
+
if (!userDoc.exists()) {
|
|
16137
|
+
throw new Error("User document was not created");
|
|
16138
|
+
}
|
|
16139
|
+
user = userDoc.data();
|
|
16140
|
+
console.log("[AUTH] User document created successfully:", user.uid);
|
|
16141
|
+
} catch (error) {
|
|
16142
|
+
console.error("[AUTH] \u274C setDoc FAILED directly:", {
|
|
16143
|
+
errorCode: error == null ? void 0 : error.code,
|
|
16144
|
+
errorMessage: error == null ? void 0 : error.message,
|
|
16145
|
+
uid: firebaseUser.uid
|
|
16146
|
+
});
|
|
16147
|
+
throw error;
|
|
16148
|
+
}
|
|
16116
16149
|
}
|
|
16117
16150
|
let practitioner;
|
|
16118
16151
|
if (practitionerIds.length === 1) {
|
|
@@ -16544,7 +16577,7 @@ var AuthService = class extends BaseService {
|
|
|
16544
16577
|
};
|
|
16545
16578
|
|
|
16546
16579
|
// src/services/calendar/calendar.v2.service.ts
|
|
16547
|
-
import { Timestamp as Timestamp29, serverTimestamp as
|
|
16580
|
+
import { Timestamp as Timestamp29, serverTimestamp as serverTimestamp27 } from "firebase/firestore";
|
|
16548
16581
|
import {
|
|
16549
16582
|
doc as doc32,
|
|
16550
16583
|
getDoc as getDoc33,
|
|
@@ -16569,7 +16602,7 @@ import {
|
|
|
16569
16602
|
where as where22,
|
|
16570
16603
|
orderBy as orderBy8,
|
|
16571
16604
|
Timestamp as Timestamp23,
|
|
16572
|
-
serverTimestamp as
|
|
16605
|
+
serverTimestamp as serverTimestamp22
|
|
16573
16606
|
} from "firebase/firestore";
|
|
16574
16607
|
|
|
16575
16608
|
// src/services/calendar/utils/docs.utils.ts
|
|
@@ -16618,8 +16651,8 @@ async function createClinicCalendarEventUtil(db, clinicId, eventData, generateId
|
|
|
16618
16651
|
const newEvent = {
|
|
16619
16652
|
id: eventId,
|
|
16620
16653
|
...eventData,
|
|
16621
|
-
createdAt:
|
|
16622
|
-
updatedAt:
|
|
16654
|
+
createdAt: serverTimestamp22(),
|
|
16655
|
+
updatedAt: serverTimestamp22()
|
|
16623
16656
|
};
|
|
16624
16657
|
await setDoc17(eventRef, newEvent);
|
|
16625
16658
|
return {
|
|
@@ -16632,7 +16665,7 @@ async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData)
|
|
|
16632
16665
|
const eventRef = getClinicCalendarEventDocRef(db, clinicId, eventId);
|
|
16633
16666
|
const updates = {
|
|
16634
16667
|
...updateData,
|
|
16635
|
-
updatedAt:
|
|
16668
|
+
updatedAt: serverTimestamp22()
|
|
16636
16669
|
};
|
|
16637
16670
|
await updateDoc22(eventRef, updates);
|
|
16638
16671
|
const updatedDoc = await getDoc28(eventRef);
|
|
@@ -16673,7 +16706,7 @@ import {
|
|
|
16673
16706
|
where as where23,
|
|
16674
16707
|
orderBy as orderBy9,
|
|
16675
16708
|
Timestamp as Timestamp24,
|
|
16676
|
-
serverTimestamp as
|
|
16709
|
+
serverTimestamp as serverTimestamp23
|
|
16677
16710
|
} from "firebase/firestore";
|
|
16678
16711
|
async function createPatientCalendarEventUtil(db, patientId, eventData, generateId2) {
|
|
16679
16712
|
const eventId = generateId2();
|
|
@@ -16681,8 +16714,8 @@ async function createPatientCalendarEventUtil(db, patientId, eventData, generate
|
|
|
16681
16714
|
const newEvent = {
|
|
16682
16715
|
id: eventId,
|
|
16683
16716
|
...eventData,
|
|
16684
|
-
createdAt:
|
|
16685
|
-
updatedAt:
|
|
16717
|
+
createdAt: serverTimestamp23(),
|
|
16718
|
+
updatedAt: serverTimestamp23()
|
|
16686
16719
|
};
|
|
16687
16720
|
await setDoc18(eventRef, newEvent);
|
|
16688
16721
|
return {
|
|
@@ -16695,7 +16728,7 @@ async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData
|
|
|
16695
16728
|
const eventRef = getPatientCalendarEventDocRef(db, patientId, eventId);
|
|
16696
16729
|
const updates = {
|
|
16697
16730
|
...updateData,
|
|
16698
|
-
updatedAt:
|
|
16731
|
+
updatedAt: serverTimestamp23()
|
|
16699
16732
|
};
|
|
16700
16733
|
await updateDoc23(eventRef, updates);
|
|
16701
16734
|
const updatedDoc = await getDoc29(eventRef);
|
|
@@ -16717,7 +16750,7 @@ import {
|
|
|
16717
16750
|
where as where24,
|
|
16718
16751
|
orderBy as orderBy10,
|
|
16719
16752
|
Timestamp as Timestamp25,
|
|
16720
|
-
serverTimestamp as
|
|
16753
|
+
serverTimestamp as serverTimestamp24
|
|
16721
16754
|
} from "firebase/firestore";
|
|
16722
16755
|
async function createPractitionerCalendarEventUtil(db, practitionerId, eventData, generateId2) {
|
|
16723
16756
|
const eventId = generateId2();
|
|
@@ -16729,8 +16762,8 @@ async function createPractitionerCalendarEventUtil(db, practitionerId, eventData
|
|
|
16729
16762
|
const newEvent = {
|
|
16730
16763
|
id: eventId,
|
|
16731
16764
|
...eventData,
|
|
16732
|
-
createdAt:
|
|
16733
|
-
updatedAt:
|
|
16765
|
+
createdAt: serverTimestamp24(),
|
|
16766
|
+
updatedAt: serverTimestamp24()
|
|
16734
16767
|
};
|
|
16735
16768
|
await setDoc19(eventRef, newEvent);
|
|
16736
16769
|
return {
|
|
@@ -16747,7 +16780,7 @@ async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId,
|
|
|
16747
16780
|
);
|
|
16748
16781
|
const updates = {
|
|
16749
16782
|
...updateData,
|
|
16750
|
-
updatedAt:
|
|
16783
|
+
updatedAt: serverTimestamp24()
|
|
16751
16784
|
};
|
|
16752
16785
|
await updateDoc24(eventRef, updates);
|
|
16753
16786
|
const updatedDoc = await getDoc30(eventRef);
|
|
@@ -16820,7 +16853,7 @@ import {
|
|
|
16820
16853
|
where as where25,
|
|
16821
16854
|
orderBy as orderBy11,
|
|
16822
16855
|
Timestamp as Timestamp26,
|
|
16823
|
-
serverTimestamp as
|
|
16856
|
+
serverTimestamp as serverTimestamp25
|
|
16824
16857
|
} from "firebase/firestore";
|
|
16825
16858
|
async function searchCalendarEventsUtil(db, params) {
|
|
16826
16859
|
const { searchLocation, entityId, ...filters } = params;
|
|
@@ -16925,7 +16958,7 @@ import {
|
|
|
16925
16958
|
query as query26,
|
|
16926
16959
|
orderBy as orderBy12,
|
|
16927
16960
|
Timestamp as Timestamp27,
|
|
16928
|
-
serverTimestamp as
|
|
16961
|
+
serverTimestamp as serverTimestamp26
|
|
16929
16962
|
} from "firebase/firestore";
|
|
16930
16963
|
async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendarData, generateId2) {
|
|
16931
16964
|
const calendarId = generateId2();
|
|
@@ -16937,8 +16970,8 @@ async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendar
|
|
|
16937
16970
|
const newCalendar = {
|
|
16938
16971
|
id: calendarId,
|
|
16939
16972
|
...calendarData,
|
|
16940
|
-
createdAt:
|
|
16941
|
-
updatedAt:
|
|
16973
|
+
createdAt: serverTimestamp26(),
|
|
16974
|
+
updatedAt: serverTimestamp26()
|
|
16942
16975
|
};
|
|
16943
16976
|
await setDoc21(calendarRef, newCalendar);
|
|
16944
16977
|
return {
|
|
@@ -16953,8 +16986,8 @@ async function createPatientSyncedCalendarUtil(db, patientId, calendarData, gene
|
|
|
16953
16986
|
const newCalendar = {
|
|
16954
16987
|
id: calendarId,
|
|
16955
16988
|
...calendarData,
|
|
16956
|
-
createdAt:
|
|
16957
|
-
updatedAt:
|
|
16989
|
+
createdAt: serverTimestamp26(),
|
|
16990
|
+
updatedAt: serverTimestamp26()
|
|
16958
16991
|
};
|
|
16959
16992
|
await setDoc21(calendarRef, newCalendar);
|
|
16960
16993
|
return {
|
|
@@ -16969,8 +17002,8 @@ async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, genera
|
|
|
16969
17002
|
const newCalendar = {
|
|
16970
17003
|
id: calendarId,
|
|
16971
17004
|
...calendarData,
|
|
16972
|
-
createdAt:
|
|
16973
|
-
updatedAt:
|
|
17005
|
+
createdAt: serverTimestamp26(),
|
|
17006
|
+
updatedAt: serverTimestamp26()
|
|
16974
17007
|
};
|
|
16975
17008
|
await setDoc21(calendarRef, newCalendar);
|
|
16976
17009
|
return {
|
|
@@ -17042,7 +17075,7 @@ async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendar
|
|
|
17042
17075
|
);
|
|
17043
17076
|
const updates = {
|
|
17044
17077
|
...updateData,
|
|
17045
|
-
updatedAt:
|
|
17078
|
+
updatedAt: serverTimestamp26()
|
|
17046
17079
|
};
|
|
17047
17080
|
await updateDoc26(calendarRef, updates);
|
|
17048
17081
|
const updatedDoc = await getDoc32(calendarRef);
|
|
@@ -17055,7 +17088,7 @@ async function updatePatientSyncedCalendarUtil(db, patientId, calendarId, update
|
|
|
17055
17088
|
const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
|
|
17056
17089
|
const updates = {
|
|
17057
17090
|
...updateData,
|
|
17058
|
-
updatedAt:
|
|
17091
|
+
updatedAt: serverTimestamp26()
|
|
17059
17092
|
};
|
|
17060
17093
|
await updateDoc26(calendarRef, updates);
|
|
17061
17094
|
const updatedDoc = await getDoc32(calendarRef);
|
|
@@ -17068,7 +17101,7 @@ async function updateClinicSyncedCalendarUtil(db, clinicId, calendarId, updateDa
|
|
|
17068
17101
|
const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
|
|
17069
17102
|
const updates = {
|
|
17070
17103
|
...updateData,
|
|
17071
|
-
updatedAt:
|
|
17104
|
+
updatedAt: serverTimestamp26()
|
|
17072
17105
|
};
|
|
17073
17106
|
await updateDoc26(calendarRef, updates);
|
|
17074
17107
|
const updatedDoc = await getDoc32(calendarRef);
|
|
@@ -18290,8 +18323,8 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
18290
18323
|
const newEvent = {
|
|
18291
18324
|
id: eventId,
|
|
18292
18325
|
...eventData,
|
|
18293
|
-
createdAt:
|
|
18294
|
-
updatedAt:
|
|
18326
|
+
createdAt: serverTimestamp27(),
|
|
18327
|
+
updatedAt: serverTimestamp27()
|
|
18295
18328
|
};
|
|
18296
18329
|
await setDoc22(eventRef, newEvent);
|
|
18297
18330
|
return {
|
|
@@ -18507,7 +18540,7 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
18507
18540
|
end: Timestamp29.fromDate(endTime)
|
|
18508
18541
|
},
|
|
18509
18542
|
description: externalEvent.description || "",
|
|
18510
|
-
updatedAt:
|
|
18543
|
+
updatedAt: serverTimestamp27()
|
|
18511
18544
|
});
|
|
18512
18545
|
console.log(`Updated local event ${eventId} from external event`);
|
|
18513
18546
|
} catch (error) {
|
|
@@ -18534,7 +18567,7 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
18534
18567
|
);
|
|
18535
18568
|
await updateDoc27(eventRef, {
|
|
18536
18569
|
status,
|
|
18537
|
-
updatedAt:
|
|
18570
|
+
updatedAt: serverTimestamp27()
|
|
18538
18571
|
});
|
|
18539
18572
|
console.log(`Updated event ${eventId} status to ${status}`);
|
|
18540
18573
|
} catch (error) {
|
|
@@ -18935,7 +18968,7 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
18935
18968
|
}
|
|
18936
18969
|
await updateDoc27(eventRef, {
|
|
18937
18970
|
syncedCalendarEventId: syncIds,
|
|
18938
|
-
updatedAt:
|
|
18971
|
+
updatedAt: serverTimestamp27()
|
|
18939
18972
|
});
|
|
18940
18973
|
console.log(
|
|
18941
18974
|
`Updated event ${eventId} with sync ID ${syncEvent.eventId}`
|
|
@@ -19158,7 +19191,7 @@ var CalendarServiceV2 = class extends BaseService {
|
|
|
19158
19191
|
};
|
|
19159
19192
|
|
|
19160
19193
|
// src/services/calendar/calendar.v3.service.ts
|
|
19161
|
-
import { Timestamp as Timestamp30, serverTimestamp as
|
|
19194
|
+
import { Timestamp as Timestamp30, serverTimestamp as serverTimestamp28 } from "firebase/firestore";
|
|
19162
19195
|
import { doc as doc33, getDoc as getDoc34, setDoc as setDoc23, updateDoc as updateDoc28, deleteDoc as deleteDoc15 } from "firebase/firestore";
|
|
19163
19196
|
var CalendarServiceV3 = class extends BaseService {
|
|
19164
19197
|
/**
|
|
@@ -19193,8 +19226,8 @@ var CalendarServiceV3 = class extends BaseService {
|
|
|
19193
19226
|
status: "confirmed" /* CONFIRMED */,
|
|
19194
19227
|
// Blocking events are always confirmed
|
|
19195
19228
|
syncStatus: "internal" /* INTERNAL */,
|
|
19196
|
-
createdAt:
|
|
19197
|
-
updatedAt:
|
|
19229
|
+
createdAt: serverTimestamp28(),
|
|
19230
|
+
updatedAt: serverTimestamp28()
|
|
19198
19231
|
};
|
|
19199
19232
|
if (params.entityType === "practitioner") {
|
|
19200
19233
|
eventData.practitionerProfileId = params.entityId;
|
|
@@ -19224,7 +19257,7 @@ var CalendarServiceV3 = class extends BaseService {
|
|
|
19224
19257
|
throw new Error(`Blocking event with ID ${params.eventId} not found`);
|
|
19225
19258
|
}
|
|
19226
19259
|
const updateData = {
|
|
19227
|
-
updatedAt:
|
|
19260
|
+
updatedAt: serverTimestamp28()
|
|
19228
19261
|
};
|
|
19229
19262
|
if (params.eventName !== void 0) {
|
|
19230
19263
|
updateData.eventName = params.eventName;
|
|
@@ -19471,7 +19504,7 @@ import {
|
|
|
19471
19504
|
setDoc as setDoc24,
|
|
19472
19505
|
deleteDoc as deleteDoc16,
|
|
19473
19506
|
Timestamp as Timestamp31,
|
|
19474
|
-
serverTimestamp as
|
|
19507
|
+
serverTimestamp as serverTimestamp29,
|
|
19475
19508
|
orderBy as orderBy13,
|
|
19476
19509
|
limit as limit12
|
|
19477
19510
|
} from "firebase/firestore";
|
|
@@ -19633,7 +19666,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
19633
19666
|
const updateData = {
|
|
19634
19667
|
status: "accepted" /* ACCEPTED */,
|
|
19635
19668
|
acceptedAt: Timestamp31.now(),
|
|
19636
|
-
updatedAt:
|
|
19669
|
+
updatedAt: serverTimestamp29()
|
|
19637
19670
|
};
|
|
19638
19671
|
const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
|
|
19639
19672
|
await updateDoc29(docRef, updateData);
|
|
@@ -19665,7 +19698,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
19665
19698
|
status: "rejected" /* REJECTED */,
|
|
19666
19699
|
rejectionReason: rejectionReason || null,
|
|
19667
19700
|
rejectedAt: Timestamp31.now(),
|
|
19668
|
-
updatedAt:
|
|
19701
|
+
updatedAt: serverTimestamp29()
|
|
19669
19702
|
};
|
|
19670
19703
|
const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
|
|
19671
19704
|
await updateDoc29(docRef, updateData);
|
|
@@ -19697,7 +19730,7 @@ var PractitionerInviteService = class extends BaseService {
|
|
|
19697
19730
|
status: "cancelled" /* CANCELLED */,
|
|
19698
19731
|
cancelReason: cancelReason || null,
|
|
19699
19732
|
cancelledAt: Timestamp31.now(),
|
|
19700
|
-
updatedAt:
|
|
19733
|
+
updatedAt: serverTimestamp29()
|
|
19701
19734
|
};
|
|
19702
19735
|
const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
|
|
19703
19736
|
await updateDoc29(docRef, updateData);
|
|
@@ -20971,7 +21004,7 @@ import {
|
|
|
20971
21004
|
updateDoc as updateDoc34,
|
|
20972
21005
|
setDoc as setDoc27,
|
|
20973
21006
|
deleteDoc as deleteDoc19,
|
|
20974
|
-
serverTimestamp as
|
|
21007
|
+
serverTimestamp as serverTimestamp32,
|
|
20975
21008
|
writeBatch as writeBatch6,
|
|
20976
21009
|
orderBy as orderBy18,
|
|
20977
21010
|
limit as limit16,
|
|
@@ -21457,8 +21490,8 @@ var ProcedureService = class extends BaseService {
|
|
|
21457
21490
|
const procedureRef = doc39(this.db, PROCEDURES_COLLECTION, procedureId);
|
|
21458
21491
|
await setDoc27(procedureRef, {
|
|
21459
21492
|
...newProcedure,
|
|
21460
|
-
createdAt:
|
|
21461
|
-
updatedAt:
|
|
21493
|
+
createdAt: serverTimestamp32(),
|
|
21494
|
+
updatedAt: serverTimestamp32()
|
|
21462
21495
|
});
|
|
21463
21496
|
const savedDoc = await getDoc40(procedureRef);
|
|
21464
21497
|
return savedDoc.data();
|
|
@@ -21585,8 +21618,8 @@ var ProcedureService = class extends BaseService {
|
|
|
21585
21618
|
const procedureRef = doc39(this.db, PROCEDURES_COLLECTION, newProcedureId);
|
|
21586
21619
|
await setDoc27(procedureRef, {
|
|
21587
21620
|
...newProcedure,
|
|
21588
|
-
createdAt:
|
|
21589
|
-
updatedAt:
|
|
21621
|
+
createdAt: serverTimestamp32(),
|
|
21622
|
+
updatedAt: serverTimestamp32()
|
|
21590
21623
|
});
|
|
21591
21624
|
const savedDoc = await getDoc40(procedureRef);
|
|
21592
21625
|
return savedDoc.data();
|
|
@@ -21687,8 +21720,8 @@ var ProcedureService = class extends BaseService {
|
|
|
21687
21720
|
const procedureRef = doc39(this.db, PROCEDURES_COLLECTION, newProcedureId);
|
|
21688
21721
|
batch.set(procedureRef, {
|
|
21689
21722
|
...newProcedure,
|
|
21690
|
-
createdAt:
|
|
21691
|
-
updatedAt:
|
|
21723
|
+
createdAt: serverTimestamp32(),
|
|
21724
|
+
updatedAt: serverTimestamp32()
|
|
21692
21725
|
});
|
|
21693
21726
|
}
|
|
21694
21727
|
await batch.commit();
|
|
@@ -21892,8 +21925,8 @@ var ProcedureService = class extends BaseService {
|
|
|
21892
21925
|
console.log("\u{1F525}\u{1F525}\u{1F525} NO UNDEFINED FIELDS - Proceeding with batch.set");
|
|
21893
21926
|
batch.set(procedureRef, {
|
|
21894
21927
|
...newProcedure,
|
|
21895
|
-
createdAt:
|
|
21896
|
-
updatedAt:
|
|
21928
|
+
createdAt: serverTimestamp32(),
|
|
21929
|
+
updatedAt: serverTimestamp32()
|
|
21897
21930
|
});
|
|
21898
21931
|
}
|
|
21899
21932
|
await batch.commit();
|
|
@@ -22127,7 +22160,7 @@ var ProcedureService = class extends BaseService {
|
|
|
22127
22160
|
}
|
|
22128
22161
|
await updateDoc34(procedureRef, {
|
|
22129
22162
|
...updatedProcedureData,
|
|
22130
|
-
updatedAt:
|
|
22163
|
+
updatedAt: serverTimestamp32()
|
|
22131
22164
|
});
|
|
22132
22165
|
const updatedSnapshot = await getDoc40(procedureRef);
|
|
22133
22166
|
return updatedSnapshot.data();
|
|
@@ -22145,7 +22178,7 @@ var ProcedureService = class extends BaseService {
|
|
|
22145
22178
|
}
|
|
22146
22179
|
await updateDoc34(procedureRef, {
|
|
22147
22180
|
isActive: false,
|
|
22148
|
-
updatedAt:
|
|
22181
|
+
updatedAt: serverTimestamp32()
|
|
22149
22182
|
});
|
|
22150
22183
|
}
|
|
22151
22184
|
/**
|
|
@@ -22822,8 +22855,8 @@ var ProcedureService = class extends BaseService {
|
|
|
22822
22855
|
const procedureRef = doc39(this.db, PROCEDURES_COLLECTION, procedureId);
|
|
22823
22856
|
await setDoc27(procedureRef, {
|
|
22824
22857
|
...newProcedure,
|
|
22825
|
-
createdAt:
|
|
22826
|
-
updatedAt:
|
|
22858
|
+
createdAt: serverTimestamp32(),
|
|
22859
|
+
updatedAt: serverTimestamp32()
|
|
22827
22860
|
});
|
|
22828
22861
|
const savedDoc = await getDoc40(procedureRef);
|
|
22829
22862
|
return savedDoc.data();
|
|
@@ -22906,7 +22939,7 @@ import {
|
|
|
22906
22939
|
where as where34,
|
|
22907
22940
|
setDoc as setDoc28,
|
|
22908
22941
|
deleteDoc as deleteDoc20,
|
|
22909
|
-
serverTimestamp as
|
|
22942
|
+
serverTimestamp as serverTimestamp33
|
|
22910
22943
|
} from "firebase/firestore";
|
|
22911
22944
|
import { z as z27 } from "zod";
|
|
22912
22945
|
var ReviewService = class extends BaseService {
|
|
@@ -23060,8 +23093,8 @@ var ReviewService = class extends BaseService {
|
|
|
23060
23093
|
reviewSchema.parse(review);
|
|
23061
23094
|
const firestoreData = {
|
|
23062
23095
|
...review,
|
|
23063
|
-
createdAt:
|
|
23064
|
-
updatedAt:
|
|
23096
|
+
createdAt: serverTimestamp33(),
|
|
23097
|
+
updatedAt: serverTimestamp33()
|
|
23065
23098
|
};
|
|
23066
23099
|
Object.keys(firestoreData).forEach((key) => {
|
|
23067
23100
|
if (firestoreData[key] === void 0) {
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
Timestamp,
|
|
36
36
|
runTransaction,
|
|
37
37
|
Firestore,
|
|
38
|
+
serverTimestamp,
|
|
38
39
|
} from 'firebase/firestore';
|
|
39
40
|
import { FirebaseApp } from 'firebase/app';
|
|
40
41
|
import { User, UserRole, USERS_COLLECTION } from '../../types';
|
|
@@ -909,13 +910,47 @@ export class AuthService extends BaseService {
|
|
|
909
910
|
console.log('[AUTH] User document does not exist, creating it...');
|
|
910
911
|
}
|
|
911
912
|
|
|
912
|
-
// Step 2: Create User document
|
|
913
|
+
// Step 2: Create User document directly (bypassing UserService to test auth instance issue)
|
|
913
914
|
if (!user) {
|
|
914
|
-
console.log('[AUTH] Creating user document for:', firebaseUser.uid);
|
|
915
|
-
|
|
916
|
-
|
|
915
|
+
console.log('[AUTH] Creating user document DIRECTLY for:', firebaseUser.uid);
|
|
916
|
+
console.log('[AUTH] Using THIS.auth.currentUser:', this.auth.currentUser?.uid || 'NULL');
|
|
917
|
+
console.log('[AUTH] Using THIS.db:', this.db ? 'EXISTS' : 'NULL');
|
|
918
|
+
|
|
919
|
+
const userData = {
|
|
920
|
+
uid: firebaseUser.uid,
|
|
921
|
+
email: firebaseUser.email,
|
|
922
|
+
roles: [UserRole.PRACTITIONER],
|
|
923
|
+
isAnonymous: firebaseUser.isAnonymous || false,
|
|
924
|
+
createdAt: serverTimestamp(),
|
|
925
|
+
updatedAt: serverTimestamp(),
|
|
926
|
+
lastLoginAt: serverTimestamp(),
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
console.log('[AUTH] Attempting setDoc directly with userData:', {
|
|
930
|
+
uid: userData.uid,
|
|
931
|
+
email: userData.email,
|
|
932
|
+
roles: userData.roles,
|
|
917
933
|
});
|
|
918
|
-
|
|
934
|
+
|
|
935
|
+
try {
|
|
936
|
+
await setDoc(doc(this.db, USERS_COLLECTION, firebaseUser.uid), userData);
|
|
937
|
+
console.log('[AUTH] ✅ setDoc SUCCEEDED directly!');
|
|
938
|
+
|
|
939
|
+
// Fetch the created user
|
|
940
|
+
const userDoc = await getDoc(doc(this.db, USERS_COLLECTION, firebaseUser.uid));
|
|
941
|
+
if (!userDoc.exists()) {
|
|
942
|
+
throw new Error('User document was not created');
|
|
943
|
+
}
|
|
944
|
+
user = userDoc.data() as User;
|
|
945
|
+
console.log('[AUTH] User document created successfully:', user.uid);
|
|
946
|
+
} catch (error: any) {
|
|
947
|
+
console.error('[AUTH] ❌ setDoc FAILED directly:', {
|
|
948
|
+
errorCode: error?.code,
|
|
949
|
+
errorMessage: error?.message,
|
|
950
|
+
uid: firebaseUser.uid,
|
|
951
|
+
});
|
|
952
|
+
throw error;
|
|
953
|
+
}
|
|
919
954
|
}
|
|
920
955
|
|
|
921
956
|
// Step 3: Claim the draft profiles
|