mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-14 14:59:07 +02:00
fix api api communications
This commit is contained in:
@@ -19,13 +19,17 @@ func ViewPerson(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
defer session.Close(ctx)
|
||||
|
||||
id := c.Query("id")
|
||||
if id == "" {
|
||||
id = c.GetString("id")
|
||||
}
|
||||
|
||||
if id == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "id is required"})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
result, err := session.Run(ctx, "MATCH (n:Person) WHERE n.ID = $person_id RETURN n;", map[string]any{"person_id": id})
|
||||
result, err := session.Run(ctx, "MATCH (n:Person) WHERE n.id = $person_id RETURN n;", map[string]any{"person_id": id})
|
||||
if err != nil {
|
||||
log.Printf("ip: %s error: %s", c.ClientIP(), err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
|
||||
|
Reference in New Issue
Block a user