mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
- Added Notification Service to manage project-level notifications, including creation, listing, marking as read, and dismissing notifications. - Introduced Event History Service to store and manage historical events, allowing for listing, retrieval, deletion, and replaying of events. - Integrated notifications into the server and UI, providing real-time updates for feature statuses and operations. - Enhanced sidebar and project switcher components to display unread notifications count. - Created dedicated views for managing notifications and event history, improving user experience and accessibility. These changes enhance the application's ability to inform users about important events and statuses, improving overall usability and responsiveness.
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
/**
|
|
* Event History routes - HTTP API for event history management
|
|
*
|
|
* Provides endpoints for:
|
|
* - Listing events with filtering
|
|
* - Getting individual event details
|
|
* - Deleting events
|
|
* - Clearing all events
|
|
* - Replaying events to test hooks
|
|
*
|
|
* Mounted at /api/event-history in the main server.
|
|
*/
|
|
|
|
import { Router } from 'express';
|
|
import type { EventHistoryService } from '../../services/event-history-service.js';
|
|
import type { SettingsService } from '../../services/settings-service.js';
|
|
import { validatePathParams } from '../../middleware/validate-paths.js';
|
|
import { createListHandler } from './routes/list.js';
|
|
import { createGetHandler } from './routes/get.js';
|
|
import { createDeleteHandler } from './routes/delete.js';
|
|
import { createClearHandler } from './routes/clear.js';
|
|
import { createReplayHandler } from './routes/replay.js';
|
|
|
|
/**
|
|
* Create event history router with all endpoints
|
|
*
|
|
* Endpoints:
|
|
* - POST /list - List events with optional filtering
|
|
* - POST /get - Get a single event by ID
|
|
* - POST /delete - Delete an event by ID
|
|
* - POST /clear - Clear all events for a project
|
|
* - POST /replay - Replay an event to trigger hooks
|
|
*
|
|
* @param eventHistoryService - Instance of EventHistoryService
|
|
* @param settingsService - Instance of SettingsService (for replay)
|
|
* @returns Express Router configured with all event history endpoints
|
|
*/
|
|
export function createEventHistoryRoutes(
|
|
eventHistoryService: EventHistoryService,
|
|
settingsService: SettingsService
|
|
): Router {
|
|
const router = Router();
|
|
|
|
// List events with filtering
|
|
router.post('/list', validatePathParams('projectPath'), createListHandler(eventHistoryService));
|
|
|
|
// Get single event
|
|
router.post('/get', validatePathParams('projectPath'), createGetHandler(eventHistoryService));
|
|
|
|
// Delete event
|
|
router.post(
|
|
'/delete',
|
|
validatePathParams('projectPath'),
|
|
createDeleteHandler(eventHistoryService)
|
|
);
|
|
|
|
// Clear all events
|
|
router.post('/clear', validatePathParams('projectPath'), createClearHandler(eventHistoryService));
|
|
|
|
// Replay event
|
|
router.post(
|
|
'/replay',
|
|
validatePathParams('projectPath'),
|
|
createReplayHandler(eventHistoryService, settingsService)
|
|
);
|
|
|
|
return router;
|
|
}
|