]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/oauth-client.js
1 const mongoose
= require('mongoose')
3 // ---------------------------------------------------------------------------
5 const OAuthClientSchema
= mongoose
.Schema({
11 OAuthClientSchema
.path('clientSecret').required(true)
13 OAuthClientSchema
.statics
= {
14 getByIdAndSecret: getByIdAndSecret
,
16 loadFirstClient: loadFirstClient
19 mongoose
.model('OAuthClient', OAuthClientSchema
)
21 // ---------------------------------------------------------------------------
23 function list (callback
) {
24 return this.find(callback
)
27 function loadFirstClient (callback
) {
28 return this.findOne({}, callback
)
31 function getByIdAndSecret (id
, clientSecret
) {
32 return this.findOne({ _id: id
, clientSecret: clientSecret
}).exec()