mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-13 22:39:06 +02:00
implement relationship integration tests
This commit is contained in:
@@ -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"`
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user