Remove CharacterComponent and CharacterDetail components
- Deleted `CharacterComponent` and `CharacterDetail` files from the project. - Refactored related logic to improve code maintainability and reduce redundancy.
This commit is contained in:
@@ -36,6 +36,7 @@ import { SyncedActSummary } from "./Act.js";
|
||||
import { SyncedAIGuideLine, SyncedGuideLine } from "./GuideLine.js";
|
||||
import Cover from "./Cover.js";
|
||||
import UserRepo from "../repositories/user.repository.js";
|
||||
import RemovedItem from "./RemovedItem.js";
|
||||
|
||||
export interface SyncedBookTools {
|
||||
lastUpdate: number;
|
||||
@@ -369,6 +370,7 @@ export interface SyncedSeriesSpellTag {
|
||||
export interface SyncedSeries {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
lastUpdate: number;
|
||||
books: SyncedSeriesBook[];
|
||||
characters: SyncedSeriesCharacter[];
|
||||
@@ -500,6 +502,8 @@ export default class Book {
|
||||
const book: Book = new Book(bookId);
|
||||
book.getBookInfos(userId);
|
||||
const bookTools: BookToolsTable | null = BookRepo.fetchBookTools(userId, bookId, lang);
|
||||
// Récupérer le seriesId depuis series_books
|
||||
const seriesId: string | null = BookRepo.fetchBookSeriesId(bookId, lang);
|
||||
return {
|
||||
bookId: book.getId(),
|
||||
type: book.getType(),
|
||||
@@ -508,6 +512,7 @@ export default class Book {
|
||||
subTitle: book.getSubTitle(),
|
||||
summary: book.getSummary(),
|
||||
serieId: book.getSerieId(),
|
||||
seriesId: seriesId,
|
||||
desiredReleaseDate: book.getDesiredReleaseDate(),
|
||||
desiredWordCount: book.getDesiredWordCount(),
|
||||
wordCount: book.getWordCount(),
|
||||
@@ -547,11 +552,16 @@ export default class Book {
|
||||
* Removes a book from the database.
|
||||
* @param userId - The unique identifier of the user
|
||||
* @param bookId - The unique identifier of the book to remove
|
||||
* @param deletedAt - The timestamp of deletion (from UI via System.timeStampInSeconds())
|
||||
* @param lang - The language for error messages ('fr' or 'en')
|
||||
* @returns True if the book was removed, false otherwise
|
||||
*/
|
||||
public static removeBook(userId: string, bookId: string, lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
return BookRepo.deleteBook(userId, bookId, lang);
|
||||
public static removeBook(userId: string, bookId: string, deletedAt: number, lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
const deleted: boolean = BookRepo.deleteBook(userId, bookId, lang);
|
||||
if (deleted) {
|
||||
RemovedItem.deleteTracker(userId, bookId, 'erit_books', bookId, deletedAt, lang);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public static updateBookToolSetting(userId: string, bookId: string, toolName: 'characters' | 'worlds' | 'locations' | 'spells', enabled: boolean, lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
|
||||
Reference in New Issue
Block a user