Merged in feature/textExtractionsPart2 (pull request #193)
Continue finishing the parts of the text extraction plan * add missing fields
This commit is contained in:
@@ -58,3 +58,27 @@ func (s *Controllers) UpdateClient(ctx echo.Context, id ClientID) error {
|
||||
|
||||
return ctx.NoContent(http.StatusOK)
|
||||
}
|
||||
|
||||
// ListClients returns all clients in the system.
|
||||
func (s *Controllers) ListClients(ctx echo.Context) error {
|
||||
clients, err := s.svc.Client.List(ctx.Request().Context())
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Unable to list clients: %s", err))
|
||||
}
|
||||
|
||||
// Convert to API response format
|
||||
apiClients := make([]DocClient, len(clients))
|
||||
for i, c := range clients {
|
||||
apiClients[i] = DocClient{
|
||||
Id: c.ID,
|
||||
Name: c.Name,
|
||||
CanSync: c.CanSync,
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.JSON(http.StatusOK, ClientListResponse{
|
||||
Clients: apiClients,
|
||||
//nolint:gosec // Client count is bounded by maxItems: 10000 in OpenAPI spec
|
||||
TotalCount: int32(len(apiClients)),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user