feat: reimplement geometry module with database schema, repository, service layer, and API documentation
All checks were successful
Build and Release / release (push) Successful in 1m36s
All checks were successful
Build and Release / release (push) Successful in 1m36s
This commit is contained in:
@@ -73,6 +73,18 @@ func (s *geometryService) SearchGeometries(ctx context.Context, req *request.Sea
|
||||
params.EntityID = entityId
|
||||
}
|
||||
|
||||
if req.ProjectID != nil {
|
||||
projectId, err := convert.StringToUUID(*req.ProjectID)
|
||||
if err != nil {
|
||||
return nil, fiber.NewError(fiber.StatusBadRequest, "Invalid project ID format")
|
||||
}
|
||||
params.ProjectID = projectId
|
||||
}
|
||||
|
||||
if req.HasBound != nil {
|
||||
params.HasBound = pgtype.Bool{Bool: *req.HasBound, Valid: true}
|
||||
}
|
||||
|
||||
geometries, err := s.geometryRepo.Search(ctx, params)
|
||||
if err != nil {
|
||||
return nil, fiber.NewError(fiber.StatusInternalServerError, "Failed to search geometries")
|
||||
@@ -132,7 +144,7 @@ func (s *geometryService) SearchGeometriesByEntityName(
|
||||
ID: row.GeometryID,
|
||||
GeoType: row.GeoType,
|
||||
DrawGeometry: row.DrawGeometry,
|
||||
Binding: row.Binding,
|
||||
BoundWith: row.BoundWith,
|
||||
TimeStart: row.TimeStart,
|
||||
TimeEnd: row.TimeEnd,
|
||||
})
|
||||
|
||||
@@ -716,7 +716,15 @@ func (s *submissionService) applySnapshot(ctx context.Context, tx pgx.Tx, projec
|
||||
return fiber.NewError(fiber.StatusInternalServerError, "Invalid geometry ID")
|
||||
}
|
||||
|
||||
binding, _ := json.Marshal(geo.Binding)
|
||||
var boundWith pgtype.UUID
|
||||
if geo.BoundWith != nil && *geo.BoundWith != "" {
|
||||
var err error
|
||||
boundWith, err = convert.StringToUUID(*geo.BoundWith)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid bound_with geometry ID")
|
||||
}
|
||||
}
|
||||
|
||||
geoTypeCode := int16(0)
|
||||
if geo.Type != "" {
|
||||
if n, err := strconv.ParseInt(geo.Type, 10, 16); err == nil {
|
||||
@@ -729,7 +737,7 @@ func (s *submissionService) applySnapshot(ctx context.Context, tx pgx.Tx, projec
|
||||
ID: geometryUUID,
|
||||
GeoType: pgtype.Int2{Int16: geoTypeCode, Valid: true},
|
||||
DrawGeometry: geo.DrawGeometry,
|
||||
Binding: binding,
|
||||
BoundWith: boundWith,
|
||||
TimeStart: convert.PtrFloat64ToInt4(geo.TimeStart),
|
||||
TimeEnd: convert.PtrFloat64ToInt4(geo.TimeEnd),
|
||||
ProjectID: projectUUID,
|
||||
@@ -754,7 +762,7 @@ func (s *submissionService) applySnapshot(ctx context.Context, tx pgx.Tx, projec
|
||||
ID: geometryUUID,
|
||||
GeoType: geoTypeCode,
|
||||
DrawGeometry: geo.DrawGeometry,
|
||||
Binding: binding,
|
||||
BoundWith: boundWith,
|
||||
TimeStart: convert.PtrFloat64ToInt4(geo.TimeStart),
|
||||
TimeEnd: convert.PtrFloat64ToInt4(geo.TimeEnd),
|
||||
ProjectID: projectUUID,
|
||||
|
||||
Reference in New Issue
Block a user