]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/typings/express/index.d.ts
Use raw SQL for most of video queries
[github/Chocobozzz/PeerTube.git] / server / typings / express / index.d.ts
1
2 import { RegisterServerAuthExternalOptions } from '@server/types'
3 import {
4 MAbuseMessage,
5 MAbuseReporter,
6 MAccountBlocklist,
7 MActorFollowActorsDefault,
8 MActorUrl,
9 MChannelBannerAccountDefault,
10 MStreamingPlaylist,
11 MVideoChangeOwnershipFull,
12 MVideoFile,
13 MVideoFormattableDetails,
14 MVideoId,
15 MVideoImmutable,
16 MVideoLive,
17 MVideoPlaylistFull,
18 MVideoPlaylistFullSummary
19 } from '@server/types/models'
20 import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
21 import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
22 import { MVideoImportDefault } from '@server/types/models/video/video-import'
23 import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
24 import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
25 import { HttpMethod } from '@shared/core-utils/miscs/http-methods'
26 import { PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
27 import { File as UploadXFile, Metadata } from '@uploadx/core'
28 import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
29 import {
30 MAccountDefault,
31 MActorAccountChannelId,
32 MActorFollowActorsDefaultSubscription,
33 MActorFull,
34 MComment,
35 MCommentOwnerVideoReply,
36 MUserDefault,
37 MVideoBlacklist,
38 MVideoCaptionVideo,
39 MVideoFullLight,
40 MVideoIdThumbnail,
41 MVideoRedundancyVideo,
42 MVideoShareActor,
43 MVideoThumbnail,
44 MVideoWithRights
45 } from '../../types/models'
46
47 declare module 'express' {
48 export interface Request {
49 query: any
50 method: HttpMethod
51 }
52
53 // Upload using multer or uploadx middleware
54 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
55
56 export type UploadFiles = {
57 [fieldname: string]: MulterOrUploadXFile[]
58 } | MulterOrUploadXFile[]
59
60 // Partial object used by some functions to check the file mimetype/extension
61 export type UploadFileForCheck = {
62 originalname: string
63 mimetype: string
64 }
65
66 export type UploadFilesForCheck = {
67 [fieldname: string]: UploadFileForCheck[]
68 } | UploadFileForCheck[]
69
70 // Upload file with a duration added by our middleware
71 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
72 duration: number
73 }
74
75 // Extends Metadata property of UploadX object
76 export type UploadXFileMetadata = Metadata & VideoCreate & {
77 previewfile: Express.Multer.File[]
78 thumbnailfile: Express.Multer.File[]
79 }
80
81 // Our custom UploadXFile object using our custom metadata
82 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
83
84 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
85 duration: number
86 path: string
87 filename: string
88 }
89
90 // Extends Response with added functions and potential variables passed by middlewares
91 interface Response {
92 fail: (options: {
93 message: string
94
95 title?: string
96 status?: number
97 type?: ServerErrorCode
98 instance?: string
99
100 data?: PeerTubeProblemDocumentData
101 }) => void
102
103 locals: {
104 docUrl?: string
105
106 videoAPI?: MVideoFormattableDetails
107 videoAll?: MVideoFullLight
108 onlyImmutableVideo?: MVideoImmutable
109 onlyVideo?: MVideoThumbnail
110 videoId?: MVideoId
111
112 videoLive?: MVideoLive
113
114 videoShare?: MVideoShareActor
115
116 videoFile?: MVideoFile
117
118 videoFileResumable?: EnhancedUploadXFile
119
120 videoImport?: MVideoImportDefault
121
122 videoBlacklist?: MVideoBlacklist
123
124 videoCaption?: MVideoCaptionVideo
125
126 abuse?: MAbuseReporter
127 abuseMessage?: MAbuseMessage
128
129 videoStreamingPlaylist?: MStreamingPlaylist
130
131 videoChannel?: MChannelBannerAccountDefault
132
133 videoPlaylistFull?: MVideoPlaylistFull
134 videoPlaylistSummary?: MVideoPlaylistFullSummary
135
136 videoPlaylistElement?: MVideoPlaylistElement
137 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
138
139 accountVideoRate?: MAccountVideoRateAccountVideo
140
141 videoCommentFull?: MCommentOwnerVideoReply
142 videoCommentThread?: MComment
143
144 follow?: MActorFollowActorsDefault
145 subscription?: MActorFollowActorsDefaultSubscription
146
147 nextOwner?: MAccountDefault
148 videoChangeOwnership?: MVideoChangeOwnershipFull
149
150 account?: MAccountDefault
151
152 actorUrl?: MActorUrl
153 actorFull?: MActorFull
154
155 user?: MUserDefault
156
157 server?: MServer
158
159 videoRedundancy?: MVideoRedundancyVideo
160
161 accountBlock?: MAccountBlocklist
162 serverBlock?: MServerBlocklist
163
164 oauth?: {
165 token: MOAuthTokenUser
166 }
167
168 signature?: {
169 actor: MActorAccountChannelId
170 }
171
172 authenticated?: boolean
173
174 registeredPlugin?: RegisteredPlugin
175
176 externalAuth?: RegisterServerAuthExternalOptions
177
178 plugin?: MPlugin
179 }
180 }
181 }