feat: update and delete tags and categories
This commit is contained in:
@@ -4,5 +4,5 @@ import tagdomain "legalgo-BE-go/internal/domain/tag"
|
||||
|
||||
func (i *impl) Create(spec tagdomain.TagReq) error {
|
||||
// return i.tagRepo.Create(spec)
|
||||
return i.tagRepo.CreateModel(spec)
|
||||
return i.tagRepo.Create(spec)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package tagsvc
|
||||
|
||||
func (i *impl) Delete(id string) error {
|
||||
return i.tagRepo.Delete(id)
|
||||
}
|
||||
@@ -13,6 +13,8 @@ type Tag interface {
|
||||
Create(tagdomain.TagReq) error
|
||||
GetAll() ([]tagdomain.Tag, error)
|
||||
GetAllModel() ([]tagdomain.Tag, error)
|
||||
Update(string, tagdomain.TagReq) error
|
||||
Delete(string) error
|
||||
}
|
||||
|
||||
func New(
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package tagsvc
|
||||
|
||||
import (
|
||||
tagdomain "legalgo-BE-go/internal/domain/tag"
|
||||
timeutils "legalgo-BE-go/internal/utilities/time_utils"
|
||||
)
|
||||
|
||||
func (i *impl) Update(id string, spec tagdomain.TagReq) error {
|
||||
newData := tagdomain.Tag{
|
||||
ID: id,
|
||||
Code: spec.Code,
|
||||
Name: spec.Name,
|
||||
UpdatedAt: timeutils.Now(),
|
||||
}
|
||||
return i.tagRepo.Update(newData)
|
||||
}
|
||||
Reference in New Issue
Block a user