@amohamud23/notihub 1.0.162 → 1.0.164
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 +129 -1
- package/dist/index.d.cts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +134 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -630,6 +630,87 @@ var NotiType = class _NotiType {
|
|
|
630
630
|
throw new Error("Could not update notification type");
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Deletes a notification type by its ID.
|
|
635
|
+
* @param id - The ID of the notification type to delete.
|
|
636
|
+
* @returns A promise that resolves when the notification type is deleted.
|
|
637
|
+
*/
|
|
638
|
+
static async deleteNotiType(id) {
|
|
639
|
+
const command = new import_lib_dynamodb6.DeleteCommand({
|
|
640
|
+
TableName: _NotiType.TABLE_NAME,
|
|
641
|
+
Key: { id }
|
|
642
|
+
});
|
|
643
|
+
try {
|
|
644
|
+
await ddbDocClient.send(command);
|
|
645
|
+
} catch (error) {
|
|
646
|
+
console.error("Error deleting notification type:", error);
|
|
647
|
+
throw new Error("Could not delete notification type");
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Delete all notification types for a given customerId
|
|
652
|
+
* Uses Query + BatchWrite with chunking
|
|
653
|
+
*/
|
|
654
|
+
static async deleteAllNotiTypesByCustomerId(customerId) {
|
|
655
|
+
try {
|
|
656
|
+
const itemsToDelete = [];
|
|
657
|
+
let lastEvaluatedKey;
|
|
658
|
+
do {
|
|
659
|
+
const scanResult = await ddbDocClient.send(
|
|
660
|
+
// TODO: update type
|
|
661
|
+
new import_lib_dynamodb6.ScanCommand({
|
|
662
|
+
TableName: _NotiType.TABLE_NAME,
|
|
663
|
+
FilterExpression: "customerId = :customerId",
|
|
664
|
+
ExpressionAttributeValues: {
|
|
665
|
+
":customerId": customerId
|
|
666
|
+
},
|
|
667
|
+
ExclusiveStartKey: lastEvaluatedKey
|
|
668
|
+
})
|
|
669
|
+
);
|
|
670
|
+
if (scanResult.Items) {
|
|
671
|
+
itemsToDelete.push(...scanResult.Items);
|
|
672
|
+
}
|
|
673
|
+
lastEvaluatedKey = scanResult.LastEvaluatedKey;
|
|
674
|
+
} while (lastEvaluatedKey);
|
|
675
|
+
if (itemsToDelete.length === 0) {
|
|
676
|
+
console.log(
|
|
677
|
+
`No notification types found for customerId: ${customerId}`
|
|
678
|
+
);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
console.log(
|
|
682
|
+
`Found ${itemsToDelete.length} notification types for customerId: ${customerId}. Deleting...`
|
|
683
|
+
);
|
|
684
|
+
const chunkSize = 25;
|
|
685
|
+
for (let i = 0; i < itemsToDelete.length; i += chunkSize) {
|
|
686
|
+
const chunk = itemsToDelete.slice(i, i + chunkSize);
|
|
687
|
+
const deleteRequests = chunk.map((item) => ({
|
|
688
|
+
DeleteRequest: {
|
|
689
|
+
Key: {
|
|
690
|
+
id: item.id,
|
|
691
|
+
customerId: item.customerId
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}));
|
|
695
|
+
await ddbDocClient.send(
|
|
696
|
+
new import_lib_dynamodb6.BatchWriteCommand({
|
|
697
|
+
RequestItems: {
|
|
698
|
+
[_NotiType.TABLE_NAME]: deleteRequests
|
|
699
|
+
}
|
|
700
|
+
})
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
console.log(
|
|
704
|
+
`Successfully deleted ${itemsToDelete.length} notification types for customerId: ${customerId}`
|
|
705
|
+
);
|
|
706
|
+
} catch (error) {
|
|
707
|
+
console.error(
|
|
708
|
+
`Failed to delete notification types for customerId: ${customerId}`,
|
|
709
|
+
error
|
|
710
|
+
);
|
|
711
|
+
throw new Error("Could not delete notification types for customerId");
|
|
712
|
+
}
|
|
713
|
+
}
|
|
633
714
|
};
|
|
634
715
|
var NotiType_default = NotiType;
|
|
635
716
|
|
|
@@ -732,6 +813,20 @@ var Subscription = class _Subscription {
|
|
|
732
813
|
throw new Error("Could not fetch subscription by SubscriptionId");
|
|
733
814
|
}
|
|
734
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Delete all subscriptions by user ID.
|
|
818
|
+
* @param userId - The ID of the user whose subscriptions to delete.
|
|
819
|
+
* @returns A promise that resolves when all subscriptions are deleted.
|
|
820
|
+
*/
|
|
821
|
+
static async deleteAllSubscriptionsByUserId(userId) {
|
|
822
|
+
const subscriptions = await this.getSubscriptionsByUserId(userId);
|
|
823
|
+
if (subscriptions && subscriptions.length > 0) {
|
|
824
|
+
const deletePromises = subscriptions.map(
|
|
825
|
+
(sub) => this.deleteSubscriptionById(sub.id)
|
|
826
|
+
);
|
|
827
|
+
await Promise.all(deletePromises);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
735
830
|
};
|
|
736
831
|
var Subscription_default = Subscription;
|
|
737
832
|
|
|
@@ -805,6 +900,23 @@ var NotiTypeStats = class _NotiTypeStats {
|
|
|
805
900
|
throw new Error("Could not create or update notification type stats");
|
|
806
901
|
}
|
|
807
902
|
}
|
|
903
|
+
/**
|
|
904
|
+
* Deletes notification type stats by their ID.
|
|
905
|
+
* @param id - The ID of the notification type stats to delete.
|
|
906
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
907
|
+
*/
|
|
908
|
+
static async deleteNotiTypeStatsById(id) {
|
|
909
|
+
const command = new import_lib_dynamodb8.DeleteCommand({
|
|
910
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
911
|
+
Key: { id }
|
|
912
|
+
});
|
|
913
|
+
try {
|
|
914
|
+
await ddbDocClient.send(command);
|
|
915
|
+
} catch (error) {
|
|
916
|
+
console.error("Error deleting notification type stats:", error);
|
|
917
|
+
throw new Error("Could not delete notification type stats");
|
|
918
|
+
}
|
|
919
|
+
}
|
|
808
920
|
};
|
|
809
921
|
var NotiTypeStats_default = NotiTypeStats;
|
|
810
922
|
|
|
@@ -896,7 +1008,23 @@ var SubscriptionType = class _SubscriptionType {
|
|
|
896
1008
|
throw new Error("Could not fetch subscription types by userId");
|
|
897
1009
|
}
|
|
898
1010
|
}
|
|
899
|
-
|
|
1011
|
+
/**
|
|
1012
|
+
* Deletes a subscription type by its ID.
|
|
1013
|
+
* @param id - The ID of the subscription type to delete.
|
|
1014
|
+
* @returns A promise that resolves when the subscription type is deleted.
|
|
1015
|
+
*/
|
|
1016
|
+
static async deleteSubscriptionTypeById(id) {
|
|
1017
|
+
const command = new import_lib_dynamodb10.DeleteCommand({
|
|
1018
|
+
TableName: _SubscriptionType.TABLE_NAME,
|
|
1019
|
+
Key: { id }
|
|
1020
|
+
});
|
|
1021
|
+
try {
|
|
1022
|
+
await ddbDocClient.send(command);
|
|
1023
|
+
} catch (error) {
|
|
1024
|
+
console.error("Error deleting subscription type:", error);
|
|
1025
|
+
throw new Error("Could not delete subscription type");
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
900
1028
|
};
|
|
901
1029
|
var SubscriptionType_default = SubscriptionType;
|
|
902
1030
|
|
package/dist/index.d.cts
CHANGED
|
@@ -144,7 +144,7 @@ type INotiType = {
|
|
|
144
144
|
};
|
|
145
145
|
type INotiTypeStats = {
|
|
146
146
|
id: string;
|
|
147
|
-
|
|
147
|
+
notiTypeId: string;
|
|
148
148
|
subscribed: number;
|
|
149
149
|
views: number;
|
|
150
150
|
createdAt: string;
|
|
@@ -154,6 +154,7 @@ type IUserSubscription = {
|
|
|
154
154
|
id: string;
|
|
155
155
|
user: INotiHubUser;
|
|
156
156
|
customer: INotiHubCustomer;
|
|
157
|
+
customerId: string;
|
|
157
158
|
subscriptionId: string;
|
|
158
159
|
type: "SUBSCRIBED" | "UNSUBSCRIBED";
|
|
159
160
|
createdAt: string;
|
|
@@ -163,7 +164,7 @@ type IUserSubscribeNotifier = {
|
|
|
163
164
|
userId: string;
|
|
164
165
|
userRef: INotiHubUser;
|
|
165
166
|
customerId: string;
|
|
166
|
-
|
|
167
|
+
customer: INotiHubCustomer;
|
|
167
168
|
notiTypeId: string;
|
|
168
169
|
notiTypeRef: INotiType;
|
|
169
170
|
subscriptionId: string;
|
|
@@ -401,6 +402,16 @@ declare class NotiType {
|
|
|
401
402
|
* @returns A promise that resolves to the updated notification type object.
|
|
402
403
|
*/
|
|
403
404
|
static updateNotiType(id: string, updates: Partial<INotiType>): Promise<INotiType>;
|
|
405
|
+
/**
|
|
406
|
+
* Deletes a notification type by its ID.
|
|
407
|
+
* @param id - The ID of the notification type to delete.
|
|
408
|
+
* @returns A promise that resolves when the notification type is deleted.
|
|
409
|
+
*/ static deleteNotiType(id: string): Promise<void>;
|
|
410
|
+
/**
|
|
411
|
+
* Delete all notification types for a given customerId
|
|
412
|
+
* Uses Query + BatchWrite with chunking
|
|
413
|
+
*/
|
|
414
|
+
static deleteAllNotiTypesByCustomerId(customerId: string): Promise<void>;
|
|
404
415
|
}
|
|
405
416
|
|
|
406
417
|
declare class Subscription {
|
|
@@ -436,6 +447,12 @@ declare class Subscription {
|
|
|
436
447
|
* @returns A promise that resolves to the subscription object or null if not found.
|
|
437
448
|
*/
|
|
438
449
|
static getSubscriptionBySubscriptionId(subscriptionId: string): Promise<INotiHubSubscription | null>;
|
|
450
|
+
/**
|
|
451
|
+
* Delete all subscriptions by user ID.
|
|
452
|
+
* @param userId - The ID of the user whose subscriptions to delete.
|
|
453
|
+
* @returns A promise that resolves when all subscriptions are deleted.
|
|
454
|
+
*/
|
|
455
|
+
static deleteAllSubscriptionsByUserId(userId: string): Promise<void>;
|
|
439
456
|
}
|
|
440
457
|
|
|
441
458
|
declare class NotiTypeStats {
|
|
@@ -459,6 +476,12 @@ declare class NotiTypeStats {
|
|
|
459
476
|
* @returns A promise that resolves to the created or updated notification type stats object.
|
|
460
477
|
*/
|
|
461
478
|
static createOrUpdateNotiTypeStats(notiTypeStats: INotiTypeStats): Promise<INotiTypeStats>;
|
|
479
|
+
/**
|
|
480
|
+
* Deletes notification type stats by their ID.
|
|
481
|
+
* @param id - The ID of the notification type stats to delete.
|
|
482
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
483
|
+
*/
|
|
484
|
+
static deleteNotiTypeStatsById(id: string): Promise<void>;
|
|
462
485
|
}
|
|
463
486
|
|
|
464
487
|
declare class Views {
|
|
@@ -488,6 +511,12 @@ declare class SubscriptionType {
|
|
|
488
511
|
*/
|
|
489
512
|
static getSubscriptionTypeById(id: string): Promise<IUserSubscribeNotifier | null>;
|
|
490
513
|
static getSubscriptionTypesByUserId(userId: string): Promise<IUserSubscribeNotifier[] | null>;
|
|
514
|
+
/**
|
|
515
|
+
* Deletes a subscription type by its ID.
|
|
516
|
+
* @param id - The ID of the subscription type to delete.
|
|
517
|
+
* @returns A promise that resolves when the subscription type is deleted.
|
|
518
|
+
*/
|
|
519
|
+
static deleteSubscriptionTypeById(id: string): Promise<void>;
|
|
491
520
|
}
|
|
492
521
|
|
|
493
522
|
declare class CustomerMetaData {
|
package/dist/index.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ type INotiType = {
|
|
|
144
144
|
};
|
|
145
145
|
type INotiTypeStats = {
|
|
146
146
|
id: string;
|
|
147
|
-
|
|
147
|
+
notiTypeId: string;
|
|
148
148
|
subscribed: number;
|
|
149
149
|
views: number;
|
|
150
150
|
createdAt: string;
|
|
@@ -154,6 +154,7 @@ type IUserSubscription = {
|
|
|
154
154
|
id: string;
|
|
155
155
|
user: INotiHubUser;
|
|
156
156
|
customer: INotiHubCustomer;
|
|
157
|
+
customerId: string;
|
|
157
158
|
subscriptionId: string;
|
|
158
159
|
type: "SUBSCRIBED" | "UNSUBSCRIBED";
|
|
159
160
|
createdAt: string;
|
|
@@ -163,7 +164,7 @@ type IUserSubscribeNotifier = {
|
|
|
163
164
|
userId: string;
|
|
164
165
|
userRef: INotiHubUser;
|
|
165
166
|
customerId: string;
|
|
166
|
-
|
|
167
|
+
customer: INotiHubCustomer;
|
|
167
168
|
notiTypeId: string;
|
|
168
169
|
notiTypeRef: INotiType;
|
|
169
170
|
subscriptionId: string;
|
|
@@ -401,6 +402,16 @@ declare class NotiType {
|
|
|
401
402
|
* @returns A promise that resolves to the updated notification type object.
|
|
402
403
|
*/
|
|
403
404
|
static updateNotiType(id: string, updates: Partial<INotiType>): Promise<INotiType>;
|
|
405
|
+
/**
|
|
406
|
+
* Deletes a notification type by its ID.
|
|
407
|
+
* @param id - The ID of the notification type to delete.
|
|
408
|
+
* @returns A promise that resolves when the notification type is deleted.
|
|
409
|
+
*/ static deleteNotiType(id: string): Promise<void>;
|
|
410
|
+
/**
|
|
411
|
+
* Delete all notification types for a given customerId
|
|
412
|
+
* Uses Query + BatchWrite with chunking
|
|
413
|
+
*/
|
|
414
|
+
static deleteAllNotiTypesByCustomerId(customerId: string): Promise<void>;
|
|
404
415
|
}
|
|
405
416
|
|
|
406
417
|
declare class Subscription {
|
|
@@ -436,6 +447,12 @@ declare class Subscription {
|
|
|
436
447
|
* @returns A promise that resolves to the subscription object or null if not found.
|
|
437
448
|
*/
|
|
438
449
|
static getSubscriptionBySubscriptionId(subscriptionId: string): Promise<INotiHubSubscription | null>;
|
|
450
|
+
/**
|
|
451
|
+
* Delete all subscriptions by user ID.
|
|
452
|
+
* @param userId - The ID of the user whose subscriptions to delete.
|
|
453
|
+
* @returns A promise that resolves when all subscriptions are deleted.
|
|
454
|
+
*/
|
|
455
|
+
static deleteAllSubscriptionsByUserId(userId: string): Promise<void>;
|
|
439
456
|
}
|
|
440
457
|
|
|
441
458
|
declare class NotiTypeStats {
|
|
@@ -459,6 +476,12 @@ declare class NotiTypeStats {
|
|
|
459
476
|
* @returns A promise that resolves to the created or updated notification type stats object.
|
|
460
477
|
*/
|
|
461
478
|
static createOrUpdateNotiTypeStats(notiTypeStats: INotiTypeStats): Promise<INotiTypeStats>;
|
|
479
|
+
/**
|
|
480
|
+
* Deletes notification type stats by their ID.
|
|
481
|
+
* @param id - The ID of the notification type stats to delete.
|
|
482
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
483
|
+
*/
|
|
484
|
+
static deleteNotiTypeStatsById(id: string): Promise<void>;
|
|
462
485
|
}
|
|
463
486
|
|
|
464
487
|
declare class Views {
|
|
@@ -488,6 +511,12 @@ declare class SubscriptionType {
|
|
|
488
511
|
*/
|
|
489
512
|
static getSubscriptionTypeById(id: string): Promise<IUserSubscribeNotifier | null>;
|
|
490
513
|
static getSubscriptionTypesByUserId(userId: string): Promise<IUserSubscribeNotifier[] | null>;
|
|
514
|
+
/**
|
|
515
|
+
* Deletes a subscription type by its ID.
|
|
516
|
+
* @param id - The ID of the subscription type to delete.
|
|
517
|
+
* @returns A promise that resolves when the subscription type is deleted.
|
|
518
|
+
*/
|
|
519
|
+
static deleteSubscriptionTypeById(id: string): Promise<void>;
|
|
491
520
|
}
|
|
492
521
|
|
|
493
522
|
declare class CustomerMetaData {
|
package/dist/index.js
CHANGED
|
@@ -517,9 +517,12 @@ var NotiHubStats_default = NotiHubStats;
|
|
|
517
517
|
|
|
518
518
|
// src/DynamoModels/NotiType.ts
|
|
519
519
|
import {
|
|
520
|
+
BatchWriteCommand,
|
|
521
|
+
DeleteCommand as DeleteCommand5,
|
|
520
522
|
GetCommand as GetCommand5,
|
|
521
523
|
PutCommand as PutCommand5,
|
|
522
524
|
QueryCommand as QueryCommand4,
|
|
525
|
+
ScanCommand,
|
|
523
526
|
UpdateCommand as UpdateCommand5
|
|
524
527
|
} from "@aws-sdk/lib-dynamodb";
|
|
525
528
|
var NotiType = class _NotiType {
|
|
@@ -615,6 +618,87 @@ var NotiType = class _NotiType {
|
|
|
615
618
|
throw new Error("Could not update notification type");
|
|
616
619
|
}
|
|
617
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Deletes a notification type by its ID.
|
|
623
|
+
* @param id - The ID of the notification type to delete.
|
|
624
|
+
* @returns A promise that resolves when the notification type is deleted.
|
|
625
|
+
*/
|
|
626
|
+
static async deleteNotiType(id) {
|
|
627
|
+
const command = new DeleteCommand5({
|
|
628
|
+
TableName: _NotiType.TABLE_NAME,
|
|
629
|
+
Key: { id }
|
|
630
|
+
});
|
|
631
|
+
try {
|
|
632
|
+
await ddbDocClient.send(command);
|
|
633
|
+
} catch (error) {
|
|
634
|
+
console.error("Error deleting notification type:", error);
|
|
635
|
+
throw new Error("Could not delete notification type");
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Delete all notification types for a given customerId
|
|
640
|
+
* Uses Query + BatchWrite with chunking
|
|
641
|
+
*/
|
|
642
|
+
static async deleteAllNotiTypesByCustomerId(customerId) {
|
|
643
|
+
try {
|
|
644
|
+
const itemsToDelete = [];
|
|
645
|
+
let lastEvaluatedKey;
|
|
646
|
+
do {
|
|
647
|
+
const scanResult = await ddbDocClient.send(
|
|
648
|
+
// TODO: update type
|
|
649
|
+
new ScanCommand({
|
|
650
|
+
TableName: _NotiType.TABLE_NAME,
|
|
651
|
+
FilterExpression: "customerId = :customerId",
|
|
652
|
+
ExpressionAttributeValues: {
|
|
653
|
+
":customerId": customerId
|
|
654
|
+
},
|
|
655
|
+
ExclusiveStartKey: lastEvaluatedKey
|
|
656
|
+
})
|
|
657
|
+
);
|
|
658
|
+
if (scanResult.Items) {
|
|
659
|
+
itemsToDelete.push(...scanResult.Items);
|
|
660
|
+
}
|
|
661
|
+
lastEvaluatedKey = scanResult.LastEvaluatedKey;
|
|
662
|
+
} while (lastEvaluatedKey);
|
|
663
|
+
if (itemsToDelete.length === 0) {
|
|
664
|
+
console.log(
|
|
665
|
+
`No notification types found for customerId: ${customerId}`
|
|
666
|
+
);
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
console.log(
|
|
670
|
+
`Found ${itemsToDelete.length} notification types for customerId: ${customerId}. Deleting...`
|
|
671
|
+
);
|
|
672
|
+
const chunkSize = 25;
|
|
673
|
+
for (let i = 0; i < itemsToDelete.length; i += chunkSize) {
|
|
674
|
+
const chunk = itemsToDelete.slice(i, i + chunkSize);
|
|
675
|
+
const deleteRequests = chunk.map((item) => ({
|
|
676
|
+
DeleteRequest: {
|
|
677
|
+
Key: {
|
|
678
|
+
id: item.id,
|
|
679
|
+
customerId: item.customerId
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}));
|
|
683
|
+
await ddbDocClient.send(
|
|
684
|
+
new BatchWriteCommand({
|
|
685
|
+
RequestItems: {
|
|
686
|
+
[_NotiType.TABLE_NAME]: deleteRequests
|
|
687
|
+
}
|
|
688
|
+
})
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
console.log(
|
|
692
|
+
`Successfully deleted ${itemsToDelete.length} notification types for customerId: ${customerId}`
|
|
693
|
+
);
|
|
694
|
+
} catch (error) {
|
|
695
|
+
console.error(
|
|
696
|
+
`Failed to delete notification types for customerId: ${customerId}`,
|
|
697
|
+
error
|
|
698
|
+
);
|
|
699
|
+
throw new Error("Could not delete notification types for customerId");
|
|
700
|
+
}
|
|
701
|
+
}
|
|
618
702
|
};
|
|
619
703
|
var NotiType_default = NotiType;
|
|
620
704
|
|
|
@@ -722,11 +806,26 @@ var Subscription = class _Subscription {
|
|
|
722
806
|
throw new Error("Could not fetch subscription by SubscriptionId");
|
|
723
807
|
}
|
|
724
808
|
}
|
|
809
|
+
/**
|
|
810
|
+
* Delete all subscriptions by user ID.
|
|
811
|
+
* @param userId - The ID of the user whose subscriptions to delete.
|
|
812
|
+
* @returns A promise that resolves when all subscriptions are deleted.
|
|
813
|
+
*/
|
|
814
|
+
static async deleteAllSubscriptionsByUserId(userId) {
|
|
815
|
+
const subscriptions = await this.getSubscriptionsByUserId(userId);
|
|
816
|
+
if (subscriptions && subscriptions.length > 0) {
|
|
817
|
+
const deletePromises = subscriptions.map(
|
|
818
|
+
(sub) => this.deleteSubscriptionById(sub.id)
|
|
819
|
+
);
|
|
820
|
+
await Promise.all(deletePromises);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
725
823
|
};
|
|
726
824
|
var Subscription_default = Subscription;
|
|
727
825
|
|
|
728
826
|
// src/DynamoModels/NotiTypeStats.ts
|
|
729
827
|
import {
|
|
828
|
+
DeleteCommand as DeleteCommand7,
|
|
730
829
|
GetCommand as GetCommand7,
|
|
731
830
|
PutCommand as PutCommand7,
|
|
732
831
|
QueryCommand as QueryCommand6
|
|
@@ -799,6 +898,23 @@ var NotiTypeStats = class _NotiTypeStats {
|
|
|
799
898
|
throw new Error("Could not create or update notification type stats");
|
|
800
899
|
}
|
|
801
900
|
}
|
|
901
|
+
/**
|
|
902
|
+
* Deletes notification type stats by their ID.
|
|
903
|
+
* @param id - The ID of the notification type stats to delete.
|
|
904
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
905
|
+
*/
|
|
906
|
+
static async deleteNotiTypeStatsById(id) {
|
|
907
|
+
const command = new DeleteCommand7({
|
|
908
|
+
TableName: _NotiTypeStats.TABLE_NAME,
|
|
909
|
+
Key: { id }
|
|
910
|
+
});
|
|
911
|
+
try {
|
|
912
|
+
await ddbDocClient.send(command);
|
|
913
|
+
} catch (error) {
|
|
914
|
+
console.error("Error deleting notification type stats:", error);
|
|
915
|
+
throw new Error("Could not delete notification type stats");
|
|
916
|
+
}
|
|
917
|
+
}
|
|
802
918
|
};
|
|
803
919
|
var NotiTypeStats_default = NotiTypeStats;
|
|
804
920
|
|
|
@@ -851,6 +967,7 @@ var Views_default = Views;
|
|
|
851
967
|
|
|
852
968
|
// src/DynamoModels/SubscriptionType.ts
|
|
853
969
|
import {
|
|
970
|
+
DeleteCommand as DeleteCommand9,
|
|
854
971
|
GetCommand as GetCommand9,
|
|
855
972
|
QueryCommand as QueryCommand8
|
|
856
973
|
} from "@aws-sdk/lib-dynamodb";
|
|
@@ -896,7 +1013,23 @@ var SubscriptionType = class _SubscriptionType {
|
|
|
896
1013
|
throw new Error("Could not fetch subscription types by userId");
|
|
897
1014
|
}
|
|
898
1015
|
}
|
|
899
|
-
|
|
1016
|
+
/**
|
|
1017
|
+
* Deletes a subscription type by its ID.
|
|
1018
|
+
* @param id - The ID of the subscription type to delete.
|
|
1019
|
+
* @returns A promise that resolves when the subscription type is deleted.
|
|
1020
|
+
*/
|
|
1021
|
+
static async deleteSubscriptionTypeById(id) {
|
|
1022
|
+
const command = new DeleteCommand9({
|
|
1023
|
+
TableName: _SubscriptionType.TABLE_NAME,
|
|
1024
|
+
Key: { id }
|
|
1025
|
+
});
|
|
1026
|
+
try {
|
|
1027
|
+
await ddbDocClient.send(command);
|
|
1028
|
+
} catch (error) {
|
|
1029
|
+
console.error("Error deleting subscription type:", error);
|
|
1030
|
+
throw new Error("Could not delete subscription type");
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
900
1033
|
};
|
|
901
1034
|
var SubscriptionType_default = SubscriptionType;
|
|
902
1035
|
|