OauthAccessToken.js 758 B

1234567891011121314151617181920212223242526272829303132
  1. const mongoose = require('../infrastructure/Mongoose')
  2. const { Schema } = mongoose
  3. const { ObjectId } = Schema
  4. const OauthAccessTokenSchema = new Schema(
  5. {
  6. accessToken: String,
  7. accessTokenPartial: String,
  8. type: String,
  9. accessTokenExpiresAt: Date,
  10. oauthApplication_id: { type: ObjectId, ref: 'OauthApplication' },
  11. refreshToken: String,
  12. refreshTokenExpiresAt: Date,
  13. scope: String,
  14. user_id: { type: ObjectId, ref: 'User' },
  15. createdAt: { type: Date },
  16. expiresAt: Date,
  17. lastUsedAt: Date,
  18. },
  19. {
  20. collection: 'oauthAccessTokens',
  21. minimize: false,
  22. }
  23. )
  24. exports.OauthAccessToken = mongoose.model(
  25. 'OauthAccessToken',
  26. OauthAccessTokenSchema
  27. )
  28. exports.OauthAccessTokenSchema = OauthAccessTokenSchema