mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-06 21:22:36 +00:00
chore: update list collections api
This commit is contained in:
@ -16,13 +16,27 @@ import (
|
||||
|
||||
func (s *APIV2Service) ListCollections(ctx context.Context, _ *apiv2pb.ListCollectionsRequest) (*apiv2pb.ListCollectionsResponse, error) {
|
||||
userID := ctx.Value(userIDContextKey).(int32)
|
||||
find := &store.FindCollection{}
|
||||
find.CreatorID = &userID
|
||||
collections, err := s.Store.ListCollections(ctx, find)
|
||||
collections, err := s.Store.ListCollections(ctx, &store.FindCollection{
|
||||
CreatorID: &userID,
|
||||
VisibilityList: []store.Visibility{
|
||||
store.VisibilityPrivate,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get collection list, err: %v", err)
|
||||
}
|
||||
|
||||
sharedCollections, err := s.Store.ListCollections(ctx, &store.FindCollection{
|
||||
VisibilityList: []store.Visibility{
|
||||
store.VisibilityWorkspace,
|
||||
store.VisibilityPublic,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get collection list, err: %v", err)
|
||||
}
|
||||
collections = append(collections, sharedCollections...)
|
||||
|
||||
convertedCollections := []*apiv2pb.Collection{}
|
||||
for _, collection := range collections {
|
||||
convertedCollections = append(convertedCollections, convertCollectionFromStore(collection))
|
||||
|
Reference in New Issue
Block a user