fix: update user plan and rearrange structur project
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package subscribeplanrepository
|
||||
|
||||
import (
|
||||
"errors"
|
||||
subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (s *accessor) GetByID(id string) (*subscribeplandomain.SubscribePlan, error) {
|
||||
var subscribePlan *subscribeplandomain.SubscribePlan
|
||||
|
||||
if err := s.db.First(&subscribePlan, "id = ? ", id).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return subscribePlan, errors.New("subscribe plan not found")
|
||||
}
|
||||
return subscribePlan, err
|
||||
}
|
||||
|
||||
return subscribePlan, nil
|
||||
}
|
||||
Reference in New Issue
Block a user