fix: types of nj15

This commit is contained in:
Julien Froidefond
2025-03-02 14:40:15 +01:00
parent a4b521fe2e
commit e60b48d549
27 changed files with 133 additions and 100 deletions

View File

@@ -8,8 +8,8 @@ import { AppError } from "../../utils/errors";
import type { User, KomgaConfigData, TTLConfigData, KomgaConfig, TTLConfig } from "@/types/komga";
export class ConfigDBService {
private static getCurrentUser(): User {
const user: User | null = AuthServerService.getCurrentUser();
private static async getCurrentUser(): Promise<User> {
const user: User | null = await AuthServerService.getCurrentUser();
if (!user) {
throw new AppError(ERROR_CODES.AUTH.UNAUTHENTICATED);
}
@@ -18,7 +18,7 @@ export class ConfigDBService {
static async saveConfig(data: KomgaConfigData): Promise<KomgaConfig> {
try {
const user: User | null = this.getCurrentUser();
const user: User | null = await this.getCurrentUser();
await connectDB();
const authHeader: string = Buffer.from(`${data.username}:${data.password}`).toString(
@@ -51,7 +51,7 @@ export class ConfigDBService {
static async getConfig(): Promise<KomgaConfig | null> {
try {
const user: User | null = this.getCurrentUser();
const user: User | null = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("getConfig", async () => {
@@ -68,7 +68,7 @@ export class ConfigDBService {
static async getTTLConfig(): Promise<TTLConfig | null> {
try {
const user: User | null = this.getCurrentUser();
const user: User | null = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("getTTLConfig", async () => {
@@ -85,7 +85,7 @@ export class ConfigDBService {
static async saveTTLConfig(data: TTLConfigData): Promise<TTLConfig> {
try {
const user: User | null = this.getCurrentUser();
const user: User | null = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("saveTTLConfig", async () => {