feat: update and delete tags and categories

This commit is contained in:
ericprd
2025-03-05 23:13:24 +08:00
parent 5c699dfa53
commit 299fcf949b
22 changed files with 283 additions and 32 deletions
+1 -1
View File
@@ -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)
}
+5
View File
@@ -0,0 +1,5 @@
package tagsvc
func (i *impl) Delete(id string) error {
return i.tagRepo.Delete(id)
}
+2
View File
@@ -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(
+16
View File
@@ -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)
}