mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-19 06:07:21 +02:00
66 lines
1.3 KiB
TypeScript
66 lines
1.3 KiB
TypeScript
import { Schema } from "mongoose";
|
|
|
|
const UserSchema = new Schema({
|
|
reviewConsentRevision: { type: Number, select: false },
|
|
accessTokens: {
|
|
github: { type: String, select: false },
|
|
},
|
|
accessTokenDates: {
|
|
github: { type: Date },
|
|
},
|
|
externalIDs: {
|
|
github: { type: String, index: true },
|
|
},
|
|
username: {
|
|
type: String,
|
|
index: { unique: true },
|
|
},
|
|
emails: [
|
|
{
|
|
email: { type: String },
|
|
default: Boolean,
|
|
},
|
|
],
|
|
isAdmin: { type: Boolean, default: false },
|
|
apiTokens: [
|
|
{
|
|
tokenHash: { type: String, index: true },
|
|
name: { type: String },
|
|
createdAt: { type: Date, default: Date.now },
|
|
lastUsedAt: { type: Date },
|
|
},
|
|
],
|
|
photo: String,
|
|
projectNames: { type: Map, of: String },
|
|
repositories: [
|
|
{
|
|
type: String,
|
|
ref: "Repository",
|
|
},
|
|
],
|
|
default: {
|
|
terms: [String],
|
|
options: {
|
|
expirationMode: { type: String },
|
|
update: Boolean,
|
|
image: Boolean,
|
|
pdf: Boolean,
|
|
notebook: Boolean,
|
|
link: Boolean,
|
|
page: { type: String },
|
|
},
|
|
},
|
|
status: {
|
|
type: String,
|
|
default: "active",
|
|
},
|
|
dateOfEntry: {
|
|
type: Date,
|
|
default: Date.now,
|
|
},
|
|
});
|
|
|
|
UserSchema.index({ dateOfEntry: 1 });
|
|
|
|
export default UserSchema;
|