mirror of
https://github.com/booklore-app/booklore.git
synced 2025-12-23 22:28:11 -05:00
* feat(bookmark): add bookmark editing, priority, color, notes, and improved sorting - Add UpdateBookMarkRequest DTO and bookmark editing dialog/component in frontend - Extend BookMark model/entity with color, notes, priority, updatedAt fields - Implement bookmark update API and service logic with validation - Sort bookmarks by priority and creation date - Add Flyway migrations for new columns and index - Update tests for new bookmark features Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * fix(bookmark): prevent notes length display error in edit dialog Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * fix(bookmark): reset editing state and improve dialog cancel handling Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * fix(bookmark): improve edit dialog template with Angular @if and conditional error display Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * feat(bookmark): add view dialog, search, and improved display for bookmarks in reader Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * feat(bookmark): redesign bookmarks section UI with improved layout, styling, and interactions Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * feat(bookmark): enhance view dialog UI with improved layout, styling, and priority display Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * chore(migration): rename migration files to maintain sequential versioning Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * feat(bookmark): add view and edit actions to bookmark list with improved UI and tooltips Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * feat(bookmark): add search and filter functionality to bookmark list in EPUB reader Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * feat(bookmark): update search input to use PrimeNG IconField and InputIcon components Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> --------- Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import {Injectable, inject} from '@angular/core';
|
|
import {HttpClient} from '@angular/common/http';
|
|
import {Observable} from 'rxjs';
|
|
import {API_CONFIG} from '../../core/config/api-config';
|
|
|
|
export interface BookMark {
|
|
id: number;
|
|
userId?: number;
|
|
bookId: number;
|
|
cfi: string;
|
|
title: string;
|
|
color?: string;
|
|
notes?: string;
|
|
priority?: number;
|
|
createdAt: string;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export interface CreateBookMarkRequest {
|
|
bookId: number;
|
|
cfi: string;
|
|
title?: string;
|
|
}
|
|
|
|
export interface UpdateBookMarkRequest {
|
|
title?: string;
|
|
cfi?: string;
|
|
color?: string;
|
|
notes?: string;
|
|
priority?: number;
|
|
}
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class BookMarkService {
|
|
|
|
private readonly url = `${API_CONFIG.BASE_URL}/api/v1/bookmarks`;
|
|
private readonly http = inject(HttpClient);
|
|
|
|
getBookmarksForBook(bookId: number): Observable<BookMark[]> {
|
|
return this.http.get<BookMark[]>(`${this.url}/book/${bookId}`);
|
|
}
|
|
|
|
createBookmark(request: CreateBookMarkRequest): Observable<BookMark> {
|
|
return this.http.post<BookMark>(this.url, request);
|
|
}
|
|
|
|
deleteBookmark(bookmarkId: number): Observable<void> {
|
|
return this.http.delete<void>(`${this.url}/${bookmarkId}`);
|
|
}
|
|
updateBookmark(bookmarkId: number, request: UpdateBookMarkRequest): Observable<BookMark> {
|
|
return this.http.put<BookMark>(`${this.url}/${bookmarkId}`, request);
|
|
}
|
|
}
|