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:
@@ -1,6 +1,7 @@
|
||||
import { getUserEncryptionKey } from "../keyManager.js";
|
||||
import System from "../System.js";
|
||||
import SeriesLocationRepo, { SeriesLocationResult, SeriesLocationElementResult, SeriesLocationSubElementResult } from "../repositories/series-location.repo.js";
|
||||
import RemovedItem from "./RemovedItem.js";
|
||||
|
||||
export interface SeriesLocationSubElementProps {
|
||||
id: string;
|
||||
@@ -123,32 +124,47 @@ export default class SeriesLocation {
|
||||
* Deletes a location section.
|
||||
* @param userId - The unique identifier of the user
|
||||
* @param locationId - The unique identifier of the location
|
||||
* @param deletedAt - The timestamp of deletion
|
||||
* @param lang - The language for error messages ('fr' or 'en')
|
||||
* @returns True if successful
|
||||
*/
|
||||
public static deleteLocation(userId: string, locationId: string, lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
return SeriesLocationRepo.deleteLocation(userId, locationId, lang);
|
||||
public static deleteLocation(userId: string, locationId: string, deletedAt: number = System.timeStampInSeconds(), lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
const deleted: boolean = SeriesLocationRepo.deleteLocation(userId, locationId, lang);
|
||||
if (deleted) {
|
||||
RemovedItem.deleteTracker(userId, null, 'series_locations', locationId, deletedAt, lang);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an element.
|
||||
* @param userId - The unique identifier of the user
|
||||
* @param elementId - The unique identifier of the element
|
||||
* @param deletedAt - The timestamp of deletion
|
||||
* @param lang - The language for error messages ('fr' or 'en')
|
||||
* @returns True if successful
|
||||
*/
|
||||
public static deleteElement(userId: string, elementId: string, lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
return SeriesLocationRepo.deleteElement(userId, elementId, lang);
|
||||
public static deleteElement(userId: string, elementId: string, deletedAt: number = System.timeStampInSeconds(), lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
const deleted: boolean = SeriesLocationRepo.deleteElement(userId, elementId, lang);
|
||||
if (deleted) {
|
||||
RemovedItem.deleteTracker(userId, null, 'series_location_elements', elementId, deletedAt, lang);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a sub-element.
|
||||
* @param userId - The unique identifier of the user
|
||||
* @param subElementId - The unique identifier of the sub-element
|
||||
* @param deletedAt - The timestamp of deletion
|
||||
* @param lang - The language for error messages ('fr' or 'en')
|
||||
* @returns True if successful
|
||||
*/
|
||||
public static deleteSubElement(userId: string, subElementId: string, lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
return SeriesLocationRepo.deleteSubElement(userId, subElementId, lang);
|
||||
public static deleteSubElement(userId: string, subElementId: string, deletedAt: number = System.timeStampInSeconds(), lang: 'fr' | 'en' = 'fr'): boolean {
|
||||
const deleted: boolean = SeriesLocationRepo.deleteSubElement(userId, subElementId, lang);
|
||||
if (deleted) {
|
||||
RemovedItem.deleteTracker(userId, null, 'series_location_sub_elements', subElementId, deletedAt, lang);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user