Add Group type with id, name, description, members array and optional user_ids field. Add name field to policy targets for display. Add groups API client methods for list, create, update and delete operations. Add GroupsPage component with create form, edit modal, member selection and table view. Add groups route and navigation item to Layout. Add reusable Modal component with title, subtitle and close handler. Update
32 lines
655 B
Go
32 lines
655 B
Go
package group
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Service struct {
|
|
repo Repository
|
|
}
|
|
|
|
func NewService(repo Repository) *Service {
|
|
return &Service{repo: repo}
|
|
}
|
|
|
|
func (s *Service) List(ctx context.Context) ([]Group, error) {
|
|
return s.repo.List(ctx)
|
|
}
|
|
|
|
func (s *Service) Create(ctx context.Context, input CreateRequest) (Group, error) {
|
|
return s.repo.Create(ctx, input)
|
|
}
|
|
|
|
func (s *Service) Update(ctx context.Context, groupID uuid.UUID, input UpdateRequest) (Group, error) {
|
|
return s.repo.Update(ctx, groupID, input)
|
|
}
|
|
|
|
func (s *Service) Delete(ctx context.Context, groupID uuid.UUID) error {
|
|
return s.repo.Delete(ctx, groupID)
|
|
}
|