Initialize backendized SurClaw report system
- Add React/Vite frontend for login, dashboard, reports, templates, users, settings, AI, speech, and media workflows. - Add NestJS/Prisma/PostgreSQL backend with auth, dashboard stats, reports, templates, users, departments, settings, files, AI, speech, audit logs, and HTML sanitization. - Add Prisma schema, migrations, seed data, persistent app sessions, Docker/Nginx deployment files, and upload volume configuration. - Add Vitest, Playwright, backend integration tests, and project documentation for requirements, design, permissions, API contracts, testing, deployment, security, and progress. - Configure production local fallback switch and remove unused Gemini direct dependency/env wiring.
This commit is contained in:
28
src/api/library.ts
Normal file
28
src/api/library.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { FormField } from '../types';
|
||||
import { apiRequest } from './client';
|
||||
|
||||
export interface FieldLibrary {
|
||||
formFields: FormField[];
|
||||
customTimeFormats: string[];
|
||||
multiSelectOptions: Record<string, string[]>;
|
||||
anesthesiaOptions: string[];
|
||||
}
|
||||
|
||||
export const getFieldLibrary = async () => {
|
||||
const response = await apiRequest<{ library: FieldLibrary }>('/api/library/fields');
|
||||
if (!response?.library) {
|
||||
throw new Error('Invalid field library response');
|
||||
}
|
||||
return response.library;
|
||||
};
|
||||
|
||||
export const updateFieldLibrary = async (library: Partial<FieldLibrary>) => {
|
||||
const response = await apiRequest<{ library: FieldLibrary }>('/api/library/fields', {
|
||||
method: 'PATCH',
|
||||
body: library as Record<string, unknown>,
|
||||
});
|
||||
if (!response?.library) {
|
||||
throw new Error('Invalid field library response');
|
||||
}
|
||||
return response.library;
|
||||
};
|
||||
Reference in New Issue
Block a user