From 8724a96b817855a255bcffc4ded37c2e7c05eb69 Mon Sep 17 00:00:00 2001 From: X4Lo Date: Fri, 13 Sep 2024 22:23:41 +0100 Subject: [PATCH] Front: renamed most collection related files --- frontend/src/app/app-routing.module.ts | 4 +- frontend/src/app/core/core.module.ts | 2 +- ...ction.service.ts => collection.service.ts} | 34 ++--- .../core/services/entry-ratings.service.ts | 2 +- .../app/core/services/entry-seen.service.ts | 2 +- .../src/app/core/services/entry.service.ts | 2 +- .../app/core/services/episode-seen.service.ts | 2 +- .../src/app/core/services/importer.service.ts | 2 +- .../src/app/core/services/library.service.ts | 2 +- .../app/core/services/maintenance.service.ts | 2 +- .../src/app/core/services/tmdb.service.ts | 2 +- .../collection-edit-modal.component.css | 0 .../collection-edit-modal.component.html | 0 .../collection-edit-modal.component.spec.ts | 0 .../collection-edit-modal.component.ts | 0 .../collection-entry-card.component.css} | 0 .../collection-entry-card.component.html} | 0 .../collection-entry-card.component.spec.ts} | 10 +- .../collection-entry-card.component.ts} | 16 +-- .../collection-entry-grid.component.css} | 0 .../collection-entry-grid.component.html | 7 + .../collection-entry-grid.component.spec.ts} | 10 +- .../collection-entry-grid.component.ts} | 10 +- .../collection-entry-line.component.css} | 0 .../collection-entry-line.component.html} | 0 .../collection-entry-line.component.spec.ts} | 10 +- .../collection-entry-line.component.ts} | 42 +++--- .../collection-entry-table.component.css} | 0 .../collection-entry-table.component.html | 11 +- .../collection-entry-table.component.spec.ts | 0 .../collection-entry-table.component.ts | 8 +- .../collection-info-page.component.css} | 0 .../collection-info-page.component.html} | 6 +- .../collection-info-page.component.spec.ts} | 10 +- .../collection-info-page.component.ts} | 53 ++++---- .../collections/collections-routing.module.ts | 10 +- .../collections/collections.module.ts | 50 +++++++ .../collection-card.component.css} | 0 .../collection-card.component.html} | 2 +- .../collection-card.component.spec.ts} | 10 +- .../collection-card.component.ts | 45 +++++++ .../collections-page.component.css} | 0 .../collections-page.component.html} | 4 +- .../collections-page.component.spec.ts} | 10 +- .../collections-page.component.ts} | 22 +-- .../userCollection-entry-grid.component.html | 7 - .../collections/user-collections.module.ts | 49 ------- .../userCollections-list-item.component.ts | 127 ------------------ .../entry/entry-page/entry-page.component.ts | 6 +- .../entries-display.component.ts | 2 +- .../library-page/library-page.component.ts | 2 +- .../settings-maintenance.component.ts | 2 +- .../user-collections-modal.component.html | 4 +- .../user-collections-modal.component.ts | 85 ++++++------ frontend/src/app/shared/shared.module.ts | 2 - 55 files changed, 294 insertions(+), 394 deletions(-) rename frontend/src/app/core/services/{userCollection.service.ts => collection.service.ts} (71%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-edit-modal/collection-edit-modal.component.css (100%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-edit-modal/collection-edit-modal.component.html (100%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-edit-modal/collection-edit-modal.component.spec.ts (100%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-edit-modal/collection-edit-modal.component.ts (100%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-grid-card/userCollection-grid-card.component.css => collection-info/collection-entry-card/collection-entry-card.component.css} (100%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html => collection-info/collection-entry-card/collection-entry-card.component.html} (100%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-grid-card/userCollection-grid-card.component.spec.ts => collection-info/collection-entry-card/collection-entry-card.component.spec.ts} (50%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts => collection-info/collection-entry-card/collection-entry-card.component.ts} (88%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.css => collection-info/collection-entry-grid/collection-entry-grid.component.css} (100%) create mode 100644 frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.html rename frontend/src/app/features/collections/{user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.spec.ts => collection-info/collection-entry-grid/collection-entry-grid.component.spec.ts} (50%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.ts => collection-info/collection-entry-grid/collection-entry-grid.component.ts} (65%) rename frontend/src/app/features/collections/{user-collection-info/collection-entry-table/collection-entry-table.component.css => collection-info/collection-entry-line/collection-entry-line.component.css} (100%) rename frontend/src/app/features/collections/{user-collection-info/collection-table-line/collection-table-line.component.html => collection-info/collection-entry-line/collection-entry-line.component.html} (100%) rename frontend/src/app/features/collections/{user-collection-info/collection-table-line/collection-table-line.component.spec.ts => collection-info/collection-entry-line/collection-entry-line.component.spec.ts} (58%) rename frontend/src/app/features/collections/{user-collection-info/collection-table-line/collection-table-line.component.ts => collection-info/collection-entry-line/collection-entry-line.component.ts} (73%) rename frontend/src/app/features/collections/{user-collection-info/collection-table-line/collection-table-line.component.css => collection-info/collection-entry-table/collection-entry-table.component.css} (100%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-entry-table/collection-entry-table.component.html (66%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-entry-table/collection-entry-table.component.spec.ts (100%) rename frontend/src/app/features/collections/{user-collection-info => collection-info}/collection-entry-table/collection-entry-table.component.ts (87%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-info-page/userCollection-info-page.component.css => collection-info/collection-info-page/collection-info-page.component.css} (100%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-info-page/userCollection-info-page.component.html => collection-info/collection-info-page/collection-info-page.component.html} (92%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-info-page/userCollection-info-page.component.spec.ts => collection-info/collection-info-page/collection-info-page.component.spec.ts} (50%) rename frontend/src/app/features/collections/{user-collection-info/userCollection-info-page/userCollection-info-page.component.ts => collection-info/collection-info-page/collection-info-page.component.ts} (81%) create mode 100644 frontend/src/app/features/collections/collections.module.ts rename frontend/src/app/features/collections/{user-collections/userCollection-list-item/userCollections-list-item.component.css => collections/collection-card/collection-card.component.css} (100%) rename frontend/src/app/features/collections/{user-collections/userCollection-list-item/userCollections-list-item.component.html => collections/collection-card/collection-card.component.html} (83%) rename frontend/src/app/features/collections/{user-collections/userCollection-list-item/userCollections-list-item.component.spec.ts => collections/collection-card/collection-card.component.spec.ts} (50%) create mode 100644 frontend/src/app/features/collections/collections/collection-card/collection-card.component.ts rename frontend/src/app/features/collections/{user-collections/userCollections-page/userCollections-page.component.css => collections/collections-page/collections-page.component.css} (100%) rename frontend/src/app/features/collections/{user-collections/userCollections-page/userCollections-page.component.html => collections/collections-page/collections-page.component.html} (90%) rename frontend/src/app/features/collections/{user-collections/userCollections-page/userCollections-page.component.spec.ts => collections/collections-page/collections-page.component.spec.ts} (52%) rename frontend/src/app/features/collections/{user-collections/userCollections-page/userCollections-page.component.ts => collections/collections-page/collections-page.component.ts} (88%) delete mode 100644 frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.html delete mode 100644 frontend/src/app/features/collections/user-collections.module.ts delete mode 100644 frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 1e34130..6f0c1f5 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -52,8 +52,8 @@ const routes: Routes = [ { path: 'collections', loadChildren: () => - import('./features/collections/user-collections.module').then( - (m) => m.UserCollectionsModule + import('./features/collections/collections.module').then( + (m) => m.CollectionsModule ), }, ]; diff --git a/frontend/src/app/core/core.module.ts b/frontend/src/app/core/core.module.ts index 2da5a00..6e60084 100644 --- a/frontend/src/app/core/core.module.ts +++ b/frontend/src/app/core/core.module.ts @@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common'; import { TmdbService } from './services/tmdb.service'; import { LibraryService } from './services/library.service'; import { EntryService } from './services/entry.service'; -import { CollectionService } from './services/userCollection.service'; +import { CollectionService } from './services/collection.service'; import { ToggleService } from './services/toggle.service'; import { SidebarComponent } from './components/sidebar/sidebar.component'; import { NavbarComponent } from './components/navbar/navbar.component'; diff --git a/frontend/src/app/core/services/userCollection.service.ts b/frontend/src/app/core/services/collection.service.ts similarity index 71% rename from frontend/src/app/core/services/userCollection.service.ts rename to frontend/src/app/core/services/collection.service.ts index c21cbf6..4bf1c66 100644 --- a/frontend/src/app/core/services/userCollection.service.ts +++ b/frontend/src/app/core/services/collection.service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { UserCollection } from '../../shared/models/userCollection.model'; -import { UserCollectionEntry } from '../../shared/models/userCollectionEntry.model'; +import { Collection } from '../../shared/models/collection.model'; +import { CollectionEntry } from '../../shared/models/collection-entry.model'; import { Entry } from '../../shared/models/entry.model'; import { environment } from '../../../environments/environment.prod'; @@ -16,22 +16,22 @@ export class CollectionService { constructor(private http: HttpClient) {} // get all lists - getCollections(): Observable { - return this.http.get( + getCollections(): Observable { + return this.http.get( `${this.backend_apiUrl}/${this.apiAction}` ); } // get a list by id getCollection(collectionId: string) { - return this.http.get( + return this.http.get( `${this.backend_apiUrl}/${this.apiAction}/${collectionId}` ); } // Create a new list - createCollection(collection: UserCollection): Observable { - return this.http.post( + createCollection(collection: Collection): Observable { + return this.http.post( `${this.backend_apiUrl}/${this.apiAction}`, collection ); @@ -41,24 +41,24 @@ export class CollectionService { updateCollection( collectionId: number, formData: FormData - ): Observable { - return this.http.put( + ): Observable { + return this.http.put( `${this.backend_apiUrl}/${this.apiAction}/${collectionId}`, formData ); } // * PUT - REFRESH COLLECTION - refreshCollection(collectionId: number): Observable { - return this.http.put( + refreshCollection(collectionId: number): Observable { + return this.http.put( `${this.backend_apiUrl}/${this.apiAction}/${collectionId}/refresh`, {} ); } // * PUT - GET COLLECTION PARTS - getCollectionParts(collectionId: number): Observable { - return this.http.put( + getCollectionParts(collectionId: number): Observable { + return this.http.put( `${this.backend_apiUrl}/${this.apiAction}/${collectionId}/parts`, {} ); @@ -75,8 +75,8 @@ export class CollectionService { addEntryToCollection( collectionId: number, entryId: number - ): Observable { - return this.http.post( + ): Observable { + return this.http.post( `${this.backend_apiUrl}/${this.apiAction}/${collectionId}/entries/${entryId}`, {} ); @@ -84,7 +84,7 @@ export class CollectionService { // Update an entry's order in a list updateEntryOrder( - collectionId: string, + collectionId: number, entryId: number, newOrder: number ): Observable { @@ -96,7 +96,7 @@ export class CollectionService { // Remove an entry from a list removeEntryFromCollection( - collectionId: string, + collectionId: number, entryId: number ): Observable { return this.http.delete( diff --git a/frontend/src/app/core/services/entry-ratings.service.ts b/frontend/src/app/core/services/entry-ratings.service.ts index 438c406..7d232c7 100644 --- a/frontend/src/app/core/services/entry-ratings.service.ts +++ b/frontend/src/app/core/services/entry-ratings.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { EntryRating } from '../../shared/models/entryRating.model'; +import { EntryRating } from '../../shared/models/entry-rating.model'; import { environment } from '../../../environments/environment.prod'; @Injectable({ diff --git a/frontend/src/app/core/services/entry-seen.service.ts b/frontend/src/app/core/services/entry-seen.service.ts index 4851e9f..c7849c7 100644 --- a/frontend/src/app/core/services/entry-seen.service.ts +++ b/frontend/src/app/core/services/entry-seen.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { EntrySeen } from '../../shared/models/entrySeen.model'; +import { EntrySeen } from '../../shared/models/entry-seen.model'; import { environment } from '../../../environments/environment.prod'; @Injectable({ diff --git a/frontend/src/app/core/services/entry.service.ts b/frontend/src/app/core/services/entry.service.ts index 37f86b1..de76d82 100644 --- a/frontend/src/app/core/services/entry.service.ts +++ b/frontend/src/app/core/services/entry.service.ts @@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable, map } from 'rxjs'; import { Entry } from '../../shared/models/entry.model'; import { EntryId } from '../../shared/models/entryId.model'; -import { EntryRating } from '../../shared/models/entryRating.model'; +import { EntryRating } from '../../shared/models/entry-rating.model'; import { environment } from '../../../environments/environment.prod'; import { Media } from '../../shared/models/media.model'; diff --git a/frontend/src/app/core/services/episode-seen.service.ts b/frontend/src/app/core/services/episode-seen.service.ts index 6b64fc0..5f9c55d 100644 --- a/frontend/src/app/core/services/episode-seen.service.ts +++ b/frontend/src/app/core/services/episode-seen.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { EpisodeSeen } from '../../shared/models/episodeSeen.model'; +import { EpisodeSeen } from '../../shared/models/episode-seen.model'; import { EpisodeSeenDto } from '../../shared/models/dtos/episode-seen.dto'; import { environment } from '../../../environments/environment.prod'; diff --git a/frontend/src/app/core/services/importer.service.ts b/frontend/src/app/core/services/importer.service.ts index 8d2e977..56e18d8 100644 --- a/frontend/src/app/core/services/importer.service.ts +++ b/frontend/src/app/core/services/importer.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { MovieDateSeen } from '../../shared/models/dtos/movieDateSeen.model'; +import { MovieDateSeen } from '../../shared/models/dtos/movie-dateSeen.model'; import { HttpClient } from '@angular/common/http'; import { Entry } from '../../shared/models/entry.model'; import { environment } from '../../../environments/environment.prod'; diff --git a/frontend/src/app/core/services/library.service.ts b/frontend/src/app/core/services/library.service.ts index df310ae..5b22215 100644 --- a/frontend/src/app/core/services/library.service.ts +++ b/frontend/src/app/core/services/library.service.ts @@ -4,7 +4,7 @@ import { Observable, ReplaySubject, throwError, map, of } from 'rxjs'; import { catchError, switchMap, tap } from 'rxjs/operators'; import { Entry } from '../../shared/models/entry.model'; import { EntryId } from '../../shared/models/entryId.model'; -import { EntryRating } from '../../shared/models/entryRating.model'; +import { EntryRating } from '../../shared/models/entry-rating.model'; import { environment } from '../../../environments/environment.prod'; @Injectable({ diff --git a/frontend/src/app/core/services/maintenance.service.ts b/frontend/src/app/core/services/maintenance.service.ts index bc64c28..3776b0f 100644 --- a/frontend/src/app/core/services/maintenance.service.ts +++ b/frontend/src/app/core/services/maintenance.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { environment } from '../../../environments/environment.prod'; -import { MaintenanceResult } from '../../shared/models/maintenanceResult.model'; +import { MaintenanceResult } from '../../shared/models/maintenance-result.model'; @Injectable({ providedIn: 'root', diff --git a/frontend/src/app/core/services/tmdb.service.ts b/frontend/src/app/core/services/tmdb.service.ts index 8eef5d8..2bfd7f1 100644 --- a/frontend/src/app/core/services/tmdb.service.ts +++ b/frontend/src/app/core/services/tmdb.service.ts @@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable, filter, from, map, of, switchMap, toArray } from 'rxjs'; import { Entry } from '../../shared/models/entry.model'; import { EntryId } from '../../shared/models/entryId.model'; -import { EntryRating } from '../../shared/models/entryRating.model'; +import { EntryRating } from '../../shared/models/entry-rating.model'; import { environment } from '../../../environments/environment.prod'; import { LibraryService } from './library.service'; diff --git a/frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.css b/frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.css rename to frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.css diff --git a/frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.html b/frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.html similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.html rename to frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.html diff --git a/frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.spec.ts b/frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.spec.ts similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.spec.ts rename to frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.spec.ts diff --git a/frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.ts b/frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.ts similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-edit-modal/collection-edit-modal.component.ts rename to frontend/src/app/features/collections/collection-info/collection-edit-modal/collection-edit-modal.component.ts diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.css b/frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.css rename to frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.css diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html b/frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.html similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.html rename to frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.html diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.spec.ts b/frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.spec.ts similarity index 50% rename from frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.spec.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.spec.ts index e99beec..3c60df7 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.spec.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserCollectionGridCardComponent } from './userCollection-grid-card.component'; +import { CollectionEntryCardComponent } from './collection-entry-card.component'; describe('UserCollectionGridCardComponent', () => { - let component: UserCollectionGridCardComponent; - let fixture: ComponentFixture; + let component: CollectionEntryCardComponent; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [UserCollectionGridCardComponent] + declarations: [CollectionEntryCardComponent] }); - fixture = TestBed.createComponent(UserCollectionGridCardComponent); + fixture = TestBed.createComponent(CollectionEntryCardComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts b/frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.ts similarity index 88% rename from frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.ts index 63e78a9..b074f5d 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-card/collection-entry-card.component.ts @@ -2,15 +2,15 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { Entry } from '../../../../shared/models/entry.model'; import { trigger, transition, style, animate } from '@angular/animations'; -import { CollectionService } from '../../../../core/services/userCollection.service'; +import { CollectionService } from '../../../../core/services/collection.service'; import { Router } from '@angular/router'; import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component'; import { environment } from '../../../../../environments/environment.prod'; @Component({ - selector: 'app-userCollection-grid-card', - templateUrl: './userCollection-grid-card.component.html', - styleUrls: ['./userCollection-grid-card.component.css'], + selector: 'app-collection-entry-card', + templateUrl: './collection-entry-card.component.html', + styleUrls: ['./collection-entry-card.component.css'], animations: [ trigger('fadeInOut', [ transition(':enter', [ @@ -21,13 +21,13 @@ import { environment } from '../../../../../environments/environment.prod'; ]), ], }) -export class UserCollectionGridCardComponent implements OnInit { +export class CollectionEntryCardComponent implements OnInit { @Input() entry!: Entry; - @Input() collectionId: string = ''; + @Input() collectionId!: number; @Output() refrechEvent = new EventEmitter(); constructor( - private userCollectionService: CollectionService, + private collectionService: CollectionService, public dialog: MatDialog, private router: Router ) {} @@ -90,7 +90,7 @@ export class UserCollectionGridCardComponent implements OnInit { if (result) { if (result.confirmed != true) return; - this.userCollectionService + this.collectionService .removeEntryFromCollection(this.collectionId, this.entry.id) .subscribe({ next: (response) => { diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.css b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.css rename to frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.css diff --git a/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.html b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.html new file mode 100644 index 0000000..c820e47 --- /dev/null +++ b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.html @@ -0,0 +1,7 @@ +
+ + + + +
\ No newline at end of file diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.spec.ts b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.spec.ts similarity index 50% rename from frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.spec.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.spec.ts index abb5421..5b96cab 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.spec.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserCollectionEntryGridComponent } from './userCollection-entry-grid.component'; +import { CollectionEntryGridComponent } from './collection-entry-grid.component'; describe('UserCollectionEntryGridComponent', () => { - let component: UserCollectionEntryGridComponent; - let fixture: ComponentFixture; + let component: CollectionEntryGridComponent; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [UserCollectionEntryGridComponent] + declarations: [CollectionEntryGridComponent] }); - fixture = TestBed.createComponent(UserCollectionEntryGridComponent); + fixture = TestBed.createComponent(CollectionEntryGridComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.ts b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.ts similarity index 65% rename from frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.ts index 7f2bc56..237f77e 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-grid/collection-entry-grid.component.ts @@ -10,9 +10,9 @@ import { } from '@angular/animations'; @Component({ - selector: 'app-userCollection-entry-grid', - templateUrl: './userCollection-entry-grid.component.html', - styleUrls: ['./userCollection-entry-grid.component.css'], + selector: 'app-collection-entry-grid', + templateUrl: './collection-entry-grid.component.html', + styleUrls: ['./collection-entry-grid.component.css'], animations: [ trigger('animateDestroy', [ state('void', style({ opacity: '0' })), @@ -20,9 +20,9 @@ import { ]), ], }) -export class UserCollectionEntryGridComponent { +export class CollectionEntryGridComponent { @Input() entries: Entry[] = []; - @Input() collectionId: string = ''; + @Input() collectionId!: number; refrechEventReceiver() { console.log('event recieved'); diff --git a/frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.css b/frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.css rename to frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.css diff --git a/frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.html b/frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.html similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.html rename to frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.html diff --git a/frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.spec.ts b/frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.spec.ts similarity index 58% rename from frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.spec.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.spec.ts index a4bfa7a..a06d283 100644 --- a/frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.spec.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CollectionTableLineComponent } from './collection-table-line.component'; +import { CollectionEntryLineComponent } from './collection-entry-line.component'; describe('CollectionTableLineComponent', () => { - let component: CollectionTableLineComponent; - let fixture: ComponentFixture; + let component: CollectionEntryLineComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [CollectionTableLineComponent] + imports: [CollectionEntryLineComponent] }) .compileComponents(); - fixture = TestBed.createComponent(CollectionTableLineComponent); + fixture = TestBed.createComponent(CollectionEntryLineComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.ts b/frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.ts similarity index 73% rename from frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.ts index 1f7d4d0..3bf294e 100644 --- a/frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-line/collection-entry-line.component.ts @@ -7,18 +7,17 @@ import { ViewEncapsulation, } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { LibraryService } from '../../../../core/services/library.service'; import { Entry } from '../../../../shared/models/entry.model'; import { trigger, transition, style, animate } from '@angular/animations'; -import { CollectionService } from '../../../../core/services/userCollection.service'; +import { CollectionService } from '../../../../core/services/collection.service'; import { Router } from '@angular/router'; import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component'; import { environment } from '../../../../../environments/environment.prod'; @Component({ - selector: 'tr [app-collection-table-line]', - templateUrl: './collection-table-line.component.html', - styleUrl: './collection-table-line.component.css', + selector: 'tr [app-collection-entry-line]', + templateUrl: './collection-entry-line.component.html', + styleUrl: './collection-entry-line.component.css', encapsulation: ViewEncapsulation.None, animations: [ trigger('fadeInOut', [ @@ -30,21 +29,18 @@ import { environment } from '../../../../../environments/environment.prod'; ]), ], }) -export class CollectionTableLineComponent implements OnInit { +export class CollectionEntryLineComponent implements OnInit { @Input() entry!: Entry; - @Input() listId: string = ''; + @Input() collectionId!: number; @Output() refrechEvent = new EventEmitter(); constructor( - private libraryService: LibraryService, - private userCollectionService: CollectionService, + private collectionService: CollectionService, public dialog: MatDialog, private router: Router ) {} - ngOnInit(): void { - - } + ngOnInit(): void {} get releaseYear(): number { return new Date(this.entry.release_date).getFullYear(); @@ -72,14 +68,13 @@ export class CollectionTableLineComponent implements OnInit { (m) => m.type == 'logo' && m.isSelected ); - if ( - selectedLogos.length && - selectedLogos[0] && - selectedLogos[0].path - ) { + if (selectedLogos.length && selectedLogos[0] && selectedLogos[0].path) { const name = selectedLogos[0].path.split('.')[0]; const extention = selectedLogos[0].path.split('.')[1]; - return environment.API_URL + `/media/entries/logos/original/${name}.${extention}`; + return ( + environment.API_URL + + `/media/entries/logos/original/${name}.${extention}` + ); } } @@ -101,19 +96,18 @@ export class CollectionTableLineComponent implements OnInit { if (result) { if (result.confirmed != true) return; - this.userCollectionService - .removeEntryFromCollection(this.listId, this.entry.id) + this.collectionService + .removeEntryFromCollection(this.collectionId, this.entry.id) .subscribe({ next: (response) => { - // TODO confirm notification - - console.log('Entry successfully removed from list.', response); + // TODO TOAST: entry removed from collection + // console.log('Entry successfully removed from collection.', response); this.entry.id = 0; this.entry.isInLibrary = false; }, error: (error) => { // TODO error notification - console.error('Error removing entry from list:', error); + console.error('Error removing entry from collection:', error); }, }); } diff --git a/frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.css b/frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-table-line/collection-table-line.component.css rename to frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.css diff --git a/frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.html b/frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.html similarity index 66% rename from frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.html rename to frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.html index 26c9904..16c5fc0 100644 --- a/frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.html +++ b/frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.html @@ -1,11 +1,3 @@ - -
@@ -30,8 +22,7 @@ - - + diff --git a/frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.spec.ts b/frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.spec.ts similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.spec.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.spec.ts diff --git a/frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.ts b/frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.ts similarity index 87% rename from frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.ts rename to frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.ts index 8acd1b0..4019307 100644 --- a/frontend/src/app/features/collections/user-collection-info/collection-entry-table/collection-entry-table.component.ts +++ b/frontend/src/app/features/collections/collection-info/collection-entry-table/collection-entry-table.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core'; import { Entry } from '../../../../shared/models/entry.model'; -import { CollectionService } from '../../../../core/services/userCollection.service'; +import { CollectionService } from '../../../../core/services/collection.service'; import { CdkDragDrop, CdkDragEnd, @@ -28,9 +28,9 @@ import { }) export class CollectionEntryTableComponent { @Input() entries: Entry[] = []; - @Input() collectionId: string = ''; + @Input() collectionId!: number; - constructor(private userCollectionService: CollectionService) {} + constructor(private collectionService: CollectionService) {} refrechEventReceiver() { console.log('event recieved'); @@ -40,7 +40,7 @@ export class CollectionEntryTableComponent { moveItemInArray(this.entries, event.previousIndex, event.currentIndex); if (event.previousIndex != event.currentIndex) { - this.userCollectionService + this.collectionService .updateEntryOrder( this.collectionId, this.entries[event.currentIndex].id, diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.css b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.css rename to frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.css diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.html b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.html similarity index 92% rename from frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.html rename to frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.html index acef434..3f03643 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.html +++ b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.html @@ -58,14 +58,14 @@

{{collection.name}}

- +
+ [collectionId]="this.collection.id">
\ No newline at end of file diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.spec.ts b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.spec.ts similarity index 50% rename from frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.spec.ts rename to frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.spec.ts index 7486711..ed6f395 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.spec.ts +++ b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserCollectionInfoPageComponent } from './userCollection-info-page.component'; +import { CollectionInfoPageComponent } from './collection-info-page.component'; describe('UserCollectionInfoPageComponent', () => { - let component: UserCollectionInfoPageComponent; - let fixture: ComponentFixture; + let component: CollectionInfoPageComponent; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [UserCollectionInfoPageComponent], + declarations: [CollectionInfoPageComponent], }); - fixture = TestBed.createComponent(UserCollectionInfoPageComponent); + fixture = TestBed.createComponent(CollectionInfoPageComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.ts similarity index 81% rename from frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts rename to frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.ts index 3e27838..7481c2d 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts +++ b/frontend/src/app/features/collections/collection-info/collection-info-page/collection-info-page.component.ts @@ -1,22 +1,22 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { CollectionService } from '../../../../core/services/userCollection.service'; -import { UserCollection } from '../../../../shared/models/userCollection.model'; +import { CollectionService } from '../../../../core/services/collection.service'; +import { Collection } from '../../../../shared/models/collection.model'; import { DatePipe } from '@angular/common'; -import { CollectionEntry } from '../../../../shared/models/dtos/collection-entry.dto'; import { CollectionEditModalComponent } from '../collection-edit-modal/collection-edit-modal.component'; import { MatDialog } from '@angular/material/dialog'; import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component'; import { ScreenshotService } from '../../../../core/services/screenshot.service'; +import { CollectionEntryDTO } from '../../../../shared/models/dtos/collection-entry-dto.model'; @Component({ - selector: 'app-userCollection-info-page', - templateUrl: './userCollection-info-page.component.html', - styleUrls: ['./userCollection-info-page.component.css'], + selector: 'app-collection-info-page', + templateUrl: './collection-info-page.component.html', + styleUrls: ['./collection-info-page.component.css'], providers: [DatePipe], }) -export class UserCollectionInfoPageComponent implements OnInit { - collection: UserCollection = {} as UserCollection; +export class CollectionInfoPageComponent implements OnInit { + collection: Collection = {} as Collection; createdAt: string = ''; updatedAt: string = ''; @@ -25,7 +25,7 @@ export class UserCollectionInfoPageComponent implements OnInit { constructor( private route: ActivatedRoute, - private userCollectionService: CollectionService, + private collectionService: CollectionService, private screenshotService: ScreenshotService, private datePipe: DatePipe, public dialog: MatDialog, @@ -36,10 +36,10 @@ export class UserCollectionInfoPageComponent implements OnInit { const id = this.route.snapshot.paramMap.get('id'); if (id == null) return; // todo redirect if no id is provided - this.userCollectionService.getCollection(id.toString()).subscribe({ + this.collectionService.getCollection(id.toString()).subscribe({ next: (data) => { - this.collection = data as unknown as UserCollection; - this.collection.entries = this.collection.entries as CollectionEntry[]; + this.collection = data as unknown as Collection; + this.collection.entries = this.collection.entries as CollectionEntryDTO[]; this.createdAt = this.getCreatedDate()?.toString() || ''; this.updatedAt = this.getUpdatedAt()?.toString() || ''; @@ -119,18 +119,17 @@ export class UserCollectionInfoPageComponent implements OnInit { if (result) { if (result.formData == null) return; - this.userCollectionService + this.collectionService .updateCollection(this.collection.id, result.formData) .subscribe({ - next: (userCollection) => { - if (userCollection) { - // TODO confirm notification - // console.log(`User Collection updated: `, userCollection); - this.collection = userCollection; + next: (result) => { + if (result) { + // TODO TOAST collection update + this.collection = result; } }, error: (error) => { - console.error('Error updating userCollection:', error); + console.error('Error updating collection:', error); // TODO error notification }, }); @@ -159,7 +158,7 @@ export class UserCollectionInfoPageComponent implements OnInit { if (result) { if (result.confirmed != true) return; - this.userCollectionService + this.collectionService .deleteCollection(this.collection.id) .subscribe({ next: () => { @@ -167,7 +166,7 @@ export class UserCollectionInfoPageComponent implements OnInit { this.router.navigate(['/collections']); }, error: (error) => { - console.error('Error updating userCollection:', error); + console.error('Error updating collection:', error); // TODO error notification }, }); @@ -210,10 +209,10 @@ export class UserCollectionInfoPageComponent implements OnInit { } refreshCollection() { - this.userCollectionService.refreshCollection(this.collection.id).subscribe({ + this.collectionService.refreshCollection(this.collection.id).subscribe({ next: (data) => { - this.collection = data as unknown as UserCollection; - this.collection.entries = this.collection.entries as CollectionEntry[]; + this.collection = data as unknown as Collection; + this.collection.entries = this.collection.entries as CollectionEntryDTO[]; this.createdAt = this.getCreatedDate()?.toString() || ''; this.updatedAt = this.getUpdatedAt()?.toString() || ''; @@ -229,13 +228,13 @@ export class UserCollectionInfoPageComponent implements OnInit { } getCollectionParts() { - this.userCollectionService + this.collectionService .getCollectionParts(this.collection.id) .subscribe({ next: (data) => { - this.collection = data as unknown as UserCollection; + this.collection = data as unknown as Collection; this.collection.entries = this.collection - .entries as CollectionEntry[]; + .entries as CollectionEntryDTO[]; this.createdAt = this.getCreatedDate()?.toString() || ''; this.updatedAt = this.getUpdatedAt()?.toString() || ''; diff --git a/frontend/src/app/features/collections/collections-routing.module.ts b/frontend/src/app/features/collections/collections-routing.module.ts index ace2b0e..46eb8e2 100644 --- a/frontend/src/app/features/collections/collections-routing.module.ts +++ b/frontend/src/app/features/collections/collections-routing.module.ts @@ -1,17 +1,17 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { UserCollectionsPageComponent } from './user-collections/userCollections-page/userCollections-page.component'; -import { UserCollectionInfoPageComponent } from './user-collection-info/userCollection-info-page/userCollection-info-page.component'; +import { CollectionsPageComponent } from './collections/collections-page/collections-page.component'; +import { CollectionInfoPageComponent } from './collection-info/collection-info-page/collection-info-page.component'; -// ! /user-collections +// ! /collections const routes: Routes = [ { path: '', - component: UserCollectionsPageComponent + component: CollectionsPageComponent }, { path: ':id', - component: UserCollectionInfoPageComponent + component: CollectionInfoPageComponent } ]; diff --git a/frontend/src/app/features/collections/collections.module.ts b/frontend/src/app/features/collections/collections.module.ts new file mode 100644 index 0000000..9461159 --- /dev/null +++ b/frontend/src/app/features/collections/collections.module.ts @@ -0,0 +1,50 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../../shared/shared.module'; +import { CollectionsRoutingModule } from './collections-routing.module'; + +import { DragDropModule } from '@angular/cdk/drag-drop'; + +import { CollectionsPageComponent } from './collections/collections-page/collections-page.component'; +import { CollectionCardComponent } from './collections/collection-card/collection-card.component'; +import { CollectionEntryGridComponent } from './collection-info/collection-entry-grid/collection-entry-grid.component'; +import { CollectionEntryCardComponent } from './collection-info/collection-entry-card/collection-entry-card.component'; +import { CollectionInfoPageComponent } from './collection-info/collection-info-page/collection-info-page.component'; +import { UserCollectionsModalComponent } from '../../shared/components/modals/list-selection-modal/user-collections-modal.component'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { CollectionEntryTableComponent } from './collection-info/collection-entry-table/collection-entry-table.component'; +import { CollectionEntryLineComponent } from './collection-info/collection-entry-line/collection-entry-line.component'; +import { CollectionEditModalComponent } from './collection-info/collection-edit-modal/collection-edit-modal.component'; + +@NgModule({ + imports: [ + CommonModule, + SharedModule, + + FormsModule, + ReactiveFormsModule, + + CollectionsRoutingModule, + + DragDropModule, + ], + declarations: [ + // collections list page + CollectionsPageComponent, + CollectionCardComponent, + + // collection info page + CollectionInfoPageComponent, + + CollectionEntryGridComponent, + CollectionEntryCardComponent, + + CollectionEntryTableComponent, + CollectionEntryLineComponent, + + CollectionEditModalComponent, + UserCollectionsModalComponent, + ], + exports: [], +}) +export class CollectionsModule {} diff --git a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.css b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.css rename to frontend/src/app/features/collections/collections/collection-card/collection-card.component.css diff --git a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.html b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.html similarity index 83% rename from frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.html rename to frontend/src/app/features/collections/collections/collection-card/collection-card.component.html index 0bd848a..79d5ab2 100644 --- a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.html +++ b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.html @@ -5,7 +5,7 @@
{{collection.name}}
- +
\ No newline at end of file diff --git a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.spec.ts b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.spec.ts similarity index 50% rename from frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.spec.ts rename to frontend/src/app/features/collections/collections/collection-card/collection-card.component.spec.ts index 15c1142..ec6539a 100644 --- a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.spec.ts +++ b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserCollectionsListItemComponent } from './userCollections-list-item.component'; +import { CollectionCardComponent } from './collection-card.component'; describe('UserCollectionsListItemComponent', () => { - let component: UserCollectionsListItemComponent; - let fixture: ComponentFixture; + let component: CollectionCardComponent; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [UserCollectionsListItemComponent] + declarations: [CollectionCardComponent] }); - fixture = TestBed.createComponent(UserCollectionsListItemComponent); + fixture = TestBed.createComponent(CollectionCardComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/features/collections/collections/collection-card/collection-card.component.ts b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.ts new file mode 100644 index 0000000..15619ca --- /dev/null +++ b/frontend/src/app/features/collections/collections/collection-card/collection-card.component.ts @@ -0,0 +1,45 @@ +import { Component, Input } from '@angular/core'; +import { Collection } from '../../../../shared/models/collection.model'; +import { CollectionService } from '../../../../core/services/collection.service'; +import { Router } from '@angular/router'; +import { trigger, transition, style, animate } from '@angular/animations'; +import { environment } from '../../../../../environments/environment.prod'; +import { Entry } from '../../../../shared/models/entry.model'; + +@Component({ + selector: 'app-collection-card', + templateUrl: './collection-card.component.html', + styleUrls: ['./collection-card.component.css'], + animations: [ + trigger('fadeInOut', [ + transition(':enter', [ + // :enter is alias for 'void => *' + style({ opacity: 0 }), + animate('0.5s ease-out', style({ opacity: 1 })), + ]), + transition(':leave', [ + // :leave is alias for '* => void' + animate('0.5s ease-in', style({ opacity: 0 })), + ]), + ]), + ], +}) +export class CollectionCardComponent { + @Input() collection!: Collection; + + constructor(private listService: CollectionService, private router: Router) {} + + getCreatedDate(): string { + if (this.collection.createdAt == null) return ''; + + return this.collection.createdAt.toString(); + } + + redirectTo(): void { + this.router.navigate([`/collections/${this.collection.id}`]); + } + + deleteList() { + this.listService.deleteCollection(this.collection.id); + } +} diff --git a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.css b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.css similarity index 100% rename from frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.css rename to frontend/src/app/features/collections/collections/collections-page/collections-page.component.css diff --git a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.html similarity index 90% rename from frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html rename to frontend/src/app/features/collections/collections/collections-page/collections-page.component.html index f297302..90a819d 100644 --- a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html +++ b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.html @@ -46,8 +46,8 @@
- +
diff --git a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.spec.ts b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.spec.ts similarity index 52% rename from frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.spec.ts rename to frontend/src/app/features/collections/collections/collections-page/collections-page.component.spec.ts index ee8ea44..f361d87 100644 --- a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.spec.ts +++ b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserCollectionsPageComponent } from './userCollections-page.component'; +import { CollectionsPageComponent } from './collections-page.component'; describe('UserCollectionsPageComponent', () => { - let component: UserCollectionsPageComponent; - let fixture: ComponentFixture; + let component: CollectionsPageComponent; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [UserCollectionsPageComponent], + declarations: [CollectionsPageComponent], }); - fixture = TestBed.createComponent(UserCollectionsPageComponent); + fixture = TestBed.createComponent(CollectionsPageComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.ts similarity index 88% rename from frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts rename to frontend/src/app/features/collections/collections/collections-page/collections-page.component.ts index 5628c96..478ca02 100644 --- a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts +++ b/frontend/src/app/features/collections/collections/collections-page/collections-page.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; -import { UserCollection } from '../../../../shared/models/userCollection.model'; -import { CollectionService } from '../../../../core/services/userCollection.service'; +import { Collection } from '../../../../shared/models/collection.model'; +import { CollectionService } from '../../../../core/services/collection.service'; import { animate, state, @@ -13,9 +13,9 @@ import { Entry } from '../../../../shared/models/entry.model'; import { environment } from '../../../../../environments/environment.prod'; @Component({ - selector: 'app-userCollections-page', - templateUrl: './userCollections-page.component.html', - styleUrls: ['./userCollections-page.component.css'], + selector: 'app-collections-page', + templateUrl: './collections-page.component.html', + styleUrls: ['./collections-page.component.css'], animations: [ trigger('animateDestroy', [ state('void', style({ opacity: '0' })), @@ -23,13 +23,13 @@ import { environment } from '../../../../../environments/environment.prod'; ]), ], }) -export class UserCollectionsPageComponent implements OnInit { +export class CollectionsPageComponent implements OnInit { searchControl = new FormControl(''); showAddButton: boolean = false; collectionsCount: number = 0; - collections: UserCollection[] = []; - collectionsToShow: UserCollection[] = []; + collections: Collection[] = []; + collectionsToShow: Collection[] = []; collectionType: string = 'All'; lockActions: boolean = false; @@ -96,7 +96,7 @@ export class UserCollectionsPageComponent implements OnInit { this.lockActions = true; // TODO add create collection from the collections list page const listName = this.searchControl.value; - let myNewList = { name: listName } as UserCollection; + let myNewList = { name: listName } as Collection; this.collectionsService.createCollection(myNewList).subscribe({ next: (collection) => { this.collections.push(collection); @@ -123,7 +123,7 @@ export class UserCollectionsPageComponent implements OnInit { ); } - getCollectionPosterPath(collection: UserCollection) { + getCollectionPosterPath(collection: Collection) { if (collection.medias && collection.medias.length != 0) { const selectedPosters = collection.medias.filter( (m) => m.type == 'poster' && m.isSelected @@ -154,7 +154,7 @@ export class UserCollectionsPageComponent implements OnInit { } } - getCollectionBakcgroundPath(collection: UserCollection) { + getCollectionBakcgroundPath(collection: Collection) { return `https://www.themoviedb.org/w1280/${collection.backdropPath}`; } diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.html b/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.html deleted file mode 100644 index 38fa77d..0000000 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - - - -
\ No newline at end of file diff --git a/frontend/src/app/features/collections/user-collections.module.ts b/frontend/src/app/features/collections/user-collections.module.ts deleted file mode 100644 index 31dbda6..0000000 --- a/frontend/src/app/features/collections/user-collections.module.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { SharedModule } from '../../shared/shared.module'; -import { CollectionsRoutingModule } from './collections-routing.module'; - -import { DragDropModule } from '@angular/cdk/drag-drop'; - -import { UserCollectionsPageComponent } from './user-collections/userCollections-page/userCollections-page.component'; -import { UserCollectionsListItemComponent } from './user-collections/userCollection-list-item/userCollections-list-item.component'; -import { UserCollectionEntryGridComponent } from './user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component'; -import { UserCollectionGridCardComponent } from './user-collection-info/userCollection-grid-card/userCollection-grid-card.component'; -import { UserCollectionInfoPageComponent } from './user-collection-info/userCollection-info-page/userCollection-info-page.component'; -import { UserCollectionsModalComponent } from '../../shared/components/modals/list-selection-modal/user-collections-modal.component'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CollectionEntryTableComponent } from './user-collection-info/collection-entry-table/collection-entry-table.component'; -import { CollectionTableLineComponent } from './user-collection-info/collection-table-line/collection-table-line.component'; - -@NgModule({ - imports: [ - CommonModule, - SharedModule, - - FormsModule, - ReactiveFormsModule, - - CollectionsRoutingModule, - - DragDropModule, - ], - declarations: [ - // collections list page - UserCollectionsPageComponent, - UserCollectionsListItemComponent, - - // collection info page - UserCollectionInfoPageComponent, - - UserCollectionEntryGridComponent, - UserCollectionGridCardComponent, - - CollectionEntryTableComponent, - CollectionTableLineComponent, - - - UserCollectionsModalComponent, - ], - exports: [], -}) -export class UserCollectionsModule {} diff --git a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts b/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts deleted file mode 100644 index f474982..0000000 --- a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { UserCollection } from '../../../../shared/models/userCollection.model'; -import { CollectionService } from '../../../../core/services/userCollection.service'; -import { Router } from '@angular/router'; -import { trigger, transition, style, animate } from '@angular/animations'; -import { environment } from '../../../../../environments/environment.prod'; -import { Entry } from '../../../../shared/models/entry.model'; - -@Component({ - selector: 'app-userCollections-list-item', - templateUrl: './userCollections-list-item.component.html', - styleUrls: ['./userCollections-list-item.component.css'], - animations: [ - trigger('fadeInOut', [ - transition(':enter', [ - // :enter is alias for 'void => *' - style({ opacity: 0 }), - animate('0.5s ease-out', style({ opacity: 1 })), - ]), - transition(':leave', [ - // :leave is alias for '* => void' - animate('0.5s ease-in', style({ opacity: 0 })), - ]), - ]), - ], -}) -export class UserCollectionsListItemComponent { - @Input() collection!: UserCollection; - - constructor(private listService: CollectionService, private router: Router) {} - - // getCollectionPosterPath() { - // console.log(this.collection.medias); - // if (this.collection.medias.length != 0) { - // const selectedPosters = this.collection.medias.filter( - // (m) => m.type == 'poster' && m.isSelected - // ); - // let selectedPoster; - // if (selectedPosters.length != 0) { - // selectedPoster = selectedPosters[0].path; - // } else { - // selectedPoster = this.collection.medias[0].path; - // } - - // return ( - // environment.API_URL + - // `/media/collections/posters/preview/${selectedPoster}` - // ); - // } else if (this.collection.entries.length != 0) { - // // * use the poster of the first entry in the collection - // // * if the collection is empty - // return this.getEntryPosterPath(this.collection.entries[0]); - // } else if (this.collection.posterPath) { - // // * use first remote tmdb poster - // // * if collection has none and has no entry - // return `https://www.themoviedb.org/w1280/${this.collection.posterPath}`; - // } else { - // // * use default poster - // // * if collection has totaly no poster - // return 'assets/images/default/default-poster.png'; - // } - // } - - // getCollectionBakcgroundPath() { - // return `https://www.themoviedb.org/w1280/${this.collection.backdropPath}`; - - // // if (this.list.isLocal) { - // // if (this.list.backdropPath == null) - // // return 'assets/images/default/default-poster.png'; - - // // // * use the collection custom poster - // // return ( - // // environment.API_URL + - // // `/media/collections/posters/preview/` + - // // this.list.posterPath - // // ); - // // } else { - // // // * use the poster of the first entry in the collection if its no empty - // // if (this.list.entries.length != 0) { - // // return this.getEntryPosterPath(this.list.entries[0]); - // // } - - // // return `https://www.themoviedb.org/w1280/${this.list.backdropPath}`; - // // // * if the collection is empty - // // return 'assets/images/default/default-poster.png'; - // // } - // } - - // getEntryPosterPath(entry: Entry) { - // // * Is in library: use a local poster - // if (entry.medias) { - // const selectedPosters = entry.medias.filter( - // (m) => m.type == 'poster' && m.isSelected - // ); - - // if ( - // selectedPosters.length && - // selectedPosters[0] && - // selectedPosters[0].path - // ) { - // const name = selectedPosters[0].path; - // return environment.API_URL + `/media/entries/posters/preview/${name}`; - // } - // } - - // // * No local poster available, Use TMDB poster - // if (entry.poster_path) - // return `https://image.tmdb.org/t/p/w300` + entry.poster_path; - - // // * No poster found, use default poster image as a last stand - // return 'assets/images/default/default-poster.png'; - // } - - getCreatedDate(): string { - if (this.collection.createdAt == null) return ''; - - return this.collection.createdAt.toString(); - } - - redirectTo(): void { - this.router.navigate([`/collections/${this.collection.id}`]); - } - - deleteList() { - this.listService.deleteCollection(this.collection.id); - } -} diff --git a/frontend/src/app/features/entry/entry-page/entry-page.component.ts b/frontend/src/app/features/entry/entry-page/entry-page.component.ts index 7126c42..c8ed892 100644 --- a/frontend/src/app/features/entry/entry-page/entry-page.component.ts +++ b/frontend/src/app/features/entry/entry-page/entry-page.component.ts @@ -18,11 +18,11 @@ import { EpisodeSeenService } from '../../../core/services/episode-seen.service' import { SeasonService } from '../../../core/services/season.service'; import { LibraryService } from '../../../core/services/library.service'; import { ToastrService } from 'ngx-toastr'; -import { EntrySeen } from '../../../shared/models/entrySeen.model'; +import { EntrySeen } from '../../../shared/models/entry-seen.model'; import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component'; import { MediaModalComponent } from '../media-modal/media-modal.component'; import { environment } from '../../../../environments/environment.prod'; -import { UserCollection } from '../../../shared/models/userCollection.model'; +import { Collection } from '../../../shared/models/collection.model'; @Component({ selector: 'app-entry-page', @@ -325,7 +325,7 @@ export class EntryPageComponent implements OnInit { } } - getCollectionBackdropPath(collection: UserCollection) { + getCollectionBackdropPath(collection: Collection) { console.log(`collection media:`, collection.medias); if (collection.medias && collection.medias.length != 0) { const backdrops = collection.medias.filter((m) => m.type == 'backdrop'); diff --git a/frontend/src/app/features/library/entries-display/entries-display.component.ts b/frontend/src/app/features/library/entries-display/entries-display.component.ts index f778e77..2216bf2 100644 --- a/frontend/src/app/features/library/entries-display/entries-display.component.ts +++ b/frontend/src/app/features/library/entries-display/entries-display.component.ts @@ -10,7 +10,7 @@ import { LibraryService } from '../../../core/services/library.service'; import { ToastrService } from 'ngx-toastr'; import { SettingsService } from '../../../core/services/settings.service'; import { Settings } from '../../../shared/models/settings.model'; -import { LibraryQueryParams } from '../../../shared/models/LibraryQueryParams'; +import { LibraryQueryParams } from '../../../shared/models/library-query-params'; import { ActivatedRoute, Router } from '@angular/router'; declare var $: any; diff --git a/frontend/src/app/features/library/library-page/library-page.component.ts b/frontend/src/app/features/library/library-page/library-page.component.ts index 7655f65..90aff5f 100644 --- a/frontend/src/app/features/library/library-page/library-page.component.ts +++ b/frontend/src/app/features/library/library-page/library-page.component.ts @@ -2,7 +2,7 @@ import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core'; import { Entry } from '../../../shared/models/entry.model'; import { LibraryService } from '../../../core/services/library.service'; import { ActivatedRoute, Event, NavigationEnd, Router } from '@angular/router'; -import { LibraryQueryParams } from '../../../shared/models/LibraryQueryParams'; +import { LibraryQueryParams } from '../../../shared/models/library-query-params'; import { SettingsService } from '../../../core/services/settings.service'; import { Settings } from '../../../shared/models/settings.model'; import { ValueSetter } from 'date-fns/parse/_lib/Setter'; diff --git a/frontend/src/app/features/settings/settings-maintenance/settings-maintenance.component.ts b/frontend/src/app/features/settings/settings-maintenance/settings-maintenance.component.ts index 958217d..eacc105 100644 --- a/frontend/src/app/features/settings/settings-maintenance/settings-maintenance.component.ts +++ b/frontend/src/app/features/settings/settings-maintenance/settings-maintenance.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { MaintenanceService } from '../../../core/services/maintenance.service'; -import { MaintenanceResult } from '../../../shared/models/maintenanceResult.model'; +import { MaintenanceResult } from '../../../shared/models/maintenance-result.model'; @Component({ selector: 'app-settings-maintenance', diff --git a/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html b/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html index 7a12a24..7304248 100644 --- a/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html +++ b/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html @@ -11,7 +11,7 @@ @@ -20,7 +20,7 @@
-