Enable adding/removing users to list as well as add/update list items #11

Merged
robin merged 15 commits from dev into main 2026-08-20 15:55:38 +02:00
Showing only changes of commit a5d649dbf5 - Show all commits
+5 -5
View File
@@ -39,7 +39,7 @@ func NewListService(r ListRepository) *ListService {
return &ListService{repo: r}
}
func (s *ListService) Create(ctx context.Context, name string, userIDs []string) (*List, error) {
func (s *ListService) Create(ctx context.Context, authUserID string, name string, userIDs []string) (*List, error) {
if len(userIDs) == 0 {
return nil, errors.New("users must have at least one associated user")
}
@@ -51,7 +51,7 @@ func (s *ListService) Create(ctx context.Context, name string, userIDs []string)
return s.repo.CreateList(ctx, name, userIDs)
}
func (s *ListService) AddUserToList(ctx context.Context, ownerID string, listID string, userID string) error {
func (s *ListService) AddUserToList(ctx context.Context, authUserID string, listID string, userID string) error {
if listID == "" {
return errors.New("list id must not be empty")
}
@@ -62,7 +62,7 @@ func (s *ListService) AddUserToList(ctx context.Context, ownerID string, listID
return s.repo.AddUserToList(ctx, listID, userID)
}
func (s *ListService) RemoveUserFromList(ctx context.Context, ownerID string, listID string, userID string) error {
func (s *ListService) RemoveUserFromList(ctx context.Context, authUserID string, listID string, userID string) error {
if listID == "" {
return errors.New("list id must not be empty")
}
@@ -73,7 +73,7 @@ func (s *ListService) RemoveUserFromList(ctx context.Context, ownerID string, li
return s.repo.RemoveUserFromList(ctx, listID, userID)
}
func (s *ListService) CreateListItem(ctx context.Context, ownerID string, listID string, title string) (*ListItem, error) {
func (s *ListService) CreateListItem(ctx context.Context, authUserID string, listID string, title string) (*ListItem, error) {
if listID == "" {
return nil, errors.New("list id must not be empty")
}
@@ -84,7 +84,7 @@ func (s *ListService) CreateListItem(ctx context.Context, ownerID string, listID
return s.repo.CreateListItem(ctx, listID, title)
}
func (s *ListService) UpdateListItem(ctx context.Context, ownerID string, listItemID string, title string, isCompleted bool) error {
func (s *ListService) UpdateListItem(ctx context.Context, authUserID string, listItemID string, title string, isCompleted bool) error {
if listItemID == "" {
return errors.New("list item id must not be empty")
}