fix: improvement access data

This commit is contained in:
ericprd
2025-03-14 13:00:12 +08:00
parent 11bc19360c
commit ee8e8e140d
7 changed files with 10 additions and 36 deletions
+3 -3
View File
@@ -5,17 +5,17 @@ import (
userdomain "legalgo-BE-go/internal/domain/user"
)
func (ur *accessor) GetUserProfile(email string) (*userdomain.UserProfile, error) {
func (ur *accessor) GetUserProfile(id string) (*userdomain.UserProfile, error) {
var user *userdomain.User
if email == "" {
if id == "" {
return nil, fmt.Errorf("email is empty")
}
if err := ur.db.
Preload("Subscribe").
Preload("Subscribe.SubscribePlan").
First(&user, "email = ?", email).
First(&user, "id = ?", id).
Error; err != nil {
return nil, err
}