forked from Prompt-Hash-Stellar/prompt-hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPurchase.ts
More file actions
36 lines (33 loc) · 690 Bytes
/
Copy pathPurchase.ts
File metadata and controls
36 lines (33 loc) · 690 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
import mongoose from "mongoose";
const purchaseSchema = new mongoose.Schema(
{
promptId: {
type: String,
required: true,
index: true,
},
buyerWallet: {
type: String,
required: true,
lowercase: true,
index: true,
},
versionIndex: {
type: Number,
required: true,
},
txHash: {
type: String,
default: "",
},
saved: {
type: Boolean,
default: false,
index: true,
},
},
{ timestamps: true },
);
purchaseSchema.index({ promptId: 1, buyerWallet: 1 });
const Purchase = mongoose.models.Purchase || mongoose.model("Purchase", purchaseSchema);
export default Purchase;