@amohamud23/notihub 1.0.180 → 1.0.181

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.cjs CHANGED
@@ -451,14 +451,17 @@ var Notifications = class _Notifications {
451
451
  throw new Error("Could not fetch notification");
452
452
  }
453
453
  }
454
- static async getNotificationsByEntityId(customerId) {
455
- const command = new import_lib_dynamodb4.GetCommand({
454
+ static async getAllNotificationsByEntityId(customerId) {
455
+ const command = new import_lib_dynamodb4.QueryCommand({
456
456
  TableName: _Notifications.TABLE_NAME,
457
- Key: { customerId }
457
+ KeyConditionExpression: "customerId = :customerId",
458
+ ExpressionAttributeValues: {
459
+ ":customerId": customerId
460
+ }
458
461
  });
459
462
  try {
460
463
  const result = await ddbDocClient.send(command);
461
- return result.Item || null;
464
+ return result.Items || null;
462
465
  } catch (error) {
463
466
  console.error(
464
467
  `Error fetching notifications by customerId: ${customerId}`,
package/dist/index.d.cts CHANGED
@@ -343,7 +343,7 @@ declare class Notifications {
343
343
  * @returns A promise that resolves to the notification object or null if not found.
344
344
  */
345
345
  static getNotificationById(id: string): Promise<INotiHubNotification | null>;
346
- static getNotificationsByEntityId(customerId: string): Promise<INotiHubNotification | null>;
346
+ static getAllNotificationsByEntityId(customerId: string): Promise<INotiHubNotification[] | null>;
347
347
  /**
348
348
  * Creates a new notification.
349
349
  * @param notification - The notification object to create.
package/dist/index.d.ts CHANGED
@@ -343,7 +343,7 @@ declare class Notifications {
343
343
  * @returns A promise that resolves to the notification object or null if not found.
344
344
  */
345
345
  static getNotificationById(id: string): Promise<INotiHubNotification | null>;
346
- static getNotificationsByEntityId(customerId: string): Promise<INotiHubNotification | null>;
346
+ static getAllNotificationsByEntityId(customerId: string): Promise<INotiHubNotification[] | null>;
347
347
  /**
348
348
  * Creates a new notification.
349
349
  * @param notification - The notification object to create.
package/dist/index.js CHANGED
@@ -395,7 +395,6 @@ var Customer_default = Customer;
395
395
 
396
396
  // src/DynamoModels/Notifications.ts
397
397
  import {
398
- GetCommand as GetCommand3,
399
398
  PutCommand as PutCommand3,
400
399
  QueryCommand as QueryCommand3
401
400
  } from "@aws-sdk/lib-dynamodb";
@@ -428,14 +427,17 @@ var Notifications = class _Notifications {
428
427
  throw new Error("Could not fetch notification");
429
428
  }
430
429
  }
431
- static async getNotificationsByEntityId(customerId) {
432
- const command = new GetCommand3({
430
+ static async getAllNotificationsByEntityId(customerId) {
431
+ const command = new QueryCommand3({
433
432
  TableName: _Notifications.TABLE_NAME,
434
- Key: { customerId }
433
+ KeyConditionExpression: "customerId = :customerId",
434
+ ExpressionAttributeValues: {
435
+ ":customerId": customerId
436
+ }
435
437
  });
436
438
  try {
437
439
  const result = await ddbDocClient.send(command);
438
- return result.Item || null;
440
+ return result.Items || null;
439
441
  } catch (error) {
440
442
  console.error(
441
443
  `Error fetching notifications by customerId: ${customerId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amohamud23/notihub",
3
- "version": "1.0.180",
3
+ "version": "1.0.181",
4
4
  "description": "Notihub Package",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",