fix(location-events): adding location id to the database from agent call

This commit is contained in:
2025-04-17 15:32:50 +01:00
parent 15289e4965
commit 5ab0d13b21
2 changed files with 11 additions and 4 deletions

View File

@@ -88,7 +88,7 @@ const eventTools = `
},
"startDateTime": {
"type": "string",
"description": "The event's start date and time in ISO 8601 format (e.g., '2025-04-18T10:00:00Z' or '2025-04-18T11:00:00+01:00'). Include if available."
"description": "The event's start date and time in ISO 8601 format (e.g., '2025-04-18T10:00:00Z'). Include if available."
},
"endDateTime": {
"type": "string",
@@ -96,7 +96,7 @@ const eventTools = `
},
"locationId": {
"type": "string",
"description": "The unique identifier (UUID or similar) for the event's location. Only include this if a location was specified for the event AND its ID was successfully retrieved using the getEventLocationId tool."
"description": "The unique identifier (UUID or similar) for the event's location. Use this if available, do not invent it."
}
},
"required": ["name"]
@@ -140,6 +140,7 @@ type createEventArguments struct {
StartDateTime *string `json:"startDateTime"`
EndDateTime *string `json:"endDateTime"`
OrganizerName *string `json:"organizerName"`
LocationID *string `json:"locationId"`
}
type linkEventArguments struct {
EventID string `json:"eventId"`
@@ -182,10 +183,16 @@ func NewEventAgent(log *log.Logger, eventsModel models.EventModel, locationModel
return model.Events{}, err
}
locationId, err := uuid.Parse(*args.LocationID)
if err != nil {
return model.Events{}, err
}
events, err := eventsModel.Save(ctx, info.UserId, model.Events{
Name: args.Name,
StartDateTime: &startTime,
EndDateTime: &endTime,
LocationID: &locationId,
})
if err != nil {