feat: add a new command - group delete
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
99c3b8922b
commit
bf2d25d7d7
|
@ -86,6 +86,10 @@ func (g *Group) List(ctx context.Context, params domain.ListGroupsParams) ([]dom
|
|||
}
|
||||
|
||||
func (g *Group) Delete(ctx context.Context, id, serverID string) error {
|
||||
if _, err := uuid.Parse(id); err != nil {
|
||||
return domain.GroupNotFoundError{ID: id}
|
||||
}
|
||||
|
||||
res, err := g.db.NewDelete().
|
||||
Model(&model.Group{}).
|
||||
Returning("NULL").
|
||||
|
|
|
@ -210,6 +210,13 @@ func TestGroup_Delete(t *testing.T) {
|
|||
assert.Len(t, groups, 0)
|
||||
})
|
||||
|
||||
t.Run("ERR: invalid UUID", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
id := "12345"
|
||||
assert.ErrorIs(t, repo.Delete(context.Background(), id, ""), domain.GroupNotFoundError{ID: id})
|
||||
})
|
||||
|
||||
t.Run("ERR: group not found (unknown ID)", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user