mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
1.6 KiB
1.6 KiB
Reference validation message sources
Grouped required-field errors
- The string
"At least one of the following fields is required: …"is produced inorCheckinsidefrontend/src/shared/validators/reference.ts. orCheckbuilds the list of field keys based onref_type_idand checks whether any of those fields contain a non-empty string. When none do, it returns the concatenated message.validateReferencewiresorCheckinto the validators fortitle_primary,title_secondary,title_series, andgen_notes, so the message appears both in inline errors and aggregate validation results.
Display labels for reference fields
- Human-readable labels per reference type come from the database table
ref_field_name(via Prisma modelref_field_name), which storesref_field_name(display text) alongsidefield_name(schema key) scoped byref_type_id. - The backend returns these labels through
getReferenceTypesinbackend/src/services/reference.ts, which fetchesref_ref_typerecords including theirref_field_namechildren, andbuildReferenceDisplayLabelMapconverts them into a lookup keyed byref_type_id. validateEntireReferencepasses thisdisplayLabelMapintovalidateReference, enablingorCheckto swap field keys for per-type display labels when building the grouped required-field message.- On the frontend,
ReferenceDetailsinjects the same display-label map intovalidateReferenceso both inline and aggregate messages show labels like "Title", "Organisation", or "Notes" instead of raw schema keys for the active reference type.