aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-token.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-28 15:49:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-28 15:49:23 +0100
commit67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677 (patch)
treebae6a9b0c3133c9cc38a2972222b5991f0cf614e /server/models/oauth-token.js
parent552cc9d646e78edae8b0fe61564d4e49db0b6206 (diff)
downloadPeerTube-67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677.tar.gz
PeerTube-67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677.tar.zst
PeerTube-67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677.zip
Server: add database field validations
Diffstat (limited to 'server/models/oauth-token.js')
-rw-r--r--server/models/oauth-token.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js
index c9108bf95..f8de4e916 100644
--- a/server/models/oauth-token.js
+++ b/server/models/oauth-token.js
@@ -1,3 +1,5 @@
1'use strict'
2
1const logger = require('../helpers/logger') 3const logger = require('../helpers/logger')
2 4
3// --------------------------------------------------------------------------- 5// ---------------------------------------------------------------------------
@@ -6,16 +8,20 @@ module.exports = function (sequelize, DataTypes) {
6 const OAuthToken = sequelize.define('OAuthToken', 8 const OAuthToken = sequelize.define('OAuthToken',
7 { 9 {
8 accessToken: { 10 accessToken: {
9 type: DataTypes.STRING 11 type: DataTypes.STRING,
12 allowNull: false
10 }, 13 },
11 accessTokenExpiresAt: { 14 accessTokenExpiresAt: {
12 type: DataTypes.DATE 15 type: DataTypes.DATE,
16 allowNull: false
13 }, 17 },
14 refreshToken: { 18 refreshToken: {
15 type: DataTypes.STRING 19 type: DataTypes.STRING,
20 allowNull: false
16 }, 21 },
17 refreshTokenExpiresAt: { 22 refreshTokenExpiresAt: {
18 type: DataTypes.DATE 23 type: DataTypes.DATE,
24 allowNull: false
19 } 25 }
20 }, 26 },
21 { 27 {
@@ -33,11 +39,6 @@ module.exports = function (sequelize, DataTypes) {
33 return OAuthToken 39 return OAuthToken
34} 40}
35 41
36// TODO: validation
37// OAuthTokenSchema.path('accessToken').required(true)
38// OAuthTokenSchema.path('client').required(true)
39// OAuthTokenSchema.path('user').required(true)
40
41// --------------------------------------------------------------------------- 42// ---------------------------------------------------------------------------
42 43
43function associate (models) { 44function associate (models) {