From 9da7b99e5da9a64d4a06bf21f43d1a1c49267880 Mon Sep 17 00:00:00 2001 From: Arnaud Delcasse Date: Wed, 5 Mar 2025 00:30:53 +0100 Subject: [PATCH] initial commit --- .gitea/workflows/build.yml | 65 + .gitignore | 1 + Dockerfile | 27 + README.md | 7 + config.go | 50 + go.mod | 52 + go.sum | 209 +++ handler/availabilities.go | 41 + handler/bookings.go | 73 + handler/handler.go | 21 + handler/journeys.go | 85 + main.go | 62 + servers/grpc/proto/README.md | 7 + .../gen/solidarity-transport-types.pb.go | 727 ++++++++ .../grpc/proto/gen/solidarity-transport.pb.go | 1578 +++++++++++++++++ .../proto/gen/solidarity-transport_grpc.pb.go | 448 +++++ .../proto/solidarity-transport-types.proto | 52 + servers/grpc/proto/solidarity-transport.proto | 110 ++ servers/grpc/server/availabilities.go | 74 + servers/grpc/server/bookings.go | 76 + servers/grpc/server/journeys.go | 67 + servers/grpc/server/server.go | 50 + servers/grpc/transformers/availabilities.go | 34 + servers/grpc/transformers/bookings.go | 36 + servers/grpc/transformers/geojson.go | 24 + servers/grpc/transformers/journeys.go | 100 ++ storage/memory.go | 152 ++ storage/mongodb.go | 214 +++ storage/storage.go | 40 + types/availabilities.go | 12 + types/booking.go | 11 + types/journeys.go | 36 + 32 files changed, 4541 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 config.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 handler/availabilities.go create mode 100644 handler/bookings.go create mode 100644 handler/handler.go create mode 100644 handler/journeys.go create mode 100644 main.go create mode 100644 servers/grpc/proto/README.md create mode 100644 servers/grpc/proto/gen/solidarity-transport-types.pb.go create mode 100644 servers/grpc/proto/gen/solidarity-transport.pb.go create mode 100644 servers/grpc/proto/gen/solidarity-transport_grpc.pb.go create mode 100644 servers/grpc/proto/solidarity-transport-types.proto create mode 100644 servers/grpc/proto/solidarity-transport.proto create mode 100644 servers/grpc/server/availabilities.go create mode 100644 servers/grpc/server/bookings.go create mode 100644 servers/grpc/server/journeys.go create mode 100644 servers/grpc/server/server.go create mode 100644 servers/grpc/transformers/availabilities.go create mode 100644 servers/grpc/transformers/bookings.go create mode 100644 servers/grpc/transformers/geojson.go create mode 100644 servers/grpc/transformers/journeys.go create mode 100644 storage/memory.go create mode 100644 storage/mongodb.go create mode 100644 storage/storage.go create mode 100644 types/availabilities.go create mode 100644 types/booking.go create mode 100644 types/journeys.go diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..71380f7 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build and Push Docker Image + +on: + push: + tags: + - "*" + branches: + - main + - dev + +jobs: + build_and_push: + runs-on: ubuntu-latest + + steps: + - name: Install Docker + run: | + apt-get update + apt-get install -y docker.io + + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Kubernetes Context + uses: azure/k8s-set-context@v4 + with: + method: kubeconfig + kubeconfig: ${{secrets.buildx_kubeconfig}} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: kubernetes + driver-opts: | + namespace=gitea + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.coopgo.io + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker image + id: metadata + uses: docker/metadata-action@v3 + with: + images: git.coopgo.io/${{gitea.repository}} + tags: | + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + flavor: | + latest=auto + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ steps.metadata.outputs.tags }} + build-args: | + ACCESS_TOKEN_USR=${{gitea.actor}} + ACCESS_TOKEN_PWD=${{gitea.token}} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b6b072 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d3931ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:alpine as builder + +ARG ACCESS_TOKEN_USR="nothing" +ARG ACCESS_TOKEN_PWD="nothing" + +RUN apk add --no-cache ca-certificates tzdata git + +WORKDIR / + +# Create a netrc file using the credentials specified using --build-arg +RUN printf "machine git.coopgo.io\n\ + login ${ACCESS_TOKEN_USR}\n\ + password ${ACCESS_TOKEN_PWD}\n"\ + >> ~/.netrc +RUN chmod 600 ~/.netrc + +COPY . . + +RUN go mod download && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server + +FROM scratch +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo +COPY --from=builder /server / + +EXPOSE 8080 +ENTRYPOINT ["/server"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9e784b --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# COOPGO Solidarity Transport + +COOPGO Solidarity Transport is a solidarity transport management microservice. It handles : + +- driver availabilities declarations +- passenger journeys requests +- matching between passenger journeys requests and driver availabilities diff --git a/config.go b/config.go new file mode 100644 index 0000000..6898b91 --- /dev/null +++ b/config.go @@ -0,0 +1,50 @@ +package main + +import ( + "strings" + + "github.com/spf13/viper" +) + +func ReadConfig() (*viper.Viper, error) { + defaults := map[string]any{ + "name": "COOPGO Solidarity Transport", + "dev_env": false, + "storage": map[string]any{ + "db": map[string]any{ + "type": "mongodb", + "mongodb": map[string]any{ + "host": "localhost", + "port": 27017, + "db_name": "coopgo_platform", + "collections": map[string]any{ + "drivers_regular_availabilities": "solidarity_drivers_regular_availabilities", + "bookings": "solidarity_bookings", + "driver_journeys": "solidarity_driver_journeys", + }, + }, + }, + }, + "services": map[string]any{ + "grpc": map[string]any{ + "enable": true, + "port": 8080, + }, + }, + "routing": map[string]any{ + "type": "valhalla", + "base_url": "https://valhalla.coopgo.io", + }, + } + + v := viper.New() + for key, value := range defaults { + v.SetDefault(key, value) + } + v.SetConfigName("config") + v.AddConfigPath(".") + v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) + v.AutomaticEnv() + err := v.ReadInConfig() + return v, err +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..00580ad --- /dev/null +++ b/go.mod @@ -0,0 +1,52 @@ +module git.coopgo.io/coopgo-platform/solidarity-transport + +go 1.23.3 + +replace git.coopgo.io/coopgo-platform/routing-service => ../../coopgo-platform/routing-service/ + +require ( + github.com/google/uuid v1.6.0 + github.com/rs/zerolog v1.33.0 + github.com/spf13/viper v1.19.0 + go.mongodb.org/mongo-driver/v2 v2.1.0 + google.golang.org/grpc v1.70.0 + google.golang.org/protobuf v1.35.2 +) + +require ( + git.coopgo.io/coopgo-platform/routing-service v0.0.0-20240919052617-d03cd410081c // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/klauspost/compress v1.17.2 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/paulmach/orb v0.11.1 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/twpayne/go-polyline v1.1.1 // indirect + github.com/xdg-go/pbkdf2 v1.0.0 // indirect + github.com/xdg-go/scram v1.1.2 // indirect + github.com/xdg-go/stringprep v1.0.4 // indirect + github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect + go.mongodb.org/mongo-driver v1.11.4 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/crypto v0.33.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/net v0.32.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..5ade2f7 --- /dev/null +++ b/go.sum @@ -0,0 +1,209 @@ +git.coopgo.io/coopgo-platform/routing-service v0.0.0-20240919052617-d03cd410081c h1:I0pJtlpW7Eloiro+VXVRzdQYJW9AMmjNIczBlROCX9Y= +git.coopgo.io/coopgo-platform/routing-service v0.0.0-20240919052617-d03cd410081c/go.mod h1:Nh7o15LlV0OuO9zxvJIs9FlelpeAaLYkXtFdgIkFrgg= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +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.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +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/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/paulmach/orb v0.11.1 h1:3koVegMC4X/WeiXYz9iswopaTwMem53NzTJuTF20JzU= +github.com/paulmach/orb v0.11.1/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= +github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stretchr/objx v0.1.0/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.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +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/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.mongodb.org/mongo-driver v1.11.4 h1:4ayjakA013OdpGyL2K3ZqylTac/rMjrJOMZ1EHizXas= +go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= +go.mongodb.org/mongo-driver/v2 v2.1.0 h1:/ELnVNjmfUKDsoBisXxuJL0noR9CfeUIrP7Yt3R+egg= +go.mongodb.org/mongo-driver/v2 v2.1.0/go.mod h1:AWiLRShSrk5RHQS3AEn3RL19rqOzVq49MCpWQ3x/huI= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/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.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ= +google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/handler/availabilities.go b/handler/availabilities.go new file mode 100644 index 0000000..5e2315b --- /dev/null +++ b/handler/availabilities.go @@ -0,0 +1,41 @@ +package handler + +import "git.coopgo.io/coopgo-platform/solidarity-transport/types" + +func (h *Handler) AddRegularAvailability(driver string, day int, startTime string, endTime string) error { + availability := types.DriverRegularAvailability{ + DriverId: driver, + Day: day, + StartTime: startTime, + EndTime: endTime, + } + + if err := h.Storage.CreateDriverRegularAvailability(availability); err != nil { + return err + } + + return nil +} + +func (h *Handler) AddDriverRegularAvailabilities(availabilities []*types.DriverRegularAvailability) error { + if err := h.Storage.CreateDriverRegularAvailabilities(availabilities); err != nil { + return err + } + return nil +} + +func (h *Handler) GetDriverRegularAvailabilities(driver string) ([]*types.DriverRegularAvailability, error) { + availabilities, err := h.Storage.GetDriverRegularAvailabilities(driver) + if err != nil { + return nil, err + } + + return availabilities, nil +} + +func (h *Handler) DeleteDriverRegularAvailabilities(driver string, availability string) error { + if err := h.Storage.DeleteDriverRegularAvailability(driver, availability); err != nil { + return err + } + return nil +} diff --git a/handler/bookings.go b/handler/bookings.go new file mode 100644 index 0000000..744d33d --- /dev/null +++ b/handler/bookings.go @@ -0,0 +1,73 @@ +package handler + +import ( + "errors" + "time" + + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/google/uuid" + "github.com/rs/zerolog/log" +) + +func (h Handler) BookDriverJourney(passengerid string, driverid string, journeyid string) error { + journey, err := h.Storage.GetDriverJourney(journeyid) + if err != nil { + log.Error().Err(err).Msg("could not find driver journey") + return err + } + + if journey.DriverId != driverid { + return errors.New("not authorized : journey id driver and driverid mismatch") + } + + booking := types.Booking{ + Id: uuid.NewString(), + GroupId: uuid.NewString(), + Status: "WAITING_CONFIRMATION", + PassengerId: passengerid, + DriverId: driverid, + Journey: journey, + } + + if err := h.Storage.CreateBooking(booking); err != nil { + log.Error().Err(err).Msg("error creating booking") + return err + } + + return nil +} + +func (h Handler) GetBookings(startdate time.Time, enddate time.Time) ([]*types.Booking, error) { + res := []*types.Booking{} + + bookings, err := h.Storage.GetAllBookings() + if err != nil { + log.Error().Err(err).Msg("error retrieving bookings") + return nil, err + } + + for _, b := range bookings { + if b.Journey.DriverDepartureDate.After(startdate) && b.Journey.DriverDepartureDate.Before(enddate) { + res = append(res, b) + } + } + return res, nil +} + +func (h Handler) GetBooking(id string) (*types.Booking, error) { + booking, err := h.Storage.GetBooking(id) + if err != nil { + log.Error().Err(err).Msg("could not get booking") + return nil, err + } + + return booking, nil +} + +func (h Handler) UpdateBookingStatus(bookingid string, newStatus string) error { + if err := h.Storage.UpdateBookingStatus(bookingid, newStatus); err != nil { + log.Error().Err(err).Msg("could not update booking") + return err + } + return nil +} diff --git a/handler/handler.go b/handler/handler.go new file mode 100644 index 0000000..82eb387 --- /dev/null +++ b/handler/handler.go @@ -0,0 +1,21 @@ +package handler + +import ( + "git.coopgo.io/coopgo-platform/routing-service" + "git.coopgo.io/coopgo-platform/solidarity-transport/storage" + "github.com/spf13/viper" +) + +type Handler struct { + Config *viper.Viper + Storage storage.Storage + Routing routing.RoutingService +} + +func NewSolidarityTransportHandler(cfg *viper.Viper, store storage.Storage, routing routing.RoutingService) (*Handler, error) { + return &Handler{ + Config: cfg, + Storage: store, + Routing: routing, + }, nil +} diff --git a/handler/journeys.go b/handler/journeys.go new file mode 100644 index 0000000..7512636 --- /dev/null +++ b/handler/journeys.go @@ -0,0 +1,85 @@ +package handler + +import ( + "errors" + "time" + + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/google/uuid" + "github.com/paulmach/orb" + "github.com/paulmach/orb/geojson" + "github.com/rs/zerolog/log" +) + +func (h *Handler) GetDriverJourneys(departure *geojson.Feature, arrival *geojson.Feature, departureDate time.Time) ([]*types.DriverJourney, error) { + day := int(departureDate.Weekday()) + timeInDay := departureDate.Format("15:04") + driverJourneys := []*types.DriverJourney{} + + // Get Availabilities + availabilities, err := h.Storage.GetRegularAvailabilities(day, timeInDay) + if err != nil { + log.Error().Err(err).Msg("error in GetRegularAvailabilities") + return nil, err + } + + for _, a := range availabilities { + log.Debug().Any("availability", a).Msg("Availability found") + if a.Address != nil { + route, err := h.Routing.Route( + []orb.Point{ + a.Address.Point(), + departure.Point(), + arrival.Point(), + a.Address.Point(), + }, + ) + if err != nil { + log.Error().Err(err).Msg("failedcomputing route request") + continue + } + + log.Debug().Any("route", route).Msg("debug route") + + driverJourney := &types.DriverJourney{ + Id: uuid.NewString(), + DriverId: a.DriverId, + PassengerPickup: departure, + PassengerDrop: arrival, + PassengerDistance: int64(route.Legs[1].Distance), + DriverDeparture: a.Address, + DriverArrival: a.Address, + DriverDistance: int64(route.Distance), + Duration: route.Legs[1].Duration, + JourneyPolyline: route.Polyline, + PassengerPickupDate: departureDate, + DriverDepartureDate: departureDate.Add(-1 * route.Legs[0].Duration), + Price: types.SolidarityTransportPrice{ + Currency: "EUR", + Amount: 0, + }, + } + driverJourneys = append(driverJourneys, driverJourney) + } + } + + if err := h.Storage.PushDriverJourneys(driverJourneys); err != nil { + log.Error().Err(err).Msg("error storing driver journeys in database") + } + + return driverJourneys, nil +} + +func (h Handler) GetDriverJourney(driverid string, journeyid string) (*types.DriverJourney, error) { + journey, err := h.Storage.GetDriverJourney(journeyid) + if err != nil { + log.Error().Err(err).Msg("error retrieving journey") + return nil, err + } + + if driverid != journey.DriverId { + return nil, errors.New("not allowed, driver id mismatch") + } + + return journey, nil +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..190bca2 --- /dev/null +++ b/main.go @@ -0,0 +1,62 @@ +package main + +import ( + "os" + + routing "git.coopgo.io/coopgo-platform/routing-service" + "git.coopgo.io/coopgo-platform/solidarity-transport/handler" + grpcserver "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/server" + "git.coopgo.io/coopgo-platform/solidarity-transport/storage" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" +) + +func main() { + zerolog.TimeFieldFormat = zerolog.TimeFormatUnix + + cfg, err := ReadConfig() + if err != nil { + panic(err) + } + + var ( + service_name = cfg.GetString("name") + grpc_enable = cfg.GetBool("services.grpc.enable") + dev_env = cfg.GetBool("dev_env") + routing_service_type = cfg.GetString("routing.type") + valhalla_base_url = cfg.GetString("routing.valhalla.base_url") + ) + if dev_env { + log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) + } + log.Info().Msg("Running " + service_name) + + storage, err := storage.NewStorage(cfg) + if err != nil { + log.Fatal().Err(err).Msg("could not initiate storage") + return + } + + 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 + } + + handler, err := handler.NewSolidarityTransportHandler(cfg, storage, routing) + if err != nil { + log.Fatal().Err(err).Msg("could not initialize solidarity transport handler") + return + } + + failed := make(chan error) + + if grpc_enable { + log.Info().Msg("Running grpc server") + go grpcserver.Run(failed, cfg, handler) + } + + err = <-failed + + log.Fatal().Err(err).Msg("Terminating") +} diff --git a/servers/grpc/proto/README.md b/servers/grpc/proto/README.md new file mode 100644 index 0000000..6d53dbc --- /dev/null +++ b/servers/grpc/proto/README.md @@ -0,0 +1,7 @@ +# Protocol buffer definition + +From this directory, generate protocol buffer server and client boilerplate using : + +protoc --go_out=paths=source_relative:./gen --go-grpc_out=paths=source_relative:./gen ./*.proto + +(You need some dependencies like protoc, protoc-gen-go ... To get them easily, you can use the nix shell) diff --git a/servers/grpc/proto/gen/solidarity-transport-types.pb.go b/servers/grpc/proto/gen/solidarity-transport-types.pb.go new file mode 100644 index 0000000..7130dac --- /dev/null +++ b/servers/grpc/proto/gen/solidarity-transport-types.pb.go @@ -0,0 +1,727 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: solidarity-transport-types.proto + +package gen + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GeoJsonFeature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Serialized string `protobuf:"bytes,1,opt,name=serialized,proto3" json:"serialized,omitempty"` +} + +func (x *GeoJsonFeature) Reset() { + *x = GeoJsonFeature{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GeoJsonFeature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GeoJsonFeature) ProtoMessage() {} + +func (x *GeoJsonFeature) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GeoJsonFeature.ProtoReflect.Descriptor instead. +func (*GeoJsonFeature) Descriptor() ([]byte, []int) { + return file_solidarity_transport_types_proto_rawDescGZIP(), []int{0} +} + +func (x *GeoJsonFeature) GetSerialized() string { + if x != nil { + return x.Serialized + } + return "" +} + +type GeoJsonFeatureCollection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Serialized string `protobuf:"bytes,1,opt,name=serialized,proto3" json:"serialized,omitempty"` +} + +func (x *GeoJsonFeatureCollection) Reset() { + *x = GeoJsonFeatureCollection{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GeoJsonFeatureCollection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GeoJsonFeatureCollection) ProtoMessage() {} + +func (x *GeoJsonFeatureCollection) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GeoJsonFeatureCollection.ProtoReflect.Descriptor instead. +func (*GeoJsonFeatureCollection) Descriptor() ([]byte, []int) { + return file_solidarity_transport_types_proto_rawDescGZIP(), []int{1} +} + +func (x *GeoJsonFeatureCollection) GetSerialized() string { + if x != nil { + return x.Serialized + } + return "" +} + +type DriverRegularAvailability struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + Day int32 `protobuf:"varint,3,opt,name=day,proto3" json:"day,omitempty"` + StartTime string `protobuf:"bytes,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime string `protobuf:"bytes,5,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + Address *GeoJsonFeature `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *DriverRegularAvailability) Reset() { + *x = DriverRegularAvailability{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DriverRegularAvailability) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DriverRegularAvailability) ProtoMessage() {} + +func (x *DriverRegularAvailability) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DriverRegularAvailability.ProtoReflect.Descriptor instead. +func (*DriverRegularAvailability) Descriptor() ([]byte, []int) { + return file_solidarity_transport_types_proto_rawDescGZIP(), []int{2} +} + +func (x *DriverRegularAvailability) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DriverRegularAvailability) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *DriverRegularAvailability) GetDay() int32 { + if x != nil { + return x.Day + } + return 0 +} + +func (x *DriverRegularAvailability) GetStartTime() string { + if x != nil { + return x.StartTime + } + return "" +} + +func (x *DriverRegularAvailability) GetEndTime() string { + if x != nil { + return x.EndTime + } + return "" +} + +func (x *DriverRegularAvailability) GetAddress() *GeoJsonFeature { + if x != nil { + return x.Address + } + return nil +} + +type SolidarityTransportDriverJourney struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + PassengerPickup *GeoJsonFeature `protobuf:"bytes,3,opt,name=passenger_pickup,json=passengerPickup,proto3" json:"passenger_pickup,omitempty"` + PassengerDrop *GeoJsonFeature `protobuf:"bytes,4,opt,name=passenger_drop,json=passengerDrop,proto3" json:"passenger_drop,omitempty"` + PassengerDistance int64 `protobuf:"varint,5,opt,name=passenger_distance,json=passengerDistance,proto3" json:"passenger_distance,omitempty"` + DriverDeparture *GeoJsonFeature `protobuf:"bytes,6,opt,name=driver_departure,json=driverDeparture,proto3" json:"driver_departure,omitempty"` + DriverArrival *GeoJsonFeature `protobuf:"bytes,7,opt,name=driver_arrival,json=driverArrival,proto3" json:"driver_arrival,omitempty"` + DriverDistance int64 `protobuf:"varint,8,opt,name=driver_distance,json=driverDistance,proto3" json:"driver_distance,omitempty"` + Duration int64 `protobuf:"varint,9,opt,name=duration,proto3" json:"duration,omitempty"` + JourneyPolyline *string `protobuf:"bytes,10,opt,name=journey_polyline,json=journeyPolyline,proto3,oneof" json:"journey_polyline,omitempty"` + PassengerPickupDate *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=passenger_pickup_date,json=passengerPickupDate,proto3" json:"passenger_pickup_date,omitempty"` + DriverDepartureDate *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=driver_departure_date,json=driverDepartureDate,proto3,oneof" json:"driver_departure_date,omitempty"` + Price *SolidarityTransportPrice `protobuf:"bytes,13,opt,name=price,proto3,oneof" json:"price,omitempty"` +} + +func (x *SolidarityTransportDriverJourney) Reset() { + *x = SolidarityTransportDriverJourney{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SolidarityTransportDriverJourney) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SolidarityTransportDriverJourney) ProtoMessage() {} + +func (x *SolidarityTransportDriverJourney) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SolidarityTransportDriverJourney.ProtoReflect.Descriptor instead. +func (*SolidarityTransportDriverJourney) Descriptor() ([]byte, []int) { + return file_solidarity_transport_types_proto_rawDescGZIP(), []int{3} +} + +func (x *SolidarityTransportDriverJourney) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SolidarityTransportDriverJourney) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *SolidarityTransportDriverJourney) GetPassengerPickup() *GeoJsonFeature { + if x != nil { + return x.PassengerPickup + } + return nil +} + +func (x *SolidarityTransportDriverJourney) GetPassengerDrop() *GeoJsonFeature { + if x != nil { + return x.PassengerDrop + } + return nil +} + +func (x *SolidarityTransportDriverJourney) GetPassengerDistance() int64 { + if x != nil { + return x.PassengerDistance + } + return 0 +} + +func (x *SolidarityTransportDriverJourney) GetDriverDeparture() *GeoJsonFeature { + if x != nil { + return x.DriverDeparture + } + return nil +} + +func (x *SolidarityTransportDriverJourney) GetDriverArrival() *GeoJsonFeature { + if x != nil { + return x.DriverArrival + } + return nil +} + +func (x *SolidarityTransportDriverJourney) GetDriverDistance() int64 { + if x != nil { + return x.DriverDistance + } + return 0 +} + +func (x *SolidarityTransportDriverJourney) GetDuration() int64 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *SolidarityTransportDriverJourney) GetJourneyPolyline() string { + if x != nil && x.JourneyPolyline != nil { + return *x.JourneyPolyline + } + return "" +} + +func (x *SolidarityTransportDriverJourney) GetPassengerPickupDate() *timestamppb.Timestamp { + if x != nil { + return x.PassengerPickupDate + } + return nil +} + +func (x *SolidarityTransportDriverJourney) GetDriverDepartureDate() *timestamppb.Timestamp { + if x != nil { + return x.DriverDepartureDate + } + return nil +} + +func (x *SolidarityTransportDriverJourney) GetPrice() *SolidarityTransportPrice { + if x != nil { + return x.Price + } + return nil +} + +type SolidarityTransportPrice struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Amount float64 `protobuf:"fixed64,1,opt,name=amount,proto3" json:"amount,omitempty"` + Currency string `protobuf:"bytes,2,opt,name=currency,proto3" json:"currency,omitempty"` +} + +func (x *SolidarityTransportPrice) Reset() { + *x = SolidarityTransportPrice{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SolidarityTransportPrice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SolidarityTransportPrice) ProtoMessage() {} + +func (x *SolidarityTransportPrice) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SolidarityTransportPrice.ProtoReflect.Descriptor instead. +func (*SolidarityTransportPrice) Descriptor() ([]byte, []int) { + return file_solidarity_transport_types_proto_rawDescGZIP(), []int{4} +} + +func (x *SolidarityTransportPrice) GetAmount() float64 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *SolidarityTransportPrice) GetCurrency() string { + if x != nil { + return x.Currency + } + return "" +} + +type SolidarityTransportBooking struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + DriverId string `protobuf:"bytes,3,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + PassengerId string `protobuf:"bytes,4,opt,name=passenger_id,json=passengerId,proto3" json:"passenger_id,omitempty"` + Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` + Journey *SolidarityTransportDriverJourney `protobuf:"bytes,10,opt,name=journey,proto3" json:"journey,omitempty"` +} + +func (x *SolidarityTransportBooking) Reset() { + *x = SolidarityTransportBooking{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SolidarityTransportBooking) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SolidarityTransportBooking) ProtoMessage() {} + +func (x *SolidarityTransportBooking) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SolidarityTransportBooking.ProtoReflect.Descriptor instead. +func (*SolidarityTransportBooking) Descriptor() ([]byte, []int) { + return file_solidarity_transport_types_proto_rawDescGZIP(), []int{5} +} + +func (x *SolidarityTransportBooking) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SolidarityTransportBooking) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *SolidarityTransportBooking) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *SolidarityTransportBooking) GetPassengerId() string { + if x != nil { + return x.PassengerId + } + return "" +} + +func (x *SolidarityTransportBooking) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *SolidarityTransportBooking) GetJourney() *SolidarityTransportDriverJourney { + if x != nil { + return x.Journey + } + return nil +} + +var File_solidarity_transport_types_proto protoreflect.FileDescriptor + +var file_solidarity_transport_types_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x0e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, + 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x3a, 0x0a, 0x18, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, + 0x64, 0x22, 0xbf, 0x01, 0x0a, 0x19, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, + 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x64, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x1d, + 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, + 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x22, 0xef, 0x05, 0x0a, 0x20, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, + 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, + 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x10, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, + 0x65, 0x72, 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x0f, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, + 0x70, 0x12, 0x36, 0x0a, 0x0e, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, + 0x72, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, + 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x70, 0x61, 0x73, 0x73, + 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x72, 0x6f, 0x70, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x61, 0x73, + 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, + 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x10, 0x64, 0x72, 0x69, 0x76, + 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x0f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x36, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x61, + 0x72, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, + 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x64, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x72, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x12, 0x27, 0x0a, 0x0f, + 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x69, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x2e, 0x0a, 0x10, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x5f, 0x70, 0x6f, 0x6c, + 0x79, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0f, 0x6a, + 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x50, 0x6f, 0x6c, 0x79, 0x6c, 0x69, 0x6e, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x4e, 0x0a, 0x15, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x70, + 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x13, 0x70, 0x61, + 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, + 0x65, 0x12, 0x53, 0x0a, 0x15, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, + 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x01, 0x52, 0x13, + 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x44, + 0x61, 0x74, 0x65, 0x88, 0x01, 0x01, 0x12, 0x34, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, + 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x48, 0x02, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11, + 0x5f, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x5f, 0x70, 0x6f, 0x6c, 0x79, 0x6c, 0x69, 0x6e, + 0x65, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, + 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x4e, 0x0a, 0x18, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, + 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x69, 0x63, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xdc, 0x01, 0x0a, 0x1a, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, + 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, + 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, + 0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, + 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x6a, 0x6f, 0x75, 0x72, 0x6e, + 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x53, 0x6f, 0x6c, 0x69, 0x64, + 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x72, + 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x07, 0x6a, 0x6f, 0x75, + 0x72, 0x6e, 0x65, 0x79, 0x42, 0x4b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, + 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, + 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, + 0x2d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_solidarity_transport_types_proto_rawDescOnce sync.Once + file_solidarity_transport_types_proto_rawDescData = file_solidarity_transport_types_proto_rawDesc +) + +func file_solidarity_transport_types_proto_rawDescGZIP() []byte { + file_solidarity_transport_types_proto_rawDescOnce.Do(func() { + file_solidarity_transport_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_solidarity_transport_types_proto_rawDescData) + }) + return file_solidarity_transport_types_proto_rawDescData +} + +var file_solidarity_transport_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_solidarity_transport_types_proto_goTypes = []interface{}{ + (*GeoJsonFeature)(nil), // 0: GeoJsonFeature + (*GeoJsonFeatureCollection)(nil), // 1: GeoJsonFeatureCollection + (*DriverRegularAvailability)(nil), // 2: DriverRegularAvailability + (*SolidarityTransportDriverJourney)(nil), // 3: SolidarityTransportDriverJourney + (*SolidarityTransportPrice)(nil), // 4: SolidarityTransportPrice + (*SolidarityTransportBooking)(nil), // 5: SolidarityTransportBooking + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp +} +var file_solidarity_transport_types_proto_depIdxs = []int32{ + 0, // 0: DriverRegularAvailability.address:type_name -> GeoJsonFeature + 0, // 1: SolidarityTransportDriverJourney.passenger_pickup:type_name -> GeoJsonFeature + 0, // 2: SolidarityTransportDriverJourney.passenger_drop:type_name -> GeoJsonFeature + 0, // 3: SolidarityTransportDriverJourney.driver_departure:type_name -> GeoJsonFeature + 0, // 4: SolidarityTransportDriverJourney.driver_arrival:type_name -> GeoJsonFeature + 6, // 5: SolidarityTransportDriverJourney.passenger_pickup_date:type_name -> google.protobuf.Timestamp + 6, // 6: SolidarityTransportDriverJourney.driver_departure_date:type_name -> google.protobuf.Timestamp + 4, // 7: SolidarityTransportDriverJourney.price:type_name -> SolidarityTransportPrice + 3, // 8: SolidarityTransportBooking.journey:type_name -> SolidarityTransportDriverJourney + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_solidarity_transport_types_proto_init() } +func file_solidarity_transport_types_proto_init() { + if File_solidarity_transport_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_solidarity_transport_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeoJsonFeature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeoJsonFeatureCollection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DriverRegularAvailability); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SolidarityTransportDriverJourney); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SolidarityTransportPrice); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SolidarityTransportBooking); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_solidarity_transport_types_proto_msgTypes[3].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_solidarity_transport_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_solidarity_transport_types_proto_goTypes, + DependencyIndexes: file_solidarity_transport_types_proto_depIdxs, + MessageInfos: file_solidarity_transport_types_proto_msgTypes, + }.Build() + File_solidarity_transport_types_proto = out.File + file_solidarity_transport_types_proto_rawDesc = nil + file_solidarity_transport_types_proto_goTypes = nil + file_solidarity_transport_types_proto_depIdxs = nil +} diff --git a/servers/grpc/proto/gen/solidarity-transport.pb.go b/servers/grpc/proto/gen/solidarity-transport.pb.go new file mode 100644 index 0000000..c4dd189 --- /dev/null +++ b/servers/grpc/proto/gen/solidarity-transport.pb.go @@ -0,0 +1,1578 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: solidarity-transport.proto + +package gen + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AddDriverRegularAvailabilityRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DriverId string `protobuf:"bytes,1,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + Day int32 `protobuf:"varint,2,opt,name=day,proto3" json:"day,omitempty"` + StartTime string `protobuf:"bytes,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime string `protobuf:"bytes,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + Address *GeoJsonFeature `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *AddDriverRegularAvailabilityRequest) Reset() { + *x = AddDriverRegularAvailabilityRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddDriverRegularAvailabilityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddDriverRegularAvailabilityRequest) ProtoMessage() {} + +func (x *AddDriverRegularAvailabilityRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddDriverRegularAvailabilityRequest.ProtoReflect.Descriptor instead. +func (*AddDriverRegularAvailabilityRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{0} +} + +func (x *AddDriverRegularAvailabilityRequest) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *AddDriverRegularAvailabilityRequest) GetDay() int32 { + if x != nil { + return x.Day + } + return 0 +} + +func (x *AddDriverRegularAvailabilityRequest) GetStartTime() string { + if x != nil { + return x.StartTime + } + return "" +} + +func (x *AddDriverRegularAvailabilityRequest) GetEndTime() string { + if x != nil { + return x.EndTime + } + return "" +} + +func (x *AddDriverRegularAvailabilityRequest) GetAddress() *GeoJsonFeature { + if x != nil { + return x.Address + } + return nil +} + +type AddDriverRegularAvailabilityResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AddDriverRegularAvailabilityResponse) Reset() { + *x = AddDriverRegularAvailabilityResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddDriverRegularAvailabilityResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddDriverRegularAvailabilityResponse) ProtoMessage() {} + +func (x *AddDriverRegularAvailabilityResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddDriverRegularAvailabilityResponse.ProtoReflect.Descriptor instead. +func (*AddDriverRegularAvailabilityResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{1} +} + +type AddDriverRegularAvailabilitiesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Availabilities []*DriverRegularAvailability `protobuf:"bytes,1,rep,name=availabilities,proto3" json:"availabilities,omitempty"` +} + +func (x *AddDriverRegularAvailabilitiesRequest) Reset() { + *x = AddDriverRegularAvailabilitiesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddDriverRegularAvailabilitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddDriverRegularAvailabilitiesRequest) ProtoMessage() {} + +func (x *AddDriverRegularAvailabilitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddDriverRegularAvailabilitiesRequest.ProtoReflect.Descriptor instead. +func (*AddDriverRegularAvailabilitiesRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{2} +} + +func (x *AddDriverRegularAvailabilitiesRequest) GetAvailabilities() []*DriverRegularAvailability { + if x != nil { + return x.Availabilities + } + return nil +} + +type AddDriverRegularAvailabilitiesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AddDriverRegularAvailabilitiesResponse) Reset() { + *x = AddDriverRegularAvailabilitiesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddDriverRegularAvailabilitiesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddDriverRegularAvailabilitiesResponse) ProtoMessage() {} + +func (x *AddDriverRegularAvailabilitiesResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddDriverRegularAvailabilitiesResponse.ProtoReflect.Descriptor instead. +func (*AddDriverRegularAvailabilitiesResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{3} +} + +type GetDriverRegularAvailabilitiesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DriverId string `protobuf:"bytes,1,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` +} + +func (x *GetDriverRegularAvailabilitiesRequest) Reset() { + *x = GetDriverRegularAvailabilitiesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDriverRegularAvailabilitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDriverRegularAvailabilitiesRequest) ProtoMessage() {} + +func (x *GetDriverRegularAvailabilitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDriverRegularAvailabilitiesRequest.ProtoReflect.Descriptor instead. +func (*GetDriverRegularAvailabilitiesRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{4} +} + +func (x *GetDriverRegularAvailabilitiesRequest) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +type GetDriverRegularAvailabilitiesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Results []*DriverRegularAvailability `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *GetDriverRegularAvailabilitiesResponse) Reset() { + *x = GetDriverRegularAvailabilitiesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDriverRegularAvailabilitiesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDriverRegularAvailabilitiesResponse) ProtoMessage() {} + +func (x *GetDriverRegularAvailabilitiesResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDriverRegularAvailabilitiesResponse.ProtoReflect.Descriptor instead. +func (*GetDriverRegularAvailabilitiesResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{5} +} + +func (x *GetDriverRegularAvailabilitiesResponse) GetResults() []*DriverRegularAvailability { + if x != nil { + return x.Results + } + return nil +} + +type DeleteDriverRegularAvailabilityRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DriverId string `protobuf:"bytes,1,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + AvailabilityId string `protobuf:"bytes,2,opt,name=availability_id,json=availabilityId,proto3" json:"availability_id,omitempty"` +} + +func (x *DeleteDriverRegularAvailabilityRequest) Reset() { + *x = DeleteDriverRegularAvailabilityRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDriverRegularAvailabilityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDriverRegularAvailabilityRequest) ProtoMessage() {} + +func (x *DeleteDriverRegularAvailabilityRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteDriverRegularAvailabilityRequest.ProtoReflect.Descriptor instead. +func (*DeleteDriverRegularAvailabilityRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteDriverRegularAvailabilityRequest) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *DeleteDriverRegularAvailabilityRequest) GetAvailabilityId() string { + if x != nil { + return x.AvailabilityId + } + return "" +} + +type DeleteDriverRegularAvailabilityResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteDriverRegularAvailabilityResponse) Reset() { + *x = DeleteDriverRegularAvailabilityResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDriverRegularAvailabilityResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDriverRegularAvailabilityResponse) ProtoMessage() {} + +func (x *DeleteDriverRegularAvailabilityResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteDriverRegularAvailabilityResponse.ProtoReflect.Descriptor instead. +func (*DeleteDriverRegularAvailabilityResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{7} +} + +type GetDriverJourneysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Departure *GeoJsonFeature `protobuf:"bytes,1,opt,name=departure,proto3" json:"departure,omitempty"` + Arrival *GeoJsonFeature `protobuf:"bytes,3,opt,name=arrival,proto3" json:"arrival,omitempty"` + DepartureDate *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=departure_date,json=departureDate,proto3" json:"departure_date,omitempty"` + TimeDelta *int64 `protobuf:"varint,6,opt,name=time_delta,json=timeDelta,proto3,oneof" json:"time_delta,omitempty"` +} + +func (x *GetDriverJourneysRequest) Reset() { + *x = GetDriverJourneysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDriverJourneysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDriverJourneysRequest) ProtoMessage() {} + +func (x *GetDriverJourneysRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDriverJourneysRequest.ProtoReflect.Descriptor instead. +func (*GetDriverJourneysRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{8} +} + +func (x *GetDriverJourneysRequest) GetDeparture() *GeoJsonFeature { + if x != nil { + return x.Departure + } + return nil +} + +func (x *GetDriverJourneysRequest) GetArrival() *GeoJsonFeature { + if x != nil { + return x.Arrival + } + return nil +} + +func (x *GetDriverJourneysRequest) GetDepartureDate() *timestamppb.Timestamp { + if x != nil { + return x.DepartureDate + } + return nil +} + +func (x *GetDriverJourneysRequest) GetTimeDelta() int64 { + if x != nil && x.TimeDelta != nil { + return *x.TimeDelta + } + return 0 +} + +type GetDriverJourneysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DriverJourneys []*SolidarityTransportDriverJourney `protobuf:"bytes,1,rep,name=driver_journeys,json=driverJourneys,proto3" json:"driver_journeys,omitempty"` +} + +func (x *GetDriverJourneysResponse) Reset() { + *x = GetDriverJourneysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDriverJourneysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDriverJourneysResponse) ProtoMessage() {} + +func (x *GetDriverJourneysResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDriverJourneysResponse.ProtoReflect.Descriptor instead. +func (*GetDriverJourneysResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{9} +} + +func (x *GetDriverJourneysResponse) GetDriverJourneys() []*SolidarityTransportDriverJourney { + if x != nil { + return x.DriverJourneys + } + return nil +} + +type GetDriverJourneyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DriverId string `protobuf:"bytes,1,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + JourneyId string `protobuf:"bytes,2,opt,name=journey_id,json=journeyId,proto3" json:"journey_id,omitempty"` +} + +func (x *GetDriverJourneyRequest) Reset() { + *x = GetDriverJourneyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDriverJourneyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDriverJourneyRequest) ProtoMessage() {} + +func (x *GetDriverJourneyRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDriverJourneyRequest.ProtoReflect.Descriptor instead. +func (*GetDriverJourneyRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{10} +} + +func (x *GetDriverJourneyRequest) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *GetDriverJourneyRequest) GetJourneyId() string { + if x != nil { + return x.JourneyId + } + return "" +} + +type GetDriverJourneyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DriverJourney *SolidarityTransportDriverJourney `protobuf:"bytes,1,opt,name=driver_journey,json=driverJourney,proto3" json:"driver_journey,omitempty"` +} + +func (x *GetDriverJourneyResponse) Reset() { + *x = GetDriverJourneyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDriverJourneyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDriverJourneyResponse) ProtoMessage() {} + +func (x *GetDriverJourneyResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDriverJourneyResponse.ProtoReflect.Descriptor instead. +func (*GetDriverJourneyResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{11} +} + +func (x *GetDriverJourneyResponse) GetDriverJourney() *SolidarityTransportDriverJourney { + if x != nil { + return x.DriverJourney + } + return nil +} + +type BookDriverJourneyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PassengerId string `protobuf:"bytes,1,opt,name=passenger_id,json=passengerId,proto3" json:"passenger_id,omitempty"` + DriverId string `protobuf:"bytes,2,opt,name=driver_id,json=driverId,proto3" json:"driver_id,omitempty"` + DriverJourneyId string `protobuf:"bytes,3,opt,name=driver_journey_id,json=driverJourneyId,proto3" json:"driver_journey_id,omitempty"` +} + +func (x *BookDriverJourneyRequest) Reset() { + *x = BookDriverJourneyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BookDriverJourneyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BookDriverJourneyRequest) ProtoMessage() {} + +func (x *BookDriverJourneyRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BookDriverJourneyRequest.ProtoReflect.Descriptor instead. +func (*BookDriverJourneyRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{12} +} + +func (x *BookDriverJourneyRequest) GetPassengerId() string { + if x != nil { + return x.PassengerId + } + return "" +} + +func (x *BookDriverJourneyRequest) GetDriverId() string { + if x != nil { + return x.DriverId + } + return "" +} + +func (x *BookDriverJourneyRequest) GetDriverJourneyId() string { + if x != nil { + return x.DriverJourneyId + } + return "" +} + +type BookDriverJourneyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *BookDriverJourneyResponse) Reset() { + *x = BookDriverJourneyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BookDriverJourneyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BookDriverJourneyResponse) ProtoMessage() {} + +func (x *BookDriverJourneyResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BookDriverJourneyResponse.ProtoReflect.Descriptor instead. +func (*BookDriverJourneyResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{13} +} + +type GetSolidarityTransportBookingsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StartDate *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + EndDate *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` +} + +func (x *GetSolidarityTransportBookingsRequest) Reset() { + *x = GetSolidarityTransportBookingsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSolidarityTransportBookingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSolidarityTransportBookingsRequest) ProtoMessage() {} + +func (x *GetSolidarityTransportBookingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSolidarityTransportBookingsRequest.ProtoReflect.Descriptor instead. +func (*GetSolidarityTransportBookingsRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{14} +} + +func (x *GetSolidarityTransportBookingsRequest) GetStartDate() *timestamppb.Timestamp { + if x != nil { + return x.StartDate + } + return nil +} + +func (x *GetSolidarityTransportBookingsRequest) GetEndDate() *timestamppb.Timestamp { + if x != nil { + return x.EndDate + } + return nil +} + +type GetSolidarityTransportBookingsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bookings []*SolidarityTransportBooking `protobuf:"bytes,1,rep,name=bookings,proto3" json:"bookings,omitempty"` +} + +func (x *GetSolidarityTransportBookingsResponse) Reset() { + *x = GetSolidarityTransportBookingsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSolidarityTransportBookingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSolidarityTransportBookingsResponse) ProtoMessage() {} + +func (x *GetSolidarityTransportBookingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSolidarityTransportBookingsResponse.ProtoReflect.Descriptor instead. +func (*GetSolidarityTransportBookingsResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{15} +} + +func (x *GetSolidarityTransportBookingsResponse) GetBookings() []*SolidarityTransportBooking { + if x != nil { + return x.Bookings + } + return nil +} + +type GetSolidarityTransportBookingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetSolidarityTransportBookingRequest) Reset() { + *x = GetSolidarityTransportBookingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSolidarityTransportBookingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSolidarityTransportBookingRequest) ProtoMessage() {} + +func (x *GetSolidarityTransportBookingRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSolidarityTransportBookingRequest.ProtoReflect.Descriptor instead. +func (*GetSolidarityTransportBookingRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{16} +} + +func (x *GetSolidarityTransportBookingRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetSolidarityTransportBookingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Booking *SolidarityTransportBooking `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"` +} + +func (x *GetSolidarityTransportBookingResponse) Reset() { + *x = GetSolidarityTransportBookingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSolidarityTransportBookingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSolidarityTransportBookingResponse) ProtoMessage() {} + +func (x *GetSolidarityTransportBookingResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSolidarityTransportBookingResponse.ProtoReflect.Descriptor instead. +func (*GetSolidarityTransportBookingResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{17} +} + +func (x *GetSolidarityTransportBookingResponse) GetBooking() *SolidarityTransportBooking { + if x != nil { + return x.Booking + } + return nil +} + +type UpdateSolidarityTransportBookingStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BookingId string `protobuf:"bytes,1,opt,name=booking_id,json=bookingId,proto3" json:"booking_id,omitempty"` + NewStatus string `protobuf:"bytes,2,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"` +} + +func (x *UpdateSolidarityTransportBookingStatusRequest) Reset() { + *x = UpdateSolidarityTransportBookingStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSolidarityTransportBookingStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSolidarityTransportBookingStatusRequest) ProtoMessage() {} + +func (x *UpdateSolidarityTransportBookingStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSolidarityTransportBookingStatusRequest.ProtoReflect.Descriptor instead. +func (*UpdateSolidarityTransportBookingStatusRequest) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{18} +} + +func (x *UpdateSolidarityTransportBookingStatusRequest) GetBookingId() string { + if x != nil { + return x.BookingId + } + return "" +} + +func (x *UpdateSolidarityTransportBookingStatusRequest) GetNewStatus() string { + if x != nil { + return x.NewStatus + } + return "" +} + +type UpdateSolidarityTransportBookingStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateSolidarityTransportBookingStatusResponse) Reset() { + *x = UpdateSolidarityTransportBookingStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_solidarity_transport_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSolidarityTransportBookingStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSolidarityTransportBookingStatusResponse) ProtoMessage() {} + +func (x *UpdateSolidarityTransportBookingStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_solidarity_transport_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSolidarityTransportBookingStatusResponse.ProtoReflect.Descriptor instead. +func (*UpdateSolidarityTransportBookingStatusResponse) Descriptor() ([]byte, []int) { + return file_solidarity_transport_proto_rawDescGZIP(), []int{19} +} + +var File_solidarity_transport_proto protoreflect.FileDescriptor + +var file_solidarity_transport_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, + 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, + 0x6f, 0x72, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xb9, 0x01, 0x0a, 0x23, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, + 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x29, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x26, 0x0a, 0x24, 0x41, + 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, + 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x6b, 0x0a, 0x25, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x0e, + 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, + 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x52, 0x0e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, + 0x22, 0x28, 0x0a, 0x26, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, + 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x25, 0x47, 0x65, + 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, + 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, + 0x22, 0x5e, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, + 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x44, 0x72, + 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, + 0x22, 0x6e, 0x0a, 0x26, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x72, + 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, + 0x22, 0x29, 0x0a, 0x27, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xea, 0x01, 0x0a, 0x18, + 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x61, + 0x72, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, + 0x6f, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x64, 0x65, + 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x61, 0x72, 0x72, 0x69, 0x76, + 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x47, 0x65, 0x6f, 0x4a, 0x73, + 0x6f, 0x6e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x07, 0x61, 0x72, 0x72, 0x69, 0x76, + 0x61, 0x6c, 0x12, 0x41, 0x0a, 0x0e, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, + 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, + 0x65, 0x44, 0x61, 0x74, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x64, 0x65, + 0x6c, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x44, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, + 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x70, 0x6f, 0x72, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, + 0x79, 0x52, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, + 0x73, 0x22, 0x55, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, + 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, + 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6a, 0x6f, 0x75, + 0x72, 0x6e, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6a, + 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x44, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x6a, + 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x53, + 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, + 0x72, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, + 0x0d, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x22, 0x86, + 0x01, 0x0a, 0x18, 0x42, 0x6f, 0x6f, 0x6b, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, + 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, + 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x64, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, + 0x75, 0x72, 0x6e, 0x65, 0x79, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x19, 0x42, 0x6f, 0x6f, 0x6b, 0x44, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, + 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, + 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, + 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x65, 0x6e, 0x64, + 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, + 0x22, 0x61, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, + 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, + 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x62, 0x6f, + 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x53, + 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, + 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x69, + 0x6e, 0x67, 0x73, 0x22, 0x36, 0x0a, 0x24, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, + 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, + 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5e, 0x0a, 0x25, 0x47, + 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, + 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, + 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x6d, 0x0a, 0x2d, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, + 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, + 0x65, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x30, 0x0a, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x08, 0x0a, + 0x13, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x70, 0x6f, 0x72, 0x74, 0x12, 0x6d, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x12, 0x24, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x41, 0x64, 0x64, + 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, + 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x73, 0x0a, 0x1e, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, + 0x41, 0x64, 0x64, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, + 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x73, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x44, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, + 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x47, 0x65, 0x74, + 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, + 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, + 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x76, 0x0a, + 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, + 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x12, 0x27, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, + 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, + 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, + 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x12, 0x19, 0x2e, 0x47, 0x65, 0x74, + 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, + 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x12, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, + 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x19, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, + 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, + 0x0a, 0x11, 0x42, 0x6f, 0x6f, 0x6b, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, + 0x6e, 0x65, 0x79, 0x12, 0x19, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, + 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, + 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x73, 0x0a, 0x1e, + 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x26, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, + 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, + 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x70, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, + 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, + 0x6e, 0x67, 0x12, 0x25, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, + 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, + 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x8b, 0x01, 0x0a, 0x26, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, + 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, + 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, + 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, + 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, + 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x4b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, + 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, + 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_solidarity_transport_proto_rawDescOnce sync.Once + file_solidarity_transport_proto_rawDescData = file_solidarity_transport_proto_rawDesc +) + +func file_solidarity_transport_proto_rawDescGZIP() []byte { + file_solidarity_transport_proto_rawDescOnce.Do(func() { + file_solidarity_transport_proto_rawDescData = protoimpl.X.CompressGZIP(file_solidarity_transport_proto_rawDescData) + }) + return file_solidarity_transport_proto_rawDescData +} + +var file_solidarity_transport_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_solidarity_transport_proto_goTypes = []interface{}{ + (*AddDriverRegularAvailabilityRequest)(nil), // 0: AddDriverRegularAvailabilityRequest + (*AddDriverRegularAvailabilityResponse)(nil), // 1: AddDriverRegularAvailabilityResponse + (*AddDriverRegularAvailabilitiesRequest)(nil), // 2: AddDriverRegularAvailabilitiesRequest + (*AddDriverRegularAvailabilitiesResponse)(nil), // 3: AddDriverRegularAvailabilitiesResponse + (*GetDriverRegularAvailabilitiesRequest)(nil), // 4: GetDriverRegularAvailabilitiesRequest + (*GetDriverRegularAvailabilitiesResponse)(nil), // 5: GetDriverRegularAvailabilitiesResponse + (*DeleteDriverRegularAvailabilityRequest)(nil), // 6: DeleteDriverRegularAvailabilityRequest + (*DeleteDriverRegularAvailabilityResponse)(nil), // 7: DeleteDriverRegularAvailabilityResponse + (*GetDriverJourneysRequest)(nil), // 8: GetDriverJourneysRequest + (*GetDriverJourneysResponse)(nil), // 9: GetDriverJourneysResponse + (*GetDriverJourneyRequest)(nil), // 10: GetDriverJourneyRequest + (*GetDriverJourneyResponse)(nil), // 11: GetDriverJourneyResponse + (*BookDriverJourneyRequest)(nil), // 12: BookDriverJourneyRequest + (*BookDriverJourneyResponse)(nil), // 13: BookDriverJourneyResponse + (*GetSolidarityTransportBookingsRequest)(nil), // 14: GetSolidarityTransportBookingsRequest + (*GetSolidarityTransportBookingsResponse)(nil), // 15: GetSolidarityTransportBookingsResponse + (*GetSolidarityTransportBookingRequest)(nil), // 16: GetSolidarityTransportBookingRequest + (*GetSolidarityTransportBookingResponse)(nil), // 17: GetSolidarityTransportBookingResponse + (*UpdateSolidarityTransportBookingStatusRequest)(nil), // 18: UpdateSolidarityTransportBookingStatusRequest + (*UpdateSolidarityTransportBookingStatusResponse)(nil), // 19: UpdateSolidarityTransportBookingStatusResponse + (*GeoJsonFeature)(nil), // 20: GeoJsonFeature + (*DriverRegularAvailability)(nil), // 21: DriverRegularAvailability + (*timestamppb.Timestamp)(nil), // 22: google.protobuf.Timestamp + (*SolidarityTransportDriverJourney)(nil), // 23: SolidarityTransportDriverJourney + (*SolidarityTransportBooking)(nil), // 24: SolidarityTransportBooking +} +var file_solidarity_transport_proto_depIdxs = []int32{ + 20, // 0: AddDriverRegularAvailabilityRequest.address:type_name -> GeoJsonFeature + 21, // 1: AddDriverRegularAvailabilitiesRequest.availabilities:type_name -> DriverRegularAvailability + 21, // 2: GetDriverRegularAvailabilitiesResponse.results:type_name -> DriverRegularAvailability + 20, // 3: GetDriverJourneysRequest.departure:type_name -> GeoJsonFeature + 20, // 4: GetDriverJourneysRequest.arrival:type_name -> GeoJsonFeature + 22, // 5: GetDriverJourneysRequest.departure_date:type_name -> google.protobuf.Timestamp + 23, // 6: GetDriverJourneysResponse.driver_journeys:type_name -> SolidarityTransportDriverJourney + 23, // 7: GetDriverJourneyResponse.driver_journey:type_name -> SolidarityTransportDriverJourney + 22, // 8: GetSolidarityTransportBookingsRequest.start_date:type_name -> google.protobuf.Timestamp + 22, // 9: GetSolidarityTransportBookingsRequest.end_date:type_name -> google.protobuf.Timestamp + 24, // 10: GetSolidarityTransportBookingsResponse.bookings:type_name -> SolidarityTransportBooking + 24, // 11: GetSolidarityTransportBookingResponse.booking:type_name -> SolidarityTransportBooking + 0, // 12: SolidarityTransport.AddDriverRegularAvailability:input_type -> AddDriverRegularAvailabilityRequest + 2, // 13: SolidarityTransport.AddDriverRegularAvailabilities:input_type -> AddDriverRegularAvailabilitiesRequest + 4, // 14: SolidarityTransport.GetDriverRegularAvailabilities:input_type -> GetDriverRegularAvailabilitiesRequest + 6, // 15: SolidarityTransport.DeleteDriverRegularAvailability:input_type -> DeleteDriverRegularAvailabilityRequest + 8, // 16: SolidarityTransport.GetDriverJourneys:input_type -> GetDriverJourneysRequest + 10, // 17: SolidarityTransport.GetDriverJourney:input_type -> GetDriverJourneyRequest + 12, // 18: SolidarityTransport.BookDriverJourney:input_type -> BookDriverJourneyRequest + 14, // 19: SolidarityTransport.GetSolidarityTransportBookings:input_type -> GetSolidarityTransportBookingsRequest + 16, // 20: SolidarityTransport.GetSolidarityTransportBooking:input_type -> GetSolidarityTransportBookingRequest + 18, // 21: SolidarityTransport.UpdateSolidarityTransportBookingStatus:input_type -> UpdateSolidarityTransportBookingStatusRequest + 1, // 22: SolidarityTransport.AddDriverRegularAvailability:output_type -> AddDriverRegularAvailabilityResponse + 3, // 23: SolidarityTransport.AddDriverRegularAvailabilities:output_type -> AddDriverRegularAvailabilitiesResponse + 5, // 24: SolidarityTransport.GetDriverRegularAvailabilities:output_type -> GetDriverRegularAvailabilitiesResponse + 7, // 25: SolidarityTransport.DeleteDriverRegularAvailability:output_type -> DeleteDriverRegularAvailabilityResponse + 9, // 26: SolidarityTransport.GetDriverJourneys:output_type -> GetDriverJourneysResponse + 11, // 27: SolidarityTransport.GetDriverJourney:output_type -> GetDriverJourneyResponse + 13, // 28: SolidarityTransport.BookDriverJourney:output_type -> BookDriverJourneyResponse + 15, // 29: SolidarityTransport.GetSolidarityTransportBookings:output_type -> GetSolidarityTransportBookingsResponse + 17, // 30: SolidarityTransport.GetSolidarityTransportBooking:output_type -> GetSolidarityTransportBookingResponse + 19, // 31: SolidarityTransport.UpdateSolidarityTransportBookingStatus:output_type -> UpdateSolidarityTransportBookingStatusResponse + 22, // [22:32] is the sub-list for method output_type + 12, // [12:22] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_solidarity_transport_proto_init() } +func file_solidarity_transport_proto_init() { + if File_solidarity_transport_proto != nil { + return + } + file_solidarity_transport_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_solidarity_transport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddDriverRegularAvailabilityRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddDriverRegularAvailabilityResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddDriverRegularAvailabilitiesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddDriverRegularAvailabilitiesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDriverRegularAvailabilitiesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDriverRegularAvailabilitiesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDriverRegularAvailabilityRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDriverRegularAvailabilityResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDriverJourneysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDriverJourneysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDriverJourneyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDriverJourneyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BookDriverJourneyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BookDriverJourneyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSolidarityTransportBookingsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSolidarityTransportBookingsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSolidarityTransportBookingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSolidarityTransportBookingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSolidarityTransportBookingStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_solidarity_transport_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSolidarityTransportBookingStatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_solidarity_transport_proto_msgTypes[8].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_solidarity_transport_proto_rawDesc, + NumEnums: 0, + NumMessages: 20, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_solidarity_transport_proto_goTypes, + DependencyIndexes: file_solidarity_transport_proto_depIdxs, + MessageInfos: file_solidarity_transport_proto_msgTypes, + }.Build() + File_solidarity_transport_proto = out.File + file_solidarity_transport_proto_rawDesc = nil + file_solidarity_transport_proto_goTypes = nil + file_solidarity_transport_proto_depIdxs = nil +} diff --git a/servers/grpc/proto/gen/solidarity-transport_grpc.pb.go b/servers/grpc/proto/gen/solidarity-transport_grpc.pb.go new file mode 100644 index 0000000..e562778 --- /dev/null +++ b/servers/grpc/proto/gen/solidarity-transport_grpc.pb.go @@ -0,0 +1,448 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.4 +// source: solidarity-transport.proto + +package gen + +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 ( + SolidarityTransport_AddDriverRegularAvailability_FullMethodName = "/SolidarityTransport/AddDriverRegularAvailability" + SolidarityTransport_AddDriverRegularAvailabilities_FullMethodName = "/SolidarityTransport/AddDriverRegularAvailabilities" + SolidarityTransport_GetDriverRegularAvailabilities_FullMethodName = "/SolidarityTransport/GetDriverRegularAvailabilities" + SolidarityTransport_DeleteDriverRegularAvailability_FullMethodName = "/SolidarityTransport/DeleteDriverRegularAvailability" + SolidarityTransport_GetDriverJourneys_FullMethodName = "/SolidarityTransport/GetDriverJourneys" + SolidarityTransport_GetDriverJourney_FullMethodName = "/SolidarityTransport/GetDriverJourney" + SolidarityTransport_BookDriverJourney_FullMethodName = "/SolidarityTransport/BookDriverJourney" + SolidarityTransport_GetSolidarityTransportBookings_FullMethodName = "/SolidarityTransport/GetSolidarityTransportBookings" + SolidarityTransport_GetSolidarityTransportBooking_FullMethodName = "/SolidarityTransport/GetSolidarityTransportBooking" + SolidarityTransport_UpdateSolidarityTransportBookingStatus_FullMethodName = "/SolidarityTransport/UpdateSolidarityTransportBookingStatus" +) + +// SolidarityTransportClient is the client API for SolidarityTransport 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 SolidarityTransportClient interface { + // Availabilities management + AddDriverRegularAvailability(ctx context.Context, in *AddDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilityResponse, error) + AddDriverRegularAvailabilities(ctx context.Context, in *AddDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilitiesResponse, error) + GetDriverRegularAvailabilities(ctx context.Context, in *GetDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*GetDriverRegularAvailabilitiesResponse, error) + DeleteDriverRegularAvailability(ctx context.Context, in *DeleteDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*DeleteDriverRegularAvailabilityResponse, error) + // Search / Journeys + GetDriverJourneys(ctx context.Context, in *GetDriverJourneysRequest, opts ...grpc.CallOption) (*GetDriverJourneysResponse, error) + GetDriverJourney(ctx context.Context, in *GetDriverJourneyRequest, opts ...grpc.CallOption) (*GetDriverJourneyResponse, error) + // Booking flows + BookDriverJourney(ctx context.Context, in *BookDriverJourneyRequest, opts ...grpc.CallOption) (*BookDriverJourneyResponse, error) + GetSolidarityTransportBookings(ctx context.Context, in *GetSolidarityTransportBookingsRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingsResponse, error) + GetSolidarityTransportBooking(ctx context.Context, in *GetSolidarityTransportBookingRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingResponse, error) + UpdateSolidarityTransportBookingStatus(ctx context.Context, in *UpdateSolidarityTransportBookingStatusRequest, opts ...grpc.CallOption) (*UpdateSolidarityTransportBookingStatusResponse, error) +} + +type solidarityTransportClient struct { + cc grpc.ClientConnInterface +} + +func NewSolidarityTransportClient(cc grpc.ClientConnInterface) SolidarityTransportClient { + return &solidarityTransportClient{cc} +} + +func (c *solidarityTransportClient) AddDriverRegularAvailability(ctx context.Context, in *AddDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilityResponse, error) { + out := new(AddDriverRegularAvailabilityResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_AddDriverRegularAvailability_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) AddDriverRegularAvailabilities(ctx context.Context, in *AddDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*AddDriverRegularAvailabilitiesResponse, error) { + out := new(AddDriverRegularAvailabilitiesResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_AddDriverRegularAvailabilities_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) GetDriverRegularAvailabilities(ctx context.Context, in *GetDriverRegularAvailabilitiesRequest, opts ...grpc.CallOption) (*GetDriverRegularAvailabilitiesResponse, error) { + out := new(GetDriverRegularAvailabilitiesResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_GetDriverRegularAvailabilities_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) DeleteDriverRegularAvailability(ctx context.Context, in *DeleteDriverRegularAvailabilityRequest, opts ...grpc.CallOption) (*DeleteDriverRegularAvailabilityResponse, error) { + out := new(DeleteDriverRegularAvailabilityResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_DeleteDriverRegularAvailability_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) GetDriverJourneys(ctx context.Context, in *GetDriverJourneysRequest, opts ...grpc.CallOption) (*GetDriverJourneysResponse, error) { + out := new(GetDriverJourneysResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_GetDriverJourneys_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) GetDriverJourney(ctx context.Context, in *GetDriverJourneyRequest, opts ...grpc.CallOption) (*GetDriverJourneyResponse, error) { + out := new(GetDriverJourneyResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_GetDriverJourney_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) BookDriverJourney(ctx context.Context, in *BookDriverJourneyRequest, opts ...grpc.CallOption) (*BookDriverJourneyResponse, error) { + out := new(BookDriverJourneyResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_BookDriverJourney_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) GetSolidarityTransportBookings(ctx context.Context, in *GetSolidarityTransportBookingsRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingsResponse, error) { + out := new(GetSolidarityTransportBookingsResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_GetSolidarityTransportBookings_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) GetSolidarityTransportBooking(ctx context.Context, in *GetSolidarityTransportBookingRequest, opts ...grpc.CallOption) (*GetSolidarityTransportBookingResponse, error) { + out := new(GetSolidarityTransportBookingResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_GetSolidarityTransportBooking_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solidarityTransportClient) UpdateSolidarityTransportBookingStatus(ctx context.Context, in *UpdateSolidarityTransportBookingStatusRequest, opts ...grpc.CallOption) (*UpdateSolidarityTransportBookingStatusResponse, error) { + out := new(UpdateSolidarityTransportBookingStatusResponse) + err := c.cc.Invoke(ctx, SolidarityTransport_UpdateSolidarityTransportBookingStatus_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SolidarityTransportServer is the server API for SolidarityTransport service. +// All implementations must embed UnimplementedSolidarityTransportServer +// for forward compatibility +type SolidarityTransportServer interface { + // Availabilities management + AddDriverRegularAvailability(context.Context, *AddDriverRegularAvailabilityRequest) (*AddDriverRegularAvailabilityResponse, error) + AddDriverRegularAvailabilities(context.Context, *AddDriverRegularAvailabilitiesRequest) (*AddDriverRegularAvailabilitiesResponse, error) + GetDriverRegularAvailabilities(context.Context, *GetDriverRegularAvailabilitiesRequest) (*GetDriverRegularAvailabilitiesResponse, error) + DeleteDriverRegularAvailability(context.Context, *DeleteDriverRegularAvailabilityRequest) (*DeleteDriverRegularAvailabilityResponse, error) + // Search / Journeys + GetDriverJourneys(context.Context, *GetDriverJourneysRequest) (*GetDriverJourneysResponse, error) + GetDriverJourney(context.Context, *GetDriverJourneyRequest) (*GetDriverJourneyResponse, error) + // Booking flows + BookDriverJourney(context.Context, *BookDriverJourneyRequest) (*BookDriverJourneyResponse, error) + GetSolidarityTransportBookings(context.Context, *GetSolidarityTransportBookingsRequest) (*GetSolidarityTransportBookingsResponse, error) + GetSolidarityTransportBooking(context.Context, *GetSolidarityTransportBookingRequest) (*GetSolidarityTransportBookingResponse, error) + UpdateSolidarityTransportBookingStatus(context.Context, *UpdateSolidarityTransportBookingStatusRequest) (*UpdateSolidarityTransportBookingStatusResponse, error) + mustEmbedUnimplementedSolidarityTransportServer() +} + +// UnimplementedSolidarityTransportServer must be embedded to have forward compatible implementations. +type UnimplementedSolidarityTransportServer struct { +} + +func (UnimplementedSolidarityTransportServer) AddDriverRegularAvailability(context.Context, *AddDriverRegularAvailabilityRequest) (*AddDriverRegularAvailabilityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddDriverRegularAvailability not implemented") +} +func (UnimplementedSolidarityTransportServer) AddDriverRegularAvailabilities(context.Context, *AddDriverRegularAvailabilitiesRequest) (*AddDriverRegularAvailabilitiesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddDriverRegularAvailabilities not implemented") +} +func (UnimplementedSolidarityTransportServer) GetDriverRegularAvailabilities(context.Context, *GetDriverRegularAvailabilitiesRequest) (*GetDriverRegularAvailabilitiesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDriverRegularAvailabilities not implemented") +} +func (UnimplementedSolidarityTransportServer) DeleteDriverRegularAvailability(context.Context, *DeleteDriverRegularAvailabilityRequest) (*DeleteDriverRegularAvailabilityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteDriverRegularAvailability not implemented") +} +func (UnimplementedSolidarityTransportServer) GetDriverJourneys(context.Context, *GetDriverJourneysRequest) (*GetDriverJourneysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDriverJourneys not implemented") +} +func (UnimplementedSolidarityTransportServer) GetDriverJourney(context.Context, *GetDriverJourneyRequest) (*GetDriverJourneyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDriverJourney not implemented") +} +func (UnimplementedSolidarityTransportServer) BookDriverJourney(context.Context, *BookDriverJourneyRequest) (*BookDriverJourneyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BookDriverJourney not implemented") +} +func (UnimplementedSolidarityTransportServer) GetSolidarityTransportBookings(context.Context, *GetSolidarityTransportBookingsRequest) (*GetSolidarityTransportBookingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSolidarityTransportBookings not implemented") +} +func (UnimplementedSolidarityTransportServer) GetSolidarityTransportBooking(context.Context, *GetSolidarityTransportBookingRequest) (*GetSolidarityTransportBookingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSolidarityTransportBooking not implemented") +} +func (UnimplementedSolidarityTransportServer) UpdateSolidarityTransportBookingStatus(context.Context, *UpdateSolidarityTransportBookingStatusRequest) (*UpdateSolidarityTransportBookingStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSolidarityTransportBookingStatus not implemented") +} +func (UnimplementedSolidarityTransportServer) mustEmbedUnimplementedSolidarityTransportServer() {} + +// UnsafeSolidarityTransportServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SolidarityTransportServer will +// result in compilation errors. +type UnsafeSolidarityTransportServer interface { + mustEmbedUnimplementedSolidarityTransportServer() +} + +func RegisterSolidarityTransportServer(s grpc.ServiceRegistrar, srv SolidarityTransportServer) { + s.RegisterService(&SolidarityTransport_ServiceDesc, srv) +} + +func _SolidarityTransport_AddDriverRegularAvailability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddDriverRegularAvailabilityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).AddDriverRegularAvailability(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_AddDriverRegularAvailability_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).AddDriverRegularAvailability(ctx, req.(*AddDriverRegularAvailabilityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_AddDriverRegularAvailabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddDriverRegularAvailabilitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).AddDriverRegularAvailabilities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_AddDriverRegularAvailabilities_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).AddDriverRegularAvailabilities(ctx, req.(*AddDriverRegularAvailabilitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_GetDriverRegularAvailabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDriverRegularAvailabilitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).GetDriverRegularAvailabilities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_GetDriverRegularAvailabilities_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).GetDriverRegularAvailabilities(ctx, req.(*GetDriverRegularAvailabilitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_DeleteDriverRegularAvailability_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteDriverRegularAvailabilityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).DeleteDriverRegularAvailability(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_DeleteDriverRegularAvailability_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).DeleteDriverRegularAvailability(ctx, req.(*DeleteDriverRegularAvailabilityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_GetDriverJourneys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDriverJourneysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).GetDriverJourneys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_GetDriverJourneys_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).GetDriverJourneys(ctx, req.(*GetDriverJourneysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_GetDriverJourney_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDriverJourneyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).GetDriverJourney(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_GetDriverJourney_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).GetDriverJourney(ctx, req.(*GetDriverJourneyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_BookDriverJourney_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BookDriverJourneyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).BookDriverJourney(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_BookDriverJourney_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).BookDriverJourney(ctx, req.(*BookDriverJourneyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_GetSolidarityTransportBookings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSolidarityTransportBookingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).GetSolidarityTransportBookings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_GetSolidarityTransportBookings_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).GetSolidarityTransportBookings(ctx, req.(*GetSolidarityTransportBookingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_GetSolidarityTransportBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSolidarityTransportBookingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).GetSolidarityTransportBooking(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_GetSolidarityTransportBooking_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).GetSolidarityTransportBooking(ctx, req.(*GetSolidarityTransportBookingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SolidarityTransport_UpdateSolidarityTransportBookingStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateSolidarityTransportBookingStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolidarityTransportServer).UpdateSolidarityTransportBookingStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SolidarityTransport_UpdateSolidarityTransportBookingStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolidarityTransportServer).UpdateSolidarityTransportBookingStatus(ctx, req.(*UpdateSolidarityTransportBookingStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SolidarityTransport_ServiceDesc is the grpc.ServiceDesc for SolidarityTransport service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SolidarityTransport_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "SolidarityTransport", + HandlerType: (*SolidarityTransportServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddDriverRegularAvailability", + Handler: _SolidarityTransport_AddDriverRegularAvailability_Handler, + }, + { + MethodName: "AddDriverRegularAvailabilities", + Handler: _SolidarityTransport_AddDriverRegularAvailabilities_Handler, + }, + { + MethodName: "GetDriverRegularAvailabilities", + Handler: _SolidarityTransport_GetDriverRegularAvailabilities_Handler, + }, + { + MethodName: "DeleteDriverRegularAvailability", + Handler: _SolidarityTransport_DeleteDriverRegularAvailability_Handler, + }, + { + MethodName: "GetDriverJourneys", + Handler: _SolidarityTransport_GetDriverJourneys_Handler, + }, + { + MethodName: "GetDriverJourney", + Handler: _SolidarityTransport_GetDriverJourney_Handler, + }, + { + MethodName: "BookDriverJourney", + Handler: _SolidarityTransport_BookDriverJourney_Handler, + }, + { + MethodName: "GetSolidarityTransportBookings", + Handler: _SolidarityTransport_GetSolidarityTransportBookings_Handler, + }, + { + MethodName: "GetSolidarityTransportBooking", + Handler: _SolidarityTransport_GetSolidarityTransportBooking_Handler, + }, + { + MethodName: "UpdateSolidarityTransportBookingStatus", + Handler: _SolidarityTransport_UpdateSolidarityTransportBookingStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "solidarity-transport.proto", +} diff --git a/servers/grpc/proto/solidarity-transport-types.proto b/servers/grpc/proto/solidarity-transport-types.proto new file mode 100644 index 0000000..c2b215b --- /dev/null +++ b/servers/grpc/proto/solidarity-transport-types.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +option go_package = "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"; + +import "google/protobuf/timestamp.proto"; + +message GeoJsonFeature { + string serialized = 1; +} +message GeoJsonFeatureCollection { + string serialized = 1; +} + +message DriverRegularAvailability { + string id = 1; + string driver_id = 2; + int32 day = 3; + string start_time = 4; + string end_time = 5; + GeoJsonFeature address = 6; + } + +message SolidarityTransportDriverJourney{ + string id = 1; + string driver_id = 2; + GeoJsonFeature passenger_pickup = 3; + GeoJsonFeature passenger_drop = 4; + int64 passenger_distance = 5; + GeoJsonFeature driver_departure = 6; + GeoJsonFeature driver_arrival = 7; + int64 driver_distance = 8; + int64 duration = 9; + optional string journey_polyline = 10; + google.protobuf.Timestamp passenger_pickup_date = 11; + optional google.protobuf.Timestamp driver_departure_date = 12; + optional SolidarityTransportPrice price = 13; + } + +message SolidarityTransportPrice { + double amount = 1; + string currency = 2; + } + +message SolidarityTransportBooking { + string id = 1; + string group_id = 2; + string driver_id = 3; + string passenger_id = 4; + string status = 5; + + SolidarityTransportDriverJourney journey = 10; + } diff --git a/servers/grpc/proto/solidarity-transport.proto b/servers/grpc/proto/solidarity-transport.proto new file mode 100644 index 0000000..7f41a14 --- /dev/null +++ b/servers/grpc/proto/solidarity-transport.proto @@ -0,0 +1,110 @@ +syntax = "proto3"; + +option go_package = "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"; + +import "google/protobuf/timestamp.proto"; +import "solidarity-transport-types.proto"; + +service SolidarityTransport { + //Availabilities management + rpc AddDriverRegularAvailability(AddDriverRegularAvailabilityRequest) returns (AddDriverRegularAvailabilityResponse) {} + rpc AddDriverRegularAvailabilities(AddDriverRegularAvailabilitiesRequest) returns (AddDriverRegularAvailabilitiesResponse) {} + rpc GetDriverRegularAvailabilities(GetDriverRegularAvailabilitiesRequest) returns (GetDriverRegularAvailabilitiesResponse) {} + rpc DeleteDriverRegularAvailability(DeleteDriverRegularAvailabilityRequest) returns (DeleteDriverRegularAvailabilityResponse) {} + + // Search / Journeys + rpc GetDriverJourneys(GetDriverJourneysRequest) returns (GetDriverJourneysResponse) {} + rpc GetDriverJourney(GetDriverJourneyRequest) returns (GetDriverJourneyResponse) {} + + // Booking flows + rpc BookDriverJourney(BookDriverJourneyRequest) returns (BookDriverJourneyResponse) {} + rpc GetSolidarityTransportBookings(GetSolidarityTransportBookingsRequest) returns (GetSolidarityTransportBookingsResponse) {} + rpc GetSolidarityTransportBooking(GetSolidarityTransportBookingRequest) returns (GetSolidarityTransportBookingResponse) {} + rpc UpdateSolidarityTransportBookingStatus(UpdateSolidarityTransportBookingStatusRequest) returns (UpdateSolidarityTransportBookingStatusResponse) {} + } + +message AddDriverRegularAvailabilityRequest{ + string driver_id = 1; + int32 day = 2; + string start_time = 3; + string end_time = 4; + GeoJsonFeature address = 5; + } + +message AddDriverRegularAvailabilityResponse{} + +message AddDriverRegularAvailabilitiesRequest{ + repeated DriverRegularAvailability availabilities = 1; + } + +message AddDriverRegularAvailabilitiesResponse{} + +message GetDriverRegularAvailabilitiesRequest { + string driver_id = 1; + } + +message GetDriverRegularAvailabilitiesResponse { + repeated DriverRegularAvailability results = 1; + } + +message DeleteDriverRegularAvailabilityRequest { + string driver_id = 1; + string availability_id = 2; + } + +message DeleteDriverRegularAvailabilityResponse {} + +// Search / Journeys + +message GetDriverJourneysRequest { + GeoJsonFeature departure = 1; + GeoJsonFeature arrival = 3; + google.protobuf.Timestamp departure_date = 5; + optional int64 time_delta = 6; + } + +message GetDriverJourneysResponse { + repeated SolidarityTransportDriverJourney driver_journeys = 1; + } + +message GetDriverJourneyRequest { + string driver_id = 1; + string journey_id = 2; + } + +message GetDriverJourneyResponse { + SolidarityTransportDriverJourney driver_journey = 1; + } + +message BookDriverJourneyRequest { + string passenger_id = 1; + string driver_id = 2; + string driver_journey_id = 3; + } + +message BookDriverJourneyResponse { + } + +message GetSolidarityTransportBookingsRequest { + google.protobuf.Timestamp start_date = 1; + google.protobuf.Timestamp end_date = 2; + } + +message GetSolidarityTransportBookingsResponse { + repeated SolidarityTransportBooking bookings = 1; + } + +message GetSolidarityTransportBookingRequest { + string id = 1; + } + +message GetSolidarityTransportBookingResponse { + SolidarityTransportBooking booking = 1; + } + +message UpdateSolidarityTransportBookingStatusRequest { + string booking_id = 1; + string new_status = 2; + } + +message UpdateSolidarityTransportBookingStatusResponse {} diff --git a/servers/grpc/server/availabilities.go b/servers/grpc/server/availabilities.go new file mode 100644 index 0000000..34ee735 --- /dev/null +++ b/servers/grpc/server/availabilities.go @@ -0,0 +1,74 @@ +package server + +import ( + "context" + + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers" + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/rs/zerolog/log" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s SolidarityTransportServerImpl) AddDriverRegularAvailability(ctx context.Context, req *gen.AddDriverRegularAvailabilityRequest) (*gen.AddDriverRegularAvailabilityResponse, error) { + if err := s.Handler.AddRegularAvailability(req.DriverId, int(req.Day), req.StartTime, req.EndTime); err != nil { + return nil, status.Errorf(codes.Internal, "AddDriverRegularAvailability : %v", err) + } + return &gen.AddDriverRegularAvailabilityResponse{}, nil +} + +func (s SolidarityTransportServerImpl) AddDriverRegularAvailabilities(ctx context.Context, req *gen.AddDriverRegularAvailabilitiesRequest) (*gen.AddDriverRegularAvailabilitiesResponse, error) { + log.Info().Msg("grpc call - AddDriverRegularAvailabilities") + availabilities := []*types.DriverRegularAvailability{} + + for _, a := range req.Availabilities { + if a != nil { + log.Debug().Any("availability", a).Msg("New availability") + na := transformers.DriverRegularAvailabilityProtoToType(a) + availabilities = append(availabilities, na) + } + } + if err := s.Handler.AddDriverRegularAvailabilities(availabilities); err != nil { + log.Error().Err(err).Msg("AddDriverAvailabilities error") + return nil, status.Errorf(codes.Internal, "AddDriverRegularAvailabilities : %v", err) + } + return &gen.AddDriverRegularAvailabilitiesResponse{}, nil +} + +func (s SolidarityTransportServerImpl) GetDriverRegularAvailabilities(ctx context.Context, req *gen.GetDriverRegularAvailabilitiesRequest) (*gen.GetDriverRegularAvailabilitiesResponse, error) { + log.Info().Str("driver", req.DriverId).Msg("grpc call - GetDriverRegularAvailabilities") + availabilities, err := s.Handler.GetDriverRegularAvailabilities(req.DriverId) + if err != nil { + log.Error().Err(err).Msg("GetDriverRegularAvailabilities error") + return nil, status.Errorf(codes.Internal, "GetDriverRegularAvailabilities : %v", err) + } + + results := []*gen.DriverRegularAvailability{} + + log.Debug().Any("availabilities", availabilities).Msg("retrieved availabilities") + + for _, a := range availabilities { + if a != nil { + log.Debug().Any("availability", a).Msg("Availability") + protoavailability := transformers.DriverRegularAvailabilityTypeToProto(a) + results = append(results, protoavailability) + } + } + + return &gen.GetDriverRegularAvailabilitiesResponse{ + Results: results, + }, nil +} + +func (s SolidarityTransportServerImpl) DeleteDriverRegularAvailability(ctx context.Context, req *gen.DeleteDriverRegularAvailabilityRequest) (*gen.DeleteDriverRegularAvailabilityResponse, error) { + driverid := req.DriverId + availabilityid := req.AvailabilityId + + if err := s.Handler.DeleteDriverRegularAvailabilities(driverid, availabilityid); err != nil { + log.Error().Err(err).Msg("DeleteDriverRegularAvailability error") + return nil, status.Errorf(codes.Internal, "DeleteDriverRegularAvailability error : %v", err) + } + + return &gen.DeleteDriverRegularAvailabilityResponse{}, nil +} diff --git a/servers/grpc/server/bookings.go b/servers/grpc/server/bookings.go new file mode 100644 index 0000000..69f1197 --- /dev/null +++ b/servers/grpc/server/bookings.go @@ -0,0 +1,76 @@ +package server + +import ( + "context" + + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers" + "github.com/rs/zerolog/log" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s SolidarityTransportServerImpl) BookDriverJourney(ctx context.Context, req *gen.BookDriverJourneyRequest) (*gen.BookDriverJourneyResponse, error) { + passengerId := req.PassengerId + driverId := req.DriverId + journeyId := req.DriverJourneyId + + if err := s.Handler.BookDriverJourney(passengerId, driverId, journeyId); err != nil { + log.Error().Err(err).Msg("issue in BookDriverJourney handler") + return nil, status.Errorf(codes.Internal, "could not create booking : %v", err) + } + return &gen.BookDriverJourneyResponse{}, nil +} + +func (s SolidarityTransportServerImpl) GetSolidarityTransportBookings(ctx context.Context, req *gen.GetSolidarityTransportBookingsRequest) (*gen.GetSolidarityTransportBookingsResponse, error) { + startdate := req.StartDate.AsTime() + enddate := req.EndDate.AsTime() + bookings, err := s.Handler.GetBookings(startdate, enddate) + if err != nil { + log.Error().Err(err).Msg("issue in GetBookings handler") + return nil, status.Errorf(codes.NotFound, "could not get bookings : %v", err) + } + + protobookings := []*gen.SolidarityTransportBooking{} + for _, b := range bookings { + protobooking, _ := transformers.BookingTypeToProto(b) + protobookings = append(protobookings, protobooking) + } + + return &gen.GetSolidarityTransportBookingsResponse{ + Bookings: protobookings, + }, nil +} + +func (s SolidarityTransportServerImpl) GetSolidarityTransportBooking(ctx context.Context, req *gen.GetSolidarityTransportBookingRequest) (*gen.GetSolidarityTransportBookingResponse, error) { + bookingid := req.Id + + booking, err := s.Handler.GetBooking(bookingid) + if err != nil { + log.Error().Err(err).Msg("issue in GetBooking handler") + return nil, status.Errorf(codes.NotFound, "could not get booking : %v", err) + } + + bookingproto, err := transformers.BookingTypeToProto(booking) + if err != nil { + log.Error().Err(err).Msg("issue in GetBooking handler") + return nil, status.Errorf(codes.NotFound, "transformer issue on booking : %v", err) + } + + return &gen.GetSolidarityTransportBookingResponse{ + Booking: bookingproto, + }, nil +} + +func (s SolidarityTransportServerImpl) UpdateSolidarityTransportBookingStatus(ctx context.Context, req *gen.UpdateSolidarityTransportBookingStatusRequest) (*gen.UpdateSolidarityTransportBookingStatusResponse, error) { + bookingid := req.BookingId + newStatus := req.NewStatus + + err := s.Handler.UpdateBookingStatus(bookingid, newStatus) + if err != nil { + log.Error().Err(err).Msg("issue in GetBooking handler") + return nil, status.Errorf(codes.NotFound, "transformer issue on booking : %v", err) + } + + return &gen.UpdateSolidarityTransportBookingStatusResponse{}, nil +} diff --git a/servers/grpc/server/journeys.go b/servers/grpc/server/journeys.go new file mode 100644 index 0000000..3efde24 --- /dev/null +++ b/servers/grpc/server/journeys.go @@ -0,0 +1,67 @@ +package server + +import ( + "context" + + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers" + "github.com/paulmach/orb/geojson" + "github.com/rs/zerolog/log" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (s SolidarityTransportServerImpl) GetDriverJourneys(ctx context.Context, req *gen.GetDriverJourneysRequest) (*gen.GetDriverJourneysResponse, error) { + departureDate := req.DepartureDate.AsTime() + departure, err := geojson.UnmarshalFeature([]byte(req.Departure.Serialized)) + if err != nil { + return nil, status.Errorf(codes.Internal, "departure unmarshalling error: %v", err) + } + arrival, err := geojson.UnmarshalFeature([]byte(req.Arrival.Serialized)) + if err != nil { + return nil, status.Errorf(codes.Internal, "arrival unmarhsalling error : %v", err) + } + + driverJourneys, err := s.Handler.GetDriverJourneys(departure, arrival, departureDate) + if err != nil { + log.Error().Err(err).Msg("issue in GetDriverJourneys handler") + return nil, status.Errorf(codes.Internal, "could not get driver journeys : %v", err) + } + + results := []*gen.SolidarityTransportDriverJourney{} + + for _, j := range driverJourneys { + // transformer + dj, err := transformers.DriverJourneyTypeToProto(j) + if err != nil { + log.Error().Err(err).Msg("issue while converting DriverJourney type to protobuf") + continue + // return nil, status.Errorf(codes.Internal, "could not get driver journeys : %v", err) + } + results = append(results, dj) + } + + return &gen.GetDriverJourneysResponse{ + DriverJourneys: results, + }, nil +} + +func (s SolidarityTransportServerImpl) GetDriverJourney(ctx context.Context, req *gen.GetDriverJourneyRequest) (*gen.GetDriverJourneyResponse, error) { + driverid := req.DriverId + journeyid := req.JourneyId + + journey, err := s.Handler.GetDriverJourney(driverid, journeyid) + if err != nil { + return nil, status.Errorf(codes.NotFound, "could not get driver journey : %v", err) + } + + protojourney, err := transformers.DriverJourneyTypeToProto(journey) + if err != nil { + log.Error().Err(err).Msg("transformation error") + return nil, status.Errorf(codes.NotFound, "transformation error : %v", err) + } + + return &gen.GetDriverJourneyResponse{ + DriverJourney: protojourney, + }, nil +} diff --git a/servers/grpc/server/server.go b/servers/grpc/server/server.go new file mode 100644 index 0000000..902c030 --- /dev/null +++ b/servers/grpc/server/server.go @@ -0,0 +1,50 @@ +package server + +import ( + "fmt" + "net" + + "git.coopgo.io/coopgo-platform/solidarity-transport/handler" + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "github.com/rs/zerolog/log" + "github.com/spf13/viper" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +type SolidarityTransportServerImpl struct { + Handler *handler.Handler + + gen.UnimplementedSolidarityTransportServer +} + +func NewSolidarityTransportServer(handler *handler.Handler) *SolidarityTransportServerImpl { + return &SolidarityTransportServerImpl{ + Handler: handler, + } +} + +func Run(done chan error, cfg *viper.Viper, handler *handler.Handler) { + var ( + dev_env = cfg.GetBool("dev_env") + address = ":" + cfg.GetString("services.grpc.port") + ) + + server := grpc.NewServer() + + gen.RegisterSolidarityTransportServer(server, NewSolidarityTransportServer(handler)) + l, err := net.Listen("tcp", address) + if err != nil { + log.Fatal().Err(err).Msg("could not register solidarity transport grpc server") + return + } + + if dev_env { + reflection.Register(server) + } + + if err := server.Serve(l); err != nil { + fmt.Println("gRPC service ended") + done <- err + } +} diff --git a/servers/grpc/transformers/availabilities.go b/servers/grpc/transformers/availabilities.go new file mode 100644 index 0000000..ea96090 --- /dev/null +++ b/servers/grpc/transformers/availabilities.go @@ -0,0 +1,34 @@ +package transformers + +import ( + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/paulmach/orb/geojson" +) + +func DriverRegularAvailabilityProtoToType(a *gen.DriverRegularAvailability) *types.DriverRegularAvailability { + address, _ := geojson.UnmarshalFeature([]byte(a.Address.Serialized)) + return &types.DriverRegularAvailability{ + ID: a.Id, + DriverId: a.DriverId, + Day: int(a.Day), + StartTime: a.StartTime, + EndTime: a.EndTime, + Address: address, + } +} + +func DriverRegularAvailabilityTypeToProto(a *types.DriverRegularAvailability) *gen.DriverRegularAvailability { + address := []byte("") + if a.Address != nil { + address, _ = a.Address.MarshalJSON() + } + return &gen.DriverRegularAvailability{ + Id: a.ID, + Day: int32(a.Day), + DriverId: a.DriverId, + StartTime: a.StartTime, + EndTime: a.EndTime, + Address: &gen.GeoJsonFeature{Serialized: string(address)}, + } +} diff --git a/servers/grpc/transformers/bookings.go b/servers/grpc/transformers/bookings.go new file mode 100644 index 0000000..9cf1243 --- /dev/null +++ b/servers/grpc/transformers/bookings.go @@ -0,0 +1,36 @@ +package transformers + +import ( + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "git.coopgo.io/coopgo-platform/solidarity-transport/types" +) + +func BookingTypeToProto(booking *types.Booking) (*gen.SolidarityTransportBooking, error) { + journey, err := DriverJourneyTypeToProto(booking.Journey) + if err != nil { + return nil, err + } + return &gen.SolidarityTransportBooking{ + Id: booking.Id, + GroupId: booking.GroupId, + DriverId: booking.DriverId, + PassengerId: booking.PassengerId, + Status: booking.Status, + Journey: journey, + }, nil +} + +func BookingProtoToType(booking *gen.SolidarityTransportBooking) (*types.Booking, error) { + journey, err := DriverJourneyProtoToType(booking.Journey) + if err != nil { + return nil, err + } + return &types.Booking{ + Id: booking.Id, + GroupId: booking.GroupId, + DriverId: booking.DriverId, + PassengerId: booking.PassengerId, + Status: booking.Status, + Journey: journey, + }, nil +} diff --git a/servers/grpc/transformers/geojson.go b/servers/grpc/transformers/geojson.go new file mode 100644 index 0000000..154ed99 --- /dev/null +++ b/servers/grpc/transformers/geojson.go @@ -0,0 +1,24 @@ +package transformers + +import ( + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "github.com/paulmach/orb/geojson" +) + +func GeoJsonToProto(feature *geojson.Feature) (*gen.GeoJsonFeature, error) { + serialized, err := feature.MarshalJSON() + if err != nil { + return nil, err + } + return &gen.GeoJsonFeature{ + Serialized: string(serialized), + }, nil +} + +func ProtoToGeoJson(feature *gen.GeoJsonFeature) (*geojson.Feature, error) { + gj, err := geojson.UnmarshalFeature([]byte(feature.Serialized)) + if err != nil { + return nil, err + } + return gj, err +} diff --git a/servers/grpc/transformers/journeys.go b/servers/grpc/transformers/journeys.go new file mode 100644 index 0000000..d4ead5c --- /dev/null +++ b/servers/grpc/transformers/journeys.go @@ -0,0 +1,100 @@ +package transformers + +import ( + "time" + + "git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen" + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/paulmach/orb/geojson" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func DriverJourneyTypeToProto(j *types.DriverJourney) (*gen.SolidarityTransportDriverJourney, error) { + passengerPickup, err := j.PassengerPickup.MarshalJSON() + if err != nil { + return nil, err + } + + passengerDrop, err := j.PassengerDrop.MarshalJSON() + if err != nil { + return nil, err + } + + driverDeparture, err := j.DriverDeparture.MarshalJSON() + if err != nil { + return nil, err + } + + driverArrival, err := j.DriverArrival.MarshalJSON() + if err != nil { + return nil, err + } + + return &gen.SolidarityTransportDriverJourney{ + Id: j.Id, + DriverId: j.DriverId, + PassengerPickup: &gen.GeoJsonFeature{ + Serialized: string(passengerPickup), + }, + PassengerDrop: &gen.GeoJsonFeature{ + Serialized: string(passengerDrop), + }, + PassengerDistance: j.PassengerDistance, + DriverDeparture: &gen.GeoJsonFeature{ + Serialized: string(driverDeparture), + }, + DriverArrival: &gen.GeoJsonFeature{ + Serialized: string(driverArrival), + }, + DriverDistance: j.DriverDistance, + Duration: int64(j.Duration.Seconds()), + JourneyPolyline: &j.JourneyPolyline, + DriverDepartureDate: timestamppb.New(j.DriverDepartureDate), + PassengerPickupDate: timestamppb.New(j.PassengerPickupDate), + Price: &gen.SolidarityTransportPrice{ + Amount: 0, + Currency: "EUR", + }, + }, nil +} + +func DriverJourneyProtoToType(j *gen.SolidarityTransportDriverJourney) (*types.DriverJourney, error) { + passengerPickup, err := geojson.UnmarshalFeature([]byte(j.PassengerPickup.Serialized)) + if err != nil { + return nil, err + } + + passengerDrop, err := geojson.UnmarshalFeature([]byte(j.PassengerDrop.Serialized)) + if err != nil { + return nil, err + } + + driverDeparture, err := geojson.UnmarshalFeature([]byte(j.DriverDeparture.Serialized)) + if err != nil { + return nil, err + } + + driverArrival, err := geojson.UnmarshalFeature([]byte(j.DriverArrival.Serialized)) + if err != nil { + return nil, err + } + + return &types.DriverJourney{ + Id: j.Id, + DriverId: j.DriverId, + PassengerPickup: passengerPickup, + PassengerDrop: passengerDrop, + PassengerDistance: j.PassengerDistance, + DriverDeparture: driverDeparture, + DriverArrival: driverArrival, + DriverDistance: j.DriverDistance, + Duration: time.Duration(j.Duration) * time.Second, + JourneyPolyline: *j.JourneyPolyline, + DriverDepartureDate: j.DriverDepartureDate.AsTime(), + PassengerPickupDate: j.PassengerPickupDate.AsTime(), + Price: types.SolidarityTransportPrice{ + Amount: j.Price.Amount, + Currency: j.Price.Currency, + }, + }, nil +} diff --git a/storage/memory.go b/storage/memory.go new file mode 100644 index 0000000..a3ae6e8 --- /dev/null +++ b/storage/memory.go @@ -0,0 +1,152 @@ +package storage + +import ( + "errors" + "strings" + + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/google/uuid" + "github.com/spf13/viper" +) + +type MemoryStorage struct { + DriverRegularAvailabilities map[string]*types.DriverRegularAvailability + DriverJourneys map[string]*types.DriverJourney + Bookings map[string]*types.Booking +} + +func NewMemoryStorage(cfg *viper.Viper) (MemoryStorage, error) { + return MemoryStorage{ + DriverRegularAvailabilities: map[string]*types.DriverRegularAvailability{}, + }, nil +} + +func (s MemoryStorage) CreateDriverRegularAvailability(availability types.DriverRegularAvailability) error { + if availability.ID == "" { + availability.ID = uuid.NewString() + } + + if s.DriverRegularAvailabilities[availability.ID] != nil { + return errors.New("availability already exists") + } + + s.DriverRegularAvailabilities[availability.ID] = &availability + + return nil +} + +func (s MemoryStorage) CreateDriverRegularAvailabilities(availabilities []*types.DriverRegularAvailability) error { + for _, availability := range availabilities { + if availability != nil { + if err := s.CreateDriverRegularAvailability(*availability); err != nil { + return err + } + } + } + return nil +} + +func (s MemoryStorage) DeleteDriverRegularAvailability(driverid string, availabilityid string) error { + if s.DriverRegularAvailabilities[availabilityid] == nil { + return errors.New("availability doesn't exist") + } + if s.DriverRegularAvailabilities[availabilityid].DriverId != driverid { + return errors.New("unallowed to delete this availability : driver mismatch") + } + s.DriverRegularAvailabilities[availabilityid] = nil + return nil +} + +func (s MemoryStorage) GetDriverRegularAvailability(driverid string, availabilityid string) (*types.DriverRegularAvailability, error) { + if s.DriverRegularAvailabilities[availabilityid] == nil { + return nil, errors.New("availability doesn't exist") + } + + if s.DriverRegularAvailabilities[availabilityid].DriverId != driverid { + return nil, errors.New("unallowed to get this availability : driver mismatch") + } + + return s.DriverRegularAvailabilities[availabilityid], nil +} + +func (s MemoryStorage) GetDriverRegularAvailabilities(driverid string) ([]*types.DriverRegularAvailability, error) { + result := []*types.DriverRegularAvailability{} + + for _, a := range s.DriverRegularAvailabilities { + if a.DriverId == driverid { + result = append(result, a) + } + } + return result, nil +} + +func (s MemoryStorage) GetRegularAvailabilities(day int, timeInDay string) ([]*types.DriverRegularAvailability, error) { + results := []*types.DriverRegularAvailability{} + + for _, a := range s.DriverRegularAvailabilities { + if a.Day == day && strings.Compare(a.StartTime, timeInDay) <= 0 && strings.Compare(a.EndTime, timeInDay) >= 0 { + results = append(results, a) + } + } + return results, nil +} + +func (s MemoryStorage) PushDriverJourneys(driverjourneys []*types.DriverJourney) error { + for _, j := range driverjourneys { + s.DriverJourneys[j.Id] = j + } + return nil +} + +func (s MemoryStorage) GetDriverJourney(id string) (res *types.DriverJourney, err error) { + res = s.DriverJourneys[id] + + if res == nil { + err = errors.New("not found") + } + return +} + +func (s MemoryStorage) CreateBooking(booking types.Booking) error { + if booking.Id == "" { + booking.Id = uuid.NewString() + } + + if s.Bookings[booking.Id] != nil { + return errors.New("booking already exists") + } + + s.Bookings[booking.Id] = &booking + + return nil +} + +func (s MemoryStorage) GetAllBookings() ([]*types.Booking, error) { + res := []*types.Booking{} + + for _, b := range s.Bookings { + res = append(res, b) + } + return res, nil +} + +func (s MemoryStorage) GetBooking(id string) (res *types.Booking, err error) { + res = s.Bookings[id] + + if res == nil { + err = errors.New("not found") + } + return +} + +func (s MemoryStorage) UpdateBookingStatus(bookingid string, newStatus string) error { + b := s.Bookings[bookingid] + + if b == nil { + return errors.New("booking doesn't exist") + } + + b.Status = newStatus + + return nil +} diff --git a/storage/mongodb.go b/storage/mongodb.go new file mode 100644 index 0000000..4588037 --- /dev/null +++ b/storage/mongodb.go @@ -0,0 +1,214 @@ +package storage + +import ( + "context" + "fmt" + + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/google/uuid" + "github.com/rs/zerolog/log" + "github.com/spf13/viper" + "go.mongodb.org/mongo-driver/v2/bson" + "go.mongodb.org/mongo-driver/v2/mongo" + "go.mongodb.org/mongo-driver/v2/mongo/options" +) + +type MongoDBCollections struct { + DriversRegularAvailabilities *mongo.Collection + Bookings *mongo.Collection + DriverJourneys *mongo.Collection +} + +type MongoDBStorage struct { + Client *mongo.Client + DbName string + Collections MongoDBCollections +} + +func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) { + var ( + mongodb_uri = cfg.GetString("storage.db.mongodb.uri") + mongodb_host = cfg.GetString("storage.db.mongodb.host") + mongodb_port = cfg.GetString("storage.db.mongodb.port") + mongodb_dbname = cfg.GetString("storage.db.mongodb.db_name") + mongodb_drivers_regular_availabilities = cfg.GetString("storage.db.mongodb.collections.drivers_regular_availabilities") + mongodb_bookings = cfg.GetString("storage.db.mongodb.collections.bookings") + mongodb_driver_journeys = cfg.GetString("storage.db.mongodb.collections.driver_journeys") + ) + + if mongodb_uri == "" { + mongodb_uri = fmt.Sprintf("mongodb://%s:%s/%s", mongodb_host, mongodb_port, mongodb_dbname) + } + + client, err := mongo.Connect(options.Client().ApplyURI(mongodb_uri)) + if err != nil { + return MongoDBStorage{}, err + } + + log.Info().Str("regular availabilities", mongodb_drivers_regular_availabilities).Str("bookings", mongodb_bookings).Msg("mongodb collections") + + return MongoDBStorage{ + Client: client, + DbName: mongodb_dbname, + Collections: MongoDBCollections{ + DriversRegularAvailabilities: client.Database(mongodb_dbname).Collection(mongodb_drivers_regular_availabilities), + Bookings: client.Database(mongodb_dbname).Collection(mongodb_bookings), + DriverJourneys: client.Database(mongodb_dbname).Collection(mongodb_driver_journeys), + }, + }, nil +} + +func (s MongoDBStorage) CreateDriverRegularAvailability(availability types.DriverRegularAvailability) error { + if availability.ID == "" { + availability.ID = uuid.NewString() + } + + if _, err := s.Collections.DriversRegularAvailabilities.InsertOne(context.Background(), availability); err != nil { + log.Error().Err(err).Msg("CreateDriverAvailability error") + return err + } + + return nil +} + +func (s MongoDBStorage) CreateDriverRegularAvailabilities(availabilities []*types.DriverRegularAvailability) error { + for _, availability := range availabilities { + if availability.ID == "" { + availability.ID = uuid.NewString() + } + } + + if _, err := s.Collections.DriversRegularAvailabilities.InsertMany(context.Background(), availabilities); err != nil { + log.Error().Err(err).Msg("CreateDriverAvailabilities error") + return err + } + + return nil +} + +func (s MongoDBStorage) DeleteDriverRegularAvailability(driverid string, availabilityid string) error { + if _, err := s.Collections.DriversRegularAvailabilities.DeleteOne(context.Background(), bson.M{"_id": availabilityid, "driver_id": driverid}); err != nil { + log.Error().Err(err).Msg("DeleteDriverRegularAvailability error") + return err + } + return nil +} + +func (s MongoDBStorage) GetDriverRegularAvailability(driverid string, availabilityid string) (*types.DriverRegularAvailability, error) { + var result types.DriverRegularAvailability + if err := s.Collections.DriversRegularAvailabilities.FindOne(context.Background(), bson.M{"_id": availabilityid, "driver_id": driverid}).Decode(&result); err != nil { + log.Error().Err(err).Msg("GetDriverRegularAvailability - error") + return nil, err + } + return &result, nil +} + +func (s MongoDBStorage) GetDriverRegularAvailabilities(driverid string) ([]*types.DriverRegularAvailability, error) { + result := []*types.DriverRegularAvailability{} + + cur, err := s.Collections.DriversRegularAvailabilities.Find(context.Background(), bson.M{"driver_id": driverid}) + if err != nil { + log.Error().Err(err).Msg("GetDriverAvailabilities DB find - error") + return nil, err + } + + if err = cur.All(context.Background(), &result); err != nil { + log.Error().Err(err).Msg("GetDriverAvailabilities cursor decoding - error") + return nil, err + } + + return result, nil +} + +func (s MongoDBStorage) GetRegularAvailabilities(day int, timeInDay string) ([]*types.DriverRegularAvailability, error) { + result := []*types.DriverRegularAvailability{} + + cur, err := s.Collections.DriversRegularAvailabilities.Find(context.Background(), + bson.M{ + "day": day, + "start_time": bson.M{"$lt": timeInDay}, + "end_time": bson.M{"$gt": timeInDay}, + }) + if err != nil { + log.Error().Err(err).Msg("GetDriverAvailabilities DB find - error") + return nil, err + } + + if err = cur.All(context.Background(), &result); err != nil { + log.Error().Err(err).Msg("GetDriverAvailabilities cursor decoding - error") + return nil, err + } + + return result, nil +} + +func (s MongoDBStorage) PushDriverJourneys(driverjourneys []*types.DriverJourney) error { + for _, journey := range driverjourneys { + if journey.Id == "" { + journey.Id = uuid.NewString() + } + } + + if _, err := s.Collections.DriverJourneys.InsertMany(context.Background(), driverjourneys); err != nil { + log.Error().Err(err).Msg("PushDriverJourneys error") + return err + } + return nil +} + +func (s MongoDBStorage) GetDriverJourney(id string) (*types.DriverJourney, error) { + var res types.DriverJourney + err := s.Collections.DriverJourneys.FindOne(context.Background(), bson.M{"_id": id}).Decode(&res) + if err != nil { + return nil, err + } + + return &res, nil +} + +func (s MongoDBStorage) CreateBooking(booking types.Booking) error { + if booking.Id == "" { + booking.Id = uuid.NewString() + } + + if _, err := s.Collections.Bookings.InsertOne(context.Background(), booking); err != nil { + log.Error().Err(err).Msg("CreateBooking error") + return err + } + + return nil +} + +func (s MongoDBStorage) GetAllBookings() ([]*types.Booking, error) { + res := []*types.Booking{} + + cur, err := s.Collections.Bookings.Find(context.Background(), bson.M{}) + if err != nil { + return nil, err + } + + err = cur.All(context.Background(), &res) + + return res, err +} + +func (s MongoDBStorage) GetBooking(id string) (*types.Booking, error) { + var res types.Booking + err := s.Collections.Bookings.FindOne(context.Background(), bson.M{"_id": id}).Decode(&res) + if err != nil { + return nil, err + } + + return &res, nil +} + +func (s MongoDBStorage) UpdateBookingStatus(bookingid string, newStatus string) error { + // filter := bson.M{"_id": bookingid} + replacement := bson.M{"$set": bson.M{"status": newStatus}} + + if _, err := s.Collections.Bookings.UpdateByID(context.Background(), bookingid, replacement); err != nil { + return err + } + + return nil +} diff --git a/storage/storage.go b/storage/storage.go new file mode 100644 index 0000000..c29bbf4 --- /dev/null +++ b/storage/storage.go @@ -0,0 +1,40 @@ +package storage + +import ( + "fmt" + + "git.coopgo.io/coopgo-platform/solidarity-transport/types" + "github.com/spf13/viper" +) + +type Storage interface { + CreateDriverRegularAvailability(types.DriverRegularAvailability) error + CreateDriverRegularAvailabilities([]*types.DriverRegularAvailability) error + DeleteDriverRegularAvailability(driverid string, availabilityid string) error + GetDriverRegularAvailability(driverid string, availabilityid string) (*types.DriverRegularAvailability, error) + GetDriverRegularAvailabilities(driverid string) ([]*types.DriverRegularAvailability, error) + + GetRegularAvailabilities(day int, timeInDay string) ([]*types.DriverRegularAvailability, error) + + PushDriverJourneys([]*types.DriverJourney) error + GetDriverJourney(id string) (*types.DriverJourney, error) + + CreateBooking(types.Booking) error + GetAllBookings() ([]*types.Booking, error) + GetBooking(id string) (*types.Booking, error) + UpdateBookingStatus(bookingid string, newStatus string) error +} + +func NewStorage(cfg *viper.Viper) (Storage, error) { + storage_type := cfg.GetString("storage.db.type") + + switch storage_type { + case "mongodb": + return NewMongoDBStorage(cfg) + case "memory": + return NewMemoryStorage(cfg) + default: + return nil, fmt.Errorf("storage type %v is not supported", storage_type) + + } +} diff --git a/types/availabilities.go b/types/availabilities.go new file mode 100644 index 0000000..2fc65f8 --- /dev/null +++ b/types/availabilities.go @@ -0,0 +1,12 @@ +package types + +import geojson "github.com/paulmach/orb/geojson" + +type DriverRegularAvailability struct { + ID string `json:"id" bson:"_id"` + DriverId string `json:"driver_id" bson:"driver_id"` + Day int `json:"day" bson:"day"` + StartTime string `json:"start_time" bson:"start_time"` + EndTime string `json:"end_time" bson:"end_time"` + Address *geojson.Feature `json:"address" bson:"address"` +} diff --git a/types/booking.go b/types/booking.go new file mode 100644 index 0000000..830e808 --- /dev/null +++ b/types/booking.go @@ -0,0 +1,11 @@ +package types + +type Booking struct { + Id string `json:"id" bson:"_id"` + GroupId string `json:"group_id" bson:"group_id"` + DriverId string `json:"driver_id" bson:"driver_id"` + PassengerId string `json:"passenger_id" bson:"passenger_id"` + Status string `json:"status" bson:"status"` + + Journey *DriverJourney `json:"journey,omitempty" bson:"journey,omitempty"` +} diff --git a/types/journeys.go b/types/journeys.go new file mode 100644 index 0000000..0540088 --- /dev/null +++ b/types/journeys.go @@ -0,0 +1,36 @@ +package types + +import ( + "time" + + geojson "github.com/paulmach/orb/geojson" +) + +type SolidarityTransportPrice struct { + Amount float64 + Currency string +} + +type DriverJourney struct { + Id string `json:"id" bson:"_id"` + DriverId string `json:"driver_id" bson:"driver_id"` + PassengerPickup *geojson.Feature `json:"passenger_pickup" bson:"passenger_pickup"` + PassengerDrop *geojson.Feature `json:"passenger_drop" bson:"passenger_drop"` + PassengerDistance int64 `json:"passenger_distance" bson:"passenger_distance"` + DriverDeparture *geojson.Feature `json:"driver_departure" bson:"driver_departure"` + DriverArrival *geojson.Feature `json:"driver_arrival" bson:"driver_arrival"` + DriverDistance int64 `json:"driver_distance" bson:"driver_distance"` + Duration time.Duration + JourneyPolyline string `json:"journey_polyline" bson:"journey_polyline"` + PassengerPickupDate time.Time `json:"passenger_pickup_date" bson:"passenger_pickup_date"` + DriverDepartureDate time.Time `json:"driver_departure_date" bson:"driver_departure_date"` + Price SolidarityTransportPrice +} + +type PassengerTrip struct { + Id string `json:"id" bson:"_id"` + PassengerId string `json:"passenger_id" bson:"passenger_id"` + PassengerPickup *geojson.Feature `json:"passenger_pickup" bson:"passenger_pickup"` + PassengerDrop *geojson.Feature `json:"passenger_drop" bson:"passenger_drop"` + PassengerPickupDate time.Time `json:"passenger_pickup_date" bson:"passenger_pickup_date"` +}