diff --git a/assets/vue/app/domain/activity/domain/entities/job.js b/assets/vue/app/domain/activity/domain/entities/job.js index f26a8a8..ea1882c 100644 --- a/assets/vue/app/domain/activity/domain/entities/job.js +++ b/assets/vue/app/domain/activity/domain/entities/job.js @@ -7,8 +7,12 @@ export class Job { payload = {}, result = null, error = null, + failureReason = null, createdAt = new Date().toISOString(), - updatedAt = new Date().toISOString() + updatedAt = new Date().toISOString(), + attempts = 0, + maxAttempts = 1, + context = {} }) { this.id = id; this.type = type; @@ -16,9 +20,12 @@ export class Job { this.progress = progress; this.payload = payload; this.result = result; - this.error = error; + this.error = failureReason ?? error; this.createdAt = createdAt; this.updatedAt = updatedAt; + this.attempts = attempts; + this.maxAttempts = maxAttempts; + this.context = context; } static create(data) { diff --git a/assets/vue/app/domain/activity/infrastructure/api/ApiJobRepository.js b/assets/vue/app/domain/activity/infrastructure/api/ApiJobRepository.js index 1b73960..427b374 100644 --- a/assets/vue/app/domain/activity/infrastructure/api/ApiJobRepository.js +++ b/assets/vue/app/domain/activity/infrastructure/api/ApiJobRepository.js @@ -23,8 +23,6 @@ export class ApiJobRepository extends JobRepositoryInterface { url += `&status=${status.join(',')}`; } - console.log('Fetching jobs from URL:', url); - const response = await fetch(url); if (!response.ok) { @@ -32,7 +30,6 @@ export class ApiJobRepository extends JobRepositoryInterface { } const data = await response.json(); - console.log('API Response:', data); // Gérer différents formats de réponse API let jobs, total, currentPage, limit_returned, hasNext, hasPrev; @@ -63,15 +60,6 @@ export class ApiJobRepository extends JobRepositoryInterface { hasPrev = !!data.hasPreviousPage; } - console.log('Processed data:', { - jobs: jobs.length, - total, - currentPage, - limit_returned, - hasNext, - hasPrev - }); - return new JobCollection( jobs, total, @@ -81,7 +69,6 @@ export class ApiJobRepository extends JobRepositoryInterface { hasPrev ); } catch (error) { - console.error('API Error:', error); throw error; } } @@ -102,7 +89,6 @@ export class ApiJobRepository extends JobRepositoryInterface { const data = await response.json(); return Job.create(data); } catch (error) { - console.error('API Error:', error); throw error; } } @@ -124,7 +110,6 @@ export class ApiJobRepository extends JobRepositoryInterface { return true; } catch (error) { - console.error('API Error:', error); throw error; } } @@ -158,7 +143,6 @@ export class ApiJobRepository extends JobRepositoryInterface { const data = await response.json(); return data.deleted || 0; } catch (error) { - console.error('API Error:', error); throw error; } } diff --git a/assets/vue/app/domain/activity/presentation/components/JobItem.vue b/assets/vue/app/domain/activity/presentation/components/JobItem.vue index faada3f..2521421 100644 --- a/assets/vue/app/domain/activity/presentation/components/JobItem.vue +++ b/assets/vue/app/domain/activity/presentation/components/JobItem.vue @@ -10,7 +10,12 @@ - {{ job.type }} + +
{{ jobTypeLabel }}
+
+ {{ job.context.mangaTitle }} +
+ {{ job.error }} +
+
+ {{ job.context.mangaTitle }} +
+
+ Chapitre {{ job.context.chapterNumber }} +
+
+ Source : {{ job.context.sourceId }} +
+
{{ formatDate(job.createdAt) }}
@@ -66,6 +83,11 @@ En attente + +
+ {{ job.attempts }} / {{ job.maxAttempts }} tentative{{ job.maxAttempts > 1 ? 's' : '' }} +