fix: update user plan and rearrange structur project
This commit is contained in:
@@ -6,14 +6,14 @@ import (
|
||||
)
|
||||
|
||||
type impl struct {
|
||||
subsRepo subscriberepository.SubsIntf
|
||||
subsRepo subscriberepository.Subscribe
|
||||
}
|
||||
|
||||
type Subscribe interface {
|
||||
Create(string) (string, error)
|
||||
Update(string, userdomain.UserSubsUpdate) error
|
||||
Update(userdomain.UserSubsUpdate) error
|
||||
}
|
||||
|
||||
func New(subsRepo subscriberepository.SubsIntf) Subscribe {
|
||||
func New(subsRepo subscriberepository.Subscribe) Subscribe {
|
||||
return &impl{subsRepo}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
package subscribesvc
|
||||
|
||||
import (
|
||||
subscribedomain "legalgo-BE-go/internal/domain/subscribe"
|
||||
userdomain "legalgo-BE-go/internal/domain/user"
|
||||
timeutils "legalgo-BE-go/internal/utilities/time_utils"
|
||||
)
|
||||
|
||||
func (i *impl) Update(id string, spec userdomain.UserSubsUpdate) error {
|
||||
return nil
|
||||
func (i *impl) Update(spec userdomain.UserSubsUpdate) error {
|
||||
newSpec := subscribedomain.Subscribe{
|
||||
ID: spec.ID,
|
||||
AutoRenew: spec.AutoRenew,
|
||||
StartDate: timeutils.Now(),
|
||||
EndDate: spec.EndDate,
|
||||
Status: spec.Status,
|
||||
SubscribePlanID: spec.SubscribePlanID,
|
||||
UpdatedAt: timeutils.Now(),
|
||||
}
|
||||
return i.subsRepo.Update(newSpec)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user