Download src/models/User.js from TwanAPI/trsstapi: direct link, hf CLI and curl.
- Browser
- Download file 636 Bytes
-
https://huggingface.co/spaces/TwanAPI/trsstapi/resolve/aaff83dd1affe87e82019cb318c593e9d15fa2fd/src/models/User.js
- Command line
-
hf download hf://spaces/TwanAPI/trsstapi@aaff83dd1affe87e82019cb318c593e9d15fa2fd/src/models/User.js
-
curl -L -o User.js https://huggingface.co/spaces/TwanAPI/trsstapi/resolve/aaff83dd1affe87e82019cb318c593e9d15fa2fd/src/models/User.js
636 Bytes
| import mongoose from "mongoose"; | |
| const RefreshTokenSchema = new mongoose.Schema({ | |
| hash: String, | |
| ip: String, | |
| userAgent: String, | |
| createdAt: { type: Date, default: Date.now }, | |
| }); | |
| const UserSchema = new mongoose.Schema( | |
| { | |
| email: { type: String, unique: true, index: true }, | |
| passwordHash: String, | |
| role: { type: String, enum: ["user", "admin"], default: "user" }, | |
| refreshTokens: [RefreshTokenSchema], | |
| deletedAt: { type: Date, default: null }, | |
| }, | |
| { timestamps: true } | |
| ); | |
| UserSchema.pre(/^find/, function () { | |
| this.where({ deletedAt: null }); | |
| }); | |
| export const User = mongoose.model("User", UserSchema); | |