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

@@ -16,8 +16,8 @@ export class FavoriteService {
}
}
private static getCurrentUser(): User {
const user = AuthServerService.getCurrentUser();
private static async getCurrentUser(): Promise<User> {
const user = await AuthServerService.getCurrentUser();
if (!user) {
throw new AppError(ERROR_CODES.AUTH.UNAUTHENTICATED);
}
@@ -29,7 +29,7 @@ export class FavoriteService {
*/
static async isFavorite(seriesId: string): Promise<boolean> {
try {
const user = this.getCurrentUser();
const user = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("isFavorite", async () => {
@@ -50,7 +50,7 @@ export class FavoriteService {
*/
static async addToFavorites(seriesId: string): Promise<void> {
try {
const user = this.getCurrentUser();
const user = await this.getCurrentUser();
await connectDB();
await DebugService.measureMongoOperation("addToFavorites", async () => {
@@ -72,7 +72,7 @@ export class FavoriteService {
*/
static async removeFromFavorites(seriesId: string): Promise<void> {
try {
const user = this.getCurrentUser();
const user = await this.getCurrentUser();
await connectDB();
await DebugService.measureMongoOperation("removeFromFavorites", async () => {
@@ -92,7 +92,7 @@ export class FavoriteService {
* Récupère tous les IDs des séries favorites
*/
static async getAllFavoriteIds(): Promise<string[]> {
const user = this.getCurrentUser();
const user = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("getAllFavoriteIds", async () => {
@@ -102,7 +102,7 @@ export class FavoriteService {
}
static async addFavorite(seriesId: string) {
const user = this.getCurrentUser();
const user = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("addFavorite", async () => {
@@ -116,7 +116,7 @@ export class FavoriteService {
}
static async removeFavorite(seriesId: string): Promise<boolean> {
const user = this.getCurrentUser();
const user = await this.getCurrentUser();
await connectDB();
return DebugService.measureMongoOperation("removeFavorite", async () => {