feat: feature enforcement imports (#37/#38) and Universal CSV validation (#71)
Activity and nutrition legacy CSV imports enforce tier limits with UsageBadge UI; Universal CSV gets mapping validation on copy/import, format-check parity, and structured error_details. version: 0.9u module: activity 1.2.1, nutrition 1.0.3, csv_import 0.4.0 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
532e17c4cd
commit
79ec249bc3
27 files changed
+690
-95
No files matched your search
@@ -29,6 +29,13 @@ export function formatFastApiDetail(detail, fallback = '') {
|
||||
return parts.length ? parts.join(' · ') : fallback || 'Validierungsfehler'
|
||||
}
|
||||
if (typeof detail === 'object') {
|
||||
if (detail.validation?.errors?.length) {
|
||||
const parts = detail.validation.errors
|
||||
.map((e) => (e && typeof e === 'object' ? e.message || e.msg || '' : String(e)))
|
||||
.filter(Boolean)
|
||||
const prefix = detail.message || 'Vorlage ungültig'
|
||||
return parts.length ? `${prefix}: ${parts.join(' · ')}` : prefix
|
||||
}
|
||||
if (Array.isArray(detail.errors) && detail.errors.length > 0) {
|
||||
const parts = detail.errors
|
||||
.map((e) => {
|
||||
@@ -713,6 +720,7 @@ export const api = {
|
||||
req(module ? `/csv/mappings?module=${encodeURIComponent(module)}` : '/csv/mappings'),
|
||||
copyCsvMapping: (mappingId, body = null) =>
|
||||
req(`/csv/mappings/${mappingId}/copy`, body ? json(body) : { method: 'POST' }),
|
||||
validateCsvMapping: (mappingId) => req(`/csv/mappings/${mappingId}/validate`),
|
||||
/** Universal-CSV (Issue #21): Zielmodul steckt in der Vorlage; nur file + mapping_id */
|
||||
/** Import-Diagnose: keine Datenbank-Schreibung, erste Zeilen + Mapping-Auflösung */
|
||||
diagnoseUniversalCsv: async (file, mappingId, module = null) => {
|
||||
|
||||
Reference in new issue
Block a user