Fix/footer UI (#296)
* feat: enhance journal entry handling with follow-up entries and related RPC * fix: improve validation for journal entry lines to ensure proper submission criteria * feat: add commit_method and rubric_version columns to journal_entries for enhanced tracking * fix: ensure conditional addition of commit_method and rubric_version columns in journal_entries * Update supabase/migrations/20260421120000_journal_entries_with_related_rpc.sql Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
greptile-apps[bot]
parent
dd920355b3
commit
64cd6a0989
@@ -148,7 +148,21 @@ function tryParseZodErrors(error: unknown): string | null {
|
||||
if (messages.length > 0) return messages.join('. ')
|
||||
}
|
||||
|
||||
// Check for { errors: { field: ["msg"] } } shape from validateBody
|
||||
// Check for { errors: [{ field, message, code }] } shape from validateBody
|
||||
if (Array.isArray(obj.errors)) {
|
||||
const items = obj.errors as Array<{ field?: string; message?: string }>
|
||||
const messages = items
|
||||
.slice(0, 3)
|
||||
.map((it) => {
|
||||
const field = it.field || ''
|
||||
const msg = it.message || 'ogiltigt värde'
|
||||
return field ? `${field}: ${msg}` : msg
|
||||
})
|
||||
.filter(Boolean)
|
||||
if (messages.length > 0) return messages.join('. ')
|
||||
}
|
||||
|
||||
// Check for { errors: { field: ["msg"] } } shape (legacy)
|
||||
if (typeof obj.errors === 'object' && obj.errors !== null) {
|
||||
const fieldErrors = obj.errors as Record<string, string[]>
|
||||
const messages: string[] = []
|
||||
|
||||
Reference in New Issue
Block a user