implement relationship integration tests

This commit is contained in:
2025-04-24 15:08:34 +02:00
parent b5342a19ca
commit c8d68c5cc7
28 changed files with 323 additions and 83 deletions

View File

@@ -240,6 +240,18 @@ type Relationship struct {
Type *string `json:"type"`
}
// DbtypeRelationship defines model for dbtypeRelationship.
type DbtypeRelationship struct {
ElementId *string `json:"ElementId,omitempty"`
EndElementId *string `json:"EndElementId,omitempty"`
EndId *int `json:"EndId,omitempty"`
Id *int `json:"Id,omitempty"`
Props *FamilyRelationship `json:"Props,omitempty"`
StartElementId *string `json:"StartElementId,omitempty"`
StartId *int `json:"StartId,omitempty"`
Type *string `json:"Type"`
}
// GetProfileAdminsParams defines parameters for GetProfileAdmins.
type GetProfileAdminsParams struct {
XUserID int `json:"X-User-ID"`

View File

@@ -16,7 +16,7 @@ func Flatten(input any, uniqueIds *[]int64, result *[]any) error {
switch val.Kind() {
case reflect.Slice, reflect.Array:
for i := 0; i < val.Len(); i++ {
for i := range val.Len() {
if err := Flatten(val.Index(i).Interface(), uniqueIds, result); err != nil {
return err
}
@@ -35,15 +35,15 @@ func Flatten(input any, uniqueIds *[]int64, result *[]any) error {
switch input.(type) {
case dbtype.Node:
node := val.Interface().(dbtype.Node)
if !slices.Contains(*uniqueIds, node.Id) {
if !slices.Contains(*uniqueIds, node.Id) { //nolint:staticcheck // this is a known issue with the neo4j-go-driver
*result = append(*result, node)
*uniqueIds = append(*uniqueIds, node.Id)
*uniqueIds = append(*uniqueIds, node.Id) //nolint:staticcheck // this is a known issue with the neo4j-go-driver
}
case dbtype.Relationship:
relationship := val.Interface().(dbtype.Relationship)
if !slices.Contains(*uniqueIds, relationship.Id) {
if !slices.Contains(*uniqueIds, relationship.Id) { //nolint:staticcheck // this is a known issue with the neo4j-go-driver
*result = append(*result, relationship)
*uniqueIds = append(*uniqueIds, relationship.Id)
*uniqueIds = append(*uniqueIds, relationship.Id) //nolint:staticcheck // this is a known issue with the neo4j-go-driver
}
}
default: