Skip to content

Commit

Permalink
🌱Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dumindu committed Sep 14, 2023
1 parent 847d9ab commit 16348b0
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions api/resource/book/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,9 @@ func (r *Repository) Read(id uuid.UUID) (*Book, error) {
}

func (r *Repository) Update(book *Book) error {
if err := r.db.Updates(book).Where("id = %s", book.ID).Error; err != nil {
return err
}

return nil
return r.db.Updates(book).Where("id = %s", book.ID).Error
}

func (r *Repository) Delete(id uuid.UUID) error {
book := &Book{}
if err := r.db.Where("id = ?", id).Delete(&book).Error; err != nil {
return err
}

return nil
return r.db.Where("id = ?", id).Delete(&Book{}).Error
}

0 comments on commit 16348b0

Please sign in to comment.