forked from Prompt-Hash-Stellar/prompt-hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.js
More file actions
57 lines (54 loc) · 1.1 KB
/
Copy pathUser.js
File metadata and controls
57 lines (54 loc) · 1.1 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
import mongoose from "mongoose";
const userSchema = new mongoose.Schema(
{
walletAddress: {
type: String,
required: true,
unique: true,
lowercase: true,
},
username: {
type: String,
unique: true,
sparse: true,
trim: true,
minLength: 3,
maxLength: 30,
},
// Off-chain profile metadata (#333)
displayName: {
type: String,
trim: true,
maxLength: 60,
default: "",
},
bio: {
type: String,
trim: true,
maxLength: 500,
default: "",
},
avatarUrl: {
type: String,
trim: true,
default: "",
},
socialLinks: {
twitter: { type: String, trim: true, default: "" },
github: { type: String, trim: true, default: "" },
website: { type: String, trim: true, default: "" },
},
rating: {
type: Number,
default: 4,
min: 1,
max: 5,
},
},
{
timestamps: true,
},
);
// Check if the model exists before creating it
const User = mongoose.models.User || mongoose.model("User", userSchema);
export default User;