refactoring
This commit is contained in:
parent
4a6326a5ab
commit
f1d60881e5
26
config.yaml
26
config.yaml
|
@ -1,16 +1,30 @@
|
||||||
service_name: SILVERMOBI
|
service_name: SILVERMOBI
|
||||||
|
|
||||||
|
storage:
|
||||||
|
db:
|
||||||
|
type: psql
|
||||||
|
psql:
|
||||||
|
host: localhost
|
||||||
|
dbname: coopgo_platform
|
||||||
|
user: postgres
|
||||||
|
password: postgres
|
||||||
|
sslmode: disable
|
||||||
|
port: 5432
|
||||||
|
schema: silvermobi_backend
|
||||||
|
tables:
|
||||||
|
users_firebase: users_firebase
|
||||||
services:
|
services:
|
||||||
internal:
|
internal:
|
||||||
mobility_accounts:
|
mobility_accounts:
|
||||||
type: grpc
|
type: grpc
|
||||||
dial: localhost:8090
|
dial: 0.0.0.0:8090
|
||||||
push:
|
push:
|
||||||
type: gorush-grpc
|
type: gorush-grpc
|
||||||
dial: 0.0.0.0:8095
|
dial: 0.0.0.0:8095
|
||||||
external:
|
external:
|
||||||
grpc:
|
grpc:
|
||||||
enable: true
|
enable: true
|
||||||
|
ip: 192.168.0.111
|
||||||
port: 8099
|
port: 8099
|
||||||
web:
|
web:
|
||||||
enable: true
|
enable: true
|
||||||
|
@ -34,7 +48,8 @@ services:
|
||||||
id: cd11c681-4168-4bdf-8f2d-9e3ade5fac8d
|
id: cd11c681-4168-4bdf-8f2d-9e3ade5fac8d
|
||||||
bearer: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjZDExYzY4MS00MTY4LTRiZGYtOGYyZC05ZTNhZGU1ZmFjOGQiLCJuYW1lIjoiY2VydGluZXJneSIsImlhdCI6MTUxNjIzOTAyMn0.tPwn3uD_6T4FjOTehYDRNg39x2A4E9FFv6qTgduODaA
|
bearer: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjZDExYzY4MS00MTY4LTRiZGYtOGYyZC05ZTNhZGU1ZmFjOGQiLCJuYW1lIjoiY2VydGluZXJneSIsImlhdCI6MTUxNjIzOTAyMn0.tPwn3uD_6T4FjOTehYDRNg39x2A4E9FFv6qTgduODaA
|
||||||
# bearer: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjZDExYzY4MS00MTY4LTRiZGYtOGYyZC05ZTNhZGU1ZmFjOGQiLCJuYW1lIjoiY2VydGluZXJneSIsImlhdCI6MTUxNjIzOTAyMn0.LAr2l5X9XFRbPRPQvZLt8AWyfzbFGS5BO9MlB4U5HJo # PROD
|
# bearer: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjZDExYzY4MS00MTY4LTRiZGYtOGYyZC05ZTNhZGU1ZmFjOGQiLCJuYW1lIjoiY2VydGluZXJneSIsImlhdCI6MTUxNjIzOTAyMn0.LAr2l5X9XFRbPRPQvZLt8AWyfzbFGS5BO9MlB4U5HJo # PROD
|
||||||
|
solidarity_service:
|
||||||
|
address: 0.0.0.0:8089
|
||||||
identification:
|
identification:
|
||||||
local:
|
local:
|
||||||
jwt_secret: JWT_KEY
|
jwt_secret: JWT_KEY
|
||||||
|
@ -45,12 +60,7 @@ carpooling_proofs:
|
||||||
base_url: https://api.demo.covoiturage.beta.gouv.fr
|
base_url: https://api.demo.covoiturage.beta.gouv.fr
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiN2Y4MTQwNzYtOTJmOS00NjExLTlhMmItZjA0MzU4MmMwOWI3IiwibyI6OSwicyI6Im9wZXJhdG9yIiwicCI6WyJjb21tb24uY2VydGlmaWNhdGUuZmluZCIsImNvbW1vbi5jb21wYW55LmZldGNoIiwiY29tbW9uLmNvbXBhbnkuZmluZCIsImNvbW1vbi5ob25vci5zYXZlIiwiY29tbW9uLmhvbm9yLnN0YXRzIiwiY29tbW9uLm9wZXJhdG9yLmxpc3QiLCJjb21tb24ub3BlcmF0b3IuZmluZCIsImNvbW1vbi5wb2xpY3kubGlzdCIsImNvbW1vbi5wb2xpY3kubGlzdC50ZW1wbGF0ZXMiLCJjb21tb24udGVycml0b3J5LmZpbmQiLCJjb21tb24udGVycml0b3J5Lmxpc3QiLCJjb21tb24udGVycml0b3J5LnJlYWQiLCJjb21tb24udHJpcC5zdGF0cyIsImNvbW1vbi51c2VyLnVwZGF0ZSIsImNvbW1vbi51c2VyLmZpbmQiLCJjb21tb24udXNlci5wb2xpY3lTaW11bGF0ZSIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLmNyZWF0ZSIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLmNhbmNlbCIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLnN0YXR1cyIsIm9wZXJhdG9yLmNlcnRpZmljYXRlLmNyZWF0ZSIsIm9wZXJhdG9yLmNlcnRpZmljYXRlLmRvd25sb2FkIiwib3BlcmF0b3IucG9saWN5LnNpbXVsYXRlLmZ1dHVyZSJdLCJ2IjoyLCJpYXQiOjE2NzgwOTg0NTR9.b4ezR41U4kGwa6FVF0-JyvqEE1kKtxGEa5gzqh4ctTU
|
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiN2Y4MTQwNzYtOTJmOS00NjExLTlhMmItZjA0MzU4MmMwOWI3IiwibyI6OSwicyI6Im9wZXJhdG9yIiwicCI6WyJjb21tb24uY2VydGlmaWNhdGUuZmluZCIsImNvbW1vbi5jb21wYW55LmZldGNoIiwiY29tbW9uLmNvbXBhbnkuZmluZCIsImNvbW1vbi5ob25vci5zYXZlIiwiY29tbW9uLmhvbm9yLnN0YXRzIiwiY29tbW9uLm9wZXJhdG9yLmxpc3QiLCJjb21tb24ub3BlcmF0b3IuZmluZCIsImNvbW1vbi5wb2xpY3kubGlzdCIsImNvbW1vbi5wb2xpY3kubGlzdC50ZW1wbGF0ZXMiLCJjb21tb24udGVycml0b3J5LmZpbmQiLCJjb21tb24udGVycml0b3J5Lmxpc3QiLCJjb21tb24udGVycml0b3J5LnJlYWQiLCJjb21tb24udHJpcC5zdGF0cyIsImNvbW1vbi51c2VyLnVwZGF0ZSIsImNvbW1vbi51c2VyLmZpbmQiLCJjb21tb24udXNlci5wb2xpY3lTaW11bGF0ZSIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLmNyZWF0ZSIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLmNhbmNlbCIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLnN0YXR1cyIsIm9wZXJhdG9yLmNlcnRpZmljYXRlLmNyZWF0ZSIsIm9wZXJhdG9yLmNlcnRpZmljYXRlLmRvd25sb2FkIiwib3BlcmF0b3IucG9saWN5LnNpbXVsYXRlLmZ1dHVyZSJdLCJ2IjoyLCJpYXQiOjE2NzgwOTg0NTR9.b4ezR41U4kGwa6FVF0-JyvqEE1kKtxGEa5gzqh4ctTU
|
||||||
|
|
||||||
storage:
|
|
||||||
kv:
|
|
||||||
redis:
|
|
||||||
addr: 0.0.0.0:6379
|
|
||||||
db: db0
|
|
||||||
type: minio
|
|
||||||
|
|
||||||
geocoder:
|
geocoder:
|
||||||
type: pelias
|
type: pelias
|
||||||
|
|
22
go.mod
22
go.mod
|
@ -3,37 +3,39 @@ module git.coopgo.io/coopgo-apps/silvermobi
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
git.coopgo.io/coopgo-platform/geocode v0.0.0-20230329105149-1f31b361814e
|
||||||
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230430115320-f5bb2e7c2c26
|
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230430115320-f5bb2e7c2c26
|
||||||
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230403183358-4d30329f06be
|
||||||
github.com/appleboy/gorush v1.16.3
|
github.com/appleboy/gorush v1.16.3
|
||||||
github.com/go-redis/redis/v9 v9.0.0-rc.2
|
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0
|
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||||
github.com/golang/protobuf v1.5.3
|
github.com/golang/protobuf v1.5.3
|
||||||
|
github.com/google/uuid v1.3.0
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
|
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
|
||||||
|
github.com/lib/pq v1.10.9
|
||||||
|
github.com/paulmach/orb v0.9.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/rs/zerolog v1.29.1
|
github.com/rs/zerolog v1.29.1
|
||||||
github.com/spf13/viper v1.16.0
|
github.com/spf13/viper v1.16.0
|
||||||
|
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
|
||||||
google.golang.org/grpc v1.56.0
|
google.golang.org/grpc v1.56.0
|
||||||
google.golang.org/protobuf v1.31.0
|
google.golang.org/protobuf v1.31.0
|
||||||
gopkg.in/mail.v2 v2.3.1
|
gopkg.in/mail.v2 v2.3.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
cloud.google.com/go/maps v0.7.0 // indirect
|
||||||
github.com/coreos/go-semver v0.3.0 // indirect
|
github.com/coreos/go-semver v0.3.0 // indirect
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
|
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
|
||||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||||
github.com/go-stack/stack v1.8.0 // indirect
|
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.16.3 // indirect
|
github.com/klauspost/compress v1.16.3 // indirect
|
||||||
github.com/magiconair/properties v1.8.7 // indirect
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||||
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect
|
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect
|
||||||
|
@ -42,14 +44,15 @@ require (
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/subosito/gotenv v1.4.2 // indirect
|
github.com/subosito/gotenv v1.4.2 // indirect
|
||||||
|
github.com/twpayne/go-polyline v1.1.1 // indirect
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||||
github.com/xdg-go/scram v1.0.2 // indirect
|
github.com/xdg-go/scram v1.1.1 // indirect
|
||||||
github.com/xdg-go/stringprep v1.0.2 // indirect
|
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||||
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
||||||
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
||||||
go.mongodb.org/mongo-driver v1.9.1 // indirect
|
go.mongodb.org/mongo-driver v1.11.1 // indirect
|
||||||
go.uber.org/atomic v1.10.0 // indirect
|
go.uber.org/atomic v1.10.0 // indirect
|
||||||
go.uber.org/multierr v1.8.0 // indirect
|
go.uber.org/multierr v1.8.0 // indirect
|
||||||
go.uber.org/zap v1.21.0 // indirect
|
go.uber.org/zap v1.21.0 // indirect
|
||||||
|
@ -58,7 +61,6 @@ require (
|
||||||
golang.org/x/sync v0.1.0 // indirect
|
golang.org/x/sync v0.1.0 // indirect
|
||||||
golang.org/x/sys v0.8.0 // indirect
|
golang.org/x/sys v0.8.0 // indirect
|
||||||
golang.org/x/text v0.9.0 // indirect
|
golang.org/x/text v0.9.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
|
|
48
go.sum
48
go.sum
|
@ -28,6 +28,8 @@ cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvu
|
||||||
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
|
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||||
|
cloud.google.com/go/maps v0.7.0 h1:mv9YaczD4oZBZkM5XJl6fXQ984IkJNHPwkc8MUsdkBo=
|
||||||
|
cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY=
|
||||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||||
|
@ -39,8 +41,12 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
|
git.coopgo.io/coopgo-platform/geocode v0.0.0-20230329105149-1f31b361814e h1:v7Xjy0cfY6WRi3Z9BeqpW/1GNyhALitgFvRgs1gbtQE=
|
||||||
|
git.coopgo.io/coopgo-platform/geocode v0.0.0-20230329105149-1f31b361814e/go.mod h1:v1ZKauCJ989bUkLHmsGdaxEa0S/L2OajERePcRqwMM8=
|
||||||
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230430115320-f5bb2e7c2c26 h1:qiYVLLNU29xgT0RRj0Jz0WrjEJnz1Eng1X7l1UW9jGU=
|
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230430115320-f5bb2e7c2c26 h1:qiYVLLNU29xgT0RRj0Jz0WrjEJnz1Eng1X7l1UW9jGU=
|
||||||
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230430115320-f5bb2e7c2c26/go.mod h1:1typNYtO+PQT6KG77vs/PUv0fO60/nbeSGZL2tt1LLg=
|
git.coopgo.io/coopgo-platform/mobility-accounts v0.0.0-20230430115320-f5bb2e7c2c26/go.mod h1:1typNYtO+PQT6KG77vs/PUv0fO60/nbeSGZL2tt1LLg=
|
||||||
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230403183358-4d30329f06be h1:VIzWX8NftKzQX1clunLaMf79Ut1dygcCc/ZLV/iWOaY=
|
||||||
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230403183358-4d30329f06be/go.mod h1:Nh7o15LlV0OuO9zxvJIs9FlelpeAaLYkXtFdgIkFrgg=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
github.com/appleboy/gorush v1.16.3 h1:g0VfSEggVGoPY/RvOJp6aoCi2c6S1szGLgztvpnLpd0=
|
github.com/appleboy/gorush v1.16.3 h1:g0VfSEggVGoPY/RvOJp6aoCi2c6S1szGLgztvpnLpd0=
|
||||||
|
@ -48,8 +54,6 @@ github.com/appleboy/gorush v1.16.3/go.mod h1:ZWWQx7W9c7aptKnJuJxdo24leCcSfduINwa
|
||||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||||
|
@ -64,10 +68,7 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
|
@ -82,9 +83,6 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||||
github.com/go-redis/redis/v9 v9.0.0-rc.2 h1:IN1eI8AvJJeWHjMW/hlFAv2sAfvTun2DVksDDJ3a6a0=
|
|
||||||
github.com/go-redis/redis/v9 v9.0.0-rc.2/go.mod h1:cgBknjwcBJa2prbnuHH/4k/Mlj4r0pWNV2HBanHujfY=
|
|
||||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
|
@ -177,6 +175,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||||
|
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||||
|
@ -188,13 +188,14 @@ github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp9
|
||||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
|
||||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
|
||||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
|
||||||
github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
|
|
||||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
|
github.com/paulmach/orb v0.9.0 h1:MwA1DqOKtvCgm7u9RZ/pnYejTeDJPnr0+0oFajBbJqk=
|
||||||
|
github.com/paulmach/orb v0.9.0/go.mod h1:SudmOk85SXtmXAB3sLGyJ6tZy/8pdfrV0o6ef98Xc30=
|
||||||
|
github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
|
||||||
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
|
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
|
||||||
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
|
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
@ -224,6 +225,7 @@ github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc=
|
||||||
github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
|
github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
@ -240,12 +242,14 @@ github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8
|
||||||
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
||||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||||
|
github.com/twpayne/go-polyline v1.1.1 h1:/tSF1BR7rN4HWj4XKqvRUNrCiYVMCvywxTFVofvDV0w=
|
||||||
|
github.com/twpayne/go-polyline v1.1.1/go.mod h1:ybd9IWWivW/rlXPXuuckeKUyF3yrIim+iqA7kSl4NFY=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
|
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
|
||||||
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
|
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
|
||||||
github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc=
|
github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
|
||||||
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
|
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
@ -259,8 +263,8 @@ go.etcd.io/etcd/client/pkg/v3 v3.5.9 h1:oidDC4+YEuSIQbsR94rY9gur91UPL6DnxDCIYd2I
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4=
|
go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4=
|
||||||
go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E=
|
go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E=
|
||||||
go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA=
|
go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA=
|
||||||
go.mongodb.org/mongo-driver v1.9.1 h1:m078y9v7sBItkt1aaoe2YlvWEXcD263e1a4E1fBrJ1c=
|
go.mongodb.org/mongo-driver v1.11.1 h1:QP0znIRTuL0jf1oBQoAoM0C6ZJfBK4kx0Uumtv1A7w8=
|
||||||
go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY=
|
go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
|
||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
@ -284,8 +288,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
|
||||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
|
||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||||
|
@ -392,7 +396,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
@ -428,7 +431,6 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
@ -436,7 +438,6 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||||
|
@ -453,7 +454,6 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
|
||||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
@ -596,6 +596,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
||||||
|
@ -609,7 +610,6 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk=
|
gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk=
|
||||||
gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
|
gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.coopgo.io/coopgo-apps/silvermobi/models"
|
||||||
|
"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (h *SilvermobiHandler) 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
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/paulmach/orb"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
"google.golang.org/genproto/googleapis/maps/routing/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (h *SilvermobiHandler) 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 *SilvermobiHandler) 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 *SilvermobiHandler) 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]
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,15 +7,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type SilvermobiHandler struct {
|
type SilvermobiHandler struct {
|
||||||
Config *viper.Viper
|
Config *viper.Viper
|
||||||
Services *services.ServicesHandler
|
Services *services.ServicesHandler
|
||||||
KVHandler storage.KVHandler
|
Storage storage.Storage
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSilvermobiHandler(cfg *viper.Viper, services *services.ServicesHandler, KVHandler storage.KVHandler) (*SilvermobiHandler, error) {
|
func NewSilvermobiHandler(cfg *viper.Viper, services *services.ServicesHandler, storage storage.Storage) (*SilvermobiHandler, error) {
|
||||||
return &SilvermobiHandler{
|
return &SilvermobiHandler{
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
Services: services,
|
Services: services,
|
||||||
KVHandler: KVHandler,
|
Storage: storage,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
|
"git.coopgo.io/coopgo-apps/silvermobi/services"
|
||||||
|
"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||||
|
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)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *SilvermobiHandler) 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 *SilvermobiHandler) 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
|
||||||
|
|
||||||
|
}
|
|
@ -107,6 +107,22 @@ func (h *SilvermobiHandler) GetAccountType(ctx context.Context, id string) (acco
|
||||||
}
|
}
|
||||||
return "", errors.New("account type not set")
|
return "", errors.New("account type not set")
|
||||||
}
|
}
|
||||||
|
func (h *SilvermobiHandler) 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 *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) (phone_validation, birth_validation, type_validation bool, err error) {
|
||||||
request := &grpcapi.GetAccountRequest{
|
request := &grpcapi.GetAccountRequest{
|
||||||
|
@ -127,7 +143,6 @@ func (h *SilvermobiHandler) CheckValidation(ctx context.Context, id string) (pho
|
||||||
if account.BirthDate != "" {
|
if account.BirthDate != "" {
|
||||||
birth_validation = true
|
birth_validation = true
|
||||||
}
|
}
|
||||||
fmt.Println(account.Type)
|
|
||||||
if account.Type != "" {
|
if account.Type != "" {
|
||||||
type_validation = true
|
type_validation = true
|
||||||
}
|
}
|
||||||
|
|
5
main.go
5
main.go
|
@ -25,16 +25,15 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("failed starting services handler")
|
log.Fatal().Err(err).Msg("failed starting services handler")
|
||||||
}
|
}
|
||||||
kvhandler, err := storage.NewKVHandler(cfg)
|
storage, err := storage.NewPostgresqlStorage(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("failed starting storage handler")
|
log.Fatal().Err(err).Msg("failed starting storage handler")
|
||||||
}
|
}
|
||||||
|
|
||||||
handler, err := handler.NewSilvermobiHandler(cfg, services, kvhandler)
|
handler, err := handler.NewSilvermobiHandler(cfg, services, storage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("failed starting ridygo handler")
|
log.Fatal().Err(err).Msg("failed starting ridygo handler")
|
||||||
}
|
}
|
||||||
|
|
||||||
failed := make(chan error)
|
failed := make(chan error)
|
||||||
|
|
||||||
if grpc_enable {
|
if grpc_enable {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
type Account struct {
|
type Account struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
FirstName string `json:"firstName,omitempty"`
|
FirstName string `json:"firstName,omitempty"`
|
||||||
LastName string `json:"lastName,omitempty"`
|
LastName string `json:"lastName,omitempty"`
|
||||||
VerifiedIdentity *bool `json:"verifiedIdentity,omitempty"`
|
VerifiedIdentity *bool `json:"verifiedIdentity,omitempty"`
|
||||||
|
@ -15,6 +16,12 @@ type Account struct {
|
||||||
LocalCredentials
|
LocalCredentials
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
ID string `json:"user_id"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
BookingID string `json:"booking_id"`
|
||||||
|
}
|
||||||
|
|
||||||
type LocalCredentials struct {
|
type LocalCredentials struct {
|
||||||
Email string
|
Email string
|
||||||
EmailVerified bool
|
EmailVerified bool
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
import "google/protobuf/timestamp.proto";
|
import "google/protobuf/timestamp.proto";
|
||||||
|
import "google/protobuf/struct.proto";
|
||||||
option go_package = "git.coopgo.io/coopgo-apps/silvermobi/grpcapi/proto";
|
option go_package = "git.coopgo.io/coopgo-apps/silvermobi/grpcapi/proto";
|
||||||
|
|
||||||
service SilvermobiGRPC {
|
service SilvermobiGRPC {
|
||||||
|
@ -16,10 +17,28 @@ service SilvermobiGRPC {
|
||||||
rpc SetKeyValue(KeyValueRequest) returns (KeyValueResponse) {}
|
rpc SetKeyValue(KeyValueRequest) returns (KeyValueResponse) {}
|
||||||
rpc GetKeyValue(KeyRequest) returns (ValueResponse) {}
|
rpc GetKeyValue(KeyRequest) returns (ValueResponse) {}
|
||||||
rpc GetValidation(ValidationRequest) returns (ValidationResponse) {}
|
rpc GetValidation(ValidationRequest) returns (ValidationResponse) {}
|
||||||
|
rpc GeoAutocomplete( GeoAutocompleteRequest) returns (GeoAutocompleteResponse) {}
|
||||||
|
rpc GeoRoute(GeoRouteRequest) returns (GeoRouteResponse) {}
|
||||||
|
rpc GeoRouteWithReturn(GeoRouteWithReturnRequest) returns (GeoRouteWithReturnResponse) {}
|
||||||
|
rpc PutFirebaseToken(FirebaseTokenRequest) returns (FirebaseTokenResponse) {}
|
||||||
|
rpc GetAccountInfo(AccountInfoRequest) returns (AccountInfoResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message AccountInfoRequest {
|
||||||
|
|
||||||
|
}
|
||||||
|
message AccountInfoResponse{
|
||||||
|
string first_name = 1;
|
||||||
|
string last_name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FirebaseTokenRequest {
|
||||||
|
string token = 1;
|
||||||
|
string device_platform = 2;
|
||||||
|
}
|
||||||
|
message FirebaseTokenResponse {
|
||||||
|
bool result = 1;
|
||||||
|
}
|
||||||
message AuthLoginRequest {
|
message AuthLoginRequest {
|
||||||
string username = 1;
|
string username = 1;
|
||||||
string password = 2;
|
string password = 2;
|
||||||
|
@ -61,20 +80,20 @@ message UpdatePasswordResponse{
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetPhoneNumberRequest {
|
message SetPhoneNumberRequest {
|
||||||
string phone_number = 1;
|
string phone_number = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetPhoneNumberResponse {
|
message SetPhoneNumberResponse {
|
||||||
bool ok = 1;
|
bool ok = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message VerifyPhoneNumberRequest {
|
message VerifyPhoneNumberRequest {
|
||||||
string phone_number = 1;
|
string phone_number = 1;
|
||||||
string verification_code = 2;
|
string verification_code = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message VerifyPhoneNumberResponse {
|
message VerifyPhoneNumberResponse {
|
||||||
bool ok = 1;
|
bool ok = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message BirthDateRequest {
|
message BirthDateRequest {
|
||||||
|
@ -126,4 +145,56 @@ message AccountTypeResponse {
|
||||||
DRIVER = 1;
|
DRIVER = 1;
|
||||||
}
|
}
|
||||||
optional AccountType type = 2;
|
optional AccountType type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GeoAutocompleteRequest {
|
||||||
|
string text = 60;
|
||||||
|
double lat = 61;
|
||||||
|
double lon = 62;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GeoAutocompleteResponse {
|
||||||
|
oneof feature_collection {
|
||||||
|
string feature_collection_raw = 1;
|
||||||
|
FeatureCollection feature_collection_impl = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GeoRouteRequest {
|
||||||
|
oneof locations {
|
||||||
|
string locations_raw = 1;
|
||||||
|
FeatureCollection locations_impl = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GeoRouteResponse {
|
||||||
|
string polyline = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GeoRouteWithReturnRequest {
|
||||||
|
oneof locations {
|
||||||
|
string locations_raw = 1;
|
||||||
|
FeatureCollection locations_impl = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GeoRouteWithReturnResponse {
|
||||||
|
string polyline = 1;
|
||||||
|
string return_polyline = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FeatureCollection {
|
||||||
|
string type = 1;
|
||||||
|
repeated double bbox = 2;
|
||||||
|
repeated Feature_ features = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Feature_ {
|
||||||
|
string id = 1;
|
||||||
|
string type = 2;
|
||||||
|
repeated double bbox = 3;
|
||||||
|
Geometry geometry = 4;
|
||||||
|
google.protobuf.Struct properties = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Geometry {}
|
|
@ -19,18 +19,23 @@ import (
|
||||||
const _ = grpc.SupportPackageIsVersion7
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SilvermobiGRPC_AuthLogin_FullMethodName = "/SilvermobiGRPC/AuthLogin"
|
SilvermobiGRPC_AuthLogin_FullMethodName = "/SilvermobiGRPC/AuthLogin"
|
||||||
SilvermobiGRPC_AuthRegister_FullMethodName = "/SilvermobiGRPC/AuthRegister"
|
SilvermobiGRPC_AuthRegister_FullMethodName = "/SilvermobiGRPC/AuthRegister"
|
||||||
SilvermobiGRPC_ForgetAccount_FullMethodName = "/SilvermobiGRPC/ForgetAccount"
|
SilvermobiGRPC_ForgetAccount_FullMethodName = "/SilvermobiGRPC/ForgetAccount"
|
||||||
SilvermobiGRPC_UpdatePassword_FullMethodName = "/SilvermobiGRPC/UpdatePassword"
|
SilvermobiGRPC_UpdatePassword_FullMethodName = "/SilvermobiGRPC/UpdatePassword"
|
||||||
SilvermobiGRPC_SetPhoneNumber_FullMethodName = "/SilvermobiGRPC/SetPhoneNumber"
|
SilvermobiGRPC_SetPhoneNumber_FullMethodName = "/SilvermobiGRPC/SetPhoneNumber"
|
||||||
SilvermobiGRPC_VerifyPhoneNumber_FullMethodName = "/SilvermobiGRPC/VerifyPhoneNumber"
|
SilvermobiGRPC_VerifyPhoneNumber_FullMethodName = "/SilvermobiGRPC/VerifyPhoneNumber"
|
||||||
SilvermobiGRPC_SetBirthDate_FullMethodName = "/SilvermobiGRPC/SetBirthDate"
|
SilvermobiGRPC_SetBirthDate_FullMethodName = "/SilvermobiGRPC/SetBirthDate"
|
||||||
SilvermobiGRPC_SetAccountType_FullMethodName = "/SilvermobiGRPC/SetAccountType"
|
SilvermobiGRPC_SetAccountType_FullMethodName = "/SilvermobiGRPC/SetAccountType"
|
||||||
SilvermobiGRPC_GetAccountType_FullMethodName = "/SilvermobiGRPC/GetAccountType"
|
SilvermobiGRPC_GetAccountType_FullMethodName = "/SilvermobiGRPC/GetAccountType"
|
||||||
SilvermobiGRPC_SetKeyValue_FullMethodName = "/SilvermobiGRPC/SetKeyValue"
|
SilvermobiGRPC_SetKeyValue_FullMethodName = "/SilvermobiGRPC/SetKeyValue"
|
||||||
SilvermobiGRPC_GetKeyValue_FullMethodName = "/SilvermobiGRPC/GetKeyValue"
|
SilvermobiGRPC_GetKeyValue_FullMethodName = "/SilvermobiGRPC/GetKeyValue"
|
||||||
SilvermobiGRPC_GetValidation_FullMethodName = "/SilvermobiGRPC/GetValidation"
|
SilvermobiGRPC_GetValidation_FullMethodName = "/SilvermobiGRPC/GetValidation"
|
||||||
|
SilvermobiGRPC_GeoAutocomplete_FullMethodName = "/SilvermobiGRPC/GeoAutocomplete"
|
||||||
|
SilvermobiGRPC_GeoRoute_FullMethodName = "/SilvermobiGRPC/GeoRoute"
|
||||||
|
SilvermobiGRPC_GeoRouteWithReturn_FullMethodName = "/SilvermobiGRPC/GeoRouteWithReturn"
|
||||||
|
SilvermobiGRPC_PutFirebaseToken_FullMethodName = "/SilvermobiGRPC/PutFirebaseToken"
|
||||||
|
SilvermobiGRPC_GetAccountInfo_FullMethodName = "/SilvermobiGRPC/GetAccountInfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SilvermobiGRPCClient is the client API for SilvermobiGRPC service.
|
// SilvermobiGRPCClient is the client API for SilvermobiGRPC service.
|
||||||
|
@ -49,6 +54,11 @@ type SilvermobiGRPCClient interface {
|
||||||
SetKeyValue(ctx context.Context, in *KeyValueRequest, opts ...grpc.CallOption) (*KeyValueResponse, error)
|
SetKeyValue(ctx context.Context, in *KeyValueRequest, opts ...grpc.CallOption) (*KeyValueResponse, error)
|
||||||
GetKeyValue(ctx context.Context, in *KeyRequest, opts ...grpc.CallOption) (*ValueResponse, error)
|
GetKeyValue(ctx context.Context, in *KeyRequest, opts ...grpc.CallOption) (*ValueResponse, error)
|
||||||
GetValidation(ctx context.Context, in *ValidationRequest, opts ...grpc.CallOption) (*ValidationResponse, error)
|
GetValidation(ctx context.Context, in *ValidationRequest, opts ...grpc.CallOption) (*ValidationResponse, error)
|
||||||
|
GeoAutocomplete(ctx context.Context, in *GeoAutocompleteRequest, opts ...grpc.CallOption) (*GeoAutocompleteResponse, error)
|
||||||
|
GeoRoute(ctx context.Context, in *GeoRouteRequest, opts ...grpc.CallOption) (*GeoRouteResponse, error)
|
||||||
|
GeoRouteWithReturn(ctx context.Context, in *GeoRouteWithReturnRequest, opts ...grpc.CallOption) (*GeoRouteWithReturnResponse, error)
|
||||||
|
PutFirebaseToken(ctx context.Context, in *FirebaseTokenRequest, opts ...grpc.CallOption) (*FirebaseTokenResponse, error)
|
||||||
|
GetAccountInfo(ctx context.Context, in *AccountInfoRequest, opts ...grpc.CallOption) (*AccountInfoResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type silvermobiGRPCClient struct {
|
type silvermobiGRPCClient struct {
|
||||||
|
@ -167,6 +177,51 @@ func (c *silvermobiGRPCClient) GetValidation(ctx context.Context, in *Validation
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *silvermobiGRPCClient) GeoAutocomplete(ctx context.Context, in *GeoAutocompleteRequest, opts ...grpc.CallOption) (*GeoAutocompleteResponse, error) {
|
||||||
|
out := new(GeoAutocompleteResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SilvermobiGRPC_GeoAutocomplete_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *silvermobiGRPCClient) GeoRoute(ctx context.Context, in *GeoRouteRequest, opts ...grpc.CallOption) (*GeoRouteResponse, error) {
|
||||||
|
out := new(GeoRouteResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SilvermobiGRPC_GeoRoute_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *silvermobiGRPCClient) GeoRouteWithReturn(ctx context.Context, in *GeoRouteWithReturnRequest, opts ...grpc.CallOption) (*GeoRouteWithReturnResponse, error) {
|
||||||
|
out := new(GeoRouteWithReturnResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SilvermobiGRPC_GeoRouteWithReturn_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *silvermobiGRPCClient) PutFirebaseToken(ctx context.Context, in *FirebaseTokenRequest, opts ...grpc.CallOption) (*FirebaseTokenResponse, error) {
|
||||||
|
out := new(FirebaseTokenResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SilvermobiGRPC_PutFirebaseToken_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *silvermobiGRPCClient) GetAccountInfo(ctx context.Context, in *AccountInfoRequest, opts ...grpc.CallOption) (*AccountInfoResponse, error) {
|
||||||
|
out := new(AccountInfoResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SilvermobiGRPC_GetAccountInfo_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// SilvermobiGRPCServer is the server API for SilvermobiGRPC service.
|
// SilvermobiGRPCServer is the server API for SilvermobiGRPC service.
|
||||||
// All implementations must embed UnimplementedSilvermobiGRPCServer
|
// All implementations must embed UnimplementedSilvermobiGRPCServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
|
@ -183,6 +238,11 @@ type SilvermobiGRPCServer interface {
|
||||||
SetKeyValue(context.Context, *KeyValueRequest) (*KeyValueResponse, error)
|
SetKeyValue(context.Context, *KeyValueRequest) (*KeyValueResponse, error)
|
||||||
GetKeyValue(context.Context, *KeyRequest) (*ValueResponse, error)
|
GetKeyValue(context.Context, *KeyRequest) (*ValueResponse, error)
|
||||||
GetValidation(context.Context, *ValidationRequest) (*ValidationResponse, error)
|
GetValidation(context.Context, *ValidationRequest) (*ValidationResponse, error)
|
||||||
|
GeoAutocomplete(context.Context, *GeoAutocompleteRequest) (*GeoAutocompleteResponse, error)
|
||||||
|
GeoRoute(context.Context, *GeoRouteRequest) (*GeoRouteResponse, error)
|
||||||
|
GeoRouteWithReturn(context.Context, *GeoRouteWithReturnRequest) (*GeoRouteWithReturnResponse, error)
|
||||||
|
PutFirebaseToken(context.Context, *FirebaseTokenRequest) (*FirebaseTokenResponse, error)
|
||||||
|
GetAccountInfo(context.Context, *AccountInfoRequest) (*AccountInfoResponse, error)
|
||||||
mustEmbedUnimplementedSilvermobiGRPCServer()
|
mustEmbedUnimplementedSilvermobiGRPCServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +286,21 @@ func (UnimplementedSilvermobiGRPCServer) GetKeyValue(context.Context, *KeyReques
|
||||||
func (UnimplementedSilvermobiGRPCServer) GetValidation(context.Context, *ValidationRequest) (*ValidationResponse, error) {
|
func (UnimplementedSilvermobiGRPCServer) GetValidation(context.Context, *ValidationRequest) (*ValidationResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetValidation not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetValidation not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedSilvermobiGRPCServer) GeoAutocomplete(context.Context, *GeoAutocompleteRequest) (*GeoAutocompleteResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GeoAutocomplete not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSilvermobiGRPCServer) GeoRoute(context.Context, *GeoRouteRequest) (*GeoRouteResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GeoRoute not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSilvermobiGRPCServer) GeoRouteWithReturn(context.Context, *GeoRouteWithReturnRequest) (*GeoRouteWithReturnResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GeoRouteWithReturn not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSilvermobiGRPCServer) PutFirebaseToken(context.Context, *FirebaseTokenRequest) (*FirebaseTokenResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method PutFirebaseToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSilvermobiGRPCServer) GetAccountInfo(context.Context, *AccountInfoRequest) (*AccountInfoResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetAccountInfo not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedSilvermobiGRPCServer) mustEmbedUnimplementedSilvermobiGRPCServer() {}
|
func (UnimplementedSilvermobiGRPCServer) mustEmbedUnimplementedSilvermobiGRPCServer() {}
|
||||||
|
|
||||||
// UnsafeSilvermobiGRPCServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeSilvermobiGRPCServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
@ -455,6 +530,96 @@ func _SilvermobiGRPC_GetValidation_Handler(srv interface{}, ctx context.Context,
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _SilvermobiGRPC_GeoAutocomplete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GeoAutocompleteRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SilvermobiGRPCServer).GeoAutocomplete(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SilvermobiGRPC_GeoAutocomplete_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SilvermobiGRPCServer).GeoAutocomplete(ctx, req.(*GeoAutocompleteRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SilvermobiGRPC_GeoRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GeoRouteRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SilvermobiGRPCServer).GeoRoute(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SilvermobiGRPC_GeoRoute_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SilvermobiGRPCServer).GeoRoute(ctx, req.(*GeoRouteRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SilvermobiGRPC_GeoRouteWithReturn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GeoRouteWithReturnRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SilvermobiGRPCServer).GeoRouteWithReturn(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SilvermobiGRPC_GeoRouteWithReturn_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SilvermobiGRPCServer).GeoRouteWithReturn(ctx, req.(*GeoRouteWithReturnRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SilvermobiGRPC_PutFirebaseToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(FirebaseTokenRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SilvermobiGRPCServer).PutFirebaseToken(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SilvermobiGRPC_PutFirebaseToken_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SilvermobiGRPCServer).PutFirebaseToken(ctx, req.(*FirebaseTokenRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SilvermobiGRPC_GetAccountInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(AccountInfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SilvermobiGRPCServer).GetAccountInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SilvermobiGRPC_GetAccountInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SilvermobiGRPCServer).GetAccountInfo(ctx, req.(*AccountInfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// SilvermobiGRPC_ServiceDesc is the grpc.ServiceDesc for SilvermobiGRPC service.
|
// SilvermobiGRPC_ServiceDesc is the grpc.ServiceDesc for SilvermobiGRPC service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
@ -510,6 +675,26 @@ var SilvermobiGRPC_ServiceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "GetValidation",
|
MethodName: "GetValidation",
|
||||||
Handler: _SilvermobiGRPC_GetValidation_Handler,
|
Handler: _SilvermobiGRPC_GetValidation_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GeoAutocomplete",
|
||||||
|
Handler: _SilvermobiGRPC_GeoAutocomplete_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GeoRoute",
|
||||||
|
Handler: _SilvermobiGRPC_GeoRoute_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GeoRouteWithReturn",
|
||||||
|
Handler: _SilvermobiGRPC_GeoRouteWithReturn_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "PutFirebaseToken",
|
||||||
|
Handler: _SilvermobiGRPC_PutFirebaseToken_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetAccountInfo",
|
||||||
|
Handler: _SilvermobiGRPC_GetAccountInfo_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "silvermobi-service.proto",
|
Metadata: "silvermobi-service.proto",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,137 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
option go_package = "git.coopgo.io/coopgo-platform/solidarity-service/servers/grpc/proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
message Feature {
|
||||||
|
double lat = 1;
|
||||||
|
double long = 2;
|
||||||
|
string address = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverJourney {
|
||||||
|
User user = 1;
|
||||||
|
optional Car car = 2;
|
||||||
|
google.protobuf.Timestamp driver_departure_Date = 3;
|
||||||
|
optional Price price = 4;
|
||||||
|
string driver_departure_Address = 5;
|
||||||
|
oneof availabilities {
|
||||||
|
RepeatedPunctualAvailabilitySlot repeated_punctual_availabilities = 6;
|
||||||
|
RepeatedRegularAvailabilitySlot repeated_regular_availabilities = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message RepeatedPunctualAvailabilitySlot {
|
||||||
|
repeated PunctualAvailabilitySlot punctual_availabilities = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RepeatedRegularAvailabilitySlot {
|
||||||
|
repeated RegularAvailabilitySlot regular_availabilities = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverRequest{
|
||||||
|
Feature driver_address = 1;
|
||||||
|
int32 driver_radius = 2;
|
||||||
|
User driver = 3;
|
||||||
|
optional Preferences preferences = 4;
|
||||||
|
optional Car car = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PunctualAvailabilitySlot {
|
||||||
|
google.protobuf.Timestamp date = 1;
|
||||||
|
string startTime = 2;
|
||||||
|
string endTime = 3;
|
||||||
|
}
|
||||||
|
message RegularAvailabilitySlot {
|
||||||
|
DayOfWeek dayOfWeek = 1;
|
||||||
|
string startTime = 2;
|
||||||
|
string endTime = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DayOfWeek {
|
||||||
|
MON = 0;
|
||||||
|
TUE = 1;
|
||||||
|
WED = 3;
|
||||||
|
THU = 4;
|
||||||
|
FRI = 5;
|
||||||
|
SAT = 6;
|
||||||
|
SUN = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BookingRequest {
|
||||||
|
string id = 1;
|
||||||
|
string passengerId = 2;
|
||||||
|
string driverId = 3;
|
||||||
|
BookingStatus status = 4;
|
||||||
|
Feature departure_address =5;
|
||||||
|
Feature destination_address = 6;
|
||||||
|
google.protobuf.Timestamp pickup_date = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Booking {
|
||||||
|
string id = 1;
|
||||||
|
User driver = 2;
|
||||||
|
User passenger = 3;
|
||||||
|
google.protobuf.Timestamp passengerPickupDate =4;
|
||||||
|
Feature passenger_departure_route = 5;
|
||||||
|
Feature passenger_destination_route = 6;
|
||||||
|
BookingStatus status = 7;
|
||||||
|
optional int64 duration = 8;
|
||||||
|
optional int64 distance = 9;
|
||||||
|
Price price = 10;
|
||||||
|
optional Car car = 11;
|
||||||
|
google.protobuf.Timestamp pickup_date = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message Car {
|
||||||
|
optional string model = 1;
|
||||||
|
optional string brand = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Preferences {
|
||||||
|
optional bool smoking = 1;
|
||||||
|
optional bool animals = 2;
|
||||||
|
optional bool music = 3;
|
||||||
|
optional bool is_talker = 4;
|
||||||
|
optional int64 luggage_size = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum PriceType {
|
||||||
|
FREE = 0;
|
||||||
|
PAYING = 1;
|
||||||
|
UNKNOWN = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Price {
|
||||||
|
optional PriceType type = 1;
|
||||||
|
optional double amount = 2;
|
||||||
|
optional string currency = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message User {
|
||||||
|
string id = 1;
|
||||||
|
string alias = 2;
|
||||||
|
optional string first_name = 3;
|
||||||
|
optional string last_name = 4;
|
||||||
|
optional int64 grade = 5;
|
||||||
|
optional string picture = 6;
|
||||||
|
optional string gender = 7;
|
||||||
|
optional bool verified_identity = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum BookingStatus {
|
||||||
|
INITIATED = 0;
|
||||||
|
WAITING_DRIVER_CONFIRMATION = 1;
|
||||||
|
WAITING_PASSENGER_CONFIRMATION = 2;
|
||||||
|
CONFIRMED = 3;
|
||||||
|
CANCELLED = 4;
|
||||||
|
COMPLETED_PENDING_VALIDATION = 5;
|
||||||
|
VALIDATED = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum UserType{
|
||||||
|
driver = 0;
|
||||||
|
passenger = 1;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,88 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
option go_package = "git.coopgo.io/coopgo-platform/solidarity-service/servers/grpc/proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
import "solidarity-api-types.proto";
|
||||||
|
|
||||||
|
service SolidarityService {
|
||||||
|
rpc SetDriverRegularAvailabilities(DriverRegularAvailabilities) returns (DriverAvailabilitiesResponse) {}
|
||||||
|
rpc SetDriverPunctualAvailabilities(DriverPunctualAvailabilities) returns (DriverAvailabilitiesResponse) {}
|
||||||
|
rpc CreateBooking(CreateBookingRequest) returns (CreateBookingResponse) {}
|
||||||
|
rpc UpdateBooking(UpdateBookingRequest) returns (UpdateBookingResponse) {}
|
||||||
|
rpc GetBooking(GetBookingRequest) returns (GetBookingResponse) {}
|
||||||
|
rpc GetBookingsByStatus(GetBookingsByStatusRequest) returns (GetBookingsByStatusResponse) {}
|
||||||
|
rpc DriverJourneys(DriverJourneysRequest) returns (DriverJourneysResponse) {}
|
||||||
|
rpc SetPassengerTrip(PassengerTripRequest) returns (PassengerTripResponse) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message PassengerTripRequest{
|
||||||
|
User passenger = 1;
|
||||||
|
optional Preferences preferences = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverRegularAvailabilities{
|
||||||
|
|
||||||
|
DriverRequest driver_request = 1;
|
||||||
|
repeated RegularAvailabilitySlot driver_availabilities = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverPunctualAvailabilities{
|
||||||
|
DriverRequest driver_request = 1;
|
||||||
|
repeated PunctualAvailabilitySlot driver_availabilities = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PassengerTripResponse {
|
||||||
|
bool success = 1;
|
||||||
|
optional string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverAvailabilitiesResponse {
|
||||||
|
bool success = 1;
|
||||||
|
optional string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateBookingRequest {
|
||||||
|
BookingRequest booking = 1;
|
||||||
|
}
|
||||||
|
message CreateBookingResponse {
|
||||||
|
Booking booking = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateBookingRequest {
|
||||||
|
string booking_id = 1;
|
||||||
|
BookingStatus status = 2;
|
||||||
|
optional string message = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateBookingResponse {
|
||||||
|
bool success = 1;
|
||||||
|
optional string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetBookingRequest {
|
||||||
|
string booking_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message GetBookingResponse {
|
||||||
|
Booking booking = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetBookingsByStatusRequest{
|
||||||
|
BookingStatus status = 1;
|
||||||
|
UserType type = 2;
|
||||||
|
string user_id = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverJourneysRequest {
|
||||||
|
Feature departure = 1;
|
||||||
|
google.protobuf.Timestamp departure_date = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DriverJourneysResponse {
|
||||||
|
repeated DriverJourney driver_journeys = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetBookingsByStatusResponse{
|
||||||
|
repeated Booking booking = 1;
|
||||||
|
}
|
|
@ -0,0 +1,368 @@
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.3.0
|
||||||
|
// - protoc v3.12.4
|
||||||
|
// source: solidarity-api.proto
|
||||||
|
|
||||||
|
package proto
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
const (
|
||||||
|
SolidarityService_SetDriverRegularAvailabilities_FullMethodName = "/SolidarityService/SetDriverRegularAvailabilities"
|
||||||
|
SolidarityService_SetDriverPunctualAvailabilities_FullMethodName = "/SolidarityService/SetDriverPunctualAvailabilities"
|
||||||
|
SolidarityService_CreateBooking_FullMethodName = "/SolidarityService/CreateBooking"
|
||||||
|
SolidarityService_UpdateBooking_FullMethodName = "/SolidarityService/UpdateBooking"
|
||||||
|
SolidarityService_GetBooking_FullMethodName = "/SolidarityService/GetBooking"
|
||||||
|
SolidarityService_GetBookingsByStatus_FullMethodName = "/SolidarityService/GetBookingsByStatus"
|
||||||
|
SolidarityService_DriverJourneys_FullMethodName = "/SolidarityService/DriverJourneys"
|
||||||
|
SolidarityService_SetPassengerTrip_FullMethodName = "/SolidarityService/SetPassengerTrip"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SolidarityServiceClient is the client API for SolidarityService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type SolidarityServiceClient interface {
|
||||||
|
SetDriverRegularAvailabilities(ctx context.Context, in *DriverRegularAvailabilities, opts ...grpc.CallOption) (*DriverAvailabilitiesResponse, error)
|
||||||
|
SetDriverPunctualAvailabilities(ctx context.Context, in *DriverPunctualAvailabilities, opts ...grpc.CallOption) (*DriverAvailabilitiesResponse, error)
|
||||||
|
CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error)
|
||||||
|
UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error)
|
||||||
|
GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error)
|
||||||
|
GetBookingsByStatus(ctx context.Context, in *GetBookingsByStatusRequest, opts ...grpc.CallOption) (*GetBookingsByStatusResponse, error)
|
||||||
|
DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error)
|
||||||
|
SetPassengerTrip(ctx context.Context, in *PassengerTripRequest, opts ...grpc.CallOption) (*PassengerTripResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type solidarityServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSolidarityServiceClient(cc grpc.ClientConnInterface) SolidarityServiceClient {
|
||||||
|
return &solidarityServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) SetDriverRegularAvailabilities(ctx context.Context, in *DriverRegularAvailabilities, opts ...grpc.CallOption) (*DriverAvailabilitiesResponse, error) {
|
||||||
|
out := new(DriverAvailabilitiesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_SetDriverRegularAvailabilities_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) SetDriverPunctualAvailabilities(ctx context.Context, in *DriverPunctualAvailabilities, opts ...grpc.CallOption) (*DriverAvailabilitiesResponse, error) {
|
||||||
|
out := new(DriverAvailabilitiesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_SetDriverPunctualAvailabilities_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error) {
|
||||||
|
out := new(CreateBookingResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_CreateBooking_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error) {
|
||||||
|
out := new(UpdateBookingResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_UpdateBooking_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error) {
|
||||||
|
out := new(GetBookingResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_GetBooking_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) GetBookingsByStatus(ctx context.Context, in *GetBookingsByStatusRequest, opts ...grpc.CallOption) (*GetBookingsByStatusResponse, error) {
|
||||||
|
out := new(GetBookingsByStatusResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_GetBookingsByStatus_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error) {
|
||||||
|
out := new(DriverJourneysResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_DriverJourneys_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *solidarityServiceClient) SetPassengerTrip(ctx context.Context, in *PassengerTripRequest, opts ...grpc.CallOption) (*PassengerTripResponse, error) {
|
||||||
|
out := new(PassengerTripResponse)
|
||||||
|
err := c.cc.Invoke(ctx, SolidarityService_SetPassengerTrip_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SolidarityServiceServer is the server API for SolidarityService service.
|
||||||
|
// All implementations must embed UnimplementedSolidarityServiceServer
|
||||||
|
// for forward compatibility
|
||||||
|
type SolidarityServiceServer interface {
|
||||||
|
SetDriverRegularAvailabilities(context.Context, *DriverRegularAvailabilities) (*DriverAvailabilitiesResponse, error)
|
||||||
|
SetDriverPunctualAvailabilities(context.Context, *DriverPunctualAvailabilities) (*DriverAvailabilitiesResponse, error)
|
||||||
|
CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error)
|
||||||
|
UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error)
|
||||||
|
GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error)
|
||||||
|
GetBookingsByStatus(context.Context, *GetBookingsByStatusRequest) (*GetBookingsByStatusResponse, error)
|
||||||
|
DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error)
|
||||||
|
SetPassengerTrip(context.Context, *PassengerTripRequest) (*PassengerTripResponse, error)
|
||||||
|
mustEmbedUnimplementedSolidarityServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedSolidarityServiceServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedSolidarityServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedSolidarityServiceServer) SetDriverRegularAvailabilities(context.Context, *DriverRegularAvailabilities) (*DriverAvailabilitiesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SetDriverRegularAvailabilities not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) SetDriverPunctualAvailabilities(context.Context, *DriverPunctualAvailabilities) (*DriverAvailabilitiesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SetDriverPunctualAvailabilities not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CreateBooking not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetBooking not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) GetBookingsByStatus(context.Context, *GetBookingsByStatusRequest) (*GetBookingsByStatusResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetBookingsByStatus not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method DriverJourneys not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) SetPassengerTrip(context.Context, *PassengerTripRequest) (*PassengerTripResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SetPassengerTrip not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSolidarityServiceServer) mustEmbedUnimplementedSolidarityServiceServer() {}
|
||||||
|
|
||||||
|
// UnsafeSolidarityServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to SolidarityServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeSolidarityServiceServer interface {
|
||||||
|
mustEmbedUnimplementedSolidarityServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterSolidarityServiceServer(s grpc.ServiceRegistrar, srv SolidarityServiceServer) {
|
||||||
|
s.RegisterService(&SolidarityService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_SetDriverRegularAvailabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DriverRegularAvailabilities)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).SetDriverRegularAvailabilities(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_SetDriverRegularAvailabilities_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).SetDriverRegularAvailabilities(ctx, req.(*DriverRegularAvailabilities))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_SetDriverPunctualAvailabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DriverPunctualAvailabilities)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).SetDriverPunctualAvailabilities(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_SetDriverPunctualAvailabilities_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).SetDriverPunctualAvailabilities(ctx, req.(*DriverPunctualAvailabilities))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_CreateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CreateBookingRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).CreateBooking(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_CreateBooking_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).CreateBooking(ctx, req.(*CreateBookingRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_UpdateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateBookingRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).UpdateBooking(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_UpdateBooking_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).UpdateBooking(ctx, req.(*UpdateBookingRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_GetBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetBookingRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).GetBooking(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_GetBooking_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).GetBooking(ctx, req.(*GetBookingRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_GetBookingsByStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetBookingsByStatusRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).GetBookingsByStatus(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_GetBookingsByStatus_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).GetBookingsByStatus(ctx, req.(*GetBookingsByStatusRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_DriverJourneys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DriverJourneysRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).DriverJourneys(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_DriverJourneys_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).DriverJourneys(ctx, req.(*DriverJourneysRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _SolidarityService_SetPassengerTrip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(PassengerTripRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(SolidarityServiceServer).SetPassengerTrip(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: SolidarityService_SetPassengerTrip_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(SolidarityServiceServer).SetPassengerTrip(ctx, req.(*PassengerTripRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SolidarityService_ServiceDesc is the grpc.ServiceDesc for SolidarityService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var SolidarityService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "SolidarityService",
|
||||||
|
HandlerType: (*SolidarityServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "SetDriverRegularAvailabilities",
|
||||||
|
Handler: _SolidarityService_SetDriverRegularAvailabilities_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SetDriverPunctualAvailabilities",
|
||||||
|
Handler: _SolidarityService_SetDriverPunctualAvailabilities_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CreateBooking",
|
||||||
|
Handler: _SolidarityService_CreateBooking_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateBooking",
|
||||||
|
Handler: _SolidarityService_UpdateBooking_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetBooking",
|
||||||
|
Handler: _SolidarityService_GetBooking_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetBookingsByStatus",
|
||||||
|
Handler: _SolidarityService_GetBookingsByStatus_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "DriverJourneys",
|
||||||
|
Handler: _SolidarityService_DriverJourneys_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SetPassengerTrip",
|
||||||
|
Handler: _SolidarityService_SetPassengerTrip_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "solidarity-api.proto",
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package grpcserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s SilvermobiGRPCService) GetAccountInfo(ctx context.Context, req *grpcproto.AccountInfoRequest) (res *grpcproto.AccountInfoResponse, err error) {
|
||||||
|
md, ok := metadata.FromIncomingContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
|
||||||
|
}
|
||||||
|
authHeader, ok := md["authorization"]
|
||||||
|
if !ok || len(authHeader) == 0 {
|
||||||
|
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
|
||||||
|
}
|
||||||
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
account, err := s.Handler.GetAccountInfos(context.Background(), id)
|
||||||
|
log.Info().
|
||||||
|
Str("ID", account.ID).
|
||||||
|
Msg("GetAccountInfo")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &grpcproto.AccountInfoResponse{
|
||||||
|
FirstName: account.FirstName,
|
||||||
|
LastName: account.LastName,
|
||||||
|
}, nil
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package grpcserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s SilvermobiGRPCService) PutFirebaseToken(ctx context.Context, req *grpcproto.FirebaseTokenRequest) (resp *grpcproto.FirebaseTokenResponse, err error) {
|
||||||
|
|
||||||
|
if req.Token == "" || req.DevicePlatform == "" {
|
||||||
|
return &grpcproto.FirebaseTokenResponse{
|
||||||
|
Result: false,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
md, ok := metadata.FromIncomingContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
return &grpcproto.FirebaseTokenResponse{
|
||||||
|
Result: false,
|
||||||
|
}, status.Errorf(codes.Unauthenticated, "Missing metadata")
|
||||||
|
}
|
||||||
|
authHeader, ok := md["authorization"]
|
||||||
|
if !ok || len(authHeader) == 0 {
|
||||||
|
return &grpcproto.FirebaseTokenResponse{
|
||||||
|
Result: false,
|
||||||
|
}, status.Errorf(codes.Unauthenticated, "Missing authorization header")
|
||||||
|
}
|
||||||
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", id).
|
||||||
|
Msg("PutFirebaseToken")
|
||||||
|
err = s.Handler.PutFirebase(context.Background(), id, req.Token, req.DevicePlatform)
|
||||||
|
if err != nil {
|
||||||
|
return &grpcproto.FirebaseTokenResponse{
|
||||||
|
Result: false,
|
||||||
|
}, status.Errorf(codes.Unknown, "Database error")
|
||||||
|
}
|
||||||
|
return &grpcproto.FirebaseTokenResponse{
|
||||||
|
Result: true,
|
||||||
|
}, nil
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package grpcserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s SilvermobiGRPCService) GeoAutocomplete(ctx context.Context, in *grpcproto.GeoAutocompleteRequest) (resp *grpcproto.GeoAutocompleteResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("text", in.Text).
|
||||||
|
Msg("GeoAutocompleteRequest")
|
||||||
|
requestid := uuid.NewString()
|
||||||
|
log.Debug().Str("requestid", requestid).Msg("GRPC GeoAutocomplete start")
|
||||||
|
|
||||||
|
if err == io.EOF {
|
||||||
|
log.Debug().Str("requestid", requestid).Msg("GRPC GeoAutocomplete EOF")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Str("requestid", requestid).Err(err).Msg("GRPC GeoAutocomplete other error")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results, err := s.Handler.GeoAutocomplete(in.Text, in.Lat, in.Lon)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Str("requestid", requestid).Err(err).Msg("GRPC GeoAutocomplete geocoding error")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rawfc, err := results.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Str("requestid", requestid).Err(err).Msg("GRPC GeoAutocomplete protocol buffer conversion error")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp = &grpcproto.GeoAutocompleteResponse{
|
||||||
|
FeatureCollection: &grpcproto.GeoAutocompleteResponse_FeatureCollectionRaw{
|
||||||
|
FeatureCollectionRaw: string(rawfc),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s SilvermobiGRPCService) GeoRoute(ctx context.Context, req *grpcproto.GeoRouteRequest) (*grpcproto.GeoRouteResponse, error) {
|
||||||
|
locations_raw, ok := req.Locations.(*grpcproto.GeoRouteRequest_LocationsRaw)
|
||||||
|
if !ok {
|
||||||
|
return nil, status.Errorf(codes.InvalidArgument, "could not read departure")
|
||||||
|
}
|
||||||
|
|
||||||
|
locations, err := geojson.UnmarshalFeatureCollection([]byte(locations_raw.LocationsRaw))
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
route, err := s.Handler.GeoRoute(*locations)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &grpcproto.GeoRouteResponse{
|
||||||
|
Polyline: route.Polyline.String(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s SilvermobiGRPCService) GeoRouteWithReturn(ctx context.Context, req *grpcproto.GeoRouteWithReturnRequest) (*grpcproto.GeoRouteWithReturnResponse, error) {
|
||||||
|
locations_raw, ok := req.Locations.(*grpcproto.GeoRouteWithReturnRequest_LocationsRaw)
|
||||||
|
if !ok {
|
||||||
|
return nil, status.Errorf(codes.InvalidArgument, "could not read departure")
|
||||||
|
}
|
||||||
|
|
||||||
|
locations, err := geojson.UnmarshalFeatureCollection([]byte(locations_raw.LocationsRaw))
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
route, err := s.Handler.GeoRoute(*locations)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return_route, err := s.Handler.GeoReturnRoute(*locations)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &grpcproto.GeoRouteWithReturnResponse{
|
||||||
|
Polyline: route.Polyline.String(),
|
||||||
|
ReturnPolyline: return_route.Polyline.String(),
|
||||||
|
}, nil
|
||||||
|
}
|
|
@ -4,7 +4,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
@ -24,6 +26,9 @@ func (s SilvermobiGRPCService) SetPhoneNumber(ctx context.Context, req *grpcprot
|
||||||
}
|
}
|
||||||
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
id := ExtractIdFromToken(tokenString)
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", id).
|
||||||
|
Msg("SetPhoneNumber")
|
||||||
if err = s.Handler.UpdatePhoneNumber(
|
if err = s.Handler.UpdatePhoneNumber(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
id,
|
id,
|
||||||
|
@ -40,13 +45,15 @@ func (s SilvermobiGRPCService) VerifyPhoneNumber(ctx context.Context, req *grpcp
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
|
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
authHeader, ok := md["authorization"]
|
authHeader, ok := md["authorization"]
|
||||||
if !ok || len(authHeader) == 0 {
|
if !ok || len(authHeader) == 0 {
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
|
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
|
||||||
}
|
}
|
||||||
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
id := ExtractIdFromToken(tokenString)
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", id).
|
||||||
|
Msg("VerifyPhoneNumber")
|
||||||
if err = s.Handler.VerifyPhoneNumber(
|
if err = s.Handler.VerifyPhoneNumber(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
id,
|
id,
|
||||||
|
@ -71,6 +78,9 @@ func (s SilvermobiGRPCService) SetBirthDate(ctx context.Context, req *grpcproto.
|
||||||
}
|
}
|
||||||
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
id := ExtractIdFromToken(tokenString)
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", id).
|
||||||
|
Msg("SetBirthDate")
|
||||||
birthdate := time.Unix(req.Birthdate.Seconds, int64(req.Birthdate.Nanos)).UTC()
|
birthdate := time.Unix(req.Birthdate.Seconds, int64(req.Birthdate.Nanos)).UTC()
|
||||||
birthdateString := birthdate.Format("2006-01-02T15:04:05Z")
|
birthdateString := birthdate.Format("2006-01-02T15:04:05Z")
|
||||||
if err = s.Handler.UpdateBirthDate(ctx, id, birthdateString); err != nil {
|
if err = s.Handler.UpdateBirthDate(ctx, id, birthdateString); err != nil {
|
||||||
|
@ -93,6 +103,9 @@ func (s SilvermobiGRPCService) SetAccountType(ctx context.Context, req *grpcprot
|
||||||
}
|
}
|
||||||
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
id := ExtractIdFromToken(tokenString)
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", id).
|
||||||
|
Msg("SetAccountType")
|
||||||
if req.GetType() != grpcproto.AccountTypeRequest_PASSENGER && req.GetType() != grpcproto.AccountTypeRequest_DRIVER {
|
if req.GetType() != grpcproto.AccountTypeRequest_PASSENGER && req.GetType() != grpcproto.AccountTypeRequest_DRIVER {
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "Type should be PASSENGER or DRIVER")
|
return nil, status.Errorf(codes.InvalidArgument, "Type should be PASSENGER or DRIVER")
|
||||||
}
|
}
|
||||||
|
@ -116,6 +129,9 @@ func (s SilvermobiGRPCService) GetAccountType(ctx context.Context, req *grpcprot
|
||||||
}
|
}
|
||||||
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
id := ExtractIdFromToken(tokenString)
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", id).
|
||||||
|
Msg("GetAccountType")
|
||||||
if req.Request == nil || !*req.Request {
|
if req.Request == nil || !*req.Request {
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "request arg should be true")
|
return nil, status.Errorf(codes.InvalidArgument, "request arg should be true")
|
||||||
}
|
}
|
||||||
|
@ -146,13 +162,13 @@ func (s SilvermobiGRPCService) GetValidation(ctx context.Context, req *grpcproto
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
|
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
authHeader, ok := md["authorization"]
|
authHeader, ok := md["authorization"]
|
||||||
if !ok || len(authHeader) == 0 {
|
if !ok || len(authHeader) == 0 {
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
|
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
|
||||||
}
|
}
|
||||||
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
|
||||||
id := ExtractIdFromToken(tokenString)
|
id := ExtractIdFromToken(tokenString)
|
||||||
|
fmt.Println(id)
|
||||||
phone_validation, birth_validation, type_validation, err := s.Handler.CheckValidation(ctx, id)
|
phone_validation, birth_validation, type_validation, err := s.Handler.CheckValidation(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -2,6 +2,7 @@ package grpcserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"git.coopgo.io/coopgo-apps/silvermobi/handler"
|
"git.coopgo.io/coopgo-apps/silvermobi/handler"
|
||||||
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
||||||
"github.com/golang-jwt/jwt/v4"
|
"github.com/golang-jwt/jwt/v4"
|
||||||
|
@ -28,6 +29,9 @@ func NoAuth(method string) bool {
|
||||||
"/SilvermobiGRPC/UpdatePassword",
|
"/SilvermobiGRPC/UpdatePassword",
|
||||||
"/SilvermobiGRPC/AuthRegister",
|
"/SilvermobiGRPC/AuthRegister",
|
||||||
"/SilvermobiGRPC/AuthLogin",
|
"/SilvermobiGRPC/AuthLogin",
|
||||||
|
"/SilvermobiGRPC/GeoAutocomplete",
|
||||||
|
"/SilvermobiGRPC/GeoRouteWithReturn",
|
||||||
|
"/SilvermobiGRPC/GeoRoute",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, m := range noAuthMethods {
|
for _, m := range noAuthMethods {
|
||||||
|
@ -53,6 +57,7 @@ func UnaryAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.UnaryServerInt
|
||||||
return handler(newCtx, req)
|
return handler(newCtx, req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func StreamAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.StreamServerInterceptor {
|
func StreamAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.StreamServerInterceptor {
|
||||||
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||||
if NoAuth(info.FullMethod) {
|
if NoAuth(info.FullMethod) {
|
||||||
|
@ -78,6 +83,28 @@ type SilvermobiGRPCService struct {
|
||||||
grpcproto.UnimplementedSilvermobiGRPCServer
|
grpcproto.UnimplementedSilvermobiGRPCServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SolidarityService struct {
|
||||||
|
Config *viper.Viper
|
||||||
|
Handler *handler.SilvermobiHandler
|
||||||
|
SolidarityClient grpcproto.SolidarityServiceClient
|
||||||
|
grpcproto.UnimplementedSolidarityServiceServer // Add this client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSolidarityService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SolidarityService {
|
||||||
|
solidarityServiceAddress := cfg.GetString("solidarity_service.address")
|
||||||
|
conn, err := grpc.Dial(solidarityServiceAddress, grpc.WithInsecure())
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
solidarityClient := grpcproto.NewSolidarityServiceClient(conn)
|
||||||
|
return SolidarityService{
|
||||||
|
Config: cfg,
|
||||||
|
Handler: handler,
|
||||||
|
SolidarityClient: solidarityClient,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SilvermobiGRPCService {
|
func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SilvermobiGRPCService {
|
||||||
return SilvermobiGRPCService{
|
return SilvermobiGRPCService{
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
|
@ -87,7 +114,7 @@ func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilvermobiHandl
|
||||||
|
|
||||||
func Run(done chan error, cfg *viper.Viper, handler *handler.SilvermobiHandler) {
|
func Run(done chan error, cfg *viper.Viper, handler *handler.SilvermobiHandler) {
|
||||||
var (
|
var (
|
||||||
address = "0.0.0.0:" + cfg.GetString("services.external.grpc.port")
|
address = cfg.GetString("services.external.grpc.ip") + ":" + cfg.GetString("services.external.grpc.port")
|
||||||
jwt_secret = cfg.GetString("identification.local.jwt_secret")
|
jwt_secret = cfg.GetString("identification.local.jwt_secret")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -104,8 +131,11 @@ func Run(done chan error, cfg *viper.Viper, handler *handler.SilvermobiHandler)
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
|
||||||
service := NewSilvermobiGRPCService(cfg, handler)
|
solidarity_service := NewSolidarityService(cfg, handler)
|
||||||
grpcproto.RegisterSilvermobiGRPCServer(server, service)
|
|
||||||
|
silvermobi_service := NewSilvermobiGRPCService(cfg, handler)
|
||||||
|
grpcproto.RegisterSilvermobiGRPCServer(server, silvermobi_service)
|
||||||
|
grpcproto.RegisterSolidarityServiceServer(server, &solidarity_service)
|
||||||
l, err := net.Listen("tcp", address)
|
l, err := net.Listen("tcp", address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err)
|
log.Fatal().Err(err)
|
||||||
|
@ -128,6 +158,7 @@ func GRPCAuthFunc(jwtKey string) grpc_auth.AuthFunc {
|
||||||
return []byte(jwtKey), nil
|
return []byte(jwtKey), nil
|
||||||
})
|
})
|
||||||
if err != nil || !token.Valid {
|
if err != nil || !token.Valid {
|
||||||
|
fmt.Println(err)
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "Invalid or expired token")
|
return nil, status.Errorf(codes.Unauthenticated, "Invalid or expired token")
|
||||||
}
|
}
|
||||||
ctx = context.WithValue(ctx, contextKeyUser, claims["sub"].(string))
|
ctx = context.WithValue(ctx, contextKeyUser, claims["sub"].(string))
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package grpcserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s *SolidarityService) SetDriverRegularAvailabilities(ctx context.Context, req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Driver ID", req.DriverRequest.Driver.Id).
|
||||||
|
Msg("SetDriverRegularAvailabilities")
|
||||||
|
resp, err = s.SolidarityClient.SetDriverRegularAvailabilities(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) SetDriverPunctualAvailabilities(ctx context.Context, req *proto.DriverPunctualAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Driver ID", req.DriverRequest.Driver.Id).
|
||||||
|
Msg("SetDriverRegularAvailabilities")
|
||||||
|
resp, err = s.SolidarityClient.SetDriverPunctualAvailabilities(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) CreateBooking(ctx context.Context, req *proto.CreateBookingRequest) (resp *proto.CreateBookingResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Booking ID", req.Booking.Id).
|
||||||
|
Msg("CreateBooking")
|
||||||
|
resp, err = s.SolidarityClient.CreateBooking(ctx, req)
|
||||||
|
if err == nil {
|
||||||
|
_ = s.Handler.SendNotification(req.Booking.DriverId, "Silvermobi", "Vous avez reçu une demande de trajet. \n Pour plus de détails, veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi.")
|
||||||
|
err = s.Handler.SendEmail(req.Booking.DriverId, "Silvermobi", "Vous avez reçu une demande de trajet. \n Pour plus de détails, veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi.")
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) UpdateBooking(ctx context.Context, req *proto.UpdateBookingRequest) (resp *proto.UpdateBookingResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Booking ID", req.BookingId).
|
||||||
|
Msg("UpdateBooking")
|
||||||
|
resp, err = s.SolidarityClient.UpdateBooking(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) GetBooking(ctx context.Context, req *proto.GetBookingRequest) (resp *proto.GetBookingResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Booking ID", req.BookingId).
|
||||||
|
Msg("GetBooking")
|
||||||
|
resp, err = s.SolidarityClient.GetBooking(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) GetBookingsByStatus(ctx context.Context, req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("User ID", req.UserId).
|
||||||
|
Msg("GetBookingByStatus")
|
||||||
|
resp, err = s.SolidarityClient.GetBookingsByStatus(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Address", req.Departure.Address).
|
||||||
|
Msg("DriverJourneys")
|
||||||
|
resp, err = s.SolidarityClient.DriverJourneys(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SolidarityService) SetPassengerTrip(ctx context.Context, req *proto.PassengerTripRequest) (resp *proto.PassengerTripResponse, err error) {
|
||||||
|
log.Info().
|
||||||
|
Str("Passenger ID", req.Passenger.Id).
|
||||||
|
Msg("SetPassengerTrip")
|
||||||
|
resp, err = s.SolidarityClient.SetPassengerTrip(ctx, req)
|
||||||
|
return resp, err
|
||||||
|
}
|
|
@ -208,17 +208,26 @@ func (s MobilityAccountService) ToAccountModel(account ma.Account) *models.Accou
|
||||||
if !ok {
|
if !ok {
|
||||||
accountType = ""
|
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{
|
return &models.Account{
|
||||||
ID: account.ID,
|
ID: account.ID,
|
||||||
FirstName: first_name,
|
FirstName: first_name,
|
||||||
LastName: last_name,
|
LastName: last_name,
|
||||||
|
Email: email,
|
||||||
BirthDate: birth_date,
|
BirthDate: birth_date,
|
||||||
Type: accountType,
|
Type: accountType,
|
||||||
LocalCredentials: models.LocalCredentials{
|
LocalCredentials: models.LocalCredentials{
|
||||||
Email: account.Authentication.Local.Email,
|
Email: account.Authentication.Local.Email,
|
||||||
EmailVerified: account.Authentication.Local.EmailValidation.Validated,
|
EmailVerified: account.Authentication.Local.EmailValidation.Validated,
|
||||||
EmailValidationCode: account.Authentication.Local.EmailValidation.ValidationCode,
|
EmailValidationCode: account.Authentication.Local.EmailValidation.ValidationCode,
|
||||||
PhoneNumber: account.Authentication.Local.PhoneNumber,
|
PhoneNumber: phone_number,
|
||||||
PhoneNumberVerified: account.Authentication.Local.PhoneNumberValidation.Validated,
|
PhoneNumberVerified: account.Authentication.Local.PhoneNumberValidation.Validated,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
|
|
||||||
"github.com/appleboy/gorush/rpc/proto"
|
"github.com/appleboy/gorush/rpc/proto"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
@ -26,6 +27,8 @@ type Notification struct {
|
||||||
Recipients []string
|
Recipients []string
|
||||||
Message string
|
Message string
|
||||||
Title string
|
Title string
|
||||||
|
Data *structpb.Struct
|
||||||
|
ID string
|
||||||
}
|
}
|
||||||
|
|
||||||
type PushService struct {
|
type PushService struct {
|
||||||
|
@ -53,6 +56,8 @@ func (s *PushService) Send(notification Notification) error {
|
||||||
Msg("Send notification")
|
Msg("Send notification")
|
||||||
|
|
||||||
resp, err := s.Client.Send(context.Background(), &proto.NotificationRequest{
|
resp, err := s.Client.Send(context.Background(), &proto.NotificationRequest{
|
||||||
|
Data: notification.Data,
|
||||||
|
ID: notification.ID,
|
||||||
Platform: notification.Platform,
|
Platform: notification.Platform,
|
||||||
Tokens: notification.Recipients,
|
Tokens: notification.Recipients,
|
||||||
Message: notification.Message,
|
Message: notification.Message,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package services
|
package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.coopgo.io/coopgo-platform/geocode"
|
||||||
|
routing "git.coopgo.io/coopgo-platform/routing-service"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
@ -8,12 +10,18 @@ import (
|
||||||
type ServicesHandler struct {
|
type ServicesHandler struct {
|
||||||
MobilityAccounts MobilityAccountService
|
MobilityAccounts MobilityAccountService
|
||||||
Push *PushService
|
Push *PushService
|
||||||
|
Geocoder geocode.Geocoder
|
||||||
|
Routing routing.RoutingService
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
|
func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
|
||||||
var (
|
var (
|
||||||
mobilityAccountsDial = cfg.GetString("services.internal.mobility_accounts.dial")
|
mobilityAccountsDial = cfg.GetString("services.internal.mobility_accounts.dial")
|
||||||
pushDial = cfg.GetString("services.internal.push.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)
|
mobilityAccounts, err := NewMobilityAccountService(mobilityAccountsDial)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -25,9 +33,22 @@ func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
|
||||||
log.Fatal().Err(err).Msg("Could not connect to Push Notifications Service")
|
log.Fatal().Err(err).Msg("Could not connect to Push Notifications Service")
|
||||||
return nil, err
|
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{
|
return &ServicesHandler{
|
||||||
MobilityAccounts: mobilityAccounts,
|
MobilityAccounts: mobilityAccounts,
|
||||||
Push: push,
|
Push: push,
|
||||||
|
Geocoder: geocoder,
|
||||||
|
Routing: routing,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/spf13/viper"
|
|
||||||
)
|
|
||||||
|
|
||||||
type KVHandler interface {
|
|
||||||
Put(k string, v any) error
|
|
||||||
Get(k string) (any, error)
|
|
||||||
Delete(k string) error
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewKVHandler(cfg *viper.Viper) (KVHandler, error) {
|
|
||||||
return NewRedisHandler(cfg)
|
|
||||||
}
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
package storage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
_ "github.com/lib/pq"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PostgresqlStorage struct {
|
||||||
|
DbConnection *sql.DB
|
||||||
|
Schema string
|
||||||
|
Tables map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPostgresqlStorage(cfg *viper.Viper) (PostgresqlStorage, error) {
|
||||||
|
var (
|
||||||
|
host = cfg.GetString("storage.db.psql.host")
|
||||||
|
port = cfg.GetString("storage.db.psql.port")
|
||||||
|
user = cfg.GetString("storage.db.psql.user")
|
||||||
|
password = cfg.GetString("storage.db.psql.password")
|
||||||
|
dbname = cfg.GetString("storage.db.psql.dbname")
|
||||||
|
sslmode = cfg.GetString("storage.db.psql.sslmode")
|
||||||
|
pg_schema = cfg.GetString("storage.db.psql.schema")
|
||||||
|
pgtables_users_firebase = cfg.GetString("storage.db.psql.tables.users_firebase")
|
||||||
|
)
|
||||||
|
portInt, _ := strconv.Atoi(port)
|
||||||
|
psqlconn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s", host, portInt, user, password, dbname, sslmode)
|
||||||
|
db, err := sql.Open("postgres", psqlconn)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("opening connection to postgresql failed")
|
||||||
|
return PostgresqlStorage{}, fmt.Errorf("connection to postgresql failed")
|
||||||
|
}
|
||||||
|
err = db.Ping()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("ping to postgresql failed")
|
||||||
|
return PostgresqlStorage{}, fmt.Errorf("connection to postgresql database failed")
|
||||||
|
}
|
||||||
|
return PostgresqlStorage{
|
||||||
|
DbConnection: db,
|
||||||
|
Schema: pg_schema,
|
||||||
|
Tables: map[string]string{
|
||||||
|
"users_firebase": fmt.Sprintf("%s.%s", pg_schema, pgtables_users_firebase),
|
||||||
|
},
|
||||||
|
}, 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
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
schema "silvermobi_backend" {}
|
||||||
|
|
||||||
|
table "users_firebase" {
|
||||||
|
schema = schema.silvermobi_backend
|
||||||
|
column "user_id" {
|
||||||
|
null = false
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "fcm_token" {
|
||||||
|
null = false
|
||||||
|
type = varchar(300)
|
||||||
|
}
|
||||||
|
columns "device_platform" {
|
||||||
|
null = false
|
||||||
|
type = text
|
||||||
|
}
|
||||||
|
primary_key {
|
||||||
|
columns = [column.user_id]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,43 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/go-redis/redis/v9"
|
|
||||||
"github.com/spf13/viper"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RedisHandler struct {
|
|
||||||
client *redis.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRedisHandler(cfg *viper.Viper) (*RedisHandler, error) {
|
|
||||||
redisClient := redis.NewClient(&redis.Options{
|
|
||||||
Addr: cfg.GetString("storage.kv.redis.addr"),
|
|
||||||
DB: cfg.GetInt("storage.kv.redis.db"),
|
|
||||||
})
|
|
||||||
|
|
||||||
_, err := redisClient.Ping(context.Background()).Result()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &RedisHandler{
|
|
||||||
client: redisClient,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rh *RedisHandler) Put(k string, v any) error {
|
|
||||||
return rh.client.Set(context.Background(), k, v, 0).Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rh *RedisHandler) Get(k string) (any, error) {
|
|
||||||
value, err := rh.client.Get(context.Background(), k).Result()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return value, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rh *RedisHandler) Delete(k string) error {
|
|
||||||
return rh.client.Del(context.Background(), k).Err()
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package storage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Storage interface {
|
||||||
|
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 (
|
||||||
|
storage_type = cfg.GetString("storage.db.type")
|
||||||
|
)
|
||||||
|
switch storage_type {
|
||||||
|
case "psql":
|
||||||
|
s, err := NewPostgresqlStorage(cfg)
|
||||||
|
return s, err
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("storage type %v is not supported", storage_type)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue