OauthAuthorizationCode.coffee 844 B

123456789101112131415161718192021222324252627282930
  1. mongoose = require 'mongoose'
  2. Settings = require 'settings-sharelatex'
  3. Schema = mongoose.Schema
  4. ObjectId = Schema.ObjectId
  5. OauthAuthorizationCodeSchema = new Schema(
  6. {
  7. authorizationCode: String
  8. expiresAt: Date
  9. oauthApplication_id: { type: ObjectId, ref: 'OauthApplication' }
  10. redirectUri: String
  11. scope: String
  12. user_id: { type: ObjectId, ref: 'User' }
  13. },
  14. {
  15. collection: 'oauthAuthorizationCodes'
  16. }
  17. )
  18. conn = mongoose.createConnection(Settings.mongo.url, {
  19. server: {poolSize: Settings.mongo.poolSize || 10},
  20. config: {autoIndex: false}
  21. })
  22. OauthAuthorizationCode = conn.model('OauthAuthorizationCode', OauthAuthorizationCodeSchema)
  23. mongoose.model 'OauthAuthorizationCode', OauthAuthorizationCodeSchema
  24. exports.OauthAuthorizationCode = OauthAuthorizationCode
  25. exports.OauthAuthorizationCodeSchema = OauthAuthorizationCodeSchema