Add endpoint for updating link

This commit is contained in:
Andrey Chervyakov 2021-03-16 00:45:13 +06:00
parent 9ae733e618
commit 8a23425826
3 changed files with 70 additions and 5 deletions

View file

@ -10,6 +10,7 @@ type Service interface {
Create(link *Link) error
GetById(id string) (*Link, error)
GetAll(limit int, offset int) (Links, error)
Update(data *Link) error
DeleteById(id string) error
}
@ -72,6 +73,14 @@ func (s *PgService) GetAll(limit int, offset int) (Links, error) {
return links, nil
}
func (s *PgService) Update(data *Link) error {
if err := s.rep.Update(data); err != nil {
return apperrors.UnknownError{Err: err}
}
return nil
}
func (s *PgService) DeleteById(id string) error {
s.cache.Delete(id)