replacing depracated grpc Dial + camelcases vars + fixing issues

This commit is contained in:
Salim Amine Bou Aram
2024-11-01 01:23:34 +01:00
parent 41bcb74462
commit 45cada4fa5
10 changed files with 100 additions and 65 deletions

View File

@@ -28,7 +28,7 @@ func (h *SilverMobiHandler) Login(ctx context.Context, username string, password
}
func (h *SilverMobiHandler) Register(ctx context.Context, username string, password string, email string,
phone_number string, first_name string, last_name string) (jwt string, err error) {
phoneNumber string, firstName string, lastName string) (jwt string, err error) {
var (
account *models.Account
@@ -40,12 +40,12 @@ func (h *SilverMobiHandler) Register(ctx context.Context, username string, passw
username,
password,
email,
phone_number,
phoneNumber,
map[string]any{
"first_name": first_name,
"last_name": last_name,
"first_name": firstName,
"last_name": lastName,
"email": email,
"phone_number": phone_number,
"phone_number": phoneNumber,
},
"silvermobi",
); err != nil {

View File

@@ -20,7 +20,7 @@ func generateRandomPassword(length int) (string, error) {
}
func (h *SilverMobiHandler) ForgetAccount(ctx context.Context, username string, namespace string) (response bool,
access_Code string) {
accessCode string) {
var (
err error

View File

@@ -3,7 +3,7 @@ package handler
import (
"fmt"
routing "git.coopgo.io/coopgo-platform/routing-service"
"git.coopgo.io/coopgo-platform/routing-service"
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
)

View File

@@ -8,8 +8,8 @@ import (
gomail "gopkg.in/mail.v2"
)
func (h *SilverMobiHandler) PutFirebase(ctx context.Context, id string, token string, device_platform string) (err error) {
err = h.Storage.CreateFirebaseToken(id, token, device_platform)
func (h *SilverMobiHandler) PutFirebase(ctx context.Context, id string, token string, devicePlatform string) (err error) {
err = h.Storage.CreateFirebaseToken(id, token, devicePlatform)
return err
}

View File

@@ -97,7 +97,7 @@ func (h *SilverMobiHandler) SetAccountType(ctx context.Context, id string, accou
}
return nil
}
func (h *SilverMobiHandler) GetAccountType(ctx context.Context, id string) (account_type string, err error) {
func (h *SilverMobiHandler) GetAccountType(ctx context.Context, id string) (accountType string, err error) {
var resp *grpcapi.GetAccountResponse
request := &grpcapi.GetAccountRequest{
@@ -138,7 +138,8 @@ func (h *SilverMobiHandler) GetAccountPhone(ctx context.Context, id string) (pho
return "", errors.New("invalid request ")
}
func (h *SilverMobiHandler) CheckValidation(ctx context.Context, id string) (phone_validation, birth_validation, type_validation bool, err error) {
func (h *SilverMobiHandler) CheckValidation(ctx context.Context, id string) (phoneValidation, birthValidation,
typeValidation bool, err error) {
var resp *grpcapi.GetAccountResponse
@@ -153,22 +154,22 @@ func (h *SilverMobiHandler) CheckValidation(ctx context.Context, id string) (pho
account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
phone_validation = false
birth_validation = false
type_validation = false
phoneValidation = false
birthValidation = false
typeValidation = false
if account.LocalCredentials.PhoneNumberVerified {
phone_validation = true
phoneValidation = true
}
if account.BirthDate != "" {
birth_validation = true
birthValidation = true
}
if account.Type != "" {
type_validation = true
typeValidation = true
}
log.Info().Msg("Getting phone and birth validation for " + account.Email)
return phone_validation, birth_validation, type_validation, nil
return phoneValidation, birthValidation, typeValidation, nil
}