"fix(param):prevent admin to get password in login response"

This commit is contained in:
AMiR 2024-05-20 21:58:55 +03:30 committed by Iman Mirazimi
parent fc040db1c0
commit 948a240282
2 changed files with 25 additions and 3 deletions

View File

@ -8,6 +8,18 @@ type LoginWithPhoneNumberRequest struct {
} }
type LoginWithPhoneNumberResponse struct { type LoginWithPhoneNumberResponse struct {
Admin entity.Admin `json:"admin"` AdminInfo AdminInfo `json:"admin_info"`
Tokens Tokens `json:"tokens"` Tokens Tokens `json:"tokens"`
} }
type AdminInfo struct {
ID uint `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
PhoneNumber string `json:"phone_number"`
Role entity.AdminRole `json:"role"`
Description string `json:"description"`
Email string `json:"email"`
Gender entity.Gender `json:"gender"`
Status entity.AdminStatus `json:"status"`
}

View File

@ -35,7 +35,17 @@ func (s Service) LoginWithPhoneNumber(ctx context.Context, req adminserviceparam
} }
return adminserviceparam.LoginWithPhoneNumberResponse{ return adminserviceparam.LoginWithPhoneNumberResponse{
Admin: admin, AdminInfo: adminserviceparam.AdminInfo{
ID: admin.ID,
FirstName: admin.FirstName,
LastName: admin.LastName,
PhoneNumber: admin.PhoneNumber,
Role: admin.Role,
Description: admin.Description,
Email: admin.Email,
Gender: admin.Gender,
Status: admin.Status,
},
Tokens: adminserviceparam.Tokens{ Tokens: adminserviceparam.Tokens{
AccessToken: accessToken, AccessToken: accessToken,
RefreshToken: refreshToken, RefreshToken: refreshToken,