fix: update user plan and rearrange structur project
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package subscribeplansvc
|
||||
|
||||
import (
|
||||
subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func (sb *impl) Create(spec subscribeplandomain.SubscribePlanReq) error {
|
||||
data := subscribeplandomain.SubscribePlan{
|
||||
ID: uuid.NewString(),
|
||||
Code: spec.Code,
|
||||
Name: spec.Name,
|
||||
}
|
||||
return sb.subsRepo.Create(data)
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package subscribeplansvc
|
||||
|
||||
import subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"
|
||||
|
||||
func (sb *impl) CreatePlan(spec subscribeplandomain.SubscribePlanReq) error {
|
||||
return sb.subsAccs.Create(spec)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package subscribeplansvc
|
||||
|
||||
func (i *impl) Delete(id string) error {
|
||||
return i.subsRepo.Delete(id)
|
||||
}
|
||||
+1
-1
@@ -5,5 +5,5 @@ import (
|
||||
)
|
||||
|
||||
func (s *impl) GetAllPlan() ([]subscribeplandomain.SubscribePlan, error) {
|
||||
return s.subsAccs.GetAll()
|
||||
return s.subsRepo.GetAll()
|
||||
}
|
||||
@@ -1,21 +1,23 @@
|
||||
package subscribeplansvc
|
||||
|
||||
import (
|
||||
subscribeplanrepository "legalgo-BE-go/internal/accessor/subscribeplan"
|
||||
subscribeplanrepository "legalgo-BE-go/internal/accessor/subscribe_plan"
|
||||
subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"
|
||||
)
|
||||
|
||||
type impl struct {
|
||||
subsAccs subscribeplanrepository.SubsPlanIntf
|
||||
subsRepo subscribeplanrepository.SubscribePlan
|
||||
}
|
||||
|
||||
type SubscribePlan interface {
|
||||
CreatePlan(subscribeplandomain.SubscribePlanReq) error
|
||||
Create(subscribeplandomain.SubscribePlanReq) error
|
||||
Update(string, subscribeplandomain.SubscribePlanUpdate) error
|
||||
GetAllPlan() ([]subscribeplandomain.SubscribePlan, error)
|
||||
Delete(string) error
|
||||
}
|
||||
|
||||
func New(
|
||||
subsAccs subscribeplanrepository.SubsPlanIntf,
|
||||
subsAccs subscribeplanrepository.SubscribePlan,
|
||||
) SubscribePlan {
|
||||
return &impl{subsAccs}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package subscribeplansvc
|
||||
|
||||
import (
|
||||
subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"
|
||||
timeutils "legalgo-BE-go/internal/utilities/time_utils"
|
||||
)
|
||||
|
||||
func (i *impl) Update(id string, spec subscribeplandomain.SubscribePlanUpdate) error {
|
||||
newData := subscribeplandomain.SubscribePlan{
|
||||
ID: id,
|
||||
Code: spec.Code,
|
||||
Name: spec.Name,
|
||||
UpdatedAt: timeutils.Now(),
|
||||
}
|
||||
return i.subsRepo.Update(newData)
|
||||
}
|
||||
Reference in New Issue
Block a user