From de381bf5b9f9cb740a249bf26561b09ade9a2671 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Mon, 5 May 2025 08:10:24 +0200 Subject: [PATCH] docs: fix jsdoc comments for improved documentation accuracy --- frontend/src/app/app.component.ts | 3 +-- .../auth/forgot-password/forgot-password.component.ts | 10 +++++----- .../app/components/auth/register/register.component.ts | 2 +- .../components/home/categories/categories.component.ts | 2 +- .../home/categories/video-list/video-list.component.ts | 1 + .../home/hero-banner/hero-banner.component.ts | 3 ++- frontend/src/app/components/home/home.component.ts | 1 + .../home/upload-video/upload-video.component.ts | 2 +- .../home/video-player/video-player.component.ts | 7 ++----- frontend/src/app/guards/auth.guard.ts | 5 ++++- frontend/src/app/services/genre.service.ts | 3 +++ frontend/src/app/services/video.service.ts | 10 +++------- .../components/error-toast/error-toast.component.ts | 3 +++ .../app/shared/components/header/header.component.ts | 4 ++++ .../legal-information/imprint/imprint.component.ts | 6 ++++++ .../privacy-policy/privacy-policy.component.ts | 6 ++++++ 16 files changed, 44 insertions(+), 24 deletions(-) diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index 4b631b0..4818624 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -1,6 +1,5 @@ import { Component } from '@angular/core'; import { RouterOutlet } from '@angular/router'; -import { ErrorToastComponent } from './shared/components/error-toast/error-toast.component'; @Component({ selector: 'app-root', @@ -10,5 +9,5 @@ import { ErrorToastComponent } from './shared/components/error-toast/error-toast styleUrl: './app.component.scss', }) export class AppComponent { - title = 'frontend'; + title = 'Videoflix - Frontend'; } diff --git a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts index e3627f0..dce5bbc 100644 --- a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts +++ b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts @@ -14,6 +14,10 @@ import { ErrorService } from '../../../services/error.service'; styleUrl: './forgot-password.component.scss', }) export class ForgotPasswordComponent implements OnInit { + sendMailSuccess: boolean = false; + queryEmail: boolean = false; + queryEmailSuccess: boolean = false; + authData = { mail: '', token: '', @@ -22,12 +26,8 @@ export class ForgotPasswordComponent implements OnInit { send: false, }; - sendMailSuccess: boolean = false; - queryEmail: boolean = false; - queryEmailSuccess: boolean = false; - /** - * Initializes the VerifyEmailComponent with ActivatedRoute, AuthService, and ErrorService. + * Initializes the ForgotPasswordComponent with ActivatedRoute, AuthService, and ErrorService. */ constructor( private route: ActivatedRoute, diff --git a/frontend/src/app/components/auth/register/register.component.ts b/frontend/src/app/components/auth/register/register.component.ts index ff6d8f5..e3239f4 100644 --- a/frontend/src/app/components/auth/register/register.component.ts +++ b/frontend/src/app/components/auth/register/register.component.ts @@ -25,7 +25,7 @@ export class RegisterComponent implements OnInit { }; /** - * Initializes the LoginComponent with ActivatedRoute, AuthService, and ErrorService. + * Initializes the RegisterComponent with ActivatedRoute, AuthService, and ErrorService. */ constructor( private route: ActivatedRoute, diff --git a/frontend/src/app/components/home/categories/categories.component.ts b/frontend/src/app/components/home/categories/categories.component.ts index dad4308..6d599dc 100644 --- a/frontend/src/app/components/home/categories/categories.component.ts +++ b/frontend/src/app/components/home/categories/categories.component.ts @@ -33,7 +33,7 @@ export class CategoriesComponent implements AfterViewInit { genres$ = this.genreService.getGenres(); /** - * Initializes the HomeComponent with the GenreService. + * Initializes the CategoriesComponent with the GenreService. */ constructor(private genreService: GenreService) {} diff --git a/frontend/src/app/components/home/categories/video-list/video-list.component.ts b/frontend/src/app/components/home/categories/video-list/video-list.component.ts index 3b2a6ec..ec57b47 100644 --- a/frontend/src/app/components/home/categories/video-list/video-list.component.ts +++ b/frontend/src/app/components/home/categories/video-list/video-list.component.ts @@ -15,6 +15,7 @@ export class VideoListComponent { @Input() currentVideo: Video | null = null; @Input() watchedVideos: any[] = []; @Input() videoCategory: string = ''; + @Output() currentVideoId = new EventEmitter(); /** diff --git a/frontend/src/app/components/home/hero-banner/hero-banner.component.ts b/frontend/src/app/components/home/hero-banner/hero-banner.component.ts index f19c009..1ed5646 100644 --- a/frontend/src/app/components/home/hero-banner/hero-banner.component.ts +++ b/frontend/src/app/components/home/hero-banner/hero-banner.component.ts @@ -51,7 +51,8 @@ export class HeroBannerComponent implements OnChanges { videoIsUploaded: { [resolution: string]: boolean }; /** - * Initializes the HomeComponent with the VideoService, ResolutionService and UserService. + * Initializes the HeroBannerComponent with the VideoService, ResolutionService and UserService. + * Gets the available resolutions and video upload status. */ constructor( private videoService: VideoService, diff --git a/frontend/src/app/components/home/home.component.ts b/frontend/src/app/components/home/home.component.ts index 91a5747..e422a6e 100644 --- a/frontend/src/app/components/home/home.component.ts +++ b/frontend/src/app/components/home/home.component.ts @@ -46,6 +46,7 @@ export class HomeComponent implements OnInit { /** * Initializes the HomeComponent with the VideoService, UserService and ResolutionService. + * Get the available resolutions, current resolution, and video upload status. */ constructor( private videoService: VideoService, diff --git a/frontend/src/app/components/home/upload-video/upload-video.component.ts b/frontend/src/app/components/home/upload-video/upload-video.component.ts index faa7e6e..6e4519b 100644 --- a/frontend/src/app/components/home/upload-video/upload-video.component.ts +++ b/frontend/src/app/components/home/upload-video/upload-video.component.ts @@ -41,7 +41,7 @@ export class UploadVideoComponent { genres$ = this.genreService.getGenres(); /** - * Initializes the HomeComponent with the ErrorService, VideoService and GenreService. + * Initializes the UploadVideoComponent with the ErrorService, VideoService and GenreService. */ constructor( public errorService: ErrorService, diff --git a/frontend/src/app/components/home/video-player/video-player.component.ts b/frontend/src/app/components/home/video-player/video-player.component.ts index 88cf2ec..68c753d 100644 --- a/frontend/src/app/components/home/video-player/video-player.component.ts +++ b/frontend/src/app/components/home/video-player/video-player.component.ts @@ -18,11 +18,8 @@ export class VideoPlayerComponent implements OnInit, OnDestroy { private defaultResolution: string; /** - * Creates a new instance of the VideoPlayerComponent and sets the default - * resolution by fetching it from the ResolutionService. - * - * @param elementRef A reference to the DOM element which hosts the video player. - * @param resolutionService A service which provides the available resolutions. + * Initializes the VideoPlayerComponent with the ElementRef and ResolutionService. + * Get the default resolution. */ constructor( private elementRef: ElementRef, diff --git a/frontend/src/app/guards/auth.guard.ts b/frontend/src/app/guards/auth.guard.ts index ea5c71e..5c190f1 100644 --- a/frontend/src/app/guards/auth.guard.ts +++ b/frontend/src/app/guards/auth.guard.ts @@ -8,7 +8,10 @@ import { AuthService } from '../services/auth.service'; providedIn: 'root', }) export class AuthGuard { - constructor(private authService: AuthService, private router: Router) {} + /** + * Initializes the AuthGuard with Router and AuthService. + */ + constructor(private router: Router, private authService: AuthService) {} /** * Determines if the route can be activated by checking if the user is authenticated. diff --git a/frontend/src/app/services/genre.service.ts b/frontend/src/app/services/genre.service.ts index 8a6ae43..2190407 100644 --- a/frontend/src/app/services/genre.service.ts +++ b/frontend/src/app/services/genre.service.ts @@ -9,6 +9,9 @@ import { Genre } from '../interfaces/genre.interface'; export class GenreService { private genres: Genre[] = []; + /** + * Initializes the GenreService with ApiService. + */ constructor(private apiService: ApiService) {} /** diff --git a/frontend/src/app/services/video.service.ts b/frontend/src/app/services/video.service.ts index 14a92db..51cc242 100644 --- a/frontend/src/app/services/video.service.ts +++ b/frontend/src/app/services/video.service.ts @@ -1,10 +1,9 @@ import { Injectable } from '@angular/core'; -import { catchError, filter, firstValueFrom, map, Observable, of } from 'rxjs'; +import { catchError, firstValueFrom, map, Observable, of } from 'rxjs'; import { ApiService } from './api.service'; import { AuthService } from './auth.service'; import { ResolutionService } from './resolution.service'; import { Video } from '../interfaces/video.interface'; -import { HttpClient, HttpEvent, HttpEventType } from '@angular/common/http'; @Injectable({ providedIn: 'root', @@ -16,13 +15,10 @@ export class VideoService { private availableResolutions: string[]; /** - * Initializes the VideoService with HttpClient,ApiService, AuthService, and ResolutionService - * - * It fetches the available resolutions from the ResolutionService and stores - * them in the availableResolutions field. + * Initializes the VideoService with ApiService, AuthService, and ResolutionService + * Get the available resolutions */ constructor( - private http: HttpClient, private apiService: ApiService, private authService: AuthService, private resolutionService: ResolutionService diff --git a/frontend/src/app/shared/components/error-toast/error-toast.component.ts b/frontend/src/app/shared/components/error-toast/error-toast.component.ts index 37615f6..518c106 100644 --- a/frontend/src/app/shared/components/error-toast/error-toast.component.ts +++ b/frontend/src/app/shared/components/error-toast/error-toast.component.ts @@ -11,6 +11,9 @@ import { ErrorService } from '../../../services/error.service'; export class ErrorToastComponent implements OnInit { errorText: string = ''; + /** + * Initializes the ErrorToastComponent with ErrorService. + */ constructor(private errorService: ErrorService) {} /** diff --git a/frontend/src/app/shared/components/header/header.component.ts b/frontend/src/app/shared/components/header/header.component.ts index 7c7c773..5edb516 100644 --- a/frontend/src/app/shared/components/header/header.component.ts +++ b/frontend/src/app/shared/components/header/header.component.ts @@ -13,8 +13,12 @@ import { TokenService } from '../../../services/token.service'; }) export class HeaderComponent { @Input() showFullLogo: boolean = true; + @Output() videosChange = new EventEmitter(); + /** + * Initializes the HeaderComponent with AuthService and TokenService. + */ constructor( private authService: AuthService, private tokenService: TokenService diff --git a/frontend/src/app/shared/components/legal-information/imprint/imprint.component.ts b/frontend/src/app/shared/components/legal-information/imprint/imprint.component.ts index ee83704..1e6d077 100644 --- a/frontend/src/app/shared/components/legal-information/imprint/imprint.component.ts +++ b/frontend/src/app/shared/components/legal-information/imprint/imprint.component.ts @@ -9,8 +9,14 @@ import { CommonModule, Location } from '@angular/common'; styleUrl: './imprint.component.scss', }) export class ImprintComponent { + /** + * Initializes the ImprintComponent with Location. + */ constructor(private location: Location) {} + /** + * Navigate back to the previous page. + */ backClicked() { this.location.back(); } diff --git a/frontend/src/app/shared/components/legal-information/privacy-policy/privacy-policy.component.ts b/frontend/src/app/shared/components/legal-information/privacy-policy/privacy-policy.component.ts index e1b5ce6..7954a63 100644 --- a/frontend/src/app/shared/components/legal-information/privacy-policy/privacy-policy.component.ts +++ b/frontend/src/app/shared/components/legal-information/privacy-policy/privacy-policy.component.ts @@ -9,8 +9,14 @@ import { CommonModule, Location } from '@angular/common'; styleUrl: './privacy-policy.component.scss', }) export class PrivacyPolicyComponent { + /** + * Initializes the PrivacyPolicyComponent with Location. + */ constructor(private location: Location) {} + /** + * Navigate back to the previous page. + */ backClicked() { this.location.back(); }