aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 10:36:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 10:36:18 +0200
commitee9e7b61f59a427208386738057c8eff48fba599 (patch)
tree9097de886128e15f21f0b5920a2076d16a087467 /server/models/user
parent70c065d64c330196d371941d9294a55da6e3aa37 (diff)
downloadPeerTube-ee9e7b61f59a427208386738057c8eff48fba599.tar.gz
PeerTube-ee9e7b61f59a427208386738057c8eff48fba599.tar.zst
PeerTube-ee9e7b61f59a427208386738057c8eff48fba599.zip
Create types for model enums
Diffstat (limited to 'server/models/user')
-rw-r--r--server/models/user/user-interface.ts4
-rw-r--r--server/models/user/user-video-rate-interface.ts6
-rw-r--r--server/models/user/user-video-rate.ts2
3 files changed, 7 insertions, 5 deletions
diff --git a/server/models/user/user-interface.ts b/server/models/user/user-interface.ts
index 6726e8ab5..fd98a042e 100644
--- a/server/models/user/user-interface.ts
+++ b/server/models/user/user-interface.ts
@@ -2,7 +2,7 @@ import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird' 2import * as Bluebird from 'bluebird'
3 3
4// Don't use barrel, import just what we need 4// Don't use barrel, import just what we need
5import { User as FormatedUser } from '../../../shared/models/user.model' 5import { UserRole, User as FormatedUser } from '../../../shared/models/user.model'
6 6
7export namespace UserMethods { 7export namespace UserMethods {
8 export type IsPasswordMatchCallback = (err: Error, same: boolean) => void 8 export type IsPasswordMatchCallback = (err: Error, same: boolean) => void
@@ -51,7 +51,7 @@ export interface UserAttributes {
51 username: string 51 username: string
52 email: string 52 email: string
53 displayNSFW?: boolean 53 displayNSFW?: boolean
54 role: string 54 role: UserRole
55} 55}
56 56
57export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> { 57export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> {
diff --git a/server/models/user/user-video-rate-interface.ts b/server/models/user/user-video-rate-interface.ts
index e48869fd2..a726639b1 100644
--- a/server/models/user/user-video-rate-interface.ts
+++ b/server/models/user/user-video-rate-interface.ts
@@ -1,8 +1,10 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { VideoRateType } from '../../../shared/models/user-video-rate.model'
4
3export namespace UserVideoRateMethods { 5export namespace UserVideoRateMethods {
4 export type LoadCallback = (err: Error, userVideoRateInstance: UserVideoRateInstance) => void 6 export type LoadCallback = (err: Error, userVideoRateInstance: UserVideoRateInstance) => void
5 export type Load = (userId, videoId, transaction, callback) => void 7 export type Load = (userId: number, videoId: string, transaction: Sequelize.Transaction, callback: LoadCallback) => void
6} 8}
7 9
8export interface UserVideoRateClass { 10export interface UserVideoRateClass {
@@ -10,7 +12,7 @@ export interface UserVideoRateClass {
10} 12}
11 13
12export interface UserVideoRateAttributes { 14export interface UserVideoRateAttributes {
13 type: string 15 type: VideoRateType
14} 16}
15 17
16export interface UserVideoRateInstance extends UserVideoRateClass, UserVideoRateAttributes, Sequelize.Instance<UserVideoRateAttributes> { 18export interface UserVideoRateInstance extends UserVideoRateClass, UserVideoRateAttributes, Sequelize.Instance<UserVideoRateAttributes> {
diff --git a/server/models/user/user-video-rate.ts b/server/models/user/user-video-rate.ts
index 68be62fc2..1094eb281 100644
--- a/server/models/user/user-video-rate.ts
+++ b/server/models/user/user-video-rate.ts
@@ -67,7 +67,7 @@ function associate (models) {
67 }) 67 })
68} 68}
69 69
70load = function (userId: number, videoId: number, transaction: Sequelize.Transaction, callback: UserVideoRateMethods.LoadCallback) { 70load = function (userId: number, videoId: string, transaction: Sequelize.Transaction, callback: UserVideoRateMethods.LoadCallback) {
71 const options: Sequelize.FindOptions = { 71 const options: Sequelize.FindOptions = {
72 where: { 72 where: {
73 userId, 73 userId,