refactor: remove caching-related API endpoints and configurations, update preferences structure, and clean up unused services
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 7m22s

This commit is contained in:
Julien Froidefond
2026-01-03 18:55:12 +01:00
parent acd26ea427
commit 512e9a480f
49 changed files with 244 additions and 4073 deletions

View File

@@ -2,7 +2,7 @@ import prisma from "@/lib/prisma";
import { getCurrentUser } from "../auth-utils";
import { ERROR_CODES } from "../../constants/errorCodes";
import { AppError } from "../../utils/errors";
import type { User, KomgaConfigData, TTLConfigData, KomgaConfig, TTLConfig } from "@/types/komga";
import type { User, KomgaConfigData, KomgaConfig } from "@/types/komga";
export class ConfigDBService {
private static async getCurrentUser(): Promise<User> {
@@ -62,58 +62,4 @@ export class ConfigDBService {
throw new AppError(ERROR_CODES.CONFIG.FETCH_ERROR, {}, error);
}
}
static async getTTLConfig(): Promise<TTLConfig | null> {
try {
const user: User | null = await this.getCurrentUser();
const userId = parseInt(user.id, 10);
const config = await prisma.tTLConfig.findUnique({
where: { userId },
});
return config as TTLConfig | null;
} catch (error) {
if (error instanceof AppError) {
throw error;
}
throw new AppError(ERROR_CODES.CONFIG.TTL_FETCH_ERROR, {}, error);
}
}
static async saveTTLConfig(data: TTLConfigData): Promise<TTLConfig> {
try {
const user: User | null = await this.getCurrentUser();
const userId = parseInt(user.id, 10);
const config = await prisma.tTLConfig.upsert({
where: { userId },
update: {
defaultTTL: data.defaultTTL,
homeTTL: data.homeTTL,
librariesTTL: data.librariesTTL,
seriesTTL: data.seriesTTL,
booksTTL: data.booksTTL,
imagesTTL: data.imagesTTL,
imageCacheMaxAge: data.imageCacheMaxAge,
},
create: {
userId,
defaultTTL: data.defaultTTL,
homeTTL: data.homeTTL,
librariesTTL: data.librariesTTL,
seriesTTL: data.seriesTTL,
booksTTL: data.booksTTL,
imagesTTL: data.imagesTTL,
imageCacheMaxAge: data.imageCacheMaxAge,
},
});
return config as TTLConfig;
} catch (error) {
if (error instanceof AppError) {
throw error;
}
throw new AppError(ERROR_CODES.CONFIG.TTL_SAVE_ERROR, {}, error);
}
}
}