geometries: add /geometries/entity search by entity name
This commit is contained in:
@@ -9,3 +9,11 @@ type SearchGeometryDto struct {
|
||||
EntityID *string `json:"entity_id" query:"entity_id" validate:"omitempty,uuid"`
|
||||
ProjectID *string `json:"project_id" query:"project_id" validate:"omitempty,uuid"`
|
||||
}
|
||||
|
||||
type SearchGeometriesByEntityNameDto struct {
|
||||
// Entity name keyword for searching. FE will render the result list by entity name.
|
||||
Name string `json:"name" query:"name" validate:"required,max=255"`
|
||||
// Cursor is entity UUID (id < cursor).
|
||||
Cursor string `json:"cursor" query:"cursor" validate:"omitempty,uuid"`
|
||||
Limit int `json:"limit" query:"limit" validate:"omitempty,min=1,max=100"`
|
||||
}
|
||||
|
||||
26
internal/dtos/response/geometryEntitySearch.go
Normal file
26
internal/dtos/response/geometryEntitySearch.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package response
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// SearchGeometriesByEntityNameResponse groups geometries by matched entities.
|
||||
// Cursor pagination is based on entity_id (descending).
|
||||
type SearchGeometriesByEntityNameResponse struct {
|
||||
Items []*EntityGeometriesSearchItem `json:"items"`
|
||||
NextCursor string `json:"next_cursor,omitempty"`
|
||||
}
|
||||
|
||||
type EntityGeometriesSearchItem struct {
|
||||
EntityID string `json:"entity_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Geometries []*EntityGeometrySearchGeo `json:"geometries"`
|
||||
}
|
||||
|
||||
type EntityGeometrySearchGeo struct {
|
||||
ID string `json:"id"`
|
||||
GeoType int16 `json:"geo_type"`
|
||||
DrawGeometry json.RawMessage `json:"draw_geometry"`
|
||||
Binding json.RawMessage `json:"binding,omitempty"`
|
||||
TimeStart *int32 `json:"time_start,omitempty"`
|
||||
TimeEnd *int32 `json:"time_end,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user