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

This commit is contained in:
2026-05-24 17:31:32 +07:00
parent 8d3b02f312
commit 3cdecdccec
16 changed files with 130 additions and 101 deletions

View File

@@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS geometries (
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE, project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
geo_type SMALLINT NOT NULL DEFAULT 1, geo_type SMALLINT NOT NULL DEFAULT 1,
draw_geometry JSONB NOT NULL, draw_geometry JSONB NOT NULL,
binding JSONB, bound_with UUID REFERENCES geometries(id) ON DELETE SET NULL,
time_start INT, time_start INT,
time_end INT, time_end INT,
bbox GEOMETRY(Polygon, 4326), bbox GEOMETRY(Polygon, 4326),
@@ -40,8 +40,8 @@ WHERE is_deleted = false;
CREATE INDEX idx_entity_geometries_geometry CREATE INDEX idx_entity_geometries_geometry
ON entity_geometries(geometry_id); ON entity_geometries(geometry_id);
CREATE INDEX idx_geom_binding CREATE INDEX idx_geom_bound_with
ON geometries USING GIN (binding); ON geometries (bound_with);
CREATE INDEX idx_geom_updated_at CREATE INDEX idx_geom_updated_at
ON geometries (updated_at DESC) ON geometries (updated_at DESC)

View File

@@ -1,15 +1,15 @@
-- name: CreateGeometry :one -- name: CreateGeometry :one
INSERT INTO geometries ( INSERT INTO geometries (
id, geo_type, draw_geometry, binding, time_start, time_end, bbox, project_id id, geo_type, draw_geometry, bound_with, time_start, time_end, bbox, project_id
) VALUES ( ) VALUES (
COALESCE(sqlc.narg('id')::uuid, uuidv7()), $1, $2, $3, $4, $5, ST_MakeEnvelope(sqlc.arg('min_lng')::float8, sqlc.arg('min_lat')::float8, sqlc.arg('max_lng')::float8, sqlc.arg('max_lat')::float8, 4326), $6 COALESCE(sqlc.narg('id')::uuid, uuidv7()), $1, $2, $3, $4, $5, ST_MakeEnvelope(sqlc.arg('min_lng')::float8, sqlc.arg('min_lat')::float8, sqlc.arg('max_lng')::float8, sqlc.arg('max_lat')::float8, 4326), $6
) )
RETURNING id, geo_type, draw_geometry, binding, time_start, time_end, project_id, RETURNING id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat, ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat,
is_deleted, created_at, updated_at; is_deleted, created_at, updated_at;
-- name: GetGeometryById :one -- name: GetGeometryById :one
SELECT id, geo_type, draw_geometry, binding, time_start, time_end, project_id, SELECT id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat, ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat,
is_deleted, created_at, updated_at is_deleted, created_at, updated_at
FROM geometries FROM geometries
@@ -20,7 +20,7 @@ UPDATE geometries
SET SET
geo_type = COALESCE(sqlc.narg('geo_type'), geo_type), geo_type = COALESCE(sqlc.narg('geo_type'), geo_type),
draw_geometry = COALESCE(sqlc.narg('draw_geometry'), draw_geometry), draw_geometry = COALESCE(sqlc.narg('draw_geometry'), draw_geometry),
binding = COALESCE(sqlc.narg('binding'), binding), bound_with = COALESCE(sqlc.narg('bound_with'), bound_with),
time_start = COALESCE(sqlc.narg('time_start'), time_start), time_start = COALESCE(sqlc.narg('time_start'), time_start),
time_end = COALESCE(sqlc.narg('time_end'), time_end), time_end = COALESCE(sqlc.narg('time_end'), time_end),
project_id = COALESCE(sqlc.narg('project_id'), project_id), project_id = COALESCE(sqlc.narg('project_id'), project_id),
@@ -31,7 +31,7 @@ SET
END, END,
updated_at = now() updated_at = now()
WHERE id = sqlc.arg('id') AND is_deleted = false WHERE id = sqlc.arg('id') AND is_deleted = false
RETURNING id, geo_type, draw_geometry, binding, time_start, time_end, project_id, RETURNING id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat, ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat,
is_deleted, created_at, updated_at; is_deleted, created_at, updated_at;
@@ -43,7 +43,7 @@ WHERE id = $1;
-- name: SearchGeometries :many -- name: SearchGeometries :many
SELECT SELECT
g.id, g.geo_type, g.draw_geometry, g.binding, g.time_start, g.time_end, g.project_id, g.id, g.geo_type, g.draw_geometry, g.bound_with, g.time_start, g.time_end, g.project_id,
ST_XMin(g.bbox)::float8 as min_lng, ST_XMin(g.bbox)::float8 as min_lng,
ST_YMin(g.bbox)::float8 as min_lat, ST_YMin(g.bbox)::float8 as min_lat,
ST_XMax(g.bbox)::float8 as max_lng, ST_XMax(g.bbox)::float8 as max_lng,
@@ -82,6 +82,11 @@ WHERE g.is_deleted = false
AND eg.entity_id = sqlc.narg('entity_id')::uuid AND eg.entity_id = sqlc.narg('entity_id')::uuid
) )
) )
AND (
sqlc.narg('has_bound')::boolean IS NULL OR
sqlc.narg('has_bound')::boolean = true OR
g.bound_with IS NULL
)
ORDER BY g.id DESC; ORDER BY g.id DESC;
-- name: SearchGeometriesByEntityName :many -- name: SearchGeometriesByEntityName :many
@@ -104,7 +109,7 @@ SELECT
g.id AS geometry_id, g.id AS geometry_id,
g.geo_type, g.geo_type,
g.draw_geometry, g.draw_geometry,
g.binding, g.bound_with,
g.time_start, g.time_start,
g.time_end g.time_end
FROM matched_entities me FROM matched_entities me
@@ -133,7 +138,7 @@ WHERE project_id = $1;
-- name: GetGeometriesByIDs :many -- name: GetGeometriesByIDs :many
SELECT SELECT
id, geo_type, draw_geometry, binding, time_start, time_end, project_id, id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_XMin(bbox)::float8 as min_lng,
ST_YMin(bbox)::float8 as min_lat, ST_YMin(bbox)::float8 as min_lat,
ST_XMax(bbox)::float8 as max_lng, ST_XMax(bbox)::float8 as max_lng,
@@ -144,7 +149,7 @@ WHERE id = ANY($1::uuid[]) AND is_deleted = false;
-- name: GetGeometriesByProjectId :many -- name: GetGeometriesByProjectId :many
SELECT SELECT
id, geo_type, draw_geometry, binding, time_start, time_end, project_id, id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_XMin(bbox)::float8 as min_lng,
ST_YMin(bbox)::float8 as min_lat, ST_YMin(bbox)::float8 as min_lat,
ST_XMax(bbox)::float8 as max_lng, ST_XMax(bbox)::float8 as max_lng,
@@ -174,7 +179,7 @@ SELECT
g.id AS geometry_id, g.id AS geometry_id,
g.geo_type, g.geo_type,
g.draw_geometry, g.draw_geometry,
g.binding, g.bound_with,
g.time_start, g.time_start,
g.time_end g.time_end
FROM ( FROM (

View File

@@ -127,7 +127,7 @@ CREATE TABLE IF NOT EXISTS geometries (
id UUID PRIMARY KEY DEFAULT uuidv7(), id UUID PRIMARY KEY DEFAULT uuidv7(),
geo_type SMALLINT NOT NULL DEFAULT 1, geo_type SMALLINT NOT NULL DEFAULT 1,
draw_geometry JSONB NOT NULL, draw_geometry JSONB NOT NULL,
binding JSONB, bound_with UUID REFERENCES geometries(id) ON DELETE SET NULL,
time_start INT, time_start INT,
time_end INT, time_end INT,
bbox GEOMETRY(Polygon, 4326), bbox GEOMETRY(Polygon, 4326),

View File

@@ -791,6 +791,11 @@ const docTemplate = `{
"name": "entity_id", "name": "entity_id",
"in": "query" "in": "query"
}, },
{
"type": "boolean",
"name": "has_bound",
"in": "query"
},
{ {
"maximum": 90, "maximum": 90,
"minimum": -90, "minimum": -90,
@@ -4769,11 +4774,8 @@ const docTemplate = `{
"id" "id"
], ],
"properties": { "properties": {
"binding": { "bound_with": {
"type": "array",
"items": {
"type": "string" "type": "string"
}
}, },
"entity_id": { "entity_id": {
"type": "string" "type": "string"
@@ -4875,11 +4877,8 @@ const docTemplate = `{
"bbox": { "bbox": {
"$ref": "#/definitions/history-api_internal_dtos_request.BBox" "$ref": "#/definitions/history-api_internal_dtos_request.BBox"
}, },
"binding": { "bound_with": {
"type": "array",
"items": {
"type": "string" "type": "string"
}
}, },
"draw_geometry": { "draw_geometry": {
"type": "array", "type": "array",

View File

@@ -784,6 +784,11 @@
"name": "entity_id", "name": "entity_id",
"in": "query" "in": "query"
}, },
{
"type": "boolean",
"name": "has_bound",
"in": "query"
},
{ {
"maximum": 90, "maximum": 90,
"minimum": -90, "minimum": -90,
@@ -4762,11 +4767,8 @@
"id" "id"
], ],
"properties": { "properties": {
"binding": { "bound_with": {
"type": "array",
"items": {
"type": "string" "type": "string"
}
}, },
"entity_id": { "entity_id": {
"type": "string" "type": "string"
@@ -4868,11 +4870,8 @@
"bbox": { "bbox": {
"$ref": "#/definitions/history-api_internal_dtos_request.BBox" "$ref": "#/definitions/history-api_internal_dtos_request.BBox"
}, },
"binding": { "bound_with": {
"type": "array",
"items": {
"type": "string" "type": "string"
}
}, },
"draw_geometry": { "draw_geometry": {
"type": "array", "type": "array",

View File

@@ -301,10 +301,8 @@ definitions:
type: object type: object
history-api_internal_dtos_request.FeatureProperties: history-api_internal_dtos_request.FeatureProperties:
properties: properties:
binding: bound_with:
items:
type: string type: string
type: array
entity_id: entity_id:
type: string type: string
entity_ids: entity_ids:
@@ -374,10 +372,8 @@ definitions:
type: string type: string
bbox: bbox:
$ref: '#/definitions/history-api_internal_dtos_request.BBox' $ref: '#/definitions/history-api_internal_dtos_request.BBox'
binding: bound_with:
items:
type: string type: string
type: array
draw_geometry: draw_geometry:
items: items:
type: integer type: integer
@@ -1216,6 +1212,9 @@ paths:
- in: query - in: query
name: entity_id name: entity_id
type: string type: string
- in: query
name: has_bound
type: boolean
- in: query - in: query
maximum: 90 maximum: 90
minimum: -90 minimum: -90

View File

@@ -9,6 +9,7 @@ type SearchGeometryDto struct {
TimeRange *int32 `json:"time_range" query:"time_range" validate:"omitempty,number"` TimeRange *int32 `json:"time_range" query:"time_range" validate:"omitempty,number"`
EntityID *string `json:"entity_id" query:"entity_id" validate:"omitempty,uuid"` EntityID *string `json:"entity_id" query:"entity_id" validate:"omitempty,uuid"`
ProjectID *string `json:"project_id" query:"project_id" validate:"omitempty,uuid"` ProjectID *string `json:"project_id" query:"project_id" validate:"omitempty,uuid"`
HasBound *bool `json:"has_bound" query:"has_bound" validate:"omitempty"`
} }
type SearchGeometriesByEntityNameDto struct { type SearchGeometriesByEntityNameDto struct {

View File

@@ -36,7 +36,7 @@ type FeatureProperties struct {
GeometryPreset string `json:"geometry_preset,omitempty"` GeometryPreset string `json:"geometry_preset,omitempty"`
TimeStart *float64 `json:"time_start,omitempty"` TimeStart *float64 `json:"time_start,omitempty"`
TimeEnd *float64 `json:"time_end,omitempty"` TimeEnd *float64 `json:"time_end,omitempty"`
Binding []string `json:"binding,omitempty"` BoundWith *string `json:"bound_with,omitempty"`
EntityID string `json:"entity_id,omitempty" validate:"omitempty,uuidv7"` EntityID string `json:"entity_id,omitempty" validate:"omitempty,uuidv7"`
EntityIDs []string `json:"entity_ids,omitempty" validate:"omitempty,dive,uuidv7"` EntityIDs []string `json:"entity_ids,omitempty" validate:"omitempty,dive,uuidv7"`
EntityName string `json:"entity_name,omitempty"` EntityName string `json:"entity_name,omitempty"`
@@ -64,7 +64,7 @@ type GeometrySnapshot struct {
Operation string `json:"operation,omitempty" validate:"omitempty,oneof=create update delete reference"` Operation string `json:"operation,omitempty" validate:"omitempty,oneof=create update delete reference"`
Type string `json:"type,omitempty" validate:"omitempty"` Type string `json:"type,omitempty" validate:"omitempty"`
DrawGeometry json.RawMessage `json:"draw_geometry,omitempty"` DrawGeometry json.RawMessage `json:"draw_geometry,omitempty"`
Binding []string `json:"binding,omitempty"` BoundWith *string `json:"bound_with,omitempty"`
TimeStart *float64 `json:"time_start,omitempty"` TimeStart *float64 `json:"time_start,omitempty"`
TimeEnd *float64 `json:"time_end,omitempty"` TimeEnd *float64 `json:"time_end,omitempty"`
BBox *BBox `json:"bbox,omitempty" validate:"omitempty"` BBox *BBox `json:"bbox,omitempty" validate:"omitempty"`

View File

@@ -16,7 +16,7 @@ type GeometryResponse struct {
ID string `json:"id"` ID string `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding json.RawMessage `json:"binding,omitempty"` BoundWith *string `json:"bound_with,omitempty"`
TimeStart int32 `json:"time_start,omitempty"` TimeStart int32 `json:"time_start,omitempty"`
TimeEnd int32 `json:"time_end,omitempty"` TimeEnd int32 `json:"time_end,omitempty"`
Bbox *Bbox `json:"bbox,omitempty"` Bbox *Bbox `json:"bbox,omitempty"`

View File

@@ -2,7 +2,6 @@ package response
import "encoding/json" import "encoding/json"
type SearchGeometriesByEntityNameResponse struct { type SearchGeometriesByEntityNameResponse struct {
Items []*EntityGeometriesSearchItem `json:"items"` Items []*EntityGeometriesSearchItem `json:"items"`
NextCursor string `json:"next_cursor,omitempty"` NextCursor string `json:"next_cursor,omitempty"`
@@ -19,7 +18,7 @@ type EntityGeometrySearchGeo struct {
ID string `json:"id"` ID string `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding json.RawMessage `json:"binding,omitempty"` BoundWith *string `json:"bound_with,omitempty"`
TimeStart *int32 `json:"time_start,omitempty"` TimeStart *int32 `json:"time_start,omitempty"`
TimeEnd *int32 `json:"time_end,omitempty"` TimeEnd *int32 `json:"time_end,omitempty"`
} }

View File

@@ -69,11 +69,11 @@ func (q *Queries) CreateEntityGeometries(ctx context.Context, arg CreateEntityGe
const createGeometry = `-- name: CreateGeometry :one const createGeometry = `-- name: CreateGeometry :one
INSERT INTO geometries ( INSERT INTO geometries (
id, geo_type, draw_geometry, binding, time_start, time_end, bbox, project_id id, geo_type, draw_geometry, bound_with, time_start, time_end, bbox, project_id
) VALUES ( ) VALUES (
COALESCE($7::uuid, uuidv7()), $1, $2, $3, $4, $5, ST_MakeEnvelope($8::float8, $9::float8, $10::float8, $11::float8, 4326), $6 COALESCE($7::uuid, uuidv7()), $1, $2, $3, $4, $5, ST_MakeEnvelope($8::float8, $9::float8, $10::float8, $11::float8, 4326), $6
) )
RETURNING id, geo_type, draw_geometry, binding, time_start, time_end, project_id, RETURNING id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat, ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat,
is_deleted, created_at, updated_at is_deleted, created_at, updated_at
` `
@@ -81,7 +81,7 @@ RETURNING id, geo_type, draw_geometry, binding, time_start, time_end, project_id
type CreateGeometryParams struct { type CreateGeometryParams struct {
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -96,7 +96,7 @@ type CreateGeometryRow struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -113,7 +113,7 @@ func (q *Queries) CreateGeometry(ctx context.Context, arg CreateGeometryParams)
row := q.db.QueryRow(ctx, createGeometry, row := q.db.QueryRow(ctx, createGeometry,
arg.GeoType, arg.GeoType,
arg.DrawGeometry, arg.DrawGeometry,
arg.Binding, arg.BoundWith,
arg.TimeStart, arg.TimeStart,
arg.TimeEnd, arg.TimeEnd,
arg.ProjectID, arg.ProjectID,
@@ -128,7 +128,7 @@ func (q *Queries) CreateGeometry(ctx context.Context, arg CreateGeometryParams)
&i.ID, &i.ID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
&i.ProjectID, &i.ProjectID,
@@ -199,7 +199,7 @@ SELECT
g.id AS geometry_id, g.id AS geometry_id,
g.geo_type, g.geo_type,
g.draw_geometry, g.draw_geometry,
g.binding, g.bound_with,
g.time_start, g.time_start,
g.time_end g.time_end
FROM ( FROM (
@@ -224,7 +224,7 @@ type GetEntityGeometriesByPairsRow struct {
GeometryID pgtype.UUID `json:"geometry_id"` GeometryID pgtype.UUID `json:"geometry_id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
} }
@@ -245,7 +245,7 @@ func (q *Queries) GetEntityGeometriesByPairs(ctx context.Context, arg GetEntityG
&i.GeometryID, &i.GeometryID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
); err != nil { ); err != nil {
@@ -261,7 +261,7 @@ func (q *Queries) GetEntityGeometriesByPairs(ctx context.Context, arg GetEntityG
const getGeometriesByIDs = `-- name: GetGeometriesByIDs :many const getGeometriesByIDs = `-- name: GetGeometriesByIDs :many
SELECT SELECT
id, geo_type, draw_geometry, binding, time_start, time_end, project_id, id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_XMin(bbox)::float8 as min_lng,
ST_YMin(bbox)::float8 as min_lat, ST_YMin(bbox)::float8 as min_lat,
ST_XMax(bbox)::float8 as max_lng, ST_XMax(bbox)::float8 as max_lng,
@@ -275,7 +275,7 @@ type GetGeometriesByIDsRow struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -301,7 +301,7 @@ func (q *Queries) GetGeometriesByIDs(ctx context.Context, dollar_1 []pgtype.UUID
&i.ID, &i.ID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
&i.ProjectID, &i.ProjectID,
@@ -325,7 +325,7 @@ func (q *Queries) GetGeometriesByIDs(ctx context.Context, dollar_1 []pgtype.UUID
const getGeometriesByProjectId = `-- name: GetGeometriesByProjectId :many const getGeometriesByProjectId = `-- name: GetGeometriesByProjectId :many
SELECT SELECT
id, geo_type, draw_geometry, binding, time_start, time_end, project_id, id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_XMin(bbox)::float8 as min_lng,
ST_YMin(bbox)::float8 as min_lat, ST_YMin(bbox)::float8 as min_lat,
ST_XMax(bbox)::float8 as max_lng, ST_XMax(bbox)::float8 as max_lng,
@@ -339,7 +339,7 @@ type GetGeometriesByProjectIdRow struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -365,7 +365,7 @@ func (q *Queries) GetGeometriesByProjectId(ctx context.Context, projectID pgtype
&i.ID, &i.ID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
&i.ProjectID, &i.ProjectID,
@@ -388,7 +388,7 @@ func (q *Queries) GetGeometriesByProjectId(ctx context.Context, projectID pgtype
} }
const getGeometryById = `-- name: GetGeometryById :one const getGeometryById = `-- name: GetGeometryById :one
SELECT id, geo_type, draw_geometry, binding, time_start, time_end, project_id, SELECT id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat, ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat,
is_deleted, created_at, updated_at is_deleted, created_at, updated_at
FROM geometries FROM geometries
@@ -399,7 +399,7 @@ type GetGeometryByIdRow struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -419,7 +419,7 @@ func (q *Queries) GetGeometryById(ctx context.Context, id pgtype.UUID) (GetGeome
&i.ID, &i.ID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
&i.ProjectID, &i.ProjectID,
@@ -436,7 +436,7 @@ func (q *Queries) GetGeometryById(ctx context.Context, id pgtype.UUID) (GetGeome
const searchGeometries = `-- name: SearchGeometries :many const searchGeometries = `-- name: SearchGeometries :many
SELECT SELECT
g.id, g.geo_type, g.draw_geometry, g.binding, g.time_start, g.time_end, g.project_id, g.id, g.geo_type, g.draw_geometry, g.bound_with, g.time_start, g.time_end, g.project_id,
ST_XMin(g.bbox)::float8 as min_lng, ST_XMin(g.bbox)::float8 as min_lng,
ST_YMin(g.bbox)::float8 as min_lat, ST_YMin(g.bbox)::float8 as min_lat,
ST_XMax(g.bbox)::float8 as max_lng, ST_XMax(g.bbox)::float8 as max_lng,
@@ -475,6 +475,11 @@ WHERE g.is_deleted = false
AND eg.entity_id = $8::uuid AND eg.entity_id = $8::uuid
) )
) )
AND (
$9::boolean IS NULL OR
$9::boolean = true OR
g.bound_with IS NULL
)
ORDER BY g.id DESC ORDER BY g.id DESC
` `
@@ -487,13 +492,14 @@ type SearchGeometriesParams struct {
TimePoint pgtype.Int4 `json:"time_point"` TimePoint pgtype.Int4 `json:"time_point"`
TimeRange pgtype.Int4 `json:"time_range"` TimeRange pgtype.Int4 `json:"time_range"`
EntityID pgtype.UUID `json:"entity_id"` EntityID pgtype.UUID `json:"entity_id"`
HasBound pgtype.Bool `json:"has_bound"`
} }
type SearchGeometriesRow struct { type SearchGeometriesRow struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -516,6 +522,7 @@ func (q *Queries) SearchGeometries(ctx context.Context, arg SearchGeometriesPara
arg.TimePoint, arg.TimePoint,
arg.TimeRange, arg.TimeRange,
arg.EntityID, arg.EntityID,
arg.HasBound,
) )
if err != nil { if err != nil {
return nil, err return nil, err
@@ -528,7 +535,7 @@ func (q *Queries) SearchGeometries(ctx context.Context, arg SearchGeometriesPara
&i.ID, &i.ID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
&i.ProjectID, &i.ProjectID,
@@ -570,7 +577,7 @@ SELECT
g.id AS geometry_id, g.id AS geometry_id,
g.geo_type, g.geo_type,
g.draw_geometry, g.draw_geometry,
g.binding, g.bound_with,
g.time_start, g.time_start,
g.time_end g.time_end
FROM matched_entities me FROM matched_entities me
@@ -595,7 +602,7 @@ type SearchGeometriesByEntityNameRow struct {
GeometryID pgtype.UUID `json:"geometry_id"` GeometryID pgtype.UUID `json:"geometry_id"`
GeoType pgtype.Int2 `json:"geo_type"` GeoType pgtype.Int2 `json:"geo_type"`
DrawGeometry []byte `json:"draw_geometry"` DrawGeometry []byte `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
} }
@@ -616,7 +623,7 @@ func (q *Queries) SearchGeometriesByEntityName(ctx context.Context, arg SearchGe
&i.GeometryID, &i.GeometryID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
); err != nil { ); err != nil {
@@ -635,7 +642,7 @@ UPDATE geometries
SET SET
geo_type = COALESCE($1, geo_type), geo_type = COALESCE($1, geo_type),
draw_geometry = COALESCE($2, draw_geometry), draw_geometry = COALESCE($2, draw_geometry),
binding = COALESCE($3, binding), bound_with = COALESCE($3, bound_with),
time_start = COALESCE($4, time_start), time_start = COALESCE($4, time_start),
time_end = COALESCE($5, time_end), time_end = COALESCE($5, time_end),
project_id = COALESCE($6, project_id), project_id = COALESCE($6, project_id),
@@ -646,7 +653,7 @@ SET
END, END,
updated_at = now() updated_at = now()
WHERE id = $12 AND is_deleted = false WHERE id = $12 AND is_deleted = false
RETURNING id, geo_type, draw_geometry, binding, time_start, time_end, project_id, RETURNING id, geo_type, draw_geometry, bound_with, time_start, time_end, project_id,
ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat, ST_XMin(bbox)::float8 as min_lng, ST_YMin(bbox)::float8 as min_lat, ST_XMax(bbox)::float8 as max_lng, ST_YMax(bbox)::float8 as max_lat,
is_deleted, created_at, updated_at is_deleted, created_at, updated_at
` `
@@ -654,7 +661,7 @@ RETURNING id, geo_type, draw_geometry, binding, time_start, time_end, project_id
type UpdateGeometryParams struct { type UpdateGeometryParams struct {
GeoType pgtype.Int2 `json:"geo_type"` GeoType pgtype.Int2 `json:"geo_type"`
DrawGeometry []byte `json:"draw_geometry"` DrawGeometry []byte `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -670,7 +677,7 @@ type UpdateGeometryRow struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
ProjectID pgtype.UUID `json:"project_id"` ProjectID pgtype.UUID `json:"project_id"`
@@ -687,7 +694,7 @@ func (q *Queries) UpdateGeometry(ctx context.Context, arg UpdateGeometryParams)
row := q.db.QueryRow(ctx, updateGeometry, row := q.db.QueryRow(ctx, updateGeometry,
arg.GeoType, arg.GeoType,
arg.DrawGeometry, arg.DrawGeometry,
arg.Binding, arg.BoundWith,
arg.TimeStart, arg.TimeStart,
arg.TimeEnd, arg.TimeEnd,
arg.ProjectID, arg.ProjectID,
@@ -703,7 +710,7 @@ func (q *Queries) UpdateGeometry(ctx context.Context, arg UpdateGeometryParams)
&i.ID, &i.ID,
&i.GeoType, &i.GeoType,
&i.DrawGeometry, &i.DrawGeometry,
&i.Binding, &i.BoundWith,
&i.TimeStart, &i.TimeStart,
&i.TimeEnd, &i.TimeEnd,
&i.ProjectID, &i.ProjectID,

View File

@@ -81,7 +81,7 @@ type Geometry struct {
ID pgtype.UUID `json:"id"` ID pgtype.UUID `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding []byte `json:"binding"` BoundWith pgtype.UUID `json:"bound_with"`
TimeStart pgtype.Int4 `json:"time_start"` TimeStart pgtype.Int4 `json:"time_start"`
TimeEnd pgtype.Int4 `json:"time_end"` TimeEnd pgtype.Int4 `json:"time_end"`
Bbox interface{} `json:"bbox"` Bbox interface{} `json:"bbox"`

View File

@@ -10,7 +10,7 @@ type GeometryEntity struct {
ID string `json:"id"` ID string `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding json.RawMessage `json:"binding"` BoundWith *string `json:"bound_with"`
TimeStart int32 `json:"time_start"` TimeStart int32 `json:"time_start"`
TimeEnd int32 `json:"time_end"` TimeEnd int32 `json:"time_end"`
Bbox *response.Bbox `json:"bbox"` Bbox *response.Bbox `json:"bbox"`
@@ -27,7 +27,7 @@ type EntityGeometriesSearchEntity struct {
GeometryID string `json:"id"` GeometryID string `json:"id"`
GeoType int16 `json:"geo_type"` GeoType int16 `json:"geo_type"`
DrawGeometry json.RawMessage `json:"draw_geometry"` DrawGeometry json.RawMessage `json:"draw_geometry"`
Binding json.RawMessage `json:"binding,omitempty"` BoundWith *string `json:"bound_with,omitempty"`
TimeStart *int32 `json:"time_start,omitempty"` TimeStart *int32 `json:"time_start,omitempty"`
TimeEnd *int32 `json:"time_end,omitempty"` TimeEnd *int32 `json:"time_end,omitempty"`
} }
@@ -40,7 +40,7 @@ func (g *GeometryEntity) ToResponse() *response.GeometryResponse {
ID: g.ID, ID: g.ID,
GeoType: g.GeoType, GeoType: g.GeoType,
DrawGeometry: g.DrawGeometry, DrawGeometry: g.DrawGeometry,
Binding: g.Binding, BoundWith: g.BoundWith,
TimeStart: g.TimeStart, TimeStart: g.TimeStart,
TimeEnd: g.TimeEnd, TimeEnd: g.TimeEnd,
Bbox: g.Bbox, Bbox: g.Bbox,

View File

@@ -97,7 +97,7 @@ func (r *geometryRepository) getByIDsWithFallback(ctx context.Context, ids []str
ID: convert.UUIDToString(row.ID), ID: convert.UUIDToString(row.ID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToInt32(row.TimeStart), TimeStart: convert.Int4ToInt32(row.TimeStart),
TimeEnd: convert.Int4ToInt32(row.TimeEnd), TimeEnd: convert.Int4ToInt32(row.TimeEnd),
Bbox: &response.Bbox{ Bbox: &response.Bbox{
@@ -159,7 +159,7 @@ func (r *geometryRepository) GetByID(ctx context.Context, id pgtype.UUID) (*mode
ID: convert.UUIDToString(row.ID), ID: convert.UUIDToString(row.ID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToInt32(row.TimeStart), TimeStart: convert.Int4ToInt32(row.TimeStart),
TimeEnd: convert.Int4ToInt32(row.TimeEnd), TimeEnd: convert.Int4ToInt32(row.TimeEnd),
Bbox: &response.Bbox{ Bbox: &response.Bbox{
@@ -198,7 +198,7 @@ func (r *geometryRepository) Search(ctx context.Context, params sqlc.SearchGeome
ID: convert.UUIDToString(row.ID), ID: convert.UUIDToString(row.ID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToInt32(row.TimeStart), TimeStart: convert.Int4ToInt32(row.TimeStart),
TimeEnd: convert.Int4ToInt32(row.TimeEnd), TimeEnd: convert.Int4ToInt32(row.TimeEnd),
Bbox: &response.Bbox{ Bbox: &response.Bbox{
@@ -237,7 +237,7 @@ func (r *geometryRepository) Create(ctx context.Context, params sqlc.CreateGeome
ID: convert.UUIDToString(row.ID), ID: convert.UUIDToString(row.ID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToInt32(row.TimeStart), TimeStart: convert.Int4ToInt32(row.TimeStart),
TimeEnd: convert.Int4ToInt32(row.TimeEnd), TimeEnd: convert.Int4ToInt32(row.TimeEnd),
Bbox: &response.Bbox{ Bbox: &response.Bbox{
@@ -264,7 +264,7 @@ func (r *geometryRepository) Update(ctx context.Context, params sqlc.UpdateGeome
ID: convert.UUIDToString(row.ID), ID: convert.UUIDToString(row.ID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToInt32(row.TimeStart), TimeStart: convert.Int4ToInt32(row.TimeStart),
TimeEnd: convert.Int4ToInt32(row.TimeEnd), TimeEnd: convert.Int4ToInt32(row.TimeEnd),
Bbox: &response.Bbox{ Bbox: &response.Bbox{
@@ -328,7 +328,7 @@ func (r *geometryRepository) GetByProjectID(ctx context.Context, projectID pgtyp
ID: convert.UUIDToString(row.ID), ID: convert.UUIDToString(row.ID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToInt32(row.TimeStart), TimeStart: convert.Int4ToInt32(row.TimeStart),
TimeEnd: convert.Int4ToInt32(row.TimeEnd), TimeEnd: convert.Int4ToInt32(row.TimeEnd),
Bbox: &response.Bbox{ Bbox: &response.Bbox{
@@ -430,7 +430,7 @@ func (r *geometryRepository) getSearchByIDsWithFallback(ctx context.Context, pai
GeometryID: convert.UUIDToString(row.GeometryID), GeometryID: convert.UUIDToString(row.GeometryID),
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToPtr(row.TimeStart), TimeStart: convert.Int4ToPtr(row.TimeStart),
TimeEnd: convert.Int4ToPtr(row.TimeEnd), TimeEnd: convert.Int4ToPtr(row.TimeEnd),
} }
@@ -485,7 +485,7 @@ func (r *geometryRepository) SearchByEntityName(ctx context.Context, params sqlc
GeometryID: convert.UUIDToString(row.GeometryID), GeometryID: convert.UUIDToString(row.GeometryID),
GeoType: convert.Int2ToInt16(row.GeoType), GeoType: convert.Int2ToInt16(row.GeoType),
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: convert.UUIDToStringPtr(row.BoundWith),
TimeStart: convert.Int4ToPtr(row.TimeStart), TimeStart: convert.Int4ToPtr(row.TimeStart),
TimeEnd: convert.Int4ToPtr(row.TimeEnd), TimeEnd: convert.Int4ToPtr(row.TimeEnd),
} }

View File

@@ -73,6 +73,18 @@ func (s *geometryService) SearchGeometries(ctx context.Context, req *request.Sea
params.EntityID = entityId 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) geometries, err := s.geometryRepo.Search(ctx, params)
if err != nil { if err != nil {
return nil, fiber.NewError(fiber.StatusInternalServerError, "Failed to search geometries") return nil, fiber.NewError(fiber.StatusInternalServerError, "Failed to search geometries")
@@ -132,7 +144,7 @@ func (s *geometryService) SearchGeometriesByEntityName(
ID: row.GeometryID, ID: row.GeometryID,
GeoType: row.GeoType, GeoType: row.GeoType,
DrawGeometry: row.DrawGeometry, DrawGeometry: row.DrawGeometry,
Binding: row.Binding, BoundWith: row.BoundWith,
TimeStart: row.TimeStart, TimeStart: row.TimeStart,
TimeEnd: row.TimeEnd, TimeEnd: row.TimeEnd,
}) })

View File

@@ -716,7 +716,15 @@ func (s *submissionService) applySnapshot(ctx context.Context, tx pgx.Tx, projec
return fiber.NewError(fiber.StatusInternalServerError, "Invalid geometry ID") 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) geoTypeCode := int16(0)
if geo.Type != "" { if geo.Type != "" {
if n, err := strconv.ParseInt(geo.Type, 10, 16); err == nil { 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, ID: geometryUUID,
GeoType: pgtype.Int2{Int16: geoTypeCode, Valid: true}, GeoType: pgtype.Int2{Int16: geoTypeCode, Valid: true},
DrawGeometry: geo.DrawGeometry, DrawGeometry: geo.DrawGeometry,
Binding: binding, BoundWith: boundWith,
TimeStart: convert.PtrFloat64ToInt4(geo.TimeStart), TimeStart: convert.PtrFloat64ToInt4(geo.TimeStart),
TimeEnd: convert.PtrFloat64ToInt4(geo.TimeEnd), TimeEnd: convert.PtrFloat64ToInt4(geo.TimeEnd),
ProjectID: projectUUID, ProjectID: projectUUID,
@@ -754,7 +762,7 @@ func (s *submissionService) applySnapshot(ctx context.Context, tx pgx.Tx, projec
ID: geometryUUID, ID: geometryUUID,
GeoType: geoTypeCode, GeoType: geoTypeCode,
DrawGeometry: geo.DrawGeometry, DrawGeometry: geo.DrawGeometry,
Binding: binding, BoundWith: boundWith,
TimeStart: convert.PtrFloat64ToInt4(geo.TimeStart), TimeStart: convert.PtrFloat64ToInt4(geo.TimeStart),
TimeEnd: convert.PtrFloat64ToInt4(geo.TimeEnd), TimeEnd: convert.PtrFloat64ToInt4(geo.TimeEnd),
ProjectID: projectUUID, ProjectID: projectUUID,