mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-14 14:59:07 +02:00
implement integration test for relationship update and delete
This commit is contained in:
@@ -90,8 +90,8 @@ func (srv *server) UpdateRelationship(c *gin.Context, id1, id2 int, params api.U
|
||||
actx, aCancel := context.WithTimeout(c.Request.Context(), srv.dbOpTimeout)
|
||||
defer aCancel()
|
||||
|
||||
if err := auth.CouldManagePersonUnknownAdmin(actx, session, *relationship.Id1, params.XUserID); err != nil {
|
||||
if err := auth.CouldManagePersonUnknownAdmin(actx, session, *relationship.Id2, params.XUserID); err != nil {
|
||||
if err := auth.CouldManagePersonUnknownAdmin(actx, session, id1, params.XUserID); err != nil {
|
||||
if err := auth.CouldManagePersonUnknownAdmin(actx, session, id2, params.XUserID); err != nil {
|
||||
c.JSON(http.StatusUnauthorized, gin.H{"msg": fmt.Sprint("User does not have access to this person", err.Error())})
|
||||
|
||||
return
|
||||
|
@@ -1,3 +1,3 @@
|
||||
MATCH (a:Person)-[r]-(b:Person)
|
||||
WHERE id(a) = $id1 AND id(b) = $id2 AND type(r) != Admin
|
||||
WHERE id(a) = $id1 AND id(b) = $id2 AND type(r) <> "Admin"
|
||||
DELETE r;
|
@@ -1,4 +1,4 @@
|
||||
MATCH (n)-[r]->(o)
|
||||
WHERE id(n) = $id1 AND id(o) = $id2
|
||||
SET r += $relationship
|
||||
RETURN r as relationship
|
||||
RETURN collect(r) as relationship
|
||||
|
Reference in New Issue
Block a user