feat: implement entity and wiki management services, repositories, and routes with associated controllers
Build and Release / release (push) Successful in 1m34s

This commit is contained in:
2026-05-27 18:32:35 +07:00
parent e35f67e26b
commit d02006390b
15 changed files with 442 additions and 2 deletions
+31
View File
@@ -242,6 +242,37 @@ func (q *Queries) GetEntityBySlug(ctx context.Context, slug pgtype.Text) (Entity
return i, err
}
const getEntityIDsByGeometryIDs = `-- name: GetEntityIDsByGeometryIDs :many
SELECT geometry_id, entity_id
FROM entity_geometries
WHERE geometry_id = ANY($1::uuid[])
`
type GetEntityIDsByGeometryIDsRow struct {
GeometryID pgtype.UUID `json:"geometry_id"`
EntityID pgtype.UUID `json:"entity_id"`
}
func (q *Queries) GetEntityIDsByGeometryIDs(ctx context.Context, dollar_1 []pgtype.UUID) ([]GetEntityIDsByGeometryIDsRow, error) {
rows, err := q.db.Query(ctx, getEntityIDsByGeometryIDs, dollar_1)
if err != nil {
return nil, err
}
defer rows.Close()
items := []GetEntityIDsByGeometryIDsRow{}
for rows.Next() {
var i GetEntityIDsByGeometryIDsRow
if err := rows.Scan(&i.GeometryID, &i.EntityID); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const searchEntities = `-- name: SearchEntities :many
SELECT id, project_id, name, slug, description, status, time_start, time_end, is_deleted, created_at, updated_at
FROM entities
+31
View File
@@ -370,6 +370,37 @@ func (q *Queries) GetWikiContentCount(ctx context.Context, wikiID pgtype.UUID) (
return count, err
}
const getWikiIDsByEntityIDs = `-- name: GetWikiIDsByEntityIDs :many
SELECT entity_id, wiki_id
FROM entity_wikis
WHERE entity_id = ANY($1::uuid[])
`
type GetWikiIDsByEntityIDsRow struct {
EntityID pgtype.UUID `json:"entity_id"`
WikiID pgtype.UUID `json:"wiki_id"`
}
func (q *Queries) GetWikiIDsByEntityIDs(ctx context.Context, dollar_1 []pgtype.UUID) ([]GetWikiIDsByEntityIDsRow, error) {
rows, err := q.db.Query(ctx, getWikiIDsByEntityIDs, dollar_1)
if err != nil {
return nil, err
}
defer rows.Close()
items := []GetWikiIDsByEntityIDsRow{}
for rows.Next() {
var i GetWikiIDsByEntityIDsRow
if err := rows.Scan(&i.EntityID, &i.WikiID); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const getWikisByIDs = `-- name: GetWikisByIDs :many
SELECT id, project_id, title, slug, is_deleted, created_at, updated_at FROM wikis WHERE id = ANY($1::uuid[]) AND is_deleted = false
`