rename model list to usercollection & fixed redlated errors
This commit is contained in:
1 parent
60b517500f
commit
b48b395574
37 files changed
+2479
-1210
No files matched your search
@@ -17,29 +17,20 @@
|
||||
<div class="card-header d-lg-none">
|
||||
<div class="position-relative">
|
||||
<input class="form-control rounded-5 px-5 mobile-search-control" type="text" placeholder="Search">
|
||||
<span
|
||||
class="material-icons-outlined position-absolute ms-3 translate-middle-y start-0 top-50">search</span>
|
||||
<span
|
||||
class="material-icons-outlined position-absolute me-3 translate-middle-y end-0 top-50 mobile-search-close">close</span>
|
||||
</div>
|
||||
<span class="material-icons-outlined position-absolute ms-3 translate-middle-y start-0 top-50">search</span>
|
||||
<span class="material-icons-outlined position-absolute me-3 translate-middle-y end-0 top-50 mobile-search-close">close</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body search-content">
|
||||
<div class="card-body search-content ps ps--active-y">
|
||||
<p class="search-title">Recent Searches</p>
|
||||
<div class="d-flex align-items-start flex-wrap gap-2 kewords-wrapper">
|
||||
<a href="javascript:;" class="kewords"><span>Angular Template</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Dashboard</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Admin Template</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Bootstrap 5 Admin</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Html eCommerce</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Sass</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>laravel 9</span><i
|
||||
class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Angular Template</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Dashboard</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Admin Template</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Bootstrap 5 Admin</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Html eCommerce</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>Sass</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
<a href="javascript:;" class="kewords"><span>laravel 9</span><i class="material-icons-outlined fs-6">search</i></a>
|
||||
</div>
|
||||
<hr>
|
||||
<p class="search-title">Tutorials</p>
|
||||
@@ -77,7 +68,7 @@
|
||||
<div class="search-list d-flex flex-column gap-2">
|
||||
<div class="search-list-item d-flex align-items-center gap-3">
|
||||
<div class="memmber-img">
|
||||
<img src="https://picsum.photos/32/32" width="32" height="32" class="rounded-circle" alt="">
|
||||
<img src="assets/images/logo3.png" width="32" height="32" class="rounded-circle" alt="">
|
||||
</div>
|
||||
<div class="">
|
||||
<h5 class="mb-0 search-list-title ">Andrew Stark</h5>
|
||||
@@ -86,7 +77,7 @@
|
||||
|
||||
<div class="search-list-item d-flex align-items-center gap-3">
|
||||
<div class="memmber-img">
|
||||
<img src="https://picsum.photos/32/32" width="32" height="32" class="rounded-circle" alt="">
|
||||
<img src="assets/images/logo3.png" width="32" height="32" class="rounded-circle" alt="">
|
||||
</div>
|
||||
<div class="">
|
||||
<h5 class="mb-0 search-list-title ">Snetro Jhonia</h5>
|
||||
@@ -95,7 +86,7 @@
|
||||
|
||||
<div class="search-list-item d-flex align-items-center gap-3">
|
||||
<div class="memmber-img">
|
||||
<img src="https://picsum.photos/32/32" width="32" height="32" class="rounded-circle" alt="">
|
||||
<img src="assets/images/logo3.png" width="32" height="32" class="rounded-circle" alt="">
|
||||
</div>
|
||||
<div class="">
|
||||
<h5 class="mb-0 search-list-title">Michle Clark</h5>
|
||||
@@ -103,7 +94,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="ps__rail-x" style="left: 0px; bottom: 0px;"><div class="ps__thumb-x" tabindex="0" style="left: 0px; width: 0px;"></div></div><div class="ps__rail-y" style="top: 0px; right: 0px; height: 389px;"><div class="ps__thumb-y" tabindex="0" style="top: 0px; height: 281px;"></div></div></div>
|
||||
<div class="card-footer text-center bg-transparent">
|
||||
<a href="javascript:;" class="btn w-100">See All Search Results</a>
|
||||
</div>
|
||||
|
||||
@@ -74,13 +74,13 @@
|
||||
<div class="menu-title">Watchlist</div>
|
||||
</a>
|
||||
</li>
|
||||
<li routerLink="/lists" routerLinkActive="mm-active">
|
||||
<li routerLink="/user-collections" routerLinkActive="mm-active">
|
||||
<a>
|
||||
<div class="parent-icon"><span class="material-symbols-outlined">
|
||||
format_list_bulleted
|
||||
</span>
|
||||
</div>
|
||||
<div class="menu-title">Lists</div>
|
||||
<div class="menu-title">Collections</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -4,19 +4,20 @@ import { CommonModule } from '@angular/common';
|
||||
import { TmdbService } from './services/tmdb.service';
|
||||
import { LibraryService } from './services/library.service';
|
||||
import { EntryService } from './services/entry.service';
|
||||
import { ListService } from './services/list.service';
|
||||
import { UserCollectionService } from './services/userCollection.service';
|
||||
import { ToggleService } from './services/toggle.service';
|
||||
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
||||
import { NavbarComponent } from './components/navbar/navbar.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
declarations: [SidebarComponent, NavbarComponent],
|
||||
imports: [CommonModule],
|
||||
imports: [CommonModule, RouterModule],
|
||||
providers: [
|
||||
TmdbService,
|
||||
LibraryService,
|
||||
EntryService,
|
||||
ListService,
|
||||
UserCollectionService,
|
||||
ToggleService,
|
||||
],
|
||||
exports: [SidebarComponent, NavbarComponent],
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { UserCollection } from '../../shared/models/userCollection.model';
|
||||
import { ListEntry } from '../../shared/models/listEntry.model';
|
||||
import { Entry } from '../../shared/models/entry.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ListService {
|
||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
// get all lists
|
||||
getLists(): Observable<UserCollection[]> {
|
||||
return this.http.get<UserCollection[]>(`${this.backend_apiUrl}/lists`);
|
||||
}
|
||||
|
||||
// get a list by id
|
||||
getList(id: string) {
|
||||
return this.http.get<UserCollection[]>(`${this.backend_apiUrl}/lists/${id}`);
|
||||
}
|
||||
|
||||
// Create a new list
|
||||
createList(list: UserCollection): Observable<UserCollection> {
|
||||
return this.http.post<UserCollection>(`${this.backend_apiUrl}/lists`, list);
|
||||
}
|
||||
|
||||
// Delete a list by ID
|
||||
deleteList(id: number): Observable<any> {
|
||||
return this.http.delete(`${this.backend_apiUrl}/lists/${id}`);
|
||||
}
|
||||
|
||||
// Add an entry to a list
|
||||
addEntryToList(
|
||||
listId: number,
|
||||
entryId: number,
|
||||
order: number
|
||||
): Observable<ListEntry> {
|
||||
return this.http.post<ListEntry>(
|
||||
`${this.backend_apiUrl}/lists/${listId}/entries/${entryId}`,
|
||||
{ order: order }
|
||||
);
|
||||
}
|
||||
|
||||
// Update an entry's order in a list
|
||||
updateEntryOrder(
|
||||
listId: number,
|
||||
entryId: number,
|
||||
newOrder: number
|
||||
): Observable<any> {
|
||||
return this.http.patch(
|
||||
`${this.backend_apiUrl}/lists/${listId}/entries/${entryId}/order`,
|
||||
{ newOrder }
|
||||
);
|
||||
}
|
||||
|
||||
// Remove an entry from a list
|
||||
removeEntryFromList(listId: string, entryId: number): Observable<Entry> {
|
||||
return this.http.delete<Entry>(
|
||||
`${this.backend_apiUrl}/lists/${listId}/entries/${entryId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
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 { Entry } from '../../shared/models/entry.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UserCollectionService {
|
||||
private backend_apiUrl = 'http://localhost:4000/api/v1';
|
||||
private apiAction = 'user-collections';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
// get all lists
|
||||
getLists(): Observable<UserCollection[]> {
|
||||
return this.http.get<UserCollection[]>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}`
|
||||
);
|
||||
}
|
||||
|
||||
// get a list by id
|
||||
getList(userCollectionId: string) {
|
||||
return this.http.get<UserCollection[]>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}`
|
||||
);
|
||||
}
|
||||
|
||||
// Create a new list
|
||||
createList(userCollection: UserCollection): Observable<UserCollection> {
|
||||
return this.http.post<UserCollection>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}`,
|
||||
userCollection
|
||||
);
|
||||
}
|
||||
|
||||
// Delete a list by ID
|
||||
deleteList(userCollectionId: number): Observable<any> {
|
||||
return this.http.delete(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}`
|
||||
);
|
||||
}
|
||||
|
||||
// Add an entry to a list
|
||||
addEntryToList(
|
||||
userCollectionId: number,
|
||||
entryId: number,
|
||||
order: number
|
||||
): Observable<UserCollectionEntry> {
|
||||
return this.http.post<UserCollectionEntry>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}/entries/${entryId}`,
|
||||
{ order: order }
|
||||
);
|
||||
}
|
||||
|
||||
// Update an entry's order in a list
|
||||
updateEntryOrder(
|
||||
userCollectionId: string,
|
||||
entryId: number,
|
||||
newOrder: number
|
||||
): Observable<any> {
|
||||
return this.http.patch(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}/entries/${entryId}/order`,
|
||||
{ newOrder }
|
||||
);
|
||||
}
|
||||
|
||||
// Remove an entry from a list
|
||||
removeEntryFromList(
|
||||
userCollectionId: string,
|
||||
entryId: number
|
||||
): Observable<Entry> {
|
||||
return this.http.delete<Entry>(
|
||||
`${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}/entries/${entryId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user