@blackcode_sa/metaestetics-api 1.14.37 → 1.14.41
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 +9 -0
- package/dist/admin/index.mjs +9 -0
- package/dist/backoffice/index.d.mts +8 -0
- package/dist/backoffice/index.d.ts +8 -0
- package/dist/backoffice/index.js +8 -0
- package/dist/backoffice/index.mjs +8 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.mjs +8 -0
- package/package.json +1 -1
- package/src/admin/aggregation/appointment/README.md +1 -0
- package/src/admin/aggregation/appointment/appointment.aggregation.service.ts +15 -0
- package/src/backoffice/services/product.service.ts +9 -0
- package/src/backoffice/types/product.types.ts +9 -0
package/dist/admin/index.js
CHANGED
|
@@ -3081,6 +3081,15 @@ var AppointmentAggregationService = class {
|
|
|
3081
3081
|
const dueDateTime = new Date(appointment.appointmentStartTime.toMillis());
|
|
3082
3082
|
if (template.timeframe.unit === "days" /* DAYS */) {
|
|
3083
3083
|
dueDateTime.setDate(dueDateTime.getDate() - notifyAtValue);
|
|
3084
|
+
if (notifyAtValue === 0) {
|
|
3085
|
+
const DEFAULT_MORNING_HOUR = 8;
|
|
3086
|
+
const appointmentHour = dueDateTime.getHours();
|
|
3087
|
+
if (appointmentHour > DEFAULT_MORNING_HOUR) {
|
|
3088
|
+
dueDateTime.setHours(DEFAULT_MORNING_HOUR, 0, 0, 0);
|
|
3089
|
+
} else {
|
|
3090
|
+
dueDateTime.setHours(Math.max(0, appointmentHour - 2), 0, 0, 0);
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3084
3093
|
} else if (template.timeframe.unit === "hours" /* HOURS */) {
|
|
3085
3094
|
dueDateTime.setHours(dueDateTime.getHours() - notifyAtValue);
|
|
3086
3095
|
}
|
package/dist/admin/index.mjs
CHANGED
|
@@ -3005,6 +3005,15 @@ var AppointmentAggregationService = class {
|
|
|
3005
3005
|
const dueDateTime = new Date(appointment.appointmentStartTime.toMillis());
|
|
3006
3006
|
if (template.timeframe.unit === "days" /* DAYS */) {
|
|
3007
3007
|
dueDateTime.setDate(dueDateTime.getDate() - notifyAtValue);
|
|
3008
|
+
if (notifyAtValue === 0) {
|
|
3009
|
+
const DEFAULT_MORNING_HOUR = 8;
|
|
3010
|
+
const appointmentHour = dueDateTime.getHours();
|
|
3011
|
+
if (appointmentHour > DEFAULT_MORNING_HOUR) {
|
|
3012
|
+
dueDateTime.setHours(DEFAULT_MORNING_HOUR, 0, 0, 0);
|
|
3013
|
+
} else {
|
|
3014
|
+
dueDateTime.setHours(Math.max(0, appointmentHour - 2), 0, 0, 0);
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3008
3017
|
} else if (template.timeframe.unit === "hours" /* HOURS */) {
|
|
3009
3018
|
dueDateTime.setHours(dueDateTime.getHours() - notifyAtValue);
|
|
3010
3019
|
}
|
|
@@ -734,6 +734,14 @@ interface IProductService {
|
|
|
734
734
|
* @param brandId - ID of the brand
|
|
735
735
|
*/
|
|
736
736
|
getByBrand(brandId: string): Promise<Product[]>;
|
|
737
|
+
/**
|
|
738
|
+
* Exports products to CSV format
|
|
739
|
+
* @param options - Export options
|
|
740
|
+
*/
|
|
741
|
+
exportToCsv(options?: {
|
|
742
|
+
includeInactive?: boolean;
|
|
743
|
+
includeBom?: boolean;
|
|
744
|
+
}): Promise<string>;
|
|
737
745
|
/**
|
|
738
746
|
* @deprecated Use createTopLevel instead
|
|
739
747
|
* Creates a new product
|
|
@@ -734,6 +734,14 @@ interface IProductService {
|
|
|
734
734
|
* @param brandId - ID of the brand
|
|
735
735
|
*/
|
|
736
736
|
getByBrand(brandId: string): Promise<Product[]>;
|
|
737
|
+
/**
|
|
738
|
+
* Exports products to CSV format
|
|
739
|
+
* @param options - Export options
|
|
740
|
+
*/
|
|
741
|
+
exportToCsv(options?: {
|
|
742
|
+
includeInactive?: boolean;
|
|
743
|
+
includeBom?: boolean;
|
|
744
|
+
}): Promise<string>;
|
|
737
745
|
/**
|
|
738
746
|
* @deprecated Use createTopLevel instead
|
|
739
747
|
* Creates a new product
|
package/dist/backoffice/index.js
CHANGED
|
@@ -1878,11 +1878,19 @@ var ProductService = class extends BaseService {
|
|
|
1878
1878
|
*/
|
|
1879
1879
|
async getAllTopLevel(options) {
|
|
1880
1880
|
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
1881
|
+
console.log("[ProductService.getAllTopLevel] Called with:", {
|
|
1882
|
+
rowsPerPage,
|
|
1883
|
+
hasLastVisible: !!lastVisible,
|
|
1884
|
+
brandId: brandId || "none",
|
|
1885
|
+
category: category || "none"
|
|
1886
|
+
});
|
|
1881
1887
|
const constraints = [(0, import_firestore8.where)("isActive", "==", true), (0, import_firestore8.orderBy)("name")];
|
|
1882
1888
|
if (brandId) {
|
|
1889
|
+
console.log("[ProductService.getAllTopLevel] Adding brandId filter:", brandId);
|
|
1883
1890
|
constraints.push((0, import_firestore8.where)("brandId", "==", brandId));
|
|
1884
1891
|
}
|
|
1885
1892
|
if (category) {
|
|
1893
|
+
console.log("[ProductService.getAllTopLevel] Adding category filter:", category);
|
|
1886
1894
|
constraints.push((0, import_firestore8.where)("category", "==", category));
|
|
1887
1895
|
}
|
|
1888
1896
|
if (lastVisible) {
|
|
@@ -1854,11 +1854,19 @@ var ProductService = class extends BaseService {
|
|
|
1854
1854
|
*/
|
|
1855
1855
|
async getAllTopLevel(options) {
|
|
1856
1856
|
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
1857
|
+
console.log("[ProductService.getAllTopLevel] Called with:", {
|
|
1858
|
+
rowsPerPage,
|
|
1859
|
+
hasLastVisible: !!lastVisible,
|
|
1860
|
+
brandId: brandId || "none",
|
|
1861
|
+
category: category || "none"
|
|
1862
|
+
});
|
|
1857
1863
|
const constraints = [where6("isActive", "==", true), orderBy6("name")];
|
|
1858
1864
|
if (brandId) {
|
|
1865
|
+
console.log("[ProductService.getAllTopLevel] Adding brandId filter:", brandId);
|
|
1859
1866
|
constraints.push(where6("brandId", "==", brandId));
|
|
1860
1867
|
}
|
|
1861
1868
|
if (category) {
|
|
1869
|
+
console.log("[ProductService.getAllTopLevel] Adding category filter:", category);
|
|
1862
1870
|
constraints.push(where6("category", "==", category));
|
|
1863
1871
|
}
|
|
1864
1872
|
if (lastVisible) {
|
package/dist/index.d.mts
CHANGED
|
@@ -671,6 +671,14 @@ interface IProductService {
|
|
|
671
671
|
* @param brandId - ID of the brand
|
|
672
672
|
*/
|
|
673
673
|
getByBrand(brandId: string): Promise<Product[]>;
|
|
674
|
+
/**
|
|
675
|
+
* Exports products to CSV format
|
|
676
|
+
* @param options - Export options
|
|
677
|
+
*/
|
|
678
|
+
exportToCsv(options?: {
|
|
679
|
+
includeInactive?: boolean;
|
|
680
|
+
includeBom?: boolean;
|
|
681
|
+
}): Promise<string>;
|
|
674
682
|
/**
|
|
675
683
|
* @deprecated Use createTopLevel instead
|
|
676
684
|
* Creates a new product
|
package/dist/index.d.ts
CHANGED
|
@@ -671,6 +671,14 @@ interface IProductService {
|
|
|
671
671
|
* @param brandId - ID of the brand
|
|
672
672
|
*/
|
|
673
673
|
getByBrand(brandId: string): Promise<Product[]>;
|
|
674
|
+
/**
|
|
675
|
+
* Exports products to CSV format
|
|
676
|
+
* @param options - Export options
|
|
677
|
+
*/
|
|
678
|
+
exportToCsv(options?: {
|
|
679
|
+
includeInactive?: boolean;
|
|
680
|
+
includeBom?: boolean;
|
|
681
|
+
}): Promise<string>;
|
|
674
682
|
/**
|
|
675
683
|
* @deprecated Use createTopLevel instead
|
|
676
684
|
* Creates a new product
|
package/dist/index.js
CHANGED
|
@@ -25285,11 +25285,19 @@ var ProductService = class extends BaseService {
|
|
|
25285
25285
|
*/
|
|
25286
25286
|
async getAllTopLevel(options) {
|
|
25287
25287
|
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
25288
|
+
console.log("[ProductService.getAllTopLevel] Called with:", {
|
|
25289
|
+
rowsPerPage,
|
|
25290
|
+
hasLastVisible: !!lastVisible,
|
|
25291
|
+
brandId: brandId || "none",
|
|
25292
|
+
category: category || "none"
|
|
25293
|
+
});
|
|
25288
25294
|
const constraints = [(0, import_firestore65.where)("isActive", "==", true), (0, import_firestore65.orderBy)("name")];
|
|
25289
25295
|
if (brandId) {
|
|
25296
|
+
console.log("[ProductService.getAllTopLevel] Adding brandId filter:", brandId);
|
|
25290
25297
|
constraints.push((0, import_firestore65.where)("brandId", "==", brandId));
|
|
25291
25298
|
}
|
|
25292
25299
|
if (category) {
|
|
25300
|
+
console.log("[ProductService.getAllTopLevel] Adding category filter:", category);
|
|
25293
25301
|
constraints.push((0, import_firestore65.where)("category", "==", category));
|
|
25294
25302
|
}
|
|
25295
25303
|
if (lastVisible) {
|
package/dist/index.mjs
CHANGED
|
@@ -25602,11 +25602,19 @@ var ProductService = class extends BaseService {
|
|
|
25602
25602
|
*/
|
|
25603
25603
|
async getAllTopLevel(options) {
|
|
25604
25604
|
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
25605
|
+
console.log("[ProductService.getAllTopLevel] Called with:", {
|
|
25606
|
+
rowsPerPage,
|
|
25607
|
+
hasLastVisible: !!lastVisible,
|
|
25608
|
+
brandId: brandId || "none",
|
|
25609
|
+
category: category || "none"
|
|
25610
|
+
});
|
|
25605
25611
|
const constraints = [where39("isActive", "==", true), orderBy23("name")];
|
|
25606
25612
|
if (brandId) {
|
|
25613
|
+
console.log("[ProductService.getAllTopLevel] Adding brandId filter:", brandId);
|
|
25607
25614
|
constraints.push(where39("brandId", "==", brandId));
|
|
25608
25615
|
}
|
|
25609
25616
|
if (category) {
|
|
25617
|
+
console.log("[ProductService.getAllTopLevel] Adding category filter:", category);
|
|
25610
25618
|
constraints.push(where39("category", "==", category));
|
|
25611
25619
|
}
|
|
25612
25620
|
if (lastVisible) {
|
package/package.json
CHANGED
|
@@ -59,6 +59,7 @@ This service is responsible for handling side effects and data aggregation tasks
|
|
|
59
59
|
- **`createPreAppointmentRequirementInstances(appointment: Appointment)`**:
|
|
60
60
|
- Creates `PatientRequirementInstance` documents for pre-appointment requirements based on `appointment.preProcedureRequirements`.
|
|
61
61
|
- Calculates due times for instructions based on `appointment.appointmentStartTime`.
|
|
62
|
+
- **Same-day notification handling**: For `notifyAt: 0` with `unit: "days"`, notifications are sent at 8 AM instead of the appointment time. If the appointment is before 8 AM, the notification is sent 2 hours before the appointment.
|
|
62
63
|
- Sets `actionableWindow` with a placeholder value (TODO noted).
|
|
63
64
|
- Batch writes instances to Firestore.
|
|
64
65
|
- **`createPostAppointmentRequirementInstances(appointment: Appointment)`**:
|
|
@@ -695,6 +695,21 @@ export class AppointmentAggregationService {
|
|
|
695
695
|
const dueDateTime = new Date(appointment.appointmentStartTime.toMillis());
|
|
696
696
|
if (template.timeframe.unit === TimeUnit.DAYS) {
|
|
697
697
|
dueDateTime.setDate(dueDateTime.getDate() - notifyAtValue);
|
|
698
|
+
|
|
699
|
+
// Edge case: For "same day" PRE notifications (0 days before),
|
|
700
|
+
// send at morning time instead of appointment time
|
|
701
|
+
if (notifyAtValue === 0) {
|
|
702
|
+
const DEFAULT_MORNING_HOUR = 8;
|
|
703
|
+
const appointmentHour = dueDateTime.getHours();
|
|
704
|
+
|
|
705
|
+
if (appointmentHour > DEFAULT_MORNING_HOUR) {
|
|
706
|
+
// Appointment is after 8 AM - send notification at 8 AM
|
|
707
|
+
dueDateTime.setHours(DEFAULT_MORNING_HOUR, 0, 0, 0);
|
|
708
|
+
} else {
|
|
709
|
+
// Appointment is before/at 8 AM - send 2 hours before appointment
|
|
710
|
+
dueDateTime.setHours(Math.max(0, appointmentHour - 2), 0, 0, 0);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
698
713
|
} else if (template.timeframe.unit === TimeUnit.HOURS) {
|
|
699
714
|
dueDateTime.setHours(dueDateTime.getHours() - notifyAtValue);
|
|
700
715
|
}
|
|
@@ -295,13 +295,22 @@ export class ProductService extends BaseService implements IProductService {
|
|
|
295
295
|
}): Promise<{ products: Product[]; lastVisible: any }> {
|
|
296
296
|
const { rowsPerPage, lastVisible, brandId, category } = options;
|
|
297
297
|
|
|
298
|
+
console.log('[ProductService.getAllTopLevel] Called with:', {
|
|
299
|
+
rowsPerPage,
|
|
300
|
+
hasLastVisible: !!lastVisible,
|
|
301
|
+
brandId: brandId || 'none',
|
|
302
|
+
category: category || 'none',
|
|
303
|
+
});
|
|
304
|
+
|
|
298
305
|
const constraints: QueryConstraint[] = [where('isActive', '==', true), orderBy('name')];
|
|
299
306
|
|
|
300
307
|
if (brandId) {
|
|
308
|
+
console.log('[ProductService.getAllTopLevel] Adding brandId filter:', brandId);
|
|
301
309
|
constraints.push(where('brandId', '==', brandId));
|
|
302
310
|
}
|
|
303
311
|
|
|
304
312
|
if (category) {
|
|
313
|
+
console.log('[ProductService.getAllTopLevel] Adding category filter:', category);
|
|
305
314
|
constraints.push(where('category', '==', category));
|
|
306
315
|
}
|
|
307
316
|
|
|
@@ -136,6 +136,15 @@ export interface IProductService {
|
|
|
136
136
|
*/
|
|
137
137
|
getByBrand(brandId: string): Promise<Product[]>;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Exports products to CSV format
|
|
141
|
+
* @param options - Export options
|
|
142
|
+
*/
|
|
143
|
+
exportToCsv(options?: {
|
|
144
|
+
includeInactive?: boolean;
|
|
145
|
+
includeBom?: boolean;
|
|
146
|
+
}): Promise<string>;
|
|
147
|
+
|
|
139
148
|
// ==========================================
|
|
140
149
|
// DEPRECATED METHODS: Kept for backward compatibility
|
|
141
150
|
// ==========================================
|