feat(tool-calls): listLocation tool call handling
This commit is contained in:
@@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
"log"
|
||||
"screenmark/screenmark/.gen/haystack/haystack/model"
|
||||
. "screenmark/screenmark/.gen/haystack/haystack/table"
|
||||
@@ -39,6 +40,21 @@ func getValues(location model.Locations) []any {
|
||||
return arr
|
||||
}
|
||||
|
||||
func (m LocationModel) List(ctx context.Context, userId uuid.UUID) ([]model.Locations, error) {
|
||||
listLocationsStmt := SELECT(Locations.AllColumns, ImageLocations.AllColumns, UserImages.AllColumns).
|
||||
FROM(
|
||||
Locations.
|
||||
INNER_JOIN(ImageLocations, ImageLocations.LocationID.EQ(Locations.ID)).
|
||||
INNER_JOIN(UserImages, UserImages.ImageID.EQ(ImageLocations.ImageID)),
|
||||
).WHERE(UserImages.UserID.EQ(UUID(userId)))
|
||||
|
||||
locations := []model.Locations{}
|
||||
|
||||
err := listLocationsStmt.QueryContext(ctx, m.dbPool, &locations)
|
||||
|
||||
return locations, err
|
||||
}
|
||||
|
||||
func (m LocationModel) Save(ctx context.Context, locations []model.Locations) (model.Locations, error) {
|
||||
insertLocationStmt := Locations.
|
||||
INSERT(Locations.Name, Locations.Address, Locations.Coordinates, Locations.Description)
|
||||
|
||||
Reference in New Issue
Block a user