feat(csv-templates): Introduce CSV template analysis and validation features
- Added a new endpoint for analyzing uploaded CSV files, providing suggestions for field mappings and type conversions. - Implemented validation for required field targets to ensure all mandatory fields are mapped correctly. - Enhanced the admin CSV templates interface with new routes and navigation options in the frontend. - Updated API utility functions to support the new CSV analysis functionality. - Improved error handling for CSV uploads, including file size and row count checks.
This commit is contained in:
1 parent
338163ac0b
commit
c10da55ec6
9 files changed
+1017
-4
No files matched your search
@@ -524,6 +524,18 @@ export const api = {
|
||||
},
|
||||
adminListCsvTemplates: (module = null) =>
|
||||
req(module ? `/admin/csv-templates?module=${encodeURIComponent(module)}` : '/admin/csv-templates'),
|
||||
/** CSV für Admin-Editor analysieren (Vorschlags-Mappings, wie Nutzer-Import) */
|
||||
adminAnalyzeCsvTemplate: async (file, module, delimiter = null, seedTemplateId = null) => {
|
||||
const fd = new FormData()
|
||||
fd.append('file', file)
|
||||
fd.append('module', module)
|
||||
if (delimiter) fd.append('delimiter', delimiter)
|
||||
if (seedTemplateId != null && seedTemplateId !== '') fd.append('seed_template_id', String(seedTemplateId))
|
||||
const res = await fetch(BASE + '/admin/csv-templates/analyze-upload', { method: 'POST', headers: hdrs(), body: fd })
|
||||
const j = await res.json().catch(() => ({}))
|
||||
if (!res.ok) throw new Error(j.detail || res.statusText || 'Analyse fehlgeschlagen')
|
||||
return j
|
||||
},
|
||||
adminGetCsvTemplate: (id) => req(`/admin/csv-templates/${id}`),
|
||||
adminCreateCsvTemplate: (d) => req('/admin/csv-templates', json(d)),
|
||||
adminUpdateCsvTemplate: (id, d) => req(`/admin/csv-templates/${id}`, jput(d)),
|
||||
|
||||
Reference in new issue
Block a user