élément d'authentifications retiré
This commit is contained in:
		
							parent
							
								
									a68bec8fb4
								
							
						
					
					
						commit
						6bceee5b43
					
				| 
						 | 
				
			
			@ -1,16 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"solidarity-service/models"
 | 
			
		||||
	"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) GetAccountInfos(ctx context.Context, id string) (account *models.Account, err error) {
 | 
			
		||||
	resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, &grpcapi.GetAccountRequest{Id: id})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	account = h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
 | 
			
		||||
	return account, nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,51 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) Login(ctx context.Context, username string, password string) (jwt string, err error) {
 | 
			
		||||
	account, err := h.Services.MobilityAccounts.Login(ctx, username, password, "silvermobi")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	key := h.Config.GetString("identification.local.jwt_secret")
 | 
			
		||||
	ttl := h.Config.GetString("identification.local.ttl")
 | 
			
		||||
	parsedttl, err := time.ParseDuration(ttl)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	return account.CreateToken(parsedttl, key)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) Register(ctx context.Context, username string, password string, email string, phone_number string, first_name string, last_name string) (jwt string, err error) {
 | 
			
		||||
	account, err := h.Services.MobilityAccounts.Register(
 | 
			
		||||
		ctx,
 | 
			
		||||
		username,
 | 
			
		||||
		password,
 | 
			
		||||
		email,
 | 
			
		||||
		phone_number,
 | 
			
		||||
		map[string]any{
 | 
			
		||||
			"first_name":   first_name,
 | 
			
		||||
			"last_name":    last_name,
 | 
			
		||||
			"email":        email,
 | 
			
		||||
			"phone_number": phone_number,
 | 
			
		||||
		},
 | 
			
		||||
		"silvermobi",
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	key := h.Config.GetString("identification.local.jwt_secret")
 | 
			
		||||
	ttl := h.Config.GetString("identification.local.ttl")
 | 
			
		||||
 | 
			
		||||
	parsedttl, err := time.ParseDuration(ttl)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return account.CreateToken(parsedttl, key)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,46 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"crypto/rand"
 | 
			
		||||
	"crypto/tls"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	gomail "gopkg.in/mail.v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func generateRandomPassword(length int) (string, error) {
 | 
			
		||||
	buffer := make([]byte, length)
 | 
			
		||||
	_, err := rand.Read(buffer)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	password := base64.StdEncoding.EncodeToString(buffer)[:length]
 | 
			
		||||
	return password, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) ForgetAccount(ctx context.Context, username string, namespace string) (response bool, access_Code string) {
 | 
			
		||||
	account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, username, namespace)
 | 
			
		||||
	if err == nil {
 | 
			
		||||
		message := []byte("Hello dear,\nYour new Silvermobi password is: ")
 | 
			
		||||
		password, _ := generateRandomPassword(10)
 | 
			
		||||
		update := h.Services.MobilityAccounts.UpdatePassword(ctx, account.ID, password)
 | 
			
		||||
		if update == false {
 | 
			
		||||
			return false, ""
 | 
			
		||||
		}
 | 
			
		||||
		m := gomail.NewMessage()
 | 
			
		||||
		m.SetHeader("From", h.Config.GetString("emailing.smtp.username"))
 | 
			
		||||
		m.SetHeader("To", username)
 | 
			
		||||
		m.SetHeader("Subject", "Silvermobi Password Recovery")
 | 
			
		||||
		message = append(message, []byte(password)...)
 | 
			
		||||
		m.SetBody("text/plain", string(message))
 | 
			
		||||
		d := gomail.NewDialer(h.Config.GetString("emailing.smtp.host"), h.Config.GetInt("emailing.smtp.port"), h.Config.GetString("emailing.smtp.username"),
 | 
			
		||||
			h.Config.GetString("emailing.smtp.password"))
 | 
			
		||||
		d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
 | 
			
		||||
		if err := d.DialAndSend(m); err != nil {
 | 
			
		||||
			return false, ""
 | 
			
		||||
		}
 | 
			
		||||
		return true, password
 | 
			
		||||
	} else {
 | 
			
		||||
		return false, ""
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,57 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/paulmach/orb"
 | 
			
		||||
	"github.com/paulmach/orb/geojson"
 | 
			
		||||
	"google.golang.org/genproto/googleapis/maps/routing/v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) GeoAutocomplete(text string, lat, lon float64) (*geojson.FeatureCollection, error) {
 | 
			
		||||
	result, err := h.Services.Geocoder.Autocomplete(text)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return result, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) GeoRoute(locations geojson.FeatureCollection) (route *routing.Route, err error) {
 | 
			
		||||
	route_locations := []orb.Point{}
 | 
			
		||||
 | 
			
		||||
	features_type := ""
 | 
			
		||||
 | 
			
		||||
	for _, f := range locations.Features {
 | 
			
		||||
		ft := f.Geometry.GeoJSONType()
 | 
			
		||||
		if features_type != "" && ft != features_type {
 | 
			
		||||
			return nil, fmt.Errorf("mixing different types of geometries in the feature collection is not allowed : %s and %s found", features_type, ft)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		features_type = ft
 | 
			
		||||
 | 
			
		||||
		if features_type == "Point" {
 | 
			
		||||
			if point, ok := f.Geometry.(orb.Point); ok {
 | 
			
		||||
				route_locations = append(route_locations, point)
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			return nil, fmt.Errorf("feature type %s not supported", features_type)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return route, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) GeoReturnRoute(locations geojson.FeatureCollection) (route *routing.Route, err error) {
 | 
			
		||||
	loc := locations
 | 
			
		||||
	route.Polyline.String()
 | 
			
		||||
	reverse(loc.Features)
 | 
			
		||||
 | 
			
		||||
	return h.GeoRoute(loc)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func reverse[S ~[]E, E any](s S) {
 | 
			
		||||
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
 | 
			
		||||
		s[i], s[j] = s[j], s[i]
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ import (
 | 
			
		|||
	"git.coopgo.io/coopgo-platform/routing-service"
 | 
			
		||||
	"github.com/spf13/viper"
 | 
			
		||||
	"solidarity-service/storage"
 | 
			
		||||
	"solidarity-service/services"
 | 
			
		||||
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12,7 +11,6 @@ type SolidarityServiceHandler struct {
 | 
			
		|||
	Config  *viper.Viper
 | 
			
		||||
	Routing routing.RoutingService
 | 
			
		||||
	Storage storage.Storage
 | 
			
		||||
	Services *services.ServicesHandler
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,64 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"crypto/tls"
 | 
			
		||||
	"solidarity-service/services"
 | 
			
		||||
	"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
 | 
			
		||||
	gomail "gopkg.in/mail.v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) PutFirebase(ctx context.Context, id string, token string, device_platform string) (err error) {
 | 
			
		||||
	err = h.Storage.CreateFirebaseToken(id, token, device_platform)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) SendNotification(id, title, message string) (err error) {
 | 
			
		||||
	firebase_token, platfrom, _ := h.Storage.GetFirebaseToken(id)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if platfrom == "android" {
 | 
			
		||||
		_ = h.Services.Push.Send(
 | 
			
		||||
			services.Notification{
 | 
			
		||||
				Platform:   services.PushToAndroid,
 | 
			
		||||
				Recipients: []string{firebase_token},
 | 
			
		||||
				Title:      title,
 | 
			
		||||
				Message:    message,
 | 
			
		||||
			},
 | 
			
		||||
		)
 | 
			
		||||
	} else {
 | 
			
		||||
		_ = h.Services.Push.Send(
 | 
			
		||||
			services.Notification{
 | 
			
		||||
				Platform:   services.PushToIos,
 | 
			
		||||
				Recipients: []string{firebase_token},
 | 
			
		||||
				Title:      title,
 | 
			
		||||
				Message:    message,
 | 
			
		||||
			},
 | 
			
		||||
		)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
func (h *SolidarityServiceHandler) SendEmail(id, title, message string) (err error) {
 | 
			
		||||
	resp, err := h.Services.MobilityAccounts.Client.GetAccount(context.Background(), &grpcapi.GetAccountRequest{Id: id})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
 | 
			
		||||
	m := gomail.NewMessage()
 | 
			
		||||
	m.SetHeader("From", h.Config.GetString("emailing.smtp.username"))
 | 
			
		||||
	m.SetHeader("To", account.Email)
 | 
			
		||||
	m.SetHeader("Subject", title)
 | 
			
		||||
	m.SetBody("text/plain", message)
 | 
			
		||||
	d := gomail.NewDialer(h.Config.GetString("emailing.smtp.host"), h.Config.GetInt("emailing.smtp.port"), h.Config.GetString("emailing.smtp.username"),
 | 
			
		||||
		h.Config.GetString("emailing.smtp.password"))
 | 
			
		||||
	d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
 | 
			
		||||
	if err := d.DialAndSend(m); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,152 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"solidarity-service/services"
 | 
			
		||||
	"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
 | 
			
		||||
	"github.com/pkg/errors"
 | 
			
		||||
	"github.com/rs/zerolog/log"
 | 
			
		||||
	"math/rand"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) UpdatePhoneNumber(ctx context.Context, id string, phone_number string) error {
 | 
			
		||||
	code := rand.Intn(9999)
 | 
			
		||||
	err := h.Services.MobilityAccounts.UpdatePhoneNumber(
 | 
			
		||||
		ctx,
 | 
			
		||||
		id,
 | 
			
		||||
		phone_number,
 | 
			
		||||
		false,
 | 
			
		||||
		fmt.Sprintf("%04d", code),
 | 
			
		||||
	)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error().Err(err).Msg("updating phone number failed")
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = h.Services.Push.Send(
 | 
			
		||||
		services.Notification{
 | 
			
		||||
			Platform:   services.PushToSMSFactor,
 | 
			
		||||
			Recipients: []string{phone_number[1:]},
 | 
			
		||||
			Title:      "SILVERMOBI",
 | 
			
		||||
			Message:    fmt.Sprintf("SILVERMOBI - Votre code de validation : %04d", code),
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error().Err(err).Msg("issue sending verification code by sms")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) VerifyPhoneNumber(ctx context.Context, id string, phone_number string, verification_code string) error {
 | 
			
		||||
	request := &grpcapi.GetAccountRequest{
 | 
			
		||||
		Id: id,
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	account_ := resp.Account
 | 
			
		||||
 | 
			
		||||
	log.Debug().
 | 
			
		||||
		Str("phone_number", phone_number).
 | 
			
		||||
		Str("account.phone_number", account_.Authentication.Local.PhoneNumber).
 | 
			
		||||
		Str("verification_code", verification_code).
 | 
			
		||||
		Str("account.verification_code", account_.Authentication.Local.PhoneNumberValidation.ValidationCode).
 | 
			
		||||
		Msg("Verify phone number")
 | 
			
		||||
 | 
			
		||||
	if account_.Authentication.Local.PhoneNumber != phone_number || account_.Authentication.Local.PhoneNumberValidation.ValidationCode != verification_code {
 | 
			
		||||
		return errors.New("cound not validate phone number : verification code mismatch")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = h.Services.MobilityAccounts.UpdatePhoneNumber(
 | 
			
		||||
		ctx,
 | 
			
		||||
		id,
 | 
			
		||||
		phone_number,
 | 
			
		||||
		true,
 | 
			
		||||
		"",
 | 
			
		||||
	)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) UpdateBirthDate(ctx context.Context, id string, birthdate string) error {
 | 
			
		||||
	err := h.Services.MobilityAccounts.UpdateAccountBirthDate(ctx, id, "silvermobi", birthdate)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) SetAccountType(ctx context.Context, id string, accountType string) error {
 | 
			
		||||
	err := h.Services.MobilityAccounts.SetAccountType(ctx, id, accountType)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
func (h *SolidarityServiceHandler) GetAccountType(ctx context.Context, id string) (account_type string, err error) {
 | 
			
		||||
	request := &grpcapi.GetAccountRequest{
 | 
			
		||||
		Id: id,
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
		log.Error().Err(err).Msg("Failed get account type")
 | 
			
		||||
	}
 | 
			
		||||
	account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
 | 
			
		||||
	if account.Type != "" {
 | 
			
		||||
 | 
			
		||||
		return account.Type, nil
 | 
			
		||||
	}
 | 
			
		||||
	return "", errors.New("account type not set")
 | 
			
		||||
}
 | 
			
		||||
func (h *SolidarityServiceHandler) GetAccountPhone(ctx context.Context, id string) (phone_number string, err error) {
 | 
			
		||||
	request := &grpcapi.GetAccountRequest{
 | 
			
		||||
		Id: id,
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
		log.Error().Err(err).Msg("Failed get account type")
 | 
			
		||||
	}
 | 
			
		||||
	account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
 | 
			
		||||
	if account.PhoneNumber != "" {
 | 
			
		||||
 | 
			
		||||
		return account.PhoneNumber, nil
 | 
			
		||||
	}
 | 
			
		||||
	return "", errors.New("invalid request ")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) CheckValidation(ctx context.Context, id string) (phone_validation, birth_validation, type_validation bool, err error) {
 | 
			
		||||
	request := &grpcapi.GetAccountRequest{
 | 
			
		||||
		Id: id,
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return false, false, false, err
 | 
			
		||||
		log.Error().Err(err).Msg("Failed get validation response")
 | 
			
		||||
	}
 | 
			
		||||
	account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
 | 
			
		||||
	phone_validation = false
 | 
			
		||||
	birth_validation = false
 | 
			
		||||
	type_validation = false
 | 
			
		||||
	if account.LocalCredentials.PhoneNumberVerified {
 | 
			
		||||
		phone_validation = true
 | 
			
		||||
	}
 | 
			
		||||
	if account.BirthDate != "" {
 | 
			
		||||
		birth_validation = true
 | 
			
		||||
	}
 | 
			
		||||
	if account.Type != "" {
 | 
			
		||||
		type_validation = true
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Info().Msg("Getting phone and birth validation for " + account.Email)
 | 
			
		||||
	return phone_validation, birth_validation, type_validation, nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,16 +0,0 @@
 | 
			
		|||
package handler
 | 
			
		||||
 | 
			
		||||
import "context"
 | 
			
		||||
 | 
			
		||||
func (h *SolidarityServiceHandler) UpdatePassword(ctx context.Context, username string, password string) (response bool) {
 | 
			
		||||
	account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, username, "silvermobi")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	result := h.Services.MobilityAccounts.UpdatePassword(ctx, account.ID, password)
 | 
			
		||||
	if result == true {
 | 
			
		||||
		return true
 | 
			
		||||
	} else {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,49 +0,0 @@
 | 
			
		|||
package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/golang-jwt/jwt/v4"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Account struct {
 | 
			
		||||
	ID               string `json:"id"`
 | 
			
		||||
	Email            string `json:"email"`
 | 
			
		||||
	FirstName        string `json:"firstName,omitempty"`
 | 
			
		||||
	LastName         string `json:"lastName,omitempty"`
 | 
			
		||||
	VerifiedIdentity *bool  `json:"verifiedIdentity,omitempty"`
 | 
			
		||||
	BirthDate        string `json:"birthdate,omitempty"`
 | 
			
		||||
	Type             string `json:"type,omitempty"`
 | 
			
		||||
	LocalCredentials
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type User struct {
 | 
			
		||||
	ID        string `json:"user_id"`
 | 
			
		||||
	Status    string `json:"status"`
 | 
			
		||||
	BookingID string `json:"booking_id"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type LocalCredentials struct {
 | 
			
		||||
	Email                     string
 | 
			
		||||
	EmailVerified             bool
 | 
			
		||||
	EmailValidationCode       string
 | 
			
		||||
	PhoneNumber               string
 | 
			
		||||
	PhoneNumberVerified       bool
 | 
			
		||||
	PhoneNumberValidationCode string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type UserClaims struct {
 | 
			
		||||
	jwt.RegisteredClaims
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (account Account) CreateToken(ttl time.Duration, key string) (token string, err error) {
 | 
			
		||||
	expires_at := jwt.NewNumericDate(time.Now().Add(ttl))
 | 
			
		||||
	claims := UserClaims{
 | 
			
		||||
		RegisteredClaims: jwt.RegisteredClaims{
 | 
			
		||||
			Subject:   account.ID,
 | 
			
		||||
			ExpiresAt: expires_at,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	t := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
 | 
			
		||||
	return t.SignedString([]byte(key))
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,234 +0,0 @@
 | 
			
		|||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"solidarity-service/models"
 | 
			
		||||
	mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
 | 
			
		||||
	ma "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
 | 
			
		||||
	"google.golang.org/grpc"
 | 
			
		||||
	"google.golang.org/protobuf/types/known/structpb"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type MobilityAccountService struct {
 | 
			
		||||
	Client mobilityaccounts.MobilityAccountsClient
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewMobilityAccountService(mobilityAccountsDial string) (MobilityAccountService, error) {
 | 
			
		||||
	mobilityAccountsConn, err := grpc.Dial(mobilityAccountsDial, grpc.WithInsecure())
 | 
			
		||||
 | 
			
		||||
	client := mobilityaccounts.NewMobilityAccountsClient(mobilityAccountsConn)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return MobilityAccountService{}, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return MobilityAccountService{
 | 
			
		||||
		Client: client,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) Login(ctx context.Context, username, password, namespace string) (*models.Account, error) {
 | 
			
		||||
	resp, err := s.Client.Login(ctx, &mobilityaccounts.LoginRequest{
 | 
			
		||||
		Username:  username,
 | 
			
		||||
		Password:  password,
 | 
			
		||||
		Namespace: namespace,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	account := resp.Account.ToStorageType()
 | 
			
		||||
	return s.ToAccountModel(account), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) UpdateAccountData(ctx context.Context, id string, data map[string]any) error {
 | 
			
		||||
	d, err := structpb.NewStruct(data)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if _, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
 | 
			
		||||
		Account: &mobilityaccounts.Account{
 | 
			
		||||
			Id:   id,
 | 
			
		||||
			Data: d,
 | 
			
		||||
		},
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) UpdatePassword(ctx context.Context, id string, password string) bool {
 | 
			
		||||
	_, err := s.Client.ChangePassword(ctx, &mobilityaccounts.ChangePasswordRequest{
 | 
			
		||||
		Id:       id,
 | 
			
		||||
		Password: password,
 | 
			
		||||
	})
 | 
			
		||||
	if err == nil {
 | 
			
		||||
		return true
 | 
			
		||||
	} else {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) GetAccountUsername(ctx context.Context, username string, namespace string) (*models.Account, error) {
 | 
			
		||||
	resp, err := s.Client.GetAccountUsername(ctx, &mobilityaccounts.GetAccountUsernameRequest{
 | 
			
		||||
		Username:  username,
 | 
			
		||||
		Namespace: namespace,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return s.ToAccountModel(resp.Account.ToStorageType()), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) Register(ctx context.Context, username string, password string, email string, phone_number string, data map[string]any, namespace string) (*models.Account, error) {
 | 
			
		||||
	account := &ma.Account{
 | 
			
		||||
		Authentication: ma.AccountAuth{
 | 
			
		||||
			Local: ma.LocalAuth{
 | 
			
		||||
				Username:    username,
 | 
			
		||||
				Password:    password,
 | 
			
		||||
				Email:       email,
 | 
			
		||||
				PhoneNumber: phone_number,
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		Namespace: namespace,
 | 
			
		||||
		Data:      data,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	acc, err := mobilityaccounts.AccountFromStorageType(account)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := s.Client.Register(ctx, &mobilityaccounts.RegisterRequest{
 | 
			
		||||
		Account: acc,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return s.ToAccountModel(resp.Account.ToStorageType()), nil
 | 
			
		||||
}
 | 
			
		||||
func (s MobilityAccountService) UpdatePhoneNumber(ctx context.Context, accountid string, phone_number string, verified bool, verification_code string) error {
 | 
			
		||||
	_, err := s.Client.UpdatePhoneNumber(
 | 
			
		||||
		ctx,
 | 
			
		||||
		&mobilityaccounts.UpdatePhoneNumberRequest{
 | 
			
		||||
			Id:               accountid,
 | 
			
		||||
			PhoneNumber:      phone_number,
 | 
			
		||||
			Verified:         verified,
 | 
			
		||||
			VerificationCode: verification_code,
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) SetAccountType(ctx context.Context, id string, accountType string) error {
 | 
			
		||||
	account, err := s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{
 | 
			
		||||
		Id: id,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	data := make(map[string]interface{})
 | 
			
		||||
	data["type"] = accountType
 | 
			
		||||
	dataStruct := &structpb.Struct{
 | 
			
		||||
		Fields: make(map[string]*structpb.Value),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for key, value := range data {
 | 
			
		||||
		stringValue, ok := value.(string)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		dataStruct.Fields[key] = &structpb.Value{
 | 
			
		||||
			Kind: &structpb.Value_StringValue{
 | 
			
		||||
				StringValue: stringValue,
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	account.Account.Data = dataStruct
 | 
			
		||||
	_, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
 | 
			
		||||
		Account: account.Account,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, id string, namespace string, birthdate string) error {
 | 
			
		||||
	account, err := s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{
 | 
			
		||||
		Id: id,
 | 
			
		||||
	})
 | 
			
		||||
	data := make(map[string]interface{})
 | 
			
		||||
	data["birthdate"] = birthdate
 | 
			
		||||
 | 
			
		||||
	dataStruct := &structpb.Struct{
 | 
			
		||||
		Fields: make(map[string]*structpb.Value),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for key, value := range data {
 | 
			
		||||
		stringValue, ok := value.(string)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		dataStruct.Fields[key] = &structpb.Value{
 | 
			
		||||
			Kind: &structpb.Value_StringValue{
 | 
			
		||||
				StringValue: stringValue,
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	account.Account.Data = dataStruct
 | 
			
		||||
	_, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
 | 
			
		||||
		Account: account.Account,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s MobilityAccountService) ToAccountModel(account ma.Account) *models.Account {
 | 
			
		||||
	first_name := account.Data["first_name"].(string)
 | 
			
		||||
	last_name := account.Data["last_name"].(string)
 | 
			
		||||
	birth_date, ok := account.Data["birthdate"].(string)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		birth_date = ""
 | 
			
		||||
	}
 | 
			
		||||
	accountType, ok := account.Data["type"].(string)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		accountType = ""
 | 
			
		||||
	}
 | 
			
		||||
	phone_number, ok := account.Data["phone_number"].(string)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		phone_number = ""
 | 
			
		||||
	}
 | 
			
		||||
	email, ok := account.Data["email"].(string)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		email = ""
 | 
			
		||||
	}
 | 
			
		||||
	return &models.Account{
 | 
			
		||||
		ID:        account.ID,
 | 
			
		||||
		FirstName: first_name,
 | 
			
		||||
		LastName:  last_name,
 | 
			
		||||
		Email:     email,
 | 
			
		||||
		BirthDate: birth_date,
 | 
			
		||||
		Type:      accountType,
 | 
			
		||||
		LocalCredentials: models.LocalCredentials{
 | 
			
		||||
			Email:               account.Authentication.Local.Email,
 | 
			
		||||
			EmailVerified:       account.Authentication.Local.EmailValidation.Validated,
 | 
			
		||||
			EmailValidationCode: account.Authentication.Local.EmailValidation.ValidationCode,
 | 
			
		||||
			PhoneNumber:         phone_number,
 | 
			
		||||
			PhoneNumberVerified: account.Authentication.Local.PhoneNumberValidation.Validated,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,79 +0,0 @@
 | 
			
		|||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"google.golang.org/protobuf/types/known/structpb"
 | 
			
		||||
 | 
			
		||||
	"github.com/appleboy/gorush/rpc/proto"
 | 
			
		||||
	"github.com/rs/zerolog/log"
 | 
			
		||||
	"google.golang.org/grpc"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// PlatFormIos constant is 1 for iOS
 | 
			
		||||
	PushToIos = iota + 1
 | 
			
		||||
	// PlatFormAndroid constant is 2 for Android
 | 
			
		||||
	PushToAndroid
 | 
			
		||||
	// PlatFormHuawei constant is 3 for Huawei
 | 
			
		||||
	PushToHuawei
 | 
			
		||||
	// PlatformUnifiedPush constant is 4 for UnifiedPush
 | 
			
		||||
	PushToUnifiedPush
 | 
			
		||||
	// PlatformSMSFactor constant is 5 for SMSFactor
 | 
			
		||||
	PushToSMSFactor
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Notification struct {
 | 
			
		||||
	Platform   int32
 | 
			
		||||
	Recipients []string
 | 
			
		||||
	Message    string
 | 
			
		||||
	Title      string
 | 
			
		||||
	Data       *structpb.Struct
 | 
			
		||||
	ID         string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type PushService struct {
 | 
			
		||||
	Client proto.GorushClient
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewPushService(address string) (*PushService, error) {
 | 
			
		||||
	conn, err := grpc.Dial(address, grpc.WithInsecure())
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &PushService{
 | 
			
		||||
		Client: proto.NewGorushClient(conn),
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *PushService) Send(notification Notification) error {
 | 
			
		||||
	log.Debug().
 | 
			
		||||
		Int32("Platform", notification.Platform).
 | 
			
		||||
		Strs("recipients", notification.Recipients).
 | 
			
		||||
		Str("notification_message", notification.Message).
 | 
			
		||||
		Str("notification_title", notification.Title).
 | 
			
		||||
		Msg("Send notification")
 | 
			
		||||
 | 
			
		||||
	resp, err := s.Client.Send(context.Background(), &proto.NotificationRequest{
 | 
			
		||||
		Data:     notification.Data,
 | 
			
		||||
		ID:       notification.ID,
 | 
			
		||||
		Platform: notification.Platform,
 | 
			
		||||
		Tokens:   notification.Recipients,
 | 
			
		||||
		Message:  notification.Message,
 | 
			
		||||
		Title:    notification.Title,
 | 
			
		||||
		Priority: proto.NotificationRequest_HIGH,
 | 
			
		||||
		Alert: &proto.Alert{
 | 
			
		||||
			Title: notification.Title,
 | 
			
		||||
			Body:  notification.Message,
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Debug().Str("response", resp.String()).Msg("notification sent")
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,54 +0,0 @@
 | 
			
		|||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"git.coopgo.io/coopgo-platform/geocode"
 | 
			
		||||
	routing "git.coopgo.io/coopgo-platform/routing-service"
 | 
			
		||||
	"github.com/rs/zerolog/log"
 | 
			
		||||
	"github.com/spf13/viper"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type ServicesHandler struct {
 | 
			
		||||
	MobilityAccounts MobilityAccountService
 | 
			
		||||
	Push             *PushService
 | 
			
		||||
	Geocoder         geocode.Geocoder
 | 
			
		||||
	Routing          routing.RoutingService
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
 | 
			
		||||
	var (
 | 
			
		||||
		mobilityAccountsDial = cfg.GetString("services.internal.mobility_accounts.dial")
 | 
			
		||||
		pushDial             = cfg.GetString("services.internal.push.dial")
 | 
			
		||||
		geocoder_type        = cfg.GetString("geocoder.type")
 | 
			
		||||
		pelias_base_url      = cfg.GetString("geocoder.pelias.base_url")
 | 
			
		||||
		routing_service_type = cfg.GetString("routing.type")
 | 
			
		||||
		valhalla_base_url    = cfg.GetString("routing.valhalla.base_url")
 | 
			
		||||
	)
 | 
			
		||||
	mobilityAccounts, err := NewMobilityAccountService(mobilityAccountsDial)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal().Err(err).Msg("Could not connect to Mobility Accounts Service")
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	push, err := NewPushService(pushDial)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal().Err(err).Msg("Could not connect to Push Notifications Service")
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	geocoder, err := geocode.NewGeocoder(geocoder_type, pelias_base_url)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal().Err(err).Msg("Could not initiate the Geocoder service")
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	routing, err := routing.NewRoutingService(routing_service_type, valhalla_base_url)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal().Err(err).Msg("Could not initiate the routing service")
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &ServicesHandler{
 | 
			
		||||
		MobilityAccounts: mobilityAccounts,
 | 
			
		||||
		Push:             push,
 | 
			
		||||
		Geocoder: geocoder,
 | 
			
		||||
		Routing: routing,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -61,46 +61,6 @@ func NewPostgresqlStorage(cfg *viper.Viper) (PostgresqlStorage, error) {
 | 
			
		|||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s PostgresqlStorage) CreateFirebaseToken(user_id string, fcm_token string, device_platform string) (err error) {
 | 
			
		||||
	_, err = uuid.Parse(user_id)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error().Err(err).Msg("Postgresql Storage CreateFirebaseToken invalid User ID")
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	_, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (user_id , fcm_token , device_platform) VALUES($1,$2,$3)", s.Tables["users_firebase"]),
 | 
			
		||||
		user_id,
 | 
			
		||||
		fcm_token,
 | 
			
		||||
		device_platform)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if strings.Contains(err.Error(), "duplicate key") {
 | 
			
		||||
			_ = s.UpdateFirebaseToken(user_id, device_platform, fcm_token)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s PostgresqlStorage) GetFirebaseToken(user_id string) (fcm string, device_platform string, err error) {
 | 
			
		||||
	err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT fcm_token , device_platform FROM %s WHERE user_id = $1", s.Tables["users_firebase"]), user_id).
 | 
			
		||||
		Scan(
 | 
			
		||||
			&fcm,
 | 
			
		||||
			&device_platform,
 | 
			
		||||
		)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", "", err
 | 
			
		||||
	}
 | 
			
		||||
	return fcm, device_platform, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s PostgresqlStorage) UpdateFirebaseToken(user_id string, fcm_token string, device_platform string) error {
 | 
			
		||||
	query := fmt.Sprintf("UPDATE %s SET fcm_token = $1 device_platform = $2 WHERE user_id = $3", s.Tables["users_firebase"])
 | 
			
		||||
	_, err := s.DbConnection.Exec(query, fcm_token, device_platform, user_id)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s PostgresqlStorage) CreatePassenger(passenger internal.Passenger) (err error) {
 | 
			
		||||
	_, err = uuid.Parse(passenger.Passenger.ID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,10 +19,7 @@ type Storage interface {
 | 
			
		|||
	FilterUserBookingsByStatus(user_type string, status internal.BookingStatus, user_id string) (bookings []internal.Booking, err error)
 | 
			
		||||
	DriverJourneys(departure_route *geojson.Feature, departure_date int64) (drivers []internal.Driver, err error)
 | 
			
		||||
	GetAllDrivers(date int64) (drivers []internal.Driver, err error)
 | 
			
		||||
	CreateFirebaseToken(user_id string, fcm_token string, device_platform string) (err error)
 | 
			
		||||
	UpdateFirebaseToken(user_id string, fcm_token string, device_platform string) error
 | 
			
		||||
	GetFirebaseToken(user_id string) (fcm string, device_platform string, err error)
 | 
			
		||||
}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
func NewStorage(cfg *viper.Viper) (Storage, error) {
 | 
			
		||||
	var (
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue