Share models between server and client
authorChocobozzz <florian.bigard@gmail.com>
Sat, 17 Jun 2017 09:28:11 +0000 (11:28 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Sat, 17 Jun 2017 09:28:11 +0000 (11:28 +0200)
31 files changed:
client/src/app/+admin/friends/friend-list/friend-list.component.ts
client/src/app/+admin/friends/shared/friend.model.ts [deleted file]
client/src/app/+admin/friends/shared/friend.service.ts
client/src/app/+admin/requests/request-stats/request-stats.component.ts
client/src/app/+admin/requests/shared/index.ts
client/src/app/+admin/requests/shared/request-stats-attributes.model.ts [new file with mode: 0644]
client/src/app/+admin/requests/shared/request-stats.model.ts [deleted file]
client/src/app/+admin/requests/shared/request.service.ts
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
client/src/app/core/auth/auth.service.ts
client/src/app/core/config/config.service.ts
client/src/app/shared/video-abuse/video-abuse.model.ts [deleted file]
client/src/app/shared/video-abuse/video-abuse.service.ts
client/src/app/videos/shared/rate-type.type.ts [deleted file]
client/src/app/videos/shared/video.service.ts
client/src/app/videos/video-watch/video-watch.component.ts
server/controllers/api/clients.ts
server/controllers/api/config.ts
server/controllers/api/users.ts
server/helpers/utils.ts
server/models/user/user-interface.ts
server/models/user/user-video-rate.ts
server/models/video/video-abuse-interface.ts
server/models/video/video-abuse.ts
server/models/video/video-blacklist-interface.ts
server/models/video/video-interface.ts
shared/models/client-local.model.ts [new file with mode: 0644]
shared/models/index.ts
shared/models/server-config.model.ts [new file with mode: 0644]
shared/models/user-video-rate.model.ts
shared/models/video-abuse.model.ts

index 7bf9d2c6b577f243ee97904555962a705938bb4d..9f0256d7f3af8c7677013edf4ba065594422a817 100644 (file)
@@ -5,7 +5,7 @@ import { ServerDataSource } from 'ng2-smart-table'
 
 import { ConfirmService } from '../../../core'
 import { Utils } from '../../../shared'
-import { Friend, FriendService } from '../shared'
+import { FriendService } from '../shared'
 
 @Component({
   selector: 'my-friend-list',
diff --git a/client/src/app/+admin/friends/shared/friend.model.ts b/client/src/app/+admin/friends/shared/friend.model.ts
deleted file mode 100644 (file)
index 6950405..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface Friend {
-  id: string
-  host: string
-  score: number
-  email: string
-  createdAt: Date
-}
index f4ecd36ad3f78bcda4838b6385915752951ee85b..79de4470e77402c664afe8906738b1e1101ab9c5 100644 (file)
@@ -5,7 +5,6 @@ import 'rxjs/add/operator/map'
 
 import { ServerDataSource } from 'ng2-smart-table'
 
-import { Friend } from './friend.model'
 import { AuthHttp, RestExtractor, RestDataSource, ResultList } from '../../../shared'
 
 @Injectable()
index cca4926cf237c901bb8a8e35910cf53223ef8c18..140aaf47e788757eb5147ab7bebfc302c5b1d931 100644 (file)
@@ -2,7 +2,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core'
 
 import { NotificationsService } from 'angular2-notifications'
 
-import { RequestService, RequestStats } from '../shared'
+import { RequestService, RequestSchedulerStatsAttributes } from '../shared'
+import { RequestScheduler } from '../../../../../../shared'
 
 @Component({
   selector: 'my-request-stats',
@@ -16,11 +17,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
     requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler'
   }
 
-  stats: { [ id: string ]: RequestStats } = {
-    requestScheduler: null,
-    requestVideoEventScheduler: null,
-    requestVideoQaduScheduler: null
-  }
+  stats: RequestScheduler
 
   private intervals: { [ id: string ]: number } = {
     requestScheduler: null,
@@ -67,7 +64,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
   private runIntervals () {
     Object.keys(this.intervals).forEach(requestSchedulerName => {
       this.intervals[requestSchedulerName] = window.setInterval(() => {
-        const stats = this.stats[requestSchedulerName]
+        const stats: RequestSchedulerStatsAttributes = this.stats[requestSchedulerName]
 
         stats.remainingMilliSeconds -= 1000
 
index 2442e810ad3f7063078ec0c0bae7c3360f57de46..857fe9d2954536a19292a783e980aaccea9d17b9 100644 (file)
@@ -1,2 +1,2 @@
-export * from './request-stats.model'
+export * from './request-stats-attributes.model'
 export * from './request.service'
diff --git a/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts b/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts
new file mode 100644 (file)
index 0000000..394acc7
--- /dev/null
@@ -0,0 +1,37 @@
+import { RequestSchedulerAttributes as FormatedRequestSchedulerAttributes } from '../../../../../../shared'
+
+export interface Request {
+  request: any
+  to: any
+}
+
+export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerAttributes {
+  requestsLimitPods: number
+  requestsLimitPerPod: number
+  milliSecondsInterval: number
+  remainingMilliSeconds: number
+  totalRequests: number
+
+  constructor (hash: {
+    requestsLimitPods: number,
+    requestsLimitPerPod: number,
+    milliSecondsInterval: number,
+    remainingMilliSeconds: number,
+    totalRequests: number
+  }) {
+    this.requestsLimitPods = hash.requestsLimitPods
+    this.requestsLimitPerPod = hash.requestsLimitPerPod
+    this.milliSecondsInterval = hash.milliSecondsInterval
+    this.remainingMilliSeconds = hash.remainingMilliSeconds
+    this.totalRequests = hash.totalRequests
+  }
+
+  get remainingSeconds () {
+    return Math.floor(this.remainingMilliSeconds / 1000)
+  }
+
+  get secondsInterva () {
+    return Math.floor(this.milliSecondsInterval / 1000)
+  }
+
+}
diff --git a/client/src/app/+admin/requests/shared/request-stats.model.ts b/client/src/app/+admin/requests/shared/request-stats.model.ts
deleted file mode 100644 (file)
index 31550b5..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-export interface Request {
-  request: any
-  to: any
-}
-
-export class RequestStats {
-  requestsLimitPods: number
-  requestsLimitPerPod: number
-  milliSecondsInterval: number
-  remainingMilliSeconds: number
-  totalRequests: number
-
-  constructor (hash: {
-    requestsLimitPods: number,
-    requestsLimitPerPod: number,
-    milliSecondsInterval: number,
-    remainingMilliSeconds: number,
-    totalRequests: number
-  }) {
-    this.requestsLimitPods = hash.requestsLimitPods
-    this.requestsLimitPerPod = hash.requestsLimitPerPod
-    this.milliSecondsInterval = hash.milliSecondsInterval
-    this.remainingMilliSeconds = hash.remainingMilliSeconds
-    this.totalRequests = hash.totalRequests
-  }
-
-  get remainingSeconds () {
-    return Math.floor(this.remainingMilliSeconds / 1000)
-  }
-
-  get secondsInterva () {
-    return Math.floor(this.milliSecondsInterval / 1000)
-  }
-
-}
index faa6b93832fabf51cecba54d8c338d6d7ceccdbf..53682b111f86f186eb5026caab734e1e55644570 100644 (file)
@@ -3,8 +3,9 @@ import { Observable } from 'rxjs/Observable'
 import 'rxjs/add/operator/catch'
 import 'rxjs/add/operator/map'
 
-import { RequestStats } from './request-stats.model'
+import { RequestScheduler } from '../../../../../../shared'
 import { AuthHttp, RestExtractor } from '../../../shared'
+import { RequestSchedulerStatsAttributes } from './request-stats-attributes.model'
 
 @Injectable()
 export class RequestService {
@@ -15,18 +16,18 @@ export class RequestService {
     private restExtractor: RestExtractor
   ) {}
 
-  getStats (): Observable<{ [ id: string ]: RequestStats }> {
+  getStats (): Observable<RequestScheduler> {
     return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats')
                         .map(this.restExtractor.extractDataGet)
                         .map(this.buildRequestObjects)
                         .catch((res) => this.restExtractor.handleError(res))
   }
 
-  private buildRequestObjects (data: any) {
+  private buildRequestObjects (data: RequestScheduler) {
     const requestSchedulers = {}
 
     Object.keys(data).forEach(requestSchedulerName => {
-      requestSchedulers[requestSchedulerName] = new RequestStats(data[requestSchedulerName])
+      requestSchedulers[requestSchedulerName] = new RequestSchedulerStatsAttributes(data[requestSchedulerName])
     })
 
     return requestSchedulers
index 60eaebb44d9892d806d2a9654a919e92aeffbe8f..7c838fbf0c526982b9fa7c0201b2335369b06715 100644 (file)
@@ -2,7 +2,8 @@ import { Component } from '@angular/core'
 
 import { NotificationsService } from 'angular2-notifications'
 
-import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared'
+import { Utils, VideoAbuseService } from '../../../shared'
+import { VideoAbuse } from '../../../../../shared'
 
 @Component({
   selector: 'my-video-abuse-list',
index 32f7a5503d88342cbbe46b4cdf120ee72638f059..fcc6b9bb6430016812fb1cefa8e750582625238b 100644 (file)
@@ -11,6 +11,7 @@ import { NotificationsService } from 'angular2-notifications'
 
 import { AuthStatus } from './auth-status.model'
 import { AuthUser } from './auth-user.model'
+import { ClientLocal } from '../../../../../shared'
 // Do not use the barrel (dependency loop)
 import { RestExtractor } from '../../shared/rest'
 
@@ -40,9 +41,9 @@ export class AuthService {
     // FIXME: save in local storage?
     this.http.get(AuthService.BASE_CLIENT_URL)
       .map(this.restExtractor.extractDataGet)
-      .catch((res) => this.restExtractor.handleError(res))
+      .catch(res => this.restExtractor.handleError(res))
       .subscribe(
-        result => {
+        (result: ClientLocal) => {
           this.clientId = result.client_id
           this.clientSecret = result.client_secret
           console.log('Client credentials loaded.')
index a83ec61d2a6b4eadc586fa5b6596488a18b98774..b8cb15e84b8538fc7d3890e2adf0ac53f15c317f 100644 (file)
@@ -2,16 +2,13 @@ import { Injectable } from '@angular/core'
 import { Http } from '@angular/http'
 
 import { RestExtractor } from '../../shared/rest'
+import { ServerConfig } from '../../../../../shared'
 
 @Injectable()
 export class ConfigService {
   private static BASE_CONFIG_URL = API_URL + '/api/v1/config/'
 
-  private config: {
-    signup: {
-      enabled: boolean
-    }
-  } = {
+  private config: ServerConfig = {
     signup: {
       enabled: false
     }
diff --git a/client/src/app/shared/video-abuse/video-abuse.model.ts b/client/src/app/shared/video-abuse/video-abuse.model.ts
deleted file mode 100644 (file)
index 49c87d6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-export interface VideoAbuse {
-  id: string
-  reason: string
-  reporterPodHost: string
-  reporterUsername: string
-  videoId: string
-  createdAt: Date
-}
index 4317f935381a493475a07ba924d56e3ff149fc50..32f13b4300cb4a946e80439363667db7e9bc2951 100644 (file)
@@ -7,7 +7,7 @@ import 'rxjs/add/operator/map'
 import { AuthService } from '../core'
 import { AuthHttp } from '../auth'
 import { RestDataSource, RestExtractor, ResultList } from '../rest'
-import { VideoAbuse } from './video-abuse.model'
+import { VideoAbuse } from '../../../../../shared'
 
 @Injectable()
 export class VideoAbuseService {
diff --git a/client/src/app/videos/shared/rate-type.type.ts b/client/src/app/videos/shared/rate-type.type.ts
deleted file mode 100644 (file)
index 20eea3a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-export type RateType = 'like' | 'dislike'
index a4e3d16dfc0ae13e598fd72e20cc96390025ff3f..977b82118a31bc321f57cd9f1f0ad8ac05dd8aa8 100644 (file)
@@ -6,7 +6,6 @@ import 'rxjs/add/operator/map'
 
 import { Search } from '../../shared'
 import { SortField } from './sort-field.type'
-import { RateType } from './rate-type.type'
 import { AuthService } from '../../core'
 import {
   AuthHttp,
@@ -17,6 +16,7 @@ import {
   UserService
 } from '../../shared'
 import { Video } from './video.model'
+import { VideoRateType } from '../../../../../shared'
 
 @Injectable()
 export class VideoService {
@@ -145,7 +145,7 @@ export class VideoService {
     return this.setVideoRate(id, 'dislike')
   }
 
-  getUserVideoRating (id: string) {
+  getUserVideoRating (id: string): Observable<VideoRateType> {
     const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating'
 
     return this.authHttp.get(url)
@@ -159,7 +159,7 @@ export class VideoService {
                         .catch((res) => this.restExtractor.handleError(res))
   }
 
-  private setVideoRate (id: string, rateType: RateType) {
+  private setVideoRate (id: string, rateType: VideoRateType) {
     const url = VideoService.BASE_VIDEO_URL + id + '/rate'
     const body = {
       rating: rateType
index 4a547f7e480a6fa2ef445f0c6fba3db0a0cd0c87..808e0eda983d12834d06105ad05b002701f9d430 100644 (file)
@@ -11,15 +11,15 @@ import { AuthService, ConfirmService } from '../../core'
 import { VideoMagnetComponent } from './video-magnet.component'
 import { VideoShareComponent } from './video-share.component'
 import { VideoReportComponent } from './video-report.component'
-import { RateType, Video, VideoService } from '../shared'
+import { Video, VideoService } from '../shared'
 import { WebTorrentService } from './webtorrent.service'
+import { UserVideoRateType, VideoRateType, UserVideoRate } from '../../../../../shared'
 
 @Component({
   selector: 'my-video-watch',
   templateUrl: './video-watch.component.html',
   styleUrls: [ './video-watch.component.scss' ]
 })
-
 export class VideoWatchComponent implements OnInit, OnDestroy {
   private static LOADTIME_TOO_LONG = 20000
 
@@ -34,7 +34,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
   player: videojs.Player
   playerElement: Element
   uploadSpeed: number
-  userRating: RateType = null
+  userRating: UserVideoRateType = null
   video: Video = null
   videoNotFound = false
 
@@ -249,7 +249,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     this.videoService.getUserVideoRating(this.video.id)
                      .subscribe(
-                       ratingObject => {
+                       (ratingObject: UserVideoRate) => {
                          if (ratingObject) {
                            this.userRating = ratingObject.rating
                          }
@@ -282,7 +282,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     )
   }
 
-  private updateVideoRating (oldRating: RateType, newRating: RateType) {
+  private updateVideoRating (oldRating: UserVideoRateType, newRating: VideoRateType) {
     let likesToIncrement = 0
     let dislikesToIncrement = 0
 
index 8c460096bef12ec15c7c9a1d0e8ed5dd49be3825..96490d04a7d0fefac4b6cf3542d47e63cf44bbcc 100644 (file)
@@ -3,6 +3,7 @@ import * as express from 'express'
 import { CONFIG } from '../../initializers'
 import { logger } from '../../helpers'
 import { database as db } from '../../initializers/database'
+import { ClientLocal } from '../../../shared'
 
 const clientsRouter = express.Router()
 
@@ -27,10 +28,11 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
     if (err) return next(err)
     if (!client) return next(new Error('No client available.'))
 
-    res.json({
+    const json: ClientLocal = {
       client_id: client.clientId,
       client_secret: client.clientSecret
-    })
+    }
+    res.json(json)
   })
 }
 
index c639817976a7ca6cb1cb1db88a1da9e3e4420a0b..3e9aa77a5c6aac1bb7432adcac866d2abbe41b2d 100644 (file)
@@ -1,6 +1,7 @@
 import * as express from 'express'
 
 import { CONFIG } from '../../initializers'
+import { ServerConfig } from '../../../shared'
 
 const configRouter = express.Router()
 
@@ -8,11 +9,12 @@ configRouter.get('/', getConfig)
 
 // Get the client credentials for the PeerTube front end
 function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
-  res.json({
+  const json: ServerConfig = {
     signup: {
       enabled: CONFIG.SIGNUP.ENABLED
     }
-  })
+  }
+  res.json(json)
 }
 
 // ---------------------------------------------------------------------------
index ffe5881e5594040e6a5cb9f99fcaf84cee6e59bd..1e9e65689ea99b02a21762d46663bae4c5991b6d 100644 (file)
@@ -17,6 +17,7 @@ import {
   setUsersSort,
   token
 } from '../../middlewares'
+import { UserVideoRate as FormatedUserVideoRate } from '../../../shared'
 
 const usersRouter = express.Router()
 
@@ -119,10 +120,11 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:
 
     const rating = ratingObj ? ratingObj.type : 'none'
 
-    res.json({
+    const json: FormatedUserVideoRate = {
       videoId,
       rating
-    })
+    }
+    res.json(json)
   })
 }
 
index 07c1b3f51adffa1b01e042d211c8cba465be309c..5b8d21f70d1cdfe0d9db79f7d625fae730184903 100644 (file)
@@ -22,8 +22,12 @@ function createEmptyCallback () {
   }
 }
 
-function getFormatedObjects (objects: any[], objectsTotal: number) {
-  const formatedObjects = []
+interface FormatableToJSON {
+  toFormatedJSON()
+}
+
+function getFormatedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {
+  const formatedObjects: U[] = []
 
   objects.forEach(function (object) {
     formatedObjects.push(object.toFormatedJSON())
index fd98a042e06e75c66fda005df6b700a0d6022a35..48c67678ba7c6414c3efa14866e7ae1194f52a46 100644 (file)
@@ -58,6 +58,10 @@ export interface UserInstance extends UserClass, UserAttributes, Sequelize.Insta
   id: number
   createdAt: Date
   updatedAt: Date
+
+  isPasswordMatch: UserMethods.IsPasswordMatch
+  toFormatedJSON: UserMethods.ToFormatedJSON
+  isAdmin: UserMethods.IsAdmin
 }
 
 export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {}
index 1094eb281e68207982ce1509b34b8bede17022bb..4bdd35bc93eff627064f8127f727215de0083dc0 100644 (file)
@@ -1,6 +1,5 @@
 /*
   User rates per video.
-
 */
 import { values } from 'lodash'
 import * as Sequelize from 'sequelize'
index f3e32f79c55f41e5d07d7447ac58e989eeebc197..c85d09091ea732a0e460ecabc191655056ed7d14 100644 (file)
@@ -6,7 +6,7 @@ import { PodInstance } from '../pod'
 import { VideoAbuse as FormatedVideoAbuse } from '../../../shared/models/video-abuse.model'
 
 export namespace VideoAbuseMethods {
-  export type toFormatedJSON = () => FormatedVideoAbuse
+  export type ToFormatedJSON = (this: VideoAbuseInstance) => FormatedVideoAbuse
 
   export type ListForApiCallback = (err: Error, videoAbuseInstances?: VideoAbuseInstance[], total?: number) => void
   export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void
@@ -28,6 +28,8 @@ export interface VideoAbuseInstance extends VideoAbuseClass, VideoAbuseAttribute
   updatedAt: Date
 
   Pod: PodInstance
+
+  toFormatedJSON: VideoAbuseMethods.ToFormatedJSON
 }
 
 export interface VideoAbuseModel extends VideoAbuseClass, Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes> {}
index f5b4debe6964ad1a2b01e21031532692e23f2719..bc5f01e2101f84f24e3f0c573ad08ba555a7680d 100644 (file)
@@ -13,6 +13,7 @@ import {
 } from './video-abuse-interface'
 
 let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes>
+let toFormatedJSON: VideoAbuseMethods.ToFormatedJSON
 let listForApi: VideoAbuseMethods.ListForApi
 
 export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
@@ -66,7 +67,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
 
 // ------------------------------ METHODS ------------------------------
 
-function toFormatedJSON (this: VideoAbuseInstance) {
+toFormatedJSON = function (this: VideoAbuseInstance) {
   let reporterPodHost
 
   if (this.Pod) {
@@ -108,7 +109,7 @@ function associate (models) {
   })
 }
 
-listForApi = function (start, count, sort, callback) {
+listForApi = function (start: number, count: number, sort: string, callback: VideoAbuseMethods.ListForApiCallback) {
   const query = {
     offset: start,
     limit: count,
index c34e7fb0926cb510ff26c24e3d23132bb746e7e3..d4d6528d18f922573c4ce6a5f9d197c10123d05d 100644 (file)
@@ -39,6 +39,8 @@ export interface BlacklistedVideoInstance extends BlacklistedVideoClass, Blackli
   id: number
   createdAt: Date
   updatedAt: Date
+
+  toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON
 }
 
 export interface BlacklistedVideoModel extends BlacklistedVideoClass, Sequelize.Model<BlacklistedVideoInstance, BlacklistedVideoAttributes> {}
index 5fefc2bb168e5db12148aaf062298b0b514a61c3..4b591b9e73c1fe681721afea9660121135b20252 100644 (file)
@@ -146,6 +146,17 @@ export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.In
   id: string
   createdAt: Date
   updatedAt: Date
+
+  generateMagnetUri: VideoMethods.GenerateMagnetUri
+  getVideoFilename: VideoMethods.GetVideoFilename
+  getThumbnailName: VideoMethods.GetThumbnailName
+  getPreviewName: VideoMethods.GetPreviewName
+  getTorrentName: VideoMethods.GetTorrentName
+  isOwned: VideoMethods.IsOwned
+  toFormatedJSON: VideoMethods.ToFormatedJSON
+  toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
+  toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
+  transcodeVideofile: VideoMethods.TranscodeVideofile
 }
 
 export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}
diff --git a/shared/models/client-local.model.ts b/shared/models/client-local.model.ts
new file mode 100644 (file)
index 0000000..c27963e
--- /dev/null
@@ -0,0 +1,4 @@
+export interface ClientLocal {
+  client_id: string
+  client_secret: string
+}
index 1ddc8545f8303f9a424e7dcc8c271cdf70dfa0aa..fffac795e514cbd7de61615a75ea744f951eb69e 100644 (file)
@@ -1,3 +1,4 @@
+export * from './client-local.model'
 export * from './job.model'
 export * from './pod.model'
 export * from './request-scheduler.model'
@@ -6,3 +7,4 @@ export * from './user.model'
 export * from './video-abuse.model'
 export * from './video-blacklist.model'
 export * from './video.model'
+export * from './server-config.model'
diff --git a/shared/models/server-config.model.ts b/shared/models/server-config.model.ts
new file mode 100644 (file)
index 0000000..a391569
--- /dev/null
@@ -0,0 +1,5 @@
+export interface ServerConfig {
+  signup: {
+    enabled: boolean
+  }
+}
index d48774a4b45ddc91d62efb26bebcd029442393a8..b770f407309e674ed0283486a98831b11207d4ba 100644 (file)
@@ -1 +1,7 @@
 export type VideoRateType = 'like' | 'dislike'
+export type UserVideoRateType = 'like' | 'dislike' | 'none'
+
+export interface UserVideoRate {
+  videoId: string
+  rating: UserVideoRateType
+}
index e005a1fd52b0d104797f3970eedcb2b9d83ce309..72e32cbc7292e8a34a15e2c1f1450f755f710e1c 100644 (file)
@@ -3,6 +3,6 @@ export interface VideoAbuse {
   reporterPodHost: string
   reason: string
   reporterUsername: string
-  videoId: number
+  videoId: string
   createdAt: Date
 }