mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-06 05:02:36 +00:00
chore: tweak plans
This commit is contained in:
@ -108,15 +108,14 @@ func (s *APIV1Service) CreateCollection(ctx context.Context, request *v1pb.Creat
|
||||
return nil, status.Errorf(codes.InvalidArgument, "name and title are required")
|
||||
}
|
||||
|
||||
if !s.LicenseService.IsFeatureEnabled(license.FeatureTypeUnlimitedAccounts) {
|
||||
collections, err := s.Store.ListCollections(ctx, &store.FindCollection{
|
||||
VisibilityList: []store.Visibility{store.VisibilityWorkspace, store.VisibilityPublic},
|
||||
})
|
||||
if !s.LicenseService.IsFeatureEnabled(license.FeatureTypeUnlimitedCollections) {
|
||||
collections, err := s.Store.ListCollections(ctx, &store.FindCollection{})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get collection list, err: %v", err)
|
||||
}
|
||||
if len(collections) >= 5 {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "Maximum number of collections reached")
|
||||
collectionsLimit := int(s.LicenseService.GetSubscription().CollectionsLimit)
|
||||
if len(collections) >= collectionsLimit {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "Maximum number of collections %d reached", collectionsLimit)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,17 @@ func (s *APIV1Service) CreateShortcut(ctx context.Context, request *v1pb.CreateS
|
||||
return nil, status.Errorf(codes.InvalidArgument, "name and link are required")
|
||||
}
|
||||
|
||||
if !s.LicenseService.IsFeatureEnabled(license.FeatureTypeUnlimitedShortcuts) {
|
||||
shortcuts, err := s.Store.ListShortcuts(ctx, &store.FindShortcut{})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get shortcut list, err: %v", err)
|
||||
}
|
||||
shortcutsLimit := int(s.LicenseService.GetSubscription().ShortcutsLimit)
|
||||
if len(shortcuts) >= shortcutsLimit {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "Maximum number of shortcuts %d reached", shortcutsLimit)
|
||||
}
|
||||
}
|
||||
|
||||
user, err := getCurrentUser(ctx, s.Store)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err)
|
||||
|
Reference in New Issue
Block a user