mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
* [web] Issue Oauth2 access tokens * [web] Add partial index for `oauthAccessTokens.user_id` for Personal Access Tokens * [web] script to create personal access tokens GitOrigin-RevId: 796e8d23a6799a87ac6096c686139c6290668b83
33 lines
758 B
JavaScript
33 lines
758 B
JavaScript
const mongoose = require('../infrastructure/Mongoose')
|
|
|
|
const { Schema } = mongoose
|
|
const { ObjectId } = Schema
|
|
|
|
const OauthAccessTokenSchema = new Schema(
|
|
{
|
|
accessToken: String,
|
|
accessTokenPartial: String,
|
|
type: String,
|
|
accessTokenExpiresAt: Date,
|
|
oauthApplication_id: { type: ObjectId, ref: 'OauthApplication' },
|
|
refreshToken: String,
|
|
refreshTokenExpiresAt: Date,
|
|
scope: String,
|
|
user_id: { type: ObjectId, ref: 'User' },
|
|
createdAt: { type: Date },
|
|
expiresAt: Date,
|
|
lastUsedAt: Date,
|
|
},
|
|
{
|
|
collection: 'oauthAccessTokens',
|
|
minimize: false,
|
|
}
|
|
)
|
|
|
|
exports.OauthAccessToken = mongoose.model(
|
|
'OauthAccessToken',
|
|
OauthAccessTokenSchema
|
|
)
|
|
|
|
exports.OauthAccessTokenSchema = OauthAccessTokenSchema
|