vikunja-api/pkg/models/user_delete.go

19 lines
286 B
Go
Raw Normal View History

2018-06-10 11:11:41 +02:00
package models
// DeleteUserByID deletes a user by its ID
func DeleteUserByID(id int64, doer *User) error {
// Check if the id is 0
if id == 0 {
return ErrIDCannotBeZero{}
}
// Delete the user
2018-10-27 11:33:28 +02:00
_, err := x.Id(id).Delete(&User{})
2018-06-10 11:11:41 +02:00
if err != nil {
return err
}
return err
}