aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models')
-rw-r--r--shared/models/activitypub/activity.ts5
-rw-r--r--shared/models/activitypub/activitypub-actor.ts1
-rw-r--r--shared/models/activitypub/objects/playlist-element-object.ts10
-rw-r--r--shared/models/activitypub/objects/playlist-object.ts23
-rw-r--r--shared/models/actors/account.model.ts11
-rw-r--r--shared/models/overviews/videos-overview.ts4
-rw-r--r--shared/models/users/user-right.enum.ts4
-rw-r--r--shared/models/users/user-role.ts1
-rw-r--r--shared/models/videos/channel/video-channel.model.ts12
-rw-r--r--shared/models/videos/playlist/video-playlist-create.model.ts11
-rw-r--r--shared/models/videos/playlist/video-playlist-element-create.model.ts4
-rw-r--r--shared/models/videos/playlist/video-playlist-element-update.model.ts4
-rw-r--r--shared/models/videos/playlist/video-playlist-privacy.model.ts5
-rw-r--r--shared/models/videos/playlist/video-playlist-update.model.ts10
-rw-r--r--shared/models/videos/playlist/video-playlist.model.ts23
-rw-r--r--shared/models/videos/video.model.ts32
16 files changed, 132 insertions, 28 deletions
diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts
index 89994f665..95801190d 100644
--- a/shared/models/activitypub/activity.ts
+++ b/shared/models/activitypub/activity.ts
@@ -6,6 +6,7 @@ import { VideoAbuseObject } from './objects/video-abuse-object'
6import { VideoCommentObject } from './objects/video-comment-object' 6import { VideoCommentObject } from './objects/video-comment-object'
7import { ViewObject } from './objects/view-object' 7import { ViewObject } from './objects/view-object'
8import { APObject } from './objects/object.model' 8import { APObject } from './objects/object.model'
9import { PlaylistObject } from './objects/playlist-object'
9 10
10export type Activity = ActivityCreate | ActivityUpdate | 11export type Activity = ActivityCreate | ActivityUpdate |
11 ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | 12 ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
@@ -31,12 +32,12 @@ export interface BaseActivity {
31 32
32export interface ActivityCreate extends BaseActivity { 33export interface ActivityCreate extends BaseActivity {
33 type: 'Create' 34 type: 'Create'
34 object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject 35 object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject | PlaylistObject
35} 36}
36 37
37export interface ActivityUpdate extends BaseActivity { 38export interface ActivityUpdate extends BaseActivity {
38 type: 'Update' 39 type: 'Update'
39 object: VideoTorrentObject | ActivityPubActor | CacheFileObject 40 object: VideoTorrentObject | ActivityPubActor | CacheFileObject | PlaylistObject
40} 41}
41 42
42export interface ActivityDelete extends BaseActivity { 43export interface ActivityDelete extends BaseActivity {
diff --git a/shared/models/activitypub/activitypub-actor.ts b/shared/models/activitypub/activitypub-actor.ts
index 119bc22d4..5e30bf783 100644
--- a/shared/models/activitypub/activitypub-actor.ts
+++ b/shared/models/activitypub/activitypub-actor.ts
@@ -8,6 +8,7 @@ export interface ActivityPubActor {
8 id: string 8 id: string
9 following: string 9 following: string
10 followers: string 10 followers: string
11 playlists?: string
11 inbox: string 12 inbox: string
12 outbox: string 13 outbox: string
13 preferredUsername: string 14 preferredUsername: string
diff --git a/shared/models/activitypub/objects/playlist-element-object.ts b/shared/models/activitypub/objects/playlist-element-object.ts
new file mode 100644
index 000000000..b85e4fe19
--- /dev/null
+++ b/shared/models/activitypub/objects/playlist-element-object.ts
@@ -0,0 +1,10 @@
1export interface PlaylistElementObject {
2 id: string
3 type: 'PlaylistElement'
4
5 url: string
6 position: number
7
8 startTimestamp?: number
9 stopTimestamp?: number
10}
diff --git a/shared/models/activitypub/objects/playlist-object.ts b/shared/models/activitypub/objects/playlist-object.ts
new file mode 100644
index 000000000..5f6733f92
--- /dev/null
+++ b/shared/models/activitypub/objects/playlist-object.ts
@@ -0,0 +1,23 @@
1import { ActivityIconObject } from './common-objects'
2
3export interface PlaylistObject {
4 id: string
5 type: 'Playlist'
6
7 name: string
8 content: string
9 uuid: string
10
11 totalItems: number
12 attributedTo: string[]
13
14 icon: ActivityIconObject
15
16 orderedItems?: string[]
17
18 partOf?: string
19 next?: string
20 first?: string
21
22 to?: string[]
23}
diff --git a/shared/models/actors/account.model.ts b/shared/models/actors/account.model.ts
index 7f1dbbc37..043a2507e 100644
--- a/shared/models/actors/account.model.ts
+++ b/shared/models/actors/account.model.ts
@@ -1,4 +1,5 @@
1import { Actor } from './actor.model' 1import { Actor } from './actor.model'
2import { Avatar } from '../avatars'
2 3
3export interface Account extends Actor { 4export interface Account extends Actor {
4 displayName: string 5 displayName: string
@@ -6,3 +7,13 @@ export interface Account extends Actor {
6 7
7 userId?: number 8 userId?: number
8} 9}
10
11export interface AccountSummary {
12 id: number
13 uuid: string
14 name: string
15 displayName: string
16 url: string
17 host: string
18 avatar?: Avatar
19}
diff --git a/shared/models/overviews/videos-overview.ts b/shared/models/overviews/videos-overview.ts
index ee009d94c..e725f166b 100644
--- a/shared/models/overviews/videos-overview.ts
+++ b/shared/models/overviews/videos-overview.ts
@@ -1,8 +1,8 @@
1import { Video, VideoChannelAttribute, VideoConstant } from '../videos' 1import { Video, VideoChannelSummary, VideoConstant } from '../videos'
2 2
3export interface VideosOverview { 3export interface VideosOverview {
4 channels: { 4 channels: {
5 channel: VideoChannelAttribute 5 channel: VideoChannelSummary
6 videos: Video[] 6 videos: Video[]
7 }[] 7 }[]
8 8
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 090256bca..eaa064bd9 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -20,8 +20,12 @@ export enum UserRight {
20 20
21 REMOVE_ANY_VIDEO, 21 REMOVE_ANY_VIDEO,
22 REMOVE_ANY_VIDEO_CHANNEL, 22 REMOVE_ANY_VIDEO_CHANNEL,
23 REMOVE_ANY_VIDEO_PLAYLIST,
23 REMOVE_ANY_VIDEO_COMMENT, 24 REMOVE_ANY_VIDEO_COMMENT,
25
24 UPDATE_ANY_VIDEO, 26 UPDATE_ANY_VIDEO,
27 UPDATE_ANY_VIDEO_PLAYLIST,
28
25 SEE_ALL_VIDEOS, 29 SEE_ALL_VIDEOS,
26 CHANGE_VIDEO_OWNERSHIP 30 CHANGE_VIDEO_OWNERSHIP
27} 31}
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts
index 59c2ba106..0b6554e51 100644
--- a/shared/models/users/user-role.ts
+++ b/shared/models/users/user-role.ts
@@ -25,6 +25,7 @@ const userRoleRights: { [ id: number ]: UserRight[] } = {
25 UserRight.MANAGE_VIDEO_ABUSES, 25 UserRight.MANAGE_VIDEO_ABUSES,
26 UserRight.REMOVE_ANY_VIDEO, 26 UserRight.REMOVE_ANY_VIDEO,
27 UserRight.REMOVE_ANY_VIDEO_CHANNEL, 27 UserRight.REMOVE_ANY_VIDEO_CHANNEL,
28 UserRight.REMOVE_ANY_VIDEO_PLAYLIST,
28 UserRight.REMOVE_ANY_VIDEO_COMMENT, 29 UserRight.REMOVE_ANY_VIDEO_COMMENT,
29 UserRight.UPDATE_ANY_VIDEO, 30 UserRight.UPDATE_ANY_VIDEO,
30 UserRight.SEE_ALL_VIDEOS, 31 UserRight.SEE_ALL_VIDEOS,
diff --git a/shared/models/videos/channel/video-channel.model.ts b/shared/models/videos/channel/video-channel.model.ts
index 92918f66c..14a813f8f 100644
--- a/shared/models/videos/channel/video-channel.model.ts
+++ b/shared/models/videos/channel/video-channel.model.ts
@@ -1,6 +1,6 @@
1import { Actor } from '../../actors/actor.model' 1import { Actor } from '../../actors/actor.model'
2import { Video } from '../video.model'
3import { Account } from '../../actors/index' 2import { Account } from '../../actors/index'
3import { Avatar } from '../../avatars'
4 4
5export interface VideoChannel extends Actor { 5export interface VideoChannel extends Actor {
6 displayName: string 6 displayName: string
@@ -9,3 +9,13 @@ export interface VideoChannel extends Actor {
9 isLocal: boolean 9 isLocal: boolean
10 ownerAccount?: Account 10 ownerAccount?: Account
11} 11}
12
13export interface VideoChannelSummary {
14 id: number
15 uuid: string
16 name: string
17 displayName: string
18 url: string
19 host: string
20 avatar?: Avatar
21}
diff --git a/shared/models/videos/playlist/video-playlist-create.model.ts b/shared/models/videos/playlist/video-playlist-create.model.ts
new file mode 100644
index 000000000..386acbb96
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-create.model.ts
@@ -0,0 +1,11 @@
1import { VideoPlaylistPrivacy } from './video-playlist-privacy.model'
2
3export interface VideoPlaylistCreate {
4 displayName: string
5 description: string
6 privacy: VideoPlaylistPrivacy
7
8 videoChannelId?: number
9
10 thumbnailfile?: Blob
11}
diff --git a/shared/models/videos/playlist/video-playlist-element-create.model.ts b/shared/models/videos/playlist/video-playlist-element-create.model.ts
new file mode 100644
index 000000000..9bd56a8ca
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-element-create.model.ts
@@ -0,0 +1,4 @@
1export interface VideoPlaylistElementCreate {
2 startTimestamp?: number
3 stopTimestamp?: number
4}
diff --git a/shared/models/videos/playlist/video-playlist-element-update.model.ts b/shared/models/videos/playlist/video-playlist-element-update.model.ts
new file mode 100644
index 000000000..15a30fbdc
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-element-update.model.ts
@@ -0,0 +1,4 @@
1export interface VideoPlaylistElementUpdate {
2 startTimestamp?: number
3 stopTimestamp?: number
4}
diff --git a/shared/models/videos/playlist/video-playlist-privacy.model.ts b/shared/models/videos/playlist/video-playlist-privacy.model.ts
new file mode 100644
index 000000000..96e5e2211
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-privacy.model.ts
@@ -0,0 +1,5 @@
1export enum VideoPlaylistPrivacy {
2 PUBLIC = 1,
3 UNLISTED = 2,
4 PRIVATE = 3
5}
diff --git a/shared/models/videos/playlist/video-playlist-update.model.ts b/shared/models/videos/playlist/video-playlist-update.model.ts
new file mode 100644
index 000000000..c7a15c550
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-update.model.ts
@@ -0,0 +1,10 @@
1import { VideoPlaylistPrivacy } from './video-playlist-privacy.model'
2
3export interface VideoPlaylistUpdate {
4 displayName: string
5 description: string
6 privacy: VideoPlaylistPrivacy
7
8 videoChannelId?: number
9 thumbnailfile?: Blob
10}
diff --git a/shared/models/videos/playlist/video-playlist.model.ts b/shared/models/videos/playlist/video-playlist.model.ts
new file mode 100644
index 000000000..6aa04048c
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist.model.ts
@@ -0,0 +1,23 @@
1import { AccountSummary } from '../../actors/index'
2import { VideoChannelSummary, VideoConstant } from '..'
3import { VideoPlaylistPrivacy } from './video-playlist-privacy.model'
4
5export interface VideoPlaylist {
6 id: number
7 uuid: string
8 isLocal: boolean
9
10 displayName: string
11 description: string
12 privacy: VideoConstant<VideoPlaylistPrivacy>
13
14 thumbnailPath: string
15
16 videosLength: number
17
18 createdAt: Date | string
19 updatedAt: Date | string
20
21 ownerAccount?: AccountSummary
22 videoChannel?: VideoChannelSummary
23}
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index df800461c..6e7a6831e 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -1,4 +1,4 @@
1import { VideoResolution, VideoState } from '../../index' 1import { AccountSummary, VideoChannelSummary, VideoResolution, VideoState } from '../../index'
2import { Account } from '../actors' 2import { Account } from '../actors'
3import { Avatar } from '../avatars/avatar.model' 3import { Avatar } from '../avatars/avatar.model'
4import { VideoChannel } from './channel/video-channel.model' 4import { VideoChannel } from './channel/video-channel.model'
@@ -18,26 +18,6 @@ export interface VideoFile {
18 fps: number 18 fps: number
19} 19}
20 20
21export interface VideoChannelAttribute {
22 id: number
23 uuid: string
24 name: string
25 displayName: string
26 url: string
27 host: string
28 avatar?: Avatar
29}
30
31export interface AccountAttribute {
32 id: number
33 uuid: string
34 name: string
35 displayName: string
36 url: string
37 host: string
38 avatar?: Avatar
39}
40
41export interface Video { 21export interface Video {
42 id: number 22 id: number
43 uuid: string 23 uuid: string
@@ -68,12 +48,18 @@ export interface Video {
68 blacklisted?: boolean 48 blacklisted?: boolean
69 blacklistedReason?: string 49 blacklistedReason?: string
70 50
71 account: AccountAttribute 51 account: AccountSummary
72 channel: VideoChannelAttribute 52 channel: VideoChannelSummary
73 53
74 userHistory?: { 54 userHistory?: {
75 currentTime: number 55 currentTime: number
76 } 56 }
57
58 playlistElement?: {
59 position: number
60 startTimestamp: number
61 stopTimestamp: number
62 }
77} 63}
78 64
79export interface VideoDetails extends Video { 65export interface VideoDetails extends Video {