Add new frontend - fix 18

This commit is contained in:
Urtzi Alfaro
2025-07-23 08:38:57 +02:00
parent 05850e9ccf
commit 97e52dcfe5
4 changed files with 928 additions and 636 deletions

View File

@@ -107,7 +107,7 @@ export class NotificationService {
*/
async sendNotification(notification: NotificationCreate): Promise<NotificationResponse> {
const response = await apiClient.post<ApiResponse<NotificationResponse>>(
'/notifications/send',
'/api/v1/notifications/send',
notification
);
return response.data!;
@@ -118,7 +118,7 @@ export class NotificationService {
*/
async sendBulkNotifications(request: BulkNotificationRequest): Promise<BulkNotificationStatus> {
const response = await apiClient.post<ApiResponse<BulkNotificationStatus>>(
'/notifications/bulk',
'/api/v1/notifications/bulk',
request
);
return response.data!;
@@ -140,7 +140,7 @@ export class NotificationService {
page: number;
pages: number;
}> {
const response = await apiClient.get<ApiResponse<any>>('/notifications/history', { params });
const response = await apiClient.get<ApiResponse<any>>('/api/v1/notifications/history', { params });
return response.data!;
}
@@ -149,7 +149,7 @@ export class NotificationService {
*/
async getNotification(notificationId: string): Promise<NotificationResponse> {
const response = await apiClient.get<ApiResponse<NotificationResponse>>(
`/notifications/${notificationId}`
`/api/v1/notifications/${notificationId}`
);
return response.data!;
}
@@ -159,7 +159,7 @@ export class NotificationService {
*/
async retryNotification(notificationId: string): Promise<NotificationResponse> {
const response = await apiClient.post<ApiResponse<NotificationResponse>>(
`/notifications/${notificationId}/retry`
`/api/v1/notifications/${notificationId}/retry`
);
return response.data!;
}
@@ -168,7 +168,7 @@ export class NotificationService {
* Cancel scheduled notification
*/
async cancelNotification(notificationId: string): Promise<void> {
await apiClient.post(`/notifications/${notificationId}/cancel`);
await apiClient.post(`/api/v1/notifications/${notificationId}/cancel`);
}
/**
@@ -180,7 +180,7 @@ export class NotificationService {
type?: string;
}): Promise<NotificationStats> {
const response = await apiClient.get<ApiResponse<NotificationStats>>(
'/notifications/stats',
'/api/v1/notifications/stats',
{ params }
);
return response.data!;
@@ -191,7 +191,7 @@ export class NotificationService {
*/
async getBulkStatus(batchId: string): Promise<BulkNotificationStatus> {
const response = await apiClient.get<ApiResponse<BulkNotificationStatus>>(
`/notifications/bulk/${batchId}/status`
`/api/v1/notifications/bulk/${batchId}/status`
);
return response.data!;
}
@@ -210,7 +210,7 @@ export class NotificationService {
page: number;
pages: number;
}> {
const response = await apiClient.get<ApiResponse<any>>('/notifications/templates', { params });
const response = await apiClient.get<ApiResponse<any>>('/api/v1/notifications/templates', { params });
return response.data!;
}
@@ -219,7 +219,7 @@ export class NotificationService {
*/
async getTemplate(templateId: string): Promise<NotificationTemplate> {
const response = await apiClient.get<ApiResponse<NotificationTemplate>>(
`/notifications/templates/${templateId}`
`/api/v1/notifications/templates/${templateId}`
);
return response.data!;
}
@@ -236,7 +236,7 @@ export class NotificationService {
variables?: string[];
}): Promise<NotificationTemplate> {
const response = await apiClient.post<ApiResponse<NotificationTemplate>>(
'/notifications/templates',
'/api/v1/notifications/templates',
template
);
return response.data!;
@@ -250,7 +250,7 @@ export class NotificationService {
updates: Partial<NotificationTemplate>
): Promise<NotificationTemplate> {
const response = await apiClient.put<ApiResponse<NotificationTemplate>>(
`/notifications/templates/${templateId}`,
`/api/v1/notifications/templates/${templateId}`,
updates
);
return response.data!;
@@ -260,7 +260,7 @@ export class NotificationService {
* Delete notification template
*/
async deleteTemplate(templateId: string): Promise<void> {
await apiClient.delete(`/notifications/templates/${templateId}`);
await apiClient.delete(`/api/v1/notifications/templates/${templateId}`);
}
/**
@@ -268,7 +268,7 @@ export class NotificationService {
*/
async getPreferences(): Promise<NotificationSettings> {
const response = await apiClient.get<ApiResponse<NotificationSettings>>(
'/notifications/preferences'
'/api/v1/notifications/preferences'
);
return response.data!;
}
@@ -278,7 +278,7 @@ export class NotificationService {
*/
async updatePreferences(preferences: Partial<NotificationSettings>): Promise<NotificationSettings> {
const response = await apiClient.put<ApiResponse<NotificationSettings>>(
'/notifications/preferences',
'/api/v1/notifications/preferences',
preferences
);
return response.data!;
@@ -293,7 +293,7 @@ export class NotificationService {
delivery_time_ms?: number;
}> {
const response = await apiClient.post<ApiResponse<any>>(
'/notifications/test',
'/api/v1/notifications/test',
{ type, recipient }
);
return response.data!;
@@ -320,7 +320,7 @@ export class NotificationService {
page: number;
pages: number;
}> {
const response = await apiClient.get<ApiResponse<any>>('/notifications/webhooks', { params });
const response = await apiClient.get<ApiResponse<any>>('/api/v1/notifications/webhooks', { params });
return response.data!;
}
@@ -333,7 +333,7 @@ export class NotificationService {
webhook_url: string;
created_at: string;
}> {
const response = await apiClient.post<ApiResponse<any>>('/notifications/subscribe', {
const response = await apiClient.post<ApiResponse<any>>('/api/v1/notifications/subscribe', {
events,
webhook_url: webhookUrl,
});
@@ -344,7 +344,7 @@ export class NotificationService {
* Unsubscribe from notification events
*/
async unsubscribeFromEvents(subscriptionId: string): Promise<void> {
await apiClient.delete(`/notifications/subscribe/${subscriptionId}`);
await apiClient.delete(`/api/v1/notifications/subscribe/${subscriptionId}`);
}
}

View File

@@ -98,7 +98,7 @@ export class TenantService {
* Corresponds to POST /tenants/register
*/
async registerBakery(bakeryData: TenantCreate): Promise<TenantInfo> {
const response = await apiClient.post<ApiResponse<TenantInfo>>('/api/v1/tenants/register', bakeryData);
const response = await apiClient.post<TenantInfo>('/api/v1/tenants/register', bakeryData);
return response.data!;
}