mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Create types for model enums
This commit is contained in:
parent
70c065d64c
commit
ee9e7b61f5
21 changed files with 89 additions and 29 deletions
|
@ -3,6 +3,8 @@ import * as validator from 'validator'
|
|||
|
||||
import { exists } from './misc'
|
||||
import { CONSTRAINTS_FIELDS, USER_ROLES } from '../../initializers'
|
||||
import { UserRole } from '../../../shared'
|
||||
|
||||
const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS
|
||||
|
||||
function isUserPasswordValid (value: string) {
|
||||
|
@ -10,7 +12,7 @@ function isUserPasswordValid (value: string) {
|
|||
}
|
||||
|
||||
function isUserRoleValid (value: string) {
|
||||
return values(USER_ROLES).indexOf(value) !== -1
|
||||
return values(USER_ROLES).indexOf(value as UserRole) !== -1
|
||||
}
|
||||
|
||||
function isUserUsernameValid (value: string) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
} from '../../initializers'
|
||||
import { isUserUsernameValid } from './users'
|
||||
import { isArray, exists } from './misc'
|
||||
import { VideoRateType } from '../../../shared'
|
||||
|
||||
const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
|
||||
const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
|
||||
|
@ -105,7 +106,7 @@ function isVideoEventCountValid (value: string) {
|
|||
}
|
||||
|
||||
function isVideoRatingTypeValid (value: string) {
|
||||
return values(VIDEO_RATE_TYPES).indexOf(value) !== -1
|
||||
return values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1
|
||||
}
|
||||
|
||||
function isVideoFile (value: string, files: { [ fieldname: string ]: Express.Multer.File[] }) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue