diff --git a/.claude/project-context.md b/.claude/project-context.md index 87dfe03..6197bb3 100644 --- a/.claude/project-context.md +++ b/.claude/project-context.md @@ -1,10 +1,56 @@ # DiunaBI Project Context > This file is auto-generated for Claude Code to quickly understand the project structure. -> Last updated: 2025-12-06 +> Last updated: 2025-12-08 ## RECENT CHANGES (This Session) +**Jobs List Sorting and Multi-Select Filtering (Dec 8, 2025):** +- ✅ **Fixed Job Sorting** - Changed from single CreatedAt DESC to Priority ASC → JobType → CreatedAt DESC +- ✅ **Multi-Select Status Filter** - Replaced single status dropdown with multi-select supporting multiple JobStatus values +- ✅ **Auto-Refresh on Filter Change** - Filters now automatically trigger data reload without requiring manual button click +- ✅ **API Updates** - JobsController GetAll endpoint accepts `List? statuses` instead of single status +- ✅ **JobService Updates** - Sends status values as integers in query string for multi-select support +- Files modified: [JobsController.cs](DiunaBI.API/Controllers/JobsController.cs), [JobService.cs](DiunaBI.UI.Shared/Services/JobService.cs), [Index.razor](DiunaBI.UI.Shared/Pages/Jobs/Index.razor), [Index.razor.cs](DiunaBI.UI.Shared/Pages/Jobs/Index.razor.cs) +- Status: Jobs list now sortable by priority/type/date with working multi-select filters + +**User Timezone Support (Dec 8, 2025):** +- ✅ **DateTimeHelper Service** - Created JS Interop service to detect user's browser timezone +- ✅ **UTC to Local Conversion** - All date displays now show user's local timezone instead of UTC +- ✅ **Database Consistency** - Database continues to store UTC (correct), conversion only for display +- ✅ **Updated Pages** - Applied timezone conversion to all date fields in: + - Jobs Index and Details pages + - Layers Details page (CreatedAt, ModifiedAt, record history) + - DataInbox Index page +- ✅ **Service Registration** - Registered DateTimeHelper as scoped service in DI container +- Files created: [DateTimeHelper.cs](DiunaBI.UI.Shared/Services/DateTimeHelper.cs) +- Files modified: [ServiceCollectionExtensions.cs](DiunaBI.UI.Shared/Extensions/ServiceCollectionExtensions.cs), [Jobs/Index.razor.cs](DiunaBI.UI.Shared/Pages/Jobs/Index.razor.cs), [Jobs/Details.razor](DiunaBI.UI.Shared/Pages/Jobs/Details.razor), [Layers/Details.razor](DiunaBI.UI.Shared/Pages/Layers/Details.razor), [Layers/Details.razor.cs](DiunaBI.UI.Shared/Pages/Layers/Details.razor.cs), [DataInbox/Index.razor.cs](DiunaBI.UI.Shared/Pages/DataInbox/Index.razor.cs) +- Status: All dates display in user's local timezone with format "yyyy-MM-dd HH:mm:ss" + +**QueueJob Model Cleanup and AutoImport User (Dec 8, 2025):** +- ✅ **Removed Duplicate Fields** - Removed CreatedAtUtc and ModifiedAtUtc from QueueJob (were duplicates of CreatedAt/ModifiedAt) +- ✅ **Added ModifiedAt Field** - Was missing, now tracks job modification timestamp +- ✅ **AutoImport User ID** - Created User.AutoImportUserId constant: `f392209e-123e-4651-a5a4-0b1d6cf9ff9d` +- ✅ **System Operations** - All system-created/modified jobs now use AutoImportUserId for CreatedById and ModifiedById +- ✅ **Database Migration** - Created migration: RemoveQueueJobDuplicateUTCFields +- Files modified: [QueueJob.cs](DiunaBI.Domain/Entities/QueueJob.cs), [User.cs](DiunaBI.Domain/Entities/User.cs), [JobWorkerService.cs](DiunaBI.Infrastructure/Services/JobWorkerService.cs), [JobSchedulerService.cs](DiunaBI.Infrastructure/Services/JobSchedulerService.cs), [AppDbContext.cs](DiunaBI.Infrastructure/Data/AppDbContext.cs), [JobsController.cs](DiunaBI.API/Controllers/JobsController.cs) +- Files created: [20251208205202_RemoveQueueJobDuplicateUTCFields.cs](DiunaBI.Infrastructure/Migrations/20251208205202_RemoveQueueJobDuplicateUTCFields.cs) +- Status: QueueJob model cleaned up, all automated operations tracked with AutoImport user ID + +**Job Scheduling UI with JWT Authorization (Dec 8, 2025):** +- ✅ **New JWT Endpoints** - Created UI-specific endpoints at `/jobs/ui/schedule/*` with JWT authorization (parallel to API key endpoints) +- ✅ **Three Scheduling Options** - MudMenu dropdown in Jobs Index with: + - Run All Jobs - schedules all import and process jobs + - Run All Imports - schedules import jobs only + - Run All Processes - schedules process jobs only +- ✅ **JobService Methods** - Added three scheduling methods returning (success, jobsCreated, message) tuples +- ✅ **Auto-Refresh** - Jobs list automatically reloads after scheduling with success/failure notifications +- ✅ **Dual Authorization** - Existing `/jobs/schedule/{apiKey}` endpoints for automation, new `/jobs/ui/schedule` endpoints for UI users +- Files modified: [JobsController.cs](DiunaBI.API/Controllers/JobsController.cs), [JobService.cs](DiunaBI.UI.Shared/Services/JobService.cs), [Index.razor](DiunaBI.UI.Shared/Pages/Jobs/Index.razor), [Index.razor.cs](DiunaBI.UI.Shared/Pages/Jobs/Index.razor.cs) +- Status: UI users can now schedule jobs directly from Jobs page using JWT authentication + +--- + **API Key Authorization Fix for Cron Jobs (Dec 6, 2025):** - ✅ **Fixed 401 Unauthorized on API Key Endpoints** - Cron jobs calling `/jobs/schedule` endpoints were getting rejected despite valid API keys - ✅ **Added [AllowAnonymous] Attribute** - Bypasses controller-level `[Authorize]` to allow `[ApiKeyAuth]` filter to handle authorization