forked from Prompt-Hash-Stellar/prompt-hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebhookSubscription.ts
More file actions
44 lines (41 loc) · 829 Bytes
/
Copy pathWebhookSubscription.ts
File metadata and controls
44 lines (41 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import mongoose from "mongoose";
const webhookSubscriptionSchema = new mongoose.Schema(
{
walletAddress: {
type: String,
required: true,
lowercase: true,
index: true,
},
url: {
type: String,
required: true,
trim: true,
},
secret: {
type: String,
required: true,
},
events: {
type: [String],
default: ["PromptPurchased"],
},
active: {
type: Boolean,
default: true,
},
failureCount: {
type: Number,
default: 0,
},
lastDeliveredAt: {
type: Date,
default: null,
},
},
{ timestamps: true },
);
const WebhookSubscription =
mongoose.models.WebhookSubscription ||
mongoose.model("WebhookSubscription", webhookSubscriptionSchema);
export default WebhookSubscription;