mirror of https://github.com/Chocobozzz/PeerTube
				
				
				
			Fix typings
							parent
							
								
									1335920348
								
							
						
					
					
						commit
						5fcbd89841
					
				| 
						 | 
				
			
			@ -22,7 +22,7 @@ export class FollowService {
 | 
			
		|||
    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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,10 @@
 | 
			
		|||
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 {
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +42,7 @@ 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))
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +57,7 @@ export class UserService {
 | 
			
		|||
  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)))
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ export class VideoService {
 | 
			
		|||
               )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  viewVideo (uuid: string): Observable<VideoDetails> {
 | 
			
		||||
  viewVideo (uuid: string): Observable<boolean> {
 | 
			
		||||
    return this.authHttp.post(this.getVideoViewUrl(uuid), {})
 | 
			
		||||
               .pipe(
 | 
			
		||||
                 map(this.restExtractor.extractDataBool),
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +92,7 @@ export class VideoService {
 | 
			
		|||
    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))
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -265,11 +265,10 @@ export class VideoService {
 | 
			
		|||
    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)))
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,6 +44,7 @@ import { OAuthTokenModel } from '../../models/oauth/oauth-token'
 | 
			
		|||
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({
 | 
			
		||||
| 
						 | 
				
			
			@ -253,9 +254,10 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
 | 
			
		|||
  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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,3 +6,4 @@ export * from './user-update.model'
 | 
			
		|||
export * from './user-update-me.model'
 | 
			
		||||
export * from './user-right.enum'
 | 
			
		||||
export * from './user-role'
 | 
			
		||||
export * from './user-video-quota.model'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
export interface UserVideoQuota {
 | 
			
		||||
  videoQuotaUsed: number
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue