feat(12.1-01): list row states from one controller call per page
- pact.ListRowStates with the fixed RowState set deleted, negative, disabled - list response meta.row_states keyed by row id; unknown values dropped - list messages rowStateDeleted, rowStateNegative, rowStateDisabled - update writes through the scope the load used, so a soft-deleted record a controller includes stays soft-deleted - DataTable row state badges and text styles - roster fixture, smoke tests, OpenAPI, TS types, dist, READMEs, docs
This commit is contained in:
@@ -942,12 +942,17 @@ func (s *service) list(w http.ResponseWriter, r *http.Request) {
|
||||
WriteError(w, http.StatusInternalServerError, "error", msgServerError)
|
||||
return
|
||||
}
|
||||
WriteData(w, http.StatusOK, result.Data, map[string]any{
|
||||
meta := map[string]any{
|
||||
"page": result.Meta.Page,
|
||||
"per_page": result.Meta.PerPage,
|
||||
"total": result.Meta.Total,
|
||||
"last_page": result.Meta.LastPage,
|
||||
})
|
||||
}
|
||||
// Row states (D-12) are sent only when a row of the page has one.
|
||||
if len(result.Meta.RowStates) > 0 {
|
||||
meta["row_states"] = result.Meta.RowStates
|
||||
}
|
||||
WriteData(w, http.StatusOK, result.Data, meta)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user