let params = new HttpParams()
params = this.restService.addRestGetParams(params, pagination, sort)
- return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/following', { params })
+ return this.authHttp.get<ResultList<AccountFollow>>(FollowService.BASE_APPLICATION_URL + '/following', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(res => this.restExtractor.handleError(res))
import { catchError, map } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
-import { UserCreate, UserUpdateMe } from '../../../../../shared'
+import { UserCreate, UserUpdateMe, UserVideoQuota } from '../../../../../shared'
import { environment } from '../../../environments/environment'
import { RestExtractor } from '../rest'
+import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
@Injectable()
export class UserService {
changeAvatar (avatarForm: FormData) {
const url = UserService.BASE_USERS_URL + 'me/avatar/pick'
- return this.authHttp.post(url, avatarForm)
+ return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm)
.pipe(catchError(this.restExtractor.handleError))
}
getMyVideoQuotaUsed () {
const url = UserService.BASE_USERS_URL + '/me/video-quota-used'
- return this.authHttp.get(url)
+ return this.authHttp.get<UserVideoQuota>(url)
.pipe(catchError(res => this.restExtractor.handleError(res)))
}
)
}
- viewVideo (uuid: string): Observable<VideoDetails> {
+ viewVideo (uuid: string): Observable<boolean> {
return this.authHttp.post(this.getVideoViewUrl(uuid), {})
.pipe(
map(this.restExtractor.extractDataBool),
const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true })
return this.authHttp
- .request(req)
+ .request<{ video: { id: number, uuid: string} }>(req)
.pipe(catchError(this.restExtractor.handleError))
}
return this.setVideoRate(id, 'none')
}
- getUserVideoRating (id: number): Observable<UserVideoRate> {
+ getUserVideoRating (id: number) {
const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating'
- return this.authHttp
- .get(url)
+ return this.authHttp.get<UserVideoRate>(url)
.pipe(catchError(res => this.restExtractor.handleError(res)))
}
import { VideoModel } from '../../models/video/video'
import { VideoSortField } from '../../../client/src/app/shared/video/sort-field.type'
import { createReqFiles } from '../../helpers/express-utils'
+import { UserVideoQuota } from '../../../shared/models/users/user-video-quota.model'
const reqAvatarFile = createReqFiles([ 'avatarfile' ], IMAGE_MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.AVATARS_DIR })
const loginRateLimiter = new RateLimit({
const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
const videoQuotaUsed = await UserModel.getOriginalVideoFileTotalFromUser(user)
- return res.json({
+ const data: UserVideoQuota = {
videoQuotaUsed
- })
+ }
+ return res.json(data)
}
function getUser (req: express.Request, res: express.Response, next: express.NextFunction) {
export * from './user-update-me.model'
export * from './user-right.enum'
export * from './user-role'
+export * from './user-video-quota.model'
--- /dev/null
+export interface UserVideoQuota {
+ videoQuotaUsed: number
+}