av6-core 1.6.9 → 1.7.1

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 CHANGED
@@ -323,7 +323,7 @@ interface Col {
323
323
  }
324
324
  interface ColValue {
325
325
  value: string[] | number[];
326
- type: "string" | "number" | "date" | "range" | "gt" | "lt";
326
+ type: "string" | "number" | "date" | "range" | "gt" | "lt" | "null";
327
327
  }
328
328
  interface NewFixedSearchRequest extends NewSearchRequest {
329
329
  fixedSearch?: Record<string, ColValue>;
package/dist/index.d.ts CHANGED
@@ -323,7 +323,7 @@ interface Col {
323
323
  }
324
324
  interface ColValue {
325
325
  value: string[] | number[];
326
- type: "string" | "number" | "date" | "range" | "gt" | "lt";
326
+ type: "string" | "number" | "date" | "range" | "gt" | "lt" | "null";
327
327
  }
328
328
  interface NewFixedSearchRequest extends NewSearchRequest {
329
329
  fixedSearch?: Record<string, ColValue>;
package/dist/index.js CHANGED
@@ -205,6 +205,8 @@ function buildFieldCondition(fieldPath, fieldType, values, isNot = false) {
205
205
  break;
206
206
  }
207
207
  }
208
+ } else if (fieldType === "null") {
209
+ finalLeaf = isNot ? { [lastKey]: { not: null } } : { [lastKey]: null };
208
210
  } else {
209
211
  finalLeaf = buildSingleValueCondition(lastKey, fieldType, values[0], isNot);
210
212
  }
@@ -1981,12 +1983,13 @@ var commonService = (serviceDeps) => {
1981
1983
  },
1982
1984
  async commonExcelImport(searchParams) {
1983
1985
  logger.info("entering::commonExcelImport::service");
1984
- const absolutePath = searchParams.file?.path;
1985
- if (!absolutePath) {
1986
- throw new Error("No file path provided for Excel import");
1986
+ const file = searchParams.file;
1987
+ if (!file?.buffer) {
1988
+ throw new Error("No file buffer provided for Excel import");
1987
1989
  }
1988
1990
  const workbook = new import_exceljs.default.Workbook();
1989
- await workbook.xlsx.readFile(absolutePath);
1991
+ const buffer = searchParams.file.buffer;
1992
+ await workbook.xlsx.load(buffer);
1990
1993
  const worksheet = workbook.worksheets[0];
1991
1994
  if (!worksheet) {
1992
1995
  throw new Error("No worksheet found in Excel file");
@@ -3062,7 +3065,7 @@ var getStaffInfoFromStaffIds = async (args) => {
3062
3065
  select: { id: true, email: true, contactNo: true }
3063
3066
  });
3064
3067
  staffById = new Map(
3065
- staffRows.map((s) => [s.id, { email: s.email ?? null, contactNo: s.contactNo ?? null, userId: null }])
3068
+ staffRows.map((s) => [s.id, { email: s.email ?? null, contactNo: s.contactNo ?? null, userId: s.id }])
3066
3069
  );
3067
3070
  break;
3068
3071
  case "LEVEL2": {
@@ -3080,7 +3083,7 @@ var getStaffInfoFromStaffIds = async (args) => {
3080
3083
  }
3081
3084
  });
3082
3085
  staffById = new Map(
3083
- result2.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: null }])
3086
+ result2.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: s.id }])
3084
3087
  );
3085
3088
  break;
3086
3089
  }
@@ -3099,7 +3102,7 @@ var getStaffInfoFromStaffIds = async (args) => {
3099
3102
  }
3100
3103
  });
3101
3104
  staffById = new Map(
3102
- result.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: null }])
3105
+ result.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: s.id }])
3103
3106
  );
3104
3107
  break;
3105
3108
  }
package/dist/index.mjs CHANGED
@@ -154,6 +154,8 @@ function buildFieldCondition(fieldPath, fieldType, values, isNot = false) {
154
154
  break;
155
155
  }
156
156
  }
157
+ } else if (fieldType === "null") {
158
+ finalLeaf = isNot ? { [lastKey]: { not: null } } : { [lastKey]: null };
157
159
  } else {
158
160
  finalLeaf = buildSingleValueCondition(lastKey, fieldType, values[0], isNot);
159
161
  }
@@ -1930,12 +1932,13 @@ var commonService = (serviceDeps) => {
1930
1932
  },
1931
1933
  async commonExcelImport(searchParams) {
1932
1934
  logger.info("entering::commonExcelImport::service");
1933
- const absolutePath = searchParams.file?.path;
1934
- if (!absolutePath) {
1935
- throw new Error("No file path provided for Excel import");
1935
+ const file = searchParams.file;
1936
+ if (!file?.buffer) {
1937
+ throw new Error("No file buffer provided for Excel import");
1936
1938
  }
1937
1939
  const workbook = new ExcelJs.Workbook();
1938
- await workbook.xlsx.readFile(absolutePath);
1940
+ const buffer = searchParams.file.buffer;
1941
+ await workbook.xlsx.load(buffer);
1939
1942
  const worksheet = workbook.worksheets[0];
1940
1943
  if (!worksheet) {
1941
1944
  throw new Error("No worksheet found in Excel file");
@@ -3011,7 +3014,7 @@ var getStaffInfoFromStaffIds = async (args) => {
3011
3014
  select: { id: true, email: true, contactNo: true }
3012
3015
  });
3013
3016
  staffById = new Map(
3014
- staffRows.map((s) => [s.id, { email: s.email ?? null, contactNo: s.contactNo ?? null, userId: null }])
3017
+ staffRows.map((s) => [s.id, { email: s.email ?? null, contactNo: s.contactNo ?? null, userId: s.id }])
3015
3018
  );
3016
3019
  break;
3017
3020
  case "LEVEL2": {
@@ -3029,7 +3032,7 @@ var getStaffInfoFromStaffIds = async (args) => {
3029
3032
  }
3030
3033
  });
3031
3034
  staffById = new Map(
3032
- result2.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: null }])
3035
+ result2.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: s.id }])
3033
3036
  );
3034
3037
  break;
3035
3038
  }
@@ -3048,7 +3051,7 @@ var getStaffInfoFromStaffIds = async (args) => {
3048
3051
  }
3049
3052
  });
3050
3053
  staffById = new Map(
3051
- result.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: null }])
3054
+ result.map((s) => [s.id, { email: s.email ?? null, contactNo: s.phoneNumber ?? null, userId: s.id }])
3052
3055
  );
3053
3056
  break;
3054
3057
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.6.9",
3
+ "version": "1.7.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",