Files
Gumble-Backend/internal/data/mapper/users.go
Zane Walker 7e940c83a7
Some checks failed
Build & Test / build-test (push) Has been cancelled
Build & Test / swagger-codegen-cli (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
(Feat): Initial Commit
2026-07-03 19:41:31 +05:30

33 lines
883 B
Go

package mapper
import (
"allaboutapps.dev/aw/go-starter/internal/data/dto"
"allaboutapps.dev/aw/go-starter/internal/models"
)
func LocalAppUserProfileToDTO(appUserProfile *models.AppUserProfile) dto.AppUserProfile {
return dto.AppUserProfile{
UserID: appUserProfile.UserID,
LegalAcceptedAt: appUserProfile.LegalAcceptedAt,
UpdatedAt: appUserProfile.UpdatedAt,
}
}
func LocalUserToDTO(user *models.User) dto.User {
result := dto.User{
ID: user.ID,
Username: user.Username,
IsActive: user.IsActive,
Scopes: user.Scopes,
LastAuthenticatedAt: user.LastAuthenticatedAt,
UpdatedAt: user.UpdatedAt,
PasswordHash: user.Password,
}
if user.R != nil && user.R.AppUserProfile != nil {
result.Profile = LocalAppUserProfileToDTO(user.R.AppUserProfile).Ptr()
}
return result
}