feat: add external notification templates management

- Introduced NotificationTemplate model for reusable external notification templates.
- Implemented CRUD operations for external templates in NotificationService.
- Added routes for managing external templates in the API.
- Created frontend API methods for external templates.
- Enhanced Notifications page to manage external templates with a form and list view.
- Updated layout and login pages to improve UI consistency.
- Added integration tests for proxy host management with improved error handling.
This commit is contained in:
CI
2025-11-29 20:51:46 +00:00
parent 82dad8d9cb
commit 5cea5755a0
23 changed files with 889 additions and 19 deletions
+38
View File
@@ -50,3 +50,41 @@ export const previewProvider = async (provider: Partial<NotificationProvider>, d
const response = await client.post('/notifications/providers/preview', payload);
return response.data;
};
// External (saved) templates API
export interface ExternalTemplate {
id: string;
name: string;
description?: string;
config?: string;
template?: string;
created_at?: string;
}
export const getExternalTemplates = async () => {
const response = await client.get<ExternalTemplate[]>('/notifications/external-templates');
return response.data;
};
export const createExternalTemplate = async (data: Partial<ExternalTemplate>) => {
const response = await client.post<ExternalTemplate>('/notifications/external-templates', data);
return response.data;
};
export const updateExternalTemplate = async (id: string, data: Partial<ExternalTemplate>) => {
const response = await client.put<ExternalTemplate>(`/notifications/external-templates/${id}`, data);
return response.data;
};
export const deleteExternalTemplate = async (id: string) => {
await client.delete(`/notifications/external-templates/${id}`);
};
export const previewExternalTemplate = async (templateId?: string, template?: string, data?: Record<string, any>) => {
const payload: any = {};
if (templateId) payload.template_id = templateId;
if (template) payload.template = template;
if (data) payload.data = data;
const response = await client.post('/notifications/external-templates/preview', payload);
return response.data;
};