@blackcode_sa/metaestetics-api 1.12.28 → 1.12.29
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 +11 -12
- package/dist/index.mjs +12 -13
- package/package.json +2 -1
- package/src/services/clinic/clinic.service.ts +11 -12
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 geo-tz 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 geo-tz 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_geo_tz = require("geo-tz");
|
|
8580
8581
|
var import_geofire_common7 = require("geofire-common");
|
|
8581
8582
|
var import_zod20 = require("zod");
|
|
8582
8583
|
|
|
@@ -9332,22 +9333,20 @@ 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 geo-tz 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
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
const data = result.data;
|
|
9348
|
-
return data.timezone;
|
|
9343
|
+
const timezones = (0, import_geo_tz.find)(lat, lng);
|
|
9344
|
+
if (timezones && timezones.length > 0) {
|
|
9345
|
+
return timezones[0];
|
|
9346
|
+
}
|
|
9347
|
+
return null;
|
|
9349
9348
|
} catch (error) {
|
|
9350
|
-
console.error("Error getting timezone:", error);
|
|
9349
|
+
console.error("[CLINIC_SERVICE] Error getting timezone:", error);
|
|
9351
9350
|
return null;
|
|
9352
9351
|
}
|
|
9353
9352
|
}
|
|
@@ -9462,7 +9461,7 @@ var ClinicService = class extends BaseService {
|
|
|
9462
9461
|
);
|
|
9463
9462
|
const location = validatedData.location;
|
|
9464
9463
|
const hash = (0, import_geofire_common7.geohashForLocation)([location.latitude, location.longitude]);
|
|
9465
|
-
const tz =
|
|
9464
|
+
const tz = this.getTimezone(location.latitude, location.longitude);
|
|
9466
9465
|
console.log("\u{1F3E5} Clinic timezone:", tz);
|
|
9467
9466
|
const defaultReviewInfo = {
|
|
9468
9467
|
totalReviews: 0,
|
|
@@ -9585,7 +9584,7 @@ var ClinicService = class extends BaseService {
|
|
|
9585
9584
|
}
|
|
9586
9585
|
if (validatedData.location) {
|
|
9587
9586
|
const loc = validatedData.location;
|
|
9588
|
-
const tz =
|
|
9587
|
+
const tz = this.getTimezone(loc.latitude, loc.longitude);
|
|
9589
9588
|
updatePayload.location = {
|
|
9590
9589
|
...loc,
|
|
9591
9590
|
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 { find as findTimezone } from "geo-tz";
|
|
8649
8650
|
import {
|
|
8650
8651
|
geohashForLocation as geohashForLocation4
|
|
8651
8652
|
} from "geofire-common";
|
|
@@ -9432,22 +9433,20 @@ 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 geo-tz 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
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
const data = result.data;
|
|
9448
|
-
return data.timezone;
|
|
9443
|
+
const timezones = findTimezone(lat, lng);
|
|
9444
|
+
if (timezones && timezones.length > 0) {
|
|
9445
|
+
return timezones[0];
|
|
9446
|
+
}
|
|
9447
|
+
return null;
|
|
9449
9448
|
} catch (error) {
|
|
9450
|
-
console.error("Error getting timezone:", error);
|
|
9449
|
+
console.error("[CLINIC_SERVICE] Error getting timezone:", error);
|
|
9451
9450
|
return null;
|
|
9452
9451
|
}
|
|
9453
9452
|
}
|
|
@@ -9562,7 +9561,7 @@ var ClinicService = class extends BaseService {
|
|
|
9562
9561
|
);
|
|
9563
9562
|
const location = validatedData.location;
|
|
9564
9563
|
const hash = geohashForLocation4([location.latitude, location.longitude]);
|
|
9565
|
-
const tz =
|
|
9564
|
+
const tz = this.getTimezone(location.latitude, location.longitude);
|
|
9566
9565
|
console.log("\u{1F3E5} Clinic timezone:", tz);
|
|
9567
9566
|
const defaultReviewInfo = {
|
|
9568
9567
|
totalReviews: 0,
|
|
@@ -9685,7 +9684,7 @@ var ClinicService = class extends BaseService {
|
|
|
9685
9684
|
}
|
|
9686
9685
|
if (validatedData.location) {
|
|
9687
9686
|
const loc = validatedData.location;
|
|
9688
|
-
const tz =
|
|
9687
|
+
const tz = this.getTimezone(loc.latitude, loc.longitude);
|
|
9689
9688
|
updatePayload.location = {
|
|
9690
9689
|
...loc,
|
|
9691
9690
|
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.29",
|
|
5
5
|
"description": "Firebase authentication service with anonymous upgrade support",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"axios": "^1.8.3",
|
|
99
99
|
"expo-server-sdk": "^3.13.0",
|
|
100
100
|
"firebase-admin": "^13.0.2",
|
|
101
|
+
"geo-tz": "^8.1.4",
|
|
101
102
|
"geofire-common": "^6.0.0",
|
|
102
103
|
"luxon": "^3.7.1",
|
|
103
104
|
"zod": "^3.24.1"
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
arrayRemove,
|
|
19
19
|
} from "firebase/firestore";
|
|
20
20
|
import { getFunctions, httpsCallable } from "firebase/functions";
|
|
21
|
+
import { find as findTimezone } from "geo-tz";
|
|
21
22
|
import { BaseService } from "../base.service";
|
|
22
23
|
import {
|
|
23
24
|
Clinic,
|
|
@@ -82,22 +83,20 @@ export class ClinicService extends BaseService {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
|
-
* Get timezone from coordinates using
|
|
86
|
+
* Get timezone from coordinates using geo-tz 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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const data = result.data as { timezone: string };
|
|
98
|
-
return data.timezone;
|
|
93
|
+
const timezones = findTimezone(lat, lng);
|
|
94
|
+
if (timezones && timezones.length > 0) {
|
|
95
|
+
return timezones[0];
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
99
98
|
} catch (error) {
|
|
100
|
-
console.error("Error getting timezone:", error);
|
|
99
|
+
console.error("[CLINIC_SERVICE] Error getting timezone:", error);
|
|
101
100
|
return null;
|
|
102
101
|
}
|
|
103
102
|
}
|
|
@@ -249,7 +248,7 @@ export class ClinicService extends BaseService {
|
|
|
249
248
|
|
|
250
249
|
const location = validatedData.location;
|
|
251
250
|
const hash = geohashForLocation([location.latitude, location.longitude]);
|
|
252
|
-
const tz =
|
|
251
|
+
const tz = this.getTimezone(location.latitude, location.longitude);
|
|
253
252
|
console.log("🏥 Clinic timezone:", tz);
|
|
254
253
|
const defaultReviewInfo: ClinicReviewInfo = {
|
|
255
254
|
totalReviews: 0,
|
|
@@ -418,7 +417,7 @@ export class ClinicService extends BaseService {
|
|
|
418
417
|
// Handle location update with geohash
|
|
419
418
|
if (validatedData.location) {
|
|
420
419
|
const loc = validatedData.location;
|
|
421
|
-
const tz =
|
|
420
|
+
const tz = this.getTimezone(loc.latitude, loc.longitude);
|
|
422
421
|
updatePayload.location = {
|
|
423
422
|
...loc,
|
|
424
423
|
geohash: geohashForLocation([loc.latitude, loc.longitude]),
|