@blackcode_sa/metaestetics-api 1.12.28 → 1.12.30
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -12
- package/dist/index.mjs +9 -13
- package/package.json +2 -1
- package/src/services/clinic/clinic.service.ts +8 -12
- package/src/types/tz-lookup.d.ts +4 -0
package/dist/index.d.mts
CHANGED
|
@@ -5237,7 +5237,7 @@ declare class ClinicService extends BaseService {
|
|
|
5237
5237
|
private functions;
|
|
5238
5238
|
constructor(db: Firestore, auth: Auth, app: FirebaseApp, clinicGroupService: ClinicGroupService, clinicAdminService: ClinicAdminService, mediaService: MediaService);
|
|
5239
5239
|
/**
|
|
5240
|
-
* Get timezone from coordinates using
|
|
5240
|
+
* Get timezone from coordinates using tz-lookup library
|
|
5241
5241
|
* @param lat Latitude
|
|
5242
5242
|
* @param lng Longitude
|
|
5243
5243
|
* @returns IANA timezone string
|
package/dist/index.d.ts
CHANGED
|
@@ -5237,7 +5237,7 @@ declare class ClinicService extends BaseService {
|
|
|
5237
5237
|
private functions;
|
|
5238
5238
|
constructor(db: Firestore, auth: Auth, app: FirebaseApp, clinicGroupService: ClinicGroupService, clinicAdminService: ClinicAdminService, mediaService: MediaService);
|
|
5239
5239
|
/**
|
|
5240
|
-
* Get timezone from coordinates using
|
|
5240
|
+
* Get timezone from coordinates using tz-lookup library
|
|
5241
5241
|
* @param lat Latitude
|
|
5242
5242
|
* @param lng Longitude
|
|
5243
5243
|
* @returns IANA timezone string
|
package/dist/index.js
CHANGED
|
@@ -8577,6 +8577,7 @@ var ClinicGroupService = class extends BaseService {
|
|
|
8577
8577
|
// src/services/clinic/clinic.service.ts
|
|
8578
8578
|
var import_firestore28 = require("firebase/firestore");
|
|
8579
8579
|
var import_functions2 = require("firebase/functions");
|
|
8580
|
+
var import_tz_lookup = __toESM(require("tz-lookup"));
|
|
8580
8581
|
var import_geofire_common7 = require("geofire-common");
|
|
8581
8582
|
var import_zod20 = require("zod");
|
|
8582
8583
|
|
|
@@ -9332,22 +9333,17 @@ var ClinicService = class extends BaseService {
|
|
|
9332
9333
|
this.functions = (0, import_functions2.getFunctions)(app, "europe-west6");
|
|
9333
9334
|
}
|
|
9334
9335
|
/**
|
|
9335
|
-
* Get timezone from coordinates using
|
|
9336
|
+
* Get timezone from coordinates using tz-lookup library
|
|
9336
9337
|
* @param lat Latitude
|
|
9337
9338
|
* @param lng Longitude
|
|
9338
9339
|
* @returns IANA timezone string
|
|
9339
9340
|
*/
|
|
9340
|
-
|
|
9341
|
+
getTimezone(lat, lng) {
|
|
9341
9342
|
try {
|
|
9342
|
-
const
|
|
9343
|
-
|
|
9344
|
-
"getTimezoneFromCoordinates"
|
|
9345
|
-
);
|
|
9346
|
-
const result = await getTimezoneFromCoordinates({ lat, lng });
|
|
9347
|
-
const data = result.data;
|
|
9348
|
-
return data.timezone;
|
|
9343
|
+
const timezone = (0, import_tz_lookup.default)(lat, lng);
|
|
9344
|
+
return timezone || null;
|
|
9349
9345
|
} catch (error) {
|
|
9350
|
-
console.error("Error getting timezone:", error);
|
|
9346
|
+
console.error("[CLINIC_SERVICE] Error getting timezone:", error);
|
|
9351
9347
|
return null;
|
|
9352
9348
|
}
|
|
9353
9349
|
}
|
|
@@ -9462,7 +9458,7 @@ var ClinicService = class extends BaseService {
|
|
|
9462
9458
|
);
|
|
9463
9459
|
const location = validatedData.location;
|
|
9464
9460
|
const hash = (0, import_geofire_common7.geohashForLocation)([location.latitude, location.longitude]);
|
|
9465
|
-
const tz =
|
|
9461
|
+
const tz = this.getTimezone(location.latitude, location.longitude);
|
|
9466
9462
|
console.log("\u{1F3E5} Clinic timezone:", tz);
|
|
9467
9463
|
const defaultReviewInfo = {
|
|
9468
9464
|
totalReviews: 0,
|
|
@@ -9585,7 +9581,7 @@ var ClinicService = class extends BaseService {
|
|
|
9585
9581
|
}
|
|
9586
9582
|
if (validatedData.location) {
|
|
9587
9583
|
const loc = validatedData.location;
|
|
9588
|
-
const tz =
|
|
9584
|
+
const tz = this.getTimezone(loc.latitude, loc.longitude);
|
|
9589
9585
|
updatePayload.location = {
|
|
9590
9586
|
...loc,
|
|
9591
9587
|
geohash: (0, import_geofire_common7.geohashForLocation)([loc.latitude, loc.longitude]),
|
package/dist/index.mjs
CHANGED
|
@@ -8645,7 +8645,8 @@ import {
|
|
|
8645
8645
|
writeBatch as writeBatch4,
|
|
8646
8646
|
arrayUnion as arrayUnion7
|
|
8647
8647
|
} from "firebase/firestore";
|
|
8648
|
-
import { getFunctions as getFunctions2
|
|
8648
|
+
import { getFunctions as getFunctions2 } from "firebase/functions";
|
|
8649
|
+
import tzlookup from "tz-lookup";
|
|
8649
8650
|
import {
|
|
8650
8651
|
geohashForLocation as geohashForLocation4
|
|
8651
8652
|
} from "geofire-common";
|
|
@@ -9432,22 +9433,17 @@ var ClinicService = class extends BaseService {
|
|
|
9432
9433
|
this.functions = getFunctions2(app, "europe-west6");
|
|
9433
9434
|
}
|
|
9434
9435
|
/**
|
|
9435
|
-
* Get timezone from coordinates using
|
|
9436
|
+
* Get timezone from coordinates using tz-lookup library
|
|
9436
9437
|
* @param lat Latitude
|
|
9437
9438
|
* @param lng Longitude
|
|
9438
9439
|
* @returns IANA timezone string
|
|
9439
9440
|
*/
|
|
9440
|
-
|
|
9441
|
+
getTimezone(lat, lng) {
|
|
9441
9442
|
try {
|
|
9442
|
-
const
|
|
9443
|
-
|
|
9444
|
-
"getTimezoneFromCoordinates"
|
|
9445
|
-
);
|
|
9446
|
-
const result = await getTimezoneFromCoordinates({ lat, lng });
|
|
9447
|
-
const data = result.data;
|
|
9448
|
-
return data.timezone;
|
|
9443
|
+
const timezone = tzlookup(lat, lng);
|
|
9444
|
+
return timezone || null;
|
|
9449
9445
|
} catch (error) {
|
|
9450
|
-
console.error("Error getting timezone:", error);
|
|
9446
|
+
console.error("[CLINIC_SERVICE] Error getting timezone:", error);
|
|
9451
9447
|
return null;
|
|
9452
9448
|
}
|
|
9453
9449
|
}
|
|
@@ -9562,7 +9558,7 @@ var ClinicService = class extends BaseService {
|
|
|
9562
9558
|
);
|
|
9563
9559
|
const location = validatedData.location;
|
|
9564
9560
|
const hash = geohashForLocation4([location.latitude, location.longitude]);
|
|
9565
|
-
const tz =
|
|
9561
|
+
const tz = this.getTimezone(location.latitude, location.longitude);
|
|
9566
9562
|
console.log("\u{1F3E5} Clinic timezone:", tz);
|
|
9567
9563
|
const defaultReviewInfo = {
|
|
9568
9564
|
totalReviews: 0,
|
|
@@ -9685,7 +9681,7 @@ var ClinicService = class extends BaseService {
|
|
|
9685
9681
|
}
|
|
9686
9682
|
if (validatedData.location) {
|
|
9687
9683
|
const loc = validatedData.location;
|
|
9688
|
-
const tz =
|
|
9684
|
+
const tz = this.getTimezone(loc.latitude, loc.longitude);
|
|
9689
9685
|
updatePayload.location = {
|
|
9690
9686
|
...loc,
|
|
9691
9687
|
geohash: geohashForLocation4([loc.latitude, loc.longitude]),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackcode_sa/metaestetics-api",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.30",
|
|
5
5
|
"description": "Firebase authentication service with anonymous upgrade support",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"firebase-admin": "^13.0.2",
|
|
101
101
|
"geofire-common": "^6.0.0",
|
|
102
102
|
"luxon": "^3.7.1",
|
|
103
|
+
"tz-lookup": "^6.1.25",
|
|
103
104
|
"zod": "^3.24.1"
|
|
104
105
|
},
|
|
105
106
|
"optionalDependencies": {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
arrayRemove,
|
|
19
19
|
} from "firebase/firestore";
|
|
20
20
|
import { getFunctions, httpsCallable } from "firebase/functions";
|
|
21
|
+
import tzlookup from "tz-lookup";
|
|
21
22
|
import { BaseService } from "../base.service";
|
|
22
23
|
import {
|
|
23
24
|
Clinic,
|
|
@@ -82,22 +83,17 @@ export class ClinicService extends BaseService {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
|
-
* Get timezone from coordinates using
|
|
86
|
+
* Get timezone from coordinates using tz-lookup library
|
|
86
87
|
* @param lat Latitude
|
|
87
88
|
* @param lng Longitude
|
|
88
89
|
* @returns IANA timezone string
|
|
89
90
|
*/
|
|
90
|
-
private
|
|
91
|
+
private getTimezone(lat: number, lng: number): string | null {
|
|
91
92
|
try {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
"getTimezoneFromCoordinates"
|
|
95
|
-
);
|
|
96
|
-
const result = await getTimezoneFromCoordinates({ lat, lng });
|
|
97
|
-
const data = result.data as { timezone: string };
|
|
98
|
-
return data.timezone;
|
|
93
|
+
const timezone = tzlookup(lat, lng);
|
|
94
|
+
return timezone || null;
|
|
99
95
|
} catch (error) {
|
|
100
|
-
console.error("Error getting timezone:", error);
|
|
96
|
+
console.error("[CLINIC_SERVICE] Error getting timezone:", error);
|
|
101
97
|
return null;
|
|
102
98
|
}
|
|
103
99
|
}
|
|
@@ -249,7 +245,7 @@ export class ClinicService extends BaseService {
|
|
|
249
245
|
|
|
250
246
|
const location = validatedData.location;
|
|
251
247
|
const hash = geohashForLocation([location.latitude, location.longitude]);
|
|
252
|
-
const tz =
|
|
248
|
+
const tz = this.getTimezone(location.latitude, location.longitude);
|
|
253
249
|
console.log("🏥 Clinic timezone:", tz);
|
|
254
250
|
const defaultReviewInfo: ClinicReviewInfo = {
|
|
255
251
|
totalReviews: 0,
|
|
@@ -418,7 +414,7 @@ export class ClinicService extends BaseService {
|
|
|
418
414
|
// Handle location update with geohash
|
|
419
415
|
if (validatedData.location) {
|
|
420
416
|
const loc = validatedData.location;
|
|
421
|
-
const tz =
|
|
417
|
+
const tz = this.getTimezone(loc.latitude, loc.longitude);
|
|
422
418
|
updatePayload.location = {
|
|
423
419
|
...loc,
|
|
424
420
|
geohash: geohashForLocation([loc.latitude, loc.longitude]),
|