feat: improvements in entity domain logic

This commit is contained in:
Elton Minetto
2020-10-07 22:57:54 -03:00
parent 098477169a
commit 83c00526b2
10 changed files with 35 additions and 30 deletions
-4
View File
@@ -35,10 +35,6 @@ func (s *Service) Borrow(u *entity.User, b *entity.Book) error {
return domain.ErrNotEnoughBooks
}
_, err = u.GetBook(b.ID)
if err == nil {
return domain.ErrBookAlreadyBorrowed
}
err = u.AddBook(b.ID)
if err != nil {
return err