Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce cluster parent field on cluster mutations #68

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ paths:
post:
operationId: AdminAccountBanCreate
description: |
Suspend an account - soft delete. This disables the ability for the
Suspend an account - soft delete. This disables the ability for the
account owner to log in and use the platform. It keeps the account on
record for linkage to content so UI doesn't break. It does not change
anything else about the account such as the avatar, name, etc.
Expand Down Expand Up @@ -218,7 +218,7 @@ paths:
get:
operationId: AuthProviderList
description: |
Retrieve a list of authentication providers. Storyden supports a few
Retrieve a list of authentication providers. Storyden supports a few
ways to authenticate, from simple passwords to OAuth and WebAuthn. This
endpoint tells a client which auth capabilities are enabled.
tags: [auth]
Expand Down Expand Up @@ -3092,7 +3092,7 @@ components:

Cluster:
description: |
A cluster is a group of items and other clusters. It serves as an
A cluster is a group of items and other clusters. It serves as an
abstraction for grouping structured data objects. It can represent
things such as brands, manufacturers, authors, directors, etc. Clusters
can be referenced in content posts and they also have their own content.
Expand Down Expand Up @@ -3136,6 +3136,7 @@ components:
description: { $ref: "#/components/schemas/ClusterDescription" }
content: { $ref: "#/components/schemas/PostContent" }
owner: { $ref: "#/components/schemas/ProfileReference" }
parent: { $ref: "#/components/schemas/Cluster" }
properties: { $ref: "#/components/schemas/Properties" }

ClusterList:
Expand All @@ -3152,6 +3153,7 @@ components:
url: { $ref: "#/components/schemas/URL" }
description: { $ref: "#/components/schemas/ClusterDescription" }
content: { $ref: "#/components/schemas/PostContent" }
parent: { $ref: "#/components/schemas/ClusterSlug" }
properties: { $ref: "#/components/schemas/Properties" }

ClusterMutableProps:
Expand All @@ -3165,6 +3167,7 @@ components:
url: { $ref: "#/components/schemas/URL" }
description: { $ref: "#/components/schemas/ClusterDescription" }
content: { $ref: "#/components/schemas/PostContent" }
parent: { $ref: "#/components/schemas/ClusterSlug" }
properties: { $ref: "#/components/schemas/Properties" }

ClusterItemList:
Expand Down Expand Up @@ -3246,7 +3249,7 @@ components:
ItemList:
description: |
A list of items where each item includes all the information about its
parent cluster too. For use with APIs that want to provide a list of
parent cluster too. For use with APIs that want to provide a list of
items that may be part of different clusters.
type: array
items: { $ref: "#/components/schemas/ItemWithParents" }
Expand Down
8 changes: 8 additions & 0 deletions app/transports/openapi/bindings/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
Properties: opt.NewPtr(request.Body.Properties),
URL: opt.NewPtr(request.Body.Url),
AssetsAdd: opt.NewPtrMap(request.Body.AssetIds, deserialiseAssetIDs),
Parent: opt.NewPtrMap(request.Body.Parent, deserialiseClusterSlug),
},
)
if err != nil {
Expand Down Expand Up @@ -121,6 +122,7 @@
URL: opt.NewPtr(request.Body.Url),
Description: opt.NewPtr(request.Body.Description),
Content: opt.NewPtr(request.Body.Content),
Parent: opt.NewPtrMap(request.Body.Parent, deserialiseClusterSlug),
Properties: opt.NewPtr(request.Body.Properties),
})
if err != nil {
Expand Down Expand Up @@ -206,7 +208,7 @@
}

return openapi.ClusterAddItem200JSONResponse{
ClusterAddItemOKJSONResponse: openapi.ClusterAddItemOKJSONResponse(serialiseItem(item)),

Check failure on line 211 in app/transports/openapi/bindings/clusters.go

View workflow job for this annotation

GitHub Actions / backend-test

cannot convert serialiseItem(item) (value of type "github.com/Southclaws/storyden/internal/openapi".Item) to type "github.com/Southclaws/storyden/internal/openapi".ClusterAddItemOKJSONResponse
}, nil
}

Expand All @@ -217,7 +219,7 @@
}

return openapi.ClusterRemoveItem200JSONResponse{
ClusterRemoveItemOKJSONResponse: openapi.ClusterRemoveItemOKJSONResponse(serialiseItem(item)),

Check failure on line 222 in app/transports/openapi/bindings/clusters.go

View workflow job for this annotation

GitHub Actions / backend-test

cannot convert serialiseItem(item) (value of type "github.com/Southclaws/storyden/internal/openapi".Item) to type "github.com/Southclaws/storyden/internal/openapi".ClusterRemoveItemOKJSONResponse
}, nil
}

Expand All @@ -233,6 +235,7 @@
Description: in.Description,
Content: in.Content.Ptr(),
Owner: serialiseProfileReference(in.Owner),
Parent: opt.Map(in.Parent, serialiseCluster).Ptr(),
Properties: in.Properties,
}
}
Expand All @@ -249,8 +252,13 @@
Description: in.Description,
Content: in.Content.Ptr(),
Owner: serialiseProfileReference(in.Owner),
Parent: opt.Map(in.Parent, serialiseCluster).Ptr(),
Properties: in.Properties,
Clusters: dt.Map(in.Clusters, serialiseCluster),
Items: dt.Map(in.Items, serialiseItem),
}
}

func deserialiseClusterSlug(in string) datagraph.ClusterSlug {
return datagraph.ClusterSlug(in)
}
Loading
Loading