Compare commits
23 Commits
d8346a20be
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38cb3c5ad9 | ||
|
|
b431d460bf | ||
|
|
4392f22783 | ||
|
|
5dbb3e23d4 | ||
|
|
feb4909a70 | ||
|
|
51068be38b | ||
|
|
678286b384 | ||
|
|
b7ac71741f | ||
| a95cd6eb55 | |||
| 30a3d18277 | |||
| 4b6de48764 | |||
| 9f0dd430e8 | |||
| 88e3bae685 | |||
| fe30c3fc12 | |||
| 575b8129b7 | |||
| 4718de6c80 | |||
| d465ef56c9 | |||
| 0ad6ce8762 | |||
| 6dc6774ea7 | |||
| 201e803c6a | |||
| e0b7d73e74 | |||
| f5938d23df | |||
| e2e6759dc0 |
65
.gitea/workflows/build.yml
Normal file
65
.gitea/workflows/build.yml
Normal file
@@ -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}}
|
||||||
660
LICENSE.md
Normal file
660
LICENSE.md
Normal file
@@ -0,0 +1,660 @@
|
|||||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
## Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing
|
||||||
|
under this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
## TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
### 13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your
|
||||||
|
version supports such interaction) an opportunity to receive the
|
||||||
|
Corresponding Source of your version by providing access to the
|
||||||
|
Corresponding Source from a network server at no charge, through some
|
||||||
|
standard or customary means of facilitating copying of software. This
|
||||||
|
Corresponding Source shall include the Corresponding Source for any
|
||||||
|
work covered by version 3 of the GNU General Public License that is
|
||||||
|
incorporated pursuant to the following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Affero General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
## How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for
|
||||||
|
the specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
||||||
51
README.md
51
README.md
@@ -2,38 +2,67 @@
|
|||||||
|
|
||||||
COOPGO Carpool Service is a carpool management microservice. It is part of the COOPGO Technical Platform and the base carpool component of COOPGO's [RIDYGO](https://ridygo.fr) application. It was redesigned from scratch to implement natively the new OCSS carpool standard and bring interoperability.
|
COOPGO Carpool Service is a carpool management microservice. It is part of the COOPGO Technical Platform and the base carpool component of COOPGO's [RIDYGO](https://ridygo.fr) application. It was redesigned from scratch to implement natively the new OCSS carpool standard and bring interoperability.
|
||||||
|
|
||||||
This is not a full featured carpooling application. There is no UI and it only implements basic carpooling functionalities (create and find, book journeys). The objective of this service is to be embedded in a bigger carpool or Mobility as a Service platform.
|
This is not a full featured carpooling application. There is no UI and it only implements basic carpooling functionalities (create, search, book journeys). The objective of this service is to be embedded in a bigger carpool or Mobility as a Service platform.
|
||||||
|
|
||||||
It provides a gRPC service to interact with other microservices, and an HTTP API to provide interoperability with external carpooling operators.
|
It provides a gRPC service to interact with other microservices or the main application, and an HTTP API to provide interoperability with external carpooling operators.
|
||||||
|
|
||||||
## Technical architecture
|
## Technical architecture
|
||||||
|
|
||||||
### Managing trips and journeys
|
### Managing trips and journeys
|
||||||
|
|
||||||
Trips and journeys are managed through the provided gRPC service and stored in the database (MongoDB for the moment). They are stored in the database as GeoJSON feature collections with extra members defining the trips and journeys non-geographical parameters.
|
Trips and journeys are managed through the provided gRPC service and stored in the database (PostgreSQL or MongoDB for the moment). They are stored in the database as GeoJSON feature collections with extra members defining the trips and journeys non-geographical parameters.
|
||||||
|
|
||||||
### Tiles architecture and cache
|
Many thanks to [https://github.com/paulmach/orb](https://github.com/paulmach/orb) !
|
||||||
|
|
||||||
To reduce dependencies on the chosen database, we decided to manage geographical calculations directly in our code instead of relying completely on MongoDB geographical features.
|
### Tiles architecture
|
||||||
|
|
||||||
|
To reduce dependencies on the chosen database, we decided to manage geographical calculations directly in our code instead of relying completely on MongoDB or PostgreSQL/Postgis geographical features.
|
||||||
|
|
||||||
We use a tiles system to retrieve relevant journeys easily. Each tile is defined by :
|
We use a tiles system to retrieve relevant journeys easily. Each tile is defined by :
|
||||||
|
|
||||||
- driver or passenger status of the journey
|
- driver or passenger status of the journey
|
||||||
- date of the journey
|
- date of the journey
|
||||||
- Tile ID in the tiles grid. The tiles grid is inspired by Valhalla https://github.com/Telenav/open-source-spec/blob/master/valhalla/doc/valhalla-tiles-basic.md. We use a level 0 grid
|
- Tile ID in the tiles grid. The tiles grid is inspired by Valhalla https://github.com/Telenav/open-source-spec/blob/master/valhalla/doc/valhalla-tiles-basic.md. We use a level 0 grid.
|
||||||
|
|
||||||
Journeys are stored in each relevant tile (where a departure, destination or part of the polyline enters the tile)
|
Tile IDs from each journey/trip is processed at creation time and stored with the journeys or regular trips in the database.
|
||||||
|
|
||||||
### Search
|
We can simply generate tiles by retrieving the appropriate data from the database.
|
||||||
|
|
||||||
### Booking
|
### Search
|
||||||
|
|
||||||
|
Search is handled by generating the appropriate tiles for the fiven departure/destination/date/driver/passenger state, and filter the journeys included in these tiles.
|
||||||
|
|
||||||
|
TODO : Performance could probably be improved by parallelilizing the filtering flow with goroutines, and adding some tiles caching with [groupcache](https://github.com/golang/groupcache)
|
||||||
|
|
||||||
|
## Database
|
||||||
|
|
||||||
|
Supported databases :
|
||||||
|
|
||||||
|
- [x] PostgreSQL
|
||||||
|
- [x] MongoDB
|
||||||
|
|
||||||
|
TODO : add the option for a simple embedded key-value store like [bbolt](https://github.com/etcd-io/bbolt) or [badgerdb](https://github.com/dgraph-io/badger), with a distributed consensus mechanism (like [raft](https://github.com/hashicorp/raft)) to allow for even simpler deployments when the overall infrastructure doesn't use PostgreSQL or MongoDB
|
||||||
|
|
||||||
## OCSS standard
|
## OCSS standard
|
||||||
|
|
||||||
The OCSS standard is the new carpooling interoperability standard defined by the french carpooling ecosystem.
|
The OCSS standard is the new carpooling interoperability standard defined by the french carpooling ecosystem.
|
||||||
|
|
||||||
COOPGO Carpool Service implements all of this standard, except the messages endpoint which we think should be handled outside of this service, as different carpooling or MaaS applications may handle messaging differently.
|
COOPGO Carpool Service intends to support this standard completely.
|
||||||
|
|
||||||
|
State of the implementation :
|
||||||
|
|
||||||
|
- Server side :
|
||||||
|
- [x] GET `/driver_journeys`
|
||||||
|
- [x] GET `/passenger_journeys`
|
||||||
|
- [ ] GET `/driver_regular_trips`
|
||||||
|
- [ ] GET `/passenger_regular_trips`
|
||||||
|
- [x] POST `/bookings`
|
||||||
|
- [x] PATCH `/bookings`
|
||||||
|
- [x] GET `/bookings`
|
||||||
|
- [ ] GET `/messages`
|
||||||
|
- [x] GET `/status`
|
||||||
|
- Client side : ongoing
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
|
|
||||||
COOPGP Carpool Service is released under the terms of the AGPL version 3 licence
|
COOPGO Carpool Service is released under the terms of the AGPL version 3 licence
|
||||||
BIN
carpool-service
Executable file
BIN
carpool-service
Executable file
Binary file not shown.
55
config.go
55
config.go
@@ -8,8 +8,61 @@ import (
|
|||||||
|
|
||||||
func ReadConfig() (*viper.Viper, error) {
|
func ReadConfig() (*viper.Viper, error) {
|
||||||
defaults := map[string]any{
|
defaults := map[string]any{
|
||||||
"name": "COOPGO Mobility Accounts",
|
"name": "COOPGO Carpool Service",
|
||||||
"dev_env": false,
|
"dev_env": false,
|
||||||
|
"storage": map[string]any{
|
||||||
|
"db": map[string]any{
|
||||||
|
"type": "psql",
|
||||||
|
"mongodb": map[string]any{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 27017,
|
||||||
|
"db_name": "coopgo_platform",
|
||||||
|
"collections": map[string]any{
|
||||||
|
"regular_routes": "carpool_regular_routes",
|
||||||
|
"punctual_routes": "carpool_punctual_routes",
|
||||||
|
"bookings": "carpool_bookings",
|
||||||
|
"driver_candidate_journeys": "carpool_driver_candidate_journeys",
|
||||||
|
"passenger_candidate_journeys": "carpool_passenger_candidate_journeys",
|
||||||
|
"persisted_kv": "carpool_persisted_kv",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"psql": map[string]any{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 5432,
|
||||||
|
"user": "postgres",
|
||||||
|
"password": "postgres",
|
||||||
|
"dbname": "coopgo_platform",
|
||||||
|
"schema": "carpool_service",
|
||||||
|
"sslmode": "disable",
|
||||||
|
"tables": map[string]any{
|
||||||
|
"regular_routes": "regular_routes",
|
||||||
|
"regular_route_schedules": "regular_route_schedules",
|
||||||
|
"bookings": "bookings",
|
||||||
|
"journeys_cache": "journeys_cache",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"services": map[string]any{
|
||||||
|
"grpc": map[string]any{
|
||||||
|
"enable": true,
|
||||||
|
"port": 8080,
|
||||||
|
},
|
||||||
|
"ocss_api": map[string]any{
|
||||||
|
"enable": true,
|
||||||
|
"port": 80,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"interoperability": map[string]any{
|
||||||
|
"internal_operator_id": "example.coopgo.fr",
|
||||||
|
"ocss": map[string]any{
|
||||||
|
"operator_id": "example.coopgo.fr",
|
||||||
|
"web_urls": map[string]string{
|
||||||
|
"driver_journeys": "https://example.coopgo.fr/driver_journeys/%s",
|
||||||
|
"passenger_journeys": "https://example.coopgo.fr/passenger_journeys/%s",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
v := viper.New()
|
v := viper.New()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package geoutils provides utility functions to handler geographic calculations such as distance between geometries.
|
||||||
package geoutils
|
package geoutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -5,9 +6,10 @@ import (
|
|||||||
|
|
||||||
"github.com/paulmach/orb"
|
"github.com/paulmach/orb"
|
||||||
"github.com/paulmach/orb/geo"
|
"github.com/paulmach/orb/geo"
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DistanceFromLineString provides the shorteds distance between a point and a linestring.
|
||||||
|
// It returns the distance in meters, and the index of the closest linestring segment to the point
|
||||||
func DistanceFromLineString(point orb.Point, lineString orb.LineString) (distance float64, closestIndex int) {
|
func DistanceFromLineString(point orb.Point, lineString orb.LineString) (distance float64, closestIndex int) {
|
||||||
minDistance := math.Inf(1)
|
minDistance := math.Inf(1)
|
||||||
closest := -1
|
closest := -1
|
||||||
@@ -23,14 +25,16 @@ func DistanceFromLineString(point orb.Point, lineString orb.LineString) (distanc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().
|
// log.Debug().
|
||||||
Float64("min distance", minDistance).
|
// Float64("min distance", minDistance).
|
||||||
Int("index", closest).
|
// Int("index", closest).
|
||||||
Any("point", point).
|
// Any("point", point).
|
||||||
Msg("minimum distance to polyline")
|
// Msg("minimum distance to polyline")
|
||||||
|
|
||||||
return minDistance, closest
|
return minDistance, closest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// projectToSegment projects the point to the segment. This function is used in DistanceFromLineString for point-to-segment distance calculation
|
||||||
func projectToSegment(point, a, b orb.Point) orb.Point {
|
func projectToSegment(point, a, b orb.Point) orb.Point {
|
||||||
x := a[0]
|
x := a[0]
|
||||||
y := a[1]
|
y := a[1]
|
||||||
|
|||||||
42
go.mod
42
go.mod
@@ -1,37 +1,50 @@
|
|||||||
module git.coopgo.io/coopgo-platform/carpool-service
|
module git.coopgo.io/coopgo-platform/carpool-service
|
||||||
|
|
||||||
go 1.18
|
go 1.23.0
|
||||||
|
|
||||||
replace git.coopgo.io/coopgo-platform/routing-service => ../../coopgo-platform/routing-service/
|
toolchain go1.24.5
|
||||||
|
|
||||||
replace git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss => ./interoperability/ocss/
|
// replace git.coopgo.io/coopgo-platform/routing-service => ../../coopgo-platform/routing-service/
|
||||||
|
|
||||||
|
// replace git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss => ./interoperability/ocss/
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/uuid v1.3.0
|
ariga.io/atlas v0.10.1
|
||||||
|
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20251008142525-4392f227836a
|
||||||
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20250304234521-faabcc54f536
|
||||||
|
github.com/google/uuid v1.6.0
|
||||||
|
github.com/lib/pq v1.10.9
|
||||||
github.com/paulmach/orb v0.9.0
|
github.com/paulmach/orb v0.9.0
|
||||||
github.com/rs/zerolog v1.29.0
|
github.com/rs/zerolog v1.29.0
|
||||||
github.com/spf13/viper v1.15.0
|
github.com/spf13/viper v1.15.0
|
||||||
|
github.com/stretchr/objx v0.5.0
|
||||||
|
github.com/stretchr/testify v1.8.2
|
||||||
go.mongodb.org/mongo-driver v1.11.3
|
go.mongodb.org/mongo-driver v1.11.3
|
||||||
google.golang.org/grpc v1.53.0
|
google.golang.org/grpc v1.75.1
|
||||||
google.golang.org/protobuf v1.30.0
|
google.golang.org/protobuf v1.36.6
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20230329224518-bf6453b9639a // indirect
|
github.com/agext/levenshtein v1.2.1 // indirect
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329165521-1442647132b9 // indirect
|
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||||
github.com/golang/snappy v0.0.1 // indirect
|
github.com/golang/snappy v0.0.1 // indirect
|
||||||
|
github.com/google/go-cmp v0.7.0 // indirect
|
||||||
github.com/gorilla/schema v1.2.0 // indirect
|
github.com/gorilla/schema v1.2.0 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
|
github.com/hashicorp/hcl/v2 v2.10.0 // indirect
|
||||||
github.com/klauspost/compress v1.13.6 // indirect
|
github.com/klauspost/compress v1.13.6 // indirect
|
||||||
github.com/magiconair/properties v1.8.7 // indirect
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||||
|
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/spf13/afero v1.9.3 // indirect
|
github.com/spf13/afero v1.9.3 // indirect
|
||||||
github.com/spf13/cast v1.5.0 // indirect
|
github.com/spf13/cast v1.5.0 // indirect
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||||
@@ -42,11 +55,12 @@ require (
|
|||||||
github.com/xdg-go/scram v1.1.1 // indirect
|
github.com/xdg-go/scram v1.1.1 // indirect
|
||||||
github.com/xdg-go/stringprep v1.0.3 // indirect
|
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||||
golang.org/x/crypto v0.7.0 // indirect
|
github.com/zclconf/go-cty v1.8.0 // indirect
|
||||||
golang.org/x/net v0.8.0 // indirect
|
golang.org/x/crypto v0.39.0 // indirect
|
||||||
golang.org/x/sync v0.1.0 // indirect
|
golang.org/x/net v0.41.0 // indirect
|
||||||
golang.org/x/sys v0.6.0 // indirect
|
golang.org/x/sync v0.15.0 // indirect
|
||||||
golang.org/x/text v0.8.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
|
golang.org/x/text v0.26.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
|||||||
121
go.sum
121
go.sum
@@ -1,3 +1,5 @@
|
|||||||
|
ariga.io/atlas v0.10.1 h1:zub8+r1P4OqUYoDl6AgUxqPRwl8A9oeI5q3LucfsnUE=
|
||||||
|
ariga.io/atlas v0.10.1/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk=
|
||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||||
@@ -36,22 +38,24 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
|||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20230329105025-bbc682386a58 h1:BgNJLsOZc71pGH87GqFqVhxWXEUB04Vv39EcxhzjD+8=
|
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250313115904-6dc6774ea703 h1:+J2YX9Wc++c4js578NoVe1QVLkVRIf9xXgsAqd/oQ20=
|
||||||
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20230329105025-bbc682386a58/go.mod h1:sT9fl92Nb4K7rWsEeddGRbJKVi+84dnorDunIbnDYWk=
|
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20250313115904-6dc6774ea703/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA=
|
||||||
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20230329224518-bf6453b9639a h1:4n7WKFSAdI9fOnF5MowJq6pY2zSwDwnAoId5xUt0m9U=
|
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20251008142525-4392f227836a h1:roBn3oQRQ/j5JBAP01wIs1UQvtm3tjui+D4EAa/Hfa4=
|
||||||
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20230329224518-bf6453b9639a/go.mod h1:sT9fl92Nb4K7rWsEeddGRbJKVi+84dnorDunIbnDYWk=
|
git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss v0.0.0-20251008142525-4392f227836a/go.mod h1:c9aJwNtY4PJuqAFYZ9afnx46UAZtWJ3P8ICZM02/DBA=
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329105109-a2dc346ed5b5 h1:7lhbgBk4oXTIK6T109IymgpoC2J4tHaU2O/rj/Y8M4s=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329105109-a2dc346ed5b5/go.mod h1:qKf4kan3/vJXVywIBHa4omSlxIOMYyR11xZrrE5v9D0=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329161053-d4ad6d1f4e33 h1:zm7lc0m0po6Tq/mjkJv7udnUEXZ+Z0swVO/anirbKmY=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329161053-d4ad6d1f4e33/go.mod h1:qKf4kan3/vJXVywIBHa4omSlxIOMYyR11xZrrE5v9D0=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329161338-761449b82889 h1:Ti1gDoERrCwXzVS1SVYskwkwu3qbPAVmh0MGB6igtPA=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329161338-761449b82889/go.mod h1:qKf4kan3/vJXVywIBHa4omSlxIOMYyR11xZrrE5v9D0=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329163129-d535e945ffe9 h1:Xz7r+xWvddSrhR+lmUOSI4x8WCovqQslj5bVA+ZFiyg=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329163129-d535e945ffe9/go.mod h1:qKf4kan3/vJXVywIBHa4omSlxIOMYyR11xZrrE5v9D0=
|
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329165521-1442647132b9 h1:GPvpqJasCouzXZbDH3GyfKV++TmjPydCpj4LDZXZmeA=
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329165521-1442647132b9 h1:GPvpqJasCouzXZbDH3GyfKV++TmjPydCpj4LDZXZmeA=
|
||||||
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329165521-1442647132b9/go.mod h1:qKf4kan3/vJXVywIBHa4omSlxIOMYyR11xZrrE5v9D0=
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20230329165521-1442647132b9/go.mod h1:qKf4kan3/vJXVywIBHa4omSlxIOMYyR11xZrrE5v9D0=
|
||||||
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20250304234521-faabcc54f536 h1:SllXX1VJXulfhNi+Pd0R9chksm8zO6gkWcTQ/uSMsdc=
|
||||||
|
git.coopgo.io/coopgo-platform/routing-service v0.0.0-20250304234521-faabcc54f536/go.mod h1:Nh7o15LlV0OuO9zxvJIs9FlelpeAaLYkXtFdgIkFrgg=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||||
|
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||||
|
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
||||||
|
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||||
|
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
|
||||||
|
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
|
||||||
|
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
||||||
|
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
@@ -72,11 +76,20 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y
|
|||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||||
|
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
|
||||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
|
github.com/go-logr/logr v1.4.3/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/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||||
|
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||||
|
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||||
|
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
@@ -90,6 +103,7 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
|
|||||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||||
|
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
@@ -105,8 +119,8 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
|
|||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
@@ -121,7 +135,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.4/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.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||||
@@ -137,8 +152,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
|
|||||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||||
@@ -148,6 +163,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
|
|||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
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/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
|
github.com/hashicorp/hcl/v2 v2.10.0 h1:1S1UnuhDGlv3gRFV4+0EdwB+znNP5HmcGbIqwnSCByg=
|
||||||
|
github.com/hashicorp/hcl/v2 v2.10.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
@@ -159,15 +176,23 @@ github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47e
|
|||||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
|
||||||
|
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||||
|
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||||
|
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||||
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
||||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
|
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
|
||||||
|
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
|
||||||
@@ -185,15 +210,19 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
|||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||||
|
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
|
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
|
||||||
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
||||||
|
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||||
|
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||||
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
|
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
|
||||||
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
|
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
|
||||||
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||||
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||||
|
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
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/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
|
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
|
||||||
@@ -201,6 +230,7 @@ github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jH
|
|||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
@@ -210,14 +240,18 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||||||
github.com/stretchr/testify v1.7.0/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.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.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||||
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
|
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
|
||||||
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
||||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/twpayne/go-polyline v1.1.1 h1:/tSF1BR7rN4HWj4XKqvRUNrCiYVMCvywxTFVofvDV0w=
|
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/twpayne/go-polyline v1.1.1/go.mod h1:ybd9IWWivW/rlXPXuuckeKUyF3yrIim+iqA7kSl4NFY=
|
||||||
|
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||||
|
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
||||||
|
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
|
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
|
||||||
@@ -230,6 +264,10 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
|
||||||
|
github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA=
|
||||||
|
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
||||||
|
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
|
||||||
go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
|
go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
|
||||||
go.mongodb.org/mongo-driver v1.11.3 h1:Ql6K6qYHEzB6xvu4+AU0BoRoqf9vFPcc4o7MUIdPW8Y=
|
go.mongodb.org/mongo-driver v1.11.3 h1:Ql6K6qYHEzB6xvu4+AU0BoRoqf9vFPcc4o7MUIdPW8Y=
|
||||||
go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
|
go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
|
||||||
@@ -239,7 +277,20 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|||||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
|
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||||
|
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||||
|
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||||
|
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
|
||||||
|
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||||
|
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
@@ -247,8 +298,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/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.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
@@ -283,6 +334,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|||||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
@@ -314,8 +366,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
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-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@@ -336,13 +388,14 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/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-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/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-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@@ -376,8 +429,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@@ -385,10 +438,11 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
|
|||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
@@ -445,6 +499,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
|||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||||
|
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||||
@@ -525,8 +581,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM
|
|||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||||
google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
|
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
|
||||||
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
|
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
@@ -538,10 +594,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
|
|||||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package handler
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (h *CarpoolServiceHandler) Book(booking ocss.Booking) (*internal.Booking, error) {
|
|
||||||
futureBooking := internal.Booking{}
|
|
||||||
futureBooking.Roles = []string{}
|
|
||||||
if booking.Driver.Operator == "ridygo.fr" {
|
|
||||||
futureBooking.Roles = append(futureBooking.Roles, "driver")
|
|
||||||
previous_search_result, err := h.Storage.GetSearchResult(booking.DriverJourneyID)
|
|
||||||
if err == nil {
|
|
||||||
futureBooking.DriverJourney = &internal.PlannedJourney{
|
|
||||||
Route: internal.RegularRoute(*previous_search_result.Route),
|
|
||||||
DepartureDate: previous_search_result.DepartureDate,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if booking.Passenger.Operator == "ridygo.fr" {
|
|
||||||
futureBooking.Roles = append(futureBooking.Roles, "passenger")
|
|
||||||
previous_search_result, err := h.Storage.GetSearchResult(booking.PassengerJourneyID)
|
|
||||||
if err == nil {
|
|
||||||
futureBooking.PassengerJourney = &internal.PlannedJourney{
|
|
||||||
Route: internal.RegularRoute(*previous_search_result.Route),
|
|
||||||
DepartureDate: previous_search_result.DepartureDate,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(futureBooking.Roles) == 0 {
|
|
||||||
return nil, errors.New("couldn't find the right operator id : \"ridygo.fr\" should be set for driver or passenger")
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := uuid.Parse(booking.ID); err != nil {
|
|
||||||
return nil, errors.New("bookingid is not a valid uuid")
|
|
||||||
}
|
|
||||||
|
|
||||||
futureBooking.ID = booking.ID
|
|
||||||
futureBooking.BookingDefinition = booking
|
|
||||||
|
|
||||||
err := h.Storage.CreateBooking(futureBooking)
|
|
||||||
if err != nil {
|
|
||||||
log.Error().Err(err).Msg("issue creating booking in database")
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &futureBooking, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *CarpoolServiceHandler) GetBooking(id string) (*internal.Booking, error) {
|
|
||||||
booking, err := h.Storage.GetBooking(id)
|
|
||||||
if err != nil {
|
|
||||||
log.Error().Err(err).Msg("issue retrieving booking in storage")
|
|
||||||
return nil, errors.New("booking id not found")
|
|
||||||
}
|
|
||||||
return booking, nil
|
|
||||||
}
|
|
||||||
146
handler/bookings.go
Normal file
146
handler/bookings.go
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Book handles the booking flow
|
||||||
|
func (h *CarpoolServiceHandler) Book(booking ocss.Booking, motivation *string) (*internal.Booking, error) {
|
||||||
|
log.Debug().Any("booking", booking).Msg("handler - Book")
|
||||||
|
log.Debug().Str("passengerPickupDate", booking.PassengerPickupDate.ToTime().Format(time.RFC3339)).Msg("handler - Book")
|
||||||
|
log.Debug().Str("internal_operator_id", h.InternalOperatorID).Str("driver_operator", booking.Driver.Operator).Str("passenger_operator", booking.Passenger.Operator).Msg("operator comparison")
|
||||||
|
futureBooking := internal.Booking{}
|
||||||
|
roles := []string{}
|
||||||
|
if booking.Driver.Operator == h.InternalOperatorID {
|
||||||
|
roles = append(roles, "driver")
|
||||||
|
log.Debug().Str("driver_journey_id", booking.DriverJourneyID).Msg("looking up driver route schedule")
|
||||||
|
previous_search_result, err := h.Storage.GetRouteSchedule(booking.DriverJourneyID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("driver_journey_id", booking.DriverJourneyID).Msg("could not get driver route schedule")
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
if previous_search_result.Route != nil {
|
||||||
|
futureBooking.DriverRoute = previous_search_result.Route
|
||||||
|
log.Debug().Msg("driver route added to booking")
|
||||||
|
} else {
|
||||||
|
log.Warn().Msg("driver route schedule found but route is nil")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if booking.Passenger.Operator == h.InternalOperatorID {
|
||||||
|
roles = append(roles, "passenger")
|
||||||
|
log.Debug().Str("passenger_journey_id", booking.PassengerJourneyID).Msg("looking up passenger route schedule")
|
||||||
|
previous_search_result, err := h.Storage.GetRouteSchedule(booking.PassengerJourneyID)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("passenger_journey_id", booking.PassengerJourneyID).Msg("could not get passenger route schedule")
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
if previous_search_result.Route != nil {
|
||||||
|
futureBooking.PassengerRoute = previous_search_result.Route
|
||||||
|
log.Debug().Msg("passenger route added to booking")
|
||||||
|
} else {
|
||||||
|
log.Warn().Msg("passenger route schedule found but route is nil")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(roles) == 0 {
|
||||||
|
roles = append(roles, "driver")
|
||||||
|
// return nil, fmt.Errorf("couldn't find the right operator id : \"%s\" should be set for driver or passenger", h.InternalOperatorID)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := uuid.Parse(booking.ID); err != nil {
|
||||||
|
booking.ID = uuid.NewString()
|
||||||
|
// return nil, errors.New("bookingid is not a valid uuid")
|
||||||
|
}
|
||||||
|
|
||||||
|
futureBooking.Booking = booking
|
||||||
|
futureBooking.Motivation = motivation
|
||||||
|
|
||||||
|
err := h.Storage.CreateBooking(futureBooking)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue creating booking in database")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &futureBooking, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBooking returns the booking with the given ID
|
||||||
|
func (h *CarpoolServiceHandler) GetBooking(id string) (*internal.Booking, error) {
|
||||||
|
booking, err := h.Storage.GetBooking(id)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue retrieving booking in storage")
|
||||||
|
return nil, errors.New("booking id not found")
|
||||||
|
}
|
||||||
|
return booking, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserBookings retrieves all the bookings for a specified user id
|
||||||
|
func (h *CarpoolServiceHandler) GetUserBookings(user_id string, mindate *time.Time, maxdate *time.Time) ([]internal.Booking, error) {
|
||||||
|
bookings, err := h.Storage.GetUserBookings(user_id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []internal.Booking{}
|
||||||
|
|
||||||
|
for _, b := range bookings {
|
||||||
|
if mindate != nil {
|
||||||
|
if b.PassengerPickupDate.ToTime().Before(*mindate) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if maxdate != nil {
|
||||||
|
if b.PassengerPickupDate.ToTime().After(*maxdate) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results = append(results, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetBookings retrieves all the bookings between 2 dates
|
||||||
|
func (h *CarpoolServiceHandler) GetBookings(mindate *time.Time, maxdate *time.Time) ([]internal.Booking, error) {
|
||||||
|
bookings, err := h.Storage.GetAllBookings()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []internal.Booking{}
|
||||||
|
|
||||||
|
for _, b := range bookings {
|
||||||
|
if mindate != nil {
|
||||||
|
if b.PassengerPickupDate.ToTime().Before(*mindate) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if maxdate != nil {
|
||||||
|
if b.PassengerPickupDate.ToTime().After(*maxdate) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results = append(results, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateBookingStatus sets a new status for a given booking id
|
||||||
|
func (h *CarpoolServiceHandler) UpdateBookingStatus(id string, status ocss.BookingStatus) error {
|
||||||
|
err := h.Storage.UpdateBookingStatus(id, status.String())
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("not able to update booking status")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package handler provides the business logic for the carpool service
|
||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -8,17 +9,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CarpoolServiceHandler struct {
|
type CarpoolServiceHandler struct {
|
||||||
Config *viper.Viper
|
Config *viper.Viper
|
||||||
Storage storage.Storage
|
Storage storage.Storage
|
||||||
Tiles *tiles.TilesHandler
|
Tiles *tiles.TilesHandler
|
||||||
Routing routing.RoutingService
|
Routing routing.RoutingService
|
||||||
|
InternalOperatorID string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewCarpoolServiceHandler initiates the carpool service handler, implementing the COOPGO Carpool Service business logic
|
||||||
func NewCarpoolServiceHandler(cfg *viper.Viper, storage storage.Storage, tilesHandler *tiles.TilesHandler, routing routing.RoutingService) (*CarpoolServiceHandler, error) {
|
func NewCarpoolServiceHandler(cfg *viper.Viper, storage storage.Storage, tilesHandler *tiles.TilesHandler, routing routing.RoutingService) (*CarpoolServiceHandler, error) {
|
||||||
|
operator := cfg.GetString("interoperability.internal_operator_id")
|
||||||
return &CarpoolServiceHandler{
|
return &CarpoolServiceHandler{
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
Storage: storage,
|
Storage: storage,
|
||||||
Tiles: tilesHandler,
|
Tiles: tilesHandler,
|
||||||
Routing: routing,
|
Routing: routing,
|
||||||
|
InternalOperatorID: operator,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CreateRegularRoutes creates and stores a regular route
|
||||||
func (h *CarpoolServiceHandler) CreateRegularRoutes(routes []*geojson.FeatureCollection) error {
|
func (h *CarpoolServiceHandler) CreateRegularRoutes(routes []*geojson.FeatureCollection) error {
|
||||||
groupid := uuid.NewString()
|
groupid := uuid.NewString()
|
||||||
for _, r := range routes {
|
for _, r := range routes {
|
||||||
@@ -57,7 +58,25 @@ func (h *CarpoolServiceHandler) CreateRegularRoutes(routes []*geojson.FeatureCol
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate time.Time, maxDepartureDate time.Time) (map[string][]internal.PlannedRouteSchedule, error) {
|
func (h *CarpoolServiceHandler) GetUserRegularRoutes(userid string) ([]*geojson.FeatureCollection, error) {
|
||||||
|
routes, err := h.Storage.GetUserRegularRoutes(userid)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error in storage - GetUserRegularRoutes")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return routes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *CarpoolServiceHandler) DeleteRegularRoutes(ids []string) (err error) {
|
||||||
|
err = h.Storage.DeleteRegularRoutes(ids)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error deleteing regular routes")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserPlanning returns the planned routes for a user between 2 dates. It transforms regular routes to multiple indivual planned route schedules
|
||||||
|
func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate time.Time, maxDepartureDate time.Time) (planned_schedules map[string][]internal.PlannedRouteSchedule, missing_planning bool, err error) {
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("user_id", userid).
|
Str("user_id", userid).
|
||||||
Time("min_departure_date", minDepartureDate).
|
Time("min_departure_date", minDepartureDate).
|
||||||
@@ -75,17 +94,21 @@ func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate
|
|||||||
routes, err := h.Storage.GetUserRegularRoutes(userid)
|
routes, err := h.Storage.GetUserRegularRoutes(userid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("error in storage - GetUserRegularRoutes")
|
log.Error().Err(err).Msg("error in storage - GetUserRegularRoutes")
|
||||||
return nil, err
|
return nil, false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(routes) == 0 {
|
||||||
|
return results, true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
all_schedules := []internal.PlannedRouteSchedule{}
|
all_schedules := []internal.PlannedRouteSchedule{}
|
||||||
|
|
||||||
for _, r := range routes {
|
for _, r := range routes {
|
||||||
rr := internal.RegularRoute(*r)
|
rr := internal.RegularRoute(*r)
|
||||||
schedules, err := rr.PlannedJourneySchedules(minDepartureDate, maxDepartureDate)
|
schedules, err := rr.PlannedRouteSchedules(minDepartureDate, maxDepartureDate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err)
|
log.Error().Err(err).Msg("PlannedRouteSchedules error")
|
||||||
return nil, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
all_schedules = append(all_schedules, schedules...)
|
all_schedules = append(all_schedules, schedules...)
|
||||||
@@ -105,13 +128,14 @@ func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate
|
|||||||
err = h.Storage.StoreRouteSchedules(all_schedules)
|
err = h.Storage.StoreRouteSchedules(all_schedules)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("could not store route schedules")
|
log.Error().Err(err).Msg("could not store route schedules")
|
||||||
return nil, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return results, nil
|
return results, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPlannedTrip returns a planned trip, given an ID. This should be called after getting the user planning from regular routes
|
||||||
func (h *CarpoolServiceHandler) GetPlannedTrip(id string) (*internal.PlannedRouteSchedule, error) {
|
func (h *CarpoolServiceHandler) GetPlannedTrip(id string) (*internal.PlannedRouteSchedule, error) {
|
||||||
planned_trip, err := h.Storage.GetRouteSchedule(id)
|
planned_trip, err := h.Storage.GetRouteSchedule(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import (
|
|||||||
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
||||||
"git.coopgo.io/coopgo-platform/routing-service/encoding/polylines"
|
"git.coopgo.io/coopgo-platform/routing-service/encoding/polylines"
|
||||||
"github.com/paulmach/orb"
|
"github.com/paulmach/orb"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *CarpoolServiceHandler) GetDriverJourneys(departure orb.Point, arrival orb.Point, departureRadius *float64, arrivalRadius *float64, minDate time.Time, maxDate time.Time, count *int64) ([]internal.SearchResult, error) {
|
// GetDriverJourneys searches for matching punctual planned driver journeys.
|
||||||
|
func (h *CarpoolServiceHandler) GetDriverJourneys(departureFeature *geojson.Feature, arrivalFeature *geojson.Feature, departureRadius *float64, arrivalRadius *float64, minDate time.Time, maxDate time.Time, count *int64) ([]internal.PlannedRouteSchedule, error) {
|
||||||
|
departure := departureFeature.Point()
|
||||||
|
arrival := arrivalFeature.Point()
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Any("departure", departure).
|
Any("departure", departure).
|
||||||
Any("arrival", arrival).
|
Any("arrival", arrival).
|
||||||
@@ -51,19 +54,17 @@ func (h *CarpoolServiceHandler) GetDriverJourneys(departure orb.Point, arrival o
|
|||||||
|
|
||||||
candidate_routes := tileset.GetTiledRoutes()
|
candidate_routes := tileset.GetTiledRoutes()
|
||||||
|
|
||||||
journeys := []internal.SearchResult{}
|
journeys := []internal.PlannedRouteSchedule{}
|
||||||
|
|
||||||
counted := int64(0)
|
counted := int64(0)
|
||||||
for _, r := range candidate_routes {
|
for _, r := range candidate_routes {
|
||||||
ls := r.Route.Features[2].Geometry.(orb.LineString)
|
ls := r.Route.Features[2].Geometry.(orb.LineString)
|
||||||
|
|
||||||
// distanceFromDeparture, indexDeparture := planar.DistanceFromWithIndex(ls, departure)
|
|
||||||
// distanceFromArrival, indexArrival := planar.DistanceFromWithIndex(ls, arrival)
|
|
||||||
distanceFromDeparture, indexDeparture := geoutils.DistanceFromLineString(departure, ls)
|
distanceFromDeparture, indexDeparture := geoutils.DistanceFromLineString(departure, ls)
|
||||||
distanceFromArrival, indexArrival := geoutils.DistanceFromLineString(arrival, ls)
|
distanceFromArrival, indexArrival := geoutils.DistanceFromLineString(arrival, ls)
|
||||||
|
|
||||||
if indexArrival >= indexDeparture && distanceFromDeparture <= drad && distanceFromArrival <= arad {
|
if indexArrival >= indexDeparture && distanceFromDeparture <= drad && distanceFromArrival <= arad {
|
||||||
//routePoints := []orb.Point{r.Route.Features[0].Point(), departure, arrival, r.Route.Features[1].Point()}
|
// routePoints := []orb.Point{r.Route.Features[0].Point(), departure, arrival, r.Route.Features[1].Point()}
|
||||||
routePoints := []orb.Point{r.Route.Features[0].Point(), departure, arrival, r.Route.Features[1].Point()}
|
routePoints := []orb.Point{r.Route.Features[0].Point(), departure, arrival, r.Route.Features[1].Point()}
|
||||||
log.Debug().Any("route points", routePoints).Msg("calculate multipoint route")
|
log.Debug().Any("route points", routePoints).Msg("calculate multipoint route")
|
||||||
itinerary, err := h.Routing.Route(routePoints)
|
itinerary, err := h.Routing.Route(routePoints)
|
||||||
@@ -71,11 +72,14 @@ func (h *CarpoolServiceHandler) GetDriverJourneys(departure orb.Point, arrival o
|
|||||||
log.Error().Err(err).Msg("error getting route with viapoints")
|
log.Error().Err(err).Msg("error getting route with viapoints")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
journeys = append(journeys, internal.SearchResult{
|
|
||||||
ID: r.ID,
|
journeys = append(journeys, internal.PlannedRouteSchedule{
|
||||||
Route: r.Route,
|
ID: r.ID,
|
||||||
DepartureDate: r.DepartureDate,
|
Route: r.Route,
|
||||||
Itinerary: itinerary,
|
DepartureDate: r.DepartureDate,
|
||||||
|
Itinerary: itinerary,
|
||||||
|
PassengerPickup: departureFeature,
|
||||||
|
PassengerDrop: arrivalFeature,
|
||||||
})
|
})
|
||||||
counted = counted + 1
|
counted = counted + 1
|
||||||
if counted == *count {
|
if counted == *count {
|
||||||
@@ -85,7 +89,7 @@ func (h *CarpoolServiceHandler) GetDriverJourneys(departure orb.Point, arrival o
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(journeys) > 0 {
|
if len(journeys) > 0 {
|
||||||
err = h.Storage.StoreSearchResults(journeys)
|
err = h.Storage.StoreRouteSchedules(journeys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("Error saving search results")
|
log.Error().Err(err).Msg("Error saving search results")
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -95,8 +99,8 @@ func (h *CarpoolServiceHandler) GetDriverJourneys(departure orb.Point, arrival o
|
|||||||
return journeys, nil
|
return journeys, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arrival orb.Point, departureRadius *float64, arrivalRadius *float64, minDate time.Time, maxDate time.Time, count *int64) ([]internal.SearchResult, error) {
|
// GetPassengerJourneys searches for matching punctual planned passenger journeys.
|
||||||
|
func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arrival orb.Point, departureRadius *float64, arrivalRadius *float64, minDate time.Time, maxDate time.Time, count *int64) ([]internal.PlannedRouteSchedule, error) {
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Any("departure", departure).
|
Any("departure", departure).
|
||||||
Any("arrival", arrival).
|
Any("arrival", arrival).
|
||||||
@@ -151,7 +155,7 @@ func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arriva
|
|||||||
|
|
||||||
candidate_routes := tileset.GetTiledRoutes()
|
candidate_routes := tileset.GetTiledRoutes()
|
||||||
|
|
||||||
journeys := []internal.SearchResult{}
|
journeys := []internal.PlannedRouteSchedule{}
|
||||||
|
|
||||||
counted := int64(0)
|
counted := int64(0)
|
||||||
for _, r := range candidate_routes {
|
for _, r := range candidate_routes {
|
||||||
@@ -167,7 +171,7 @@ func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arriva
|
|||||||
log.Error().Err(err).Msg("error getting route with viapoints")
|
log.Error().Err(err).Msg("error getting route with viapoints")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
journeys = append(journeys, internal.SearchResult{
|
journeys = append(journeys, internal.PlannedRouteSchedule{
|
||||||
ID: r.ID,
|
ID: r.ID,
|
||||||
Route: r.Route,
|
Route: r.Route,
|
||||||
DepartureDate: r.DepartureDate,
|
DepartureDate: r.DepartureDate,
|
||||||
@@ -181,7 +185,7 @@ func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arriva
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(journeys) > 0 {
|
if len(journeys) > 0 {
|
||||||
err = h.Storage.StoreSearchResults(journeys)
|
err = h.Storage.StoreRouteSchedules(journeys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("Error saving search results")
|
log.Error().Err(err).Msg("Error saving search results")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import "git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
import (
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Booking is the internal struct to desribe a booking. It overrides ocss.Booking and adds driver and passenger routes
|
||||||
type Booking struct {
|
type Booking struct {
|
||||||
ID string `bson:"_id"`
|
ocss.Booking `bson:",inline"`
|
||||||
Roles []string // At least one of ["driver", "passenger"]
|
|
||||||
BookingDefinition ocss.Booking
|
DriverRoute *geojson.FeatureCollection `bson:"driver_route,omitempty"`
|
||||||
DriverJourney *PlannedJourney
|
PassengerRoute *geojson.FeatureCollection `bson:"passenger_route,omitempty"`
|
||||||
PassengerJourney *PlannedJourney
|
Motivation *string `bson:"motivation,omitempty" json:"motivation,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
package internal
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type PlannedJourney struct {
|
|
||||||
Route RegularRoute
|
|
||||||
DepartureDate time.Time
|
|
||||||
}
|
|
||||||
19
internal/planned-route-schedules.go
Normal file
19
internal/planned-route-schedules.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package internal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.coopgo.io/coopgo-platform/routing-service"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PlannedRouteSchedule describes a route at a specific date, or a journey
|
||||||
|
// It can be used during journeys search to store journeys after they are processed from regular routes and tiles
|
||||||
|
type PlannedRouteSchedule struct {
|
||||||
|
ID string `bson:"_id" json:"id"`
|
||||||
|
Route *geojson.FeatureCollection
|
||||||
|
DepartureDate time.Time `bson:"departureDate"`
|
||||||
|
Itinerary *routing.Route `bson:"itinerary,omitempty"`
|
||||||
|
PassengerPickup *geojson.Feature `bson:"passengerPickup,omitempty" json:"passengerPickup,omitempty"`
|
||||||
|
PassengerDrop *geojson.Feature `bson:"passengerDrop,omitempty" json:"passengerDrop,omitempty"`
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// package internal povides structs used internally within this carpool service
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -11,20 +12,11 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PlannedRouteSchedule struct {
|
// RegularRoute is a utility struct to manipulate regular routes. It's just a GeoJSON feature collection with additional functions
|
||||||
ID string `bson:"_id"`
|
|
||||||
Route RegularRoute
|
|
||||||
DepartureDate time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
type RegularRoute geojson.FeatureCollection
|
type RegularRoute geojson.FeatureCollection
|
||||||
|
|
||||||
func (rr RegularRoute) PlannedJourneySchedules(mindate time.Time, maxdate time.Time) ([]PlannedRouteSchedule, error) {
|
// PlannedRouteSchedules returns individual planned route schedules with 2 dates, from a regular schedule
|
||||||
log.Debug().
|
func (rr RegularRoute) PlannedRouteSchedules(mindate time.Time, maxdate time.Time) ([]PlannedRouteSchedule, error) {
|
||||||
Str("regular_route.id", rr.ExtraMembers.MustString("id", "")).
|
|
||||||
Str("mindate", mindate.Format(time.RFC3339)).
|
|
||||||
Str("maxdate", maxdate.Format(time.RFC3339)).
|
|
||||||
Msg("carpool service handler - PlannedJourneySchedules")
|
|
||||||
|
|
||||||
results := []PlannedRouteSchedule{}
|
results := []PlannedRouteSchedule{}
|
||||||
|
|
||||||
@@ -44,11 +36,13 @@ func (rr RegularRoute) PlannedJourneySchedules(mindate time.Time, maxdate time.T
|
|||||||
h, _ := strconv.Atoi(splitted[0])
|
h, _ := strconv.Atoi(splitted[0])
|
||||||
m, _ := strconv.Atoi(splitted[1])
|
m, _ := strconv.Atoi(splitted[1])
|
||||||
t := time.Date(current_date.Year(), current_date.Month(), current_date.Day(), h, m, 0, 0, time.Local)
|
t := time.Date(current_date.Year(), current_date.Month(), current_date.Day(), h, m, 0, 0, time.Local)
|
||||||
results = append(results, PlannedRouteSchedule{
|
if t.After(time.Now().Add(-1 * time.Hour)) {
|
||||||
ID: uuid.NewString(),
|
results = append(results, PlannedRouteSchedule{
|
||||||
Route: rr,
|
ID: uuid.NewString(),
|
||||||
DepartureDate: t,
|
Route: rr.FeatureCollection(),
|
||||||
})
|
DepartureDate: t,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
current_date = current_date.Add(24 * time.Hour)
|
current_date = current_date.Add(24 * time.Hour)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/routing-service"
|
|
||||||
"github.com/paulmach/orb/geojson"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SearchResult struct {
|
|
||||||
ID string `bson:"_id"`
|
|
||||||
Route *geojson.FeatureCollection
|
|
||||||
DepartureDate time.Time
|
|
||||||
Itinerary *routing.Route
|
|
||||||
}
|
|
||||||
@@ -3,13 +3,22 @@ package ocss
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/bsontype"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BookingStatuus describes the status of a booking
|
||||||
type BookingStatus int64
|
type BookingStatus int64
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BookingWaitingConfirmation BookingStatus = iota
|
BookingInitiated BookingStatus = iota
|
||||||
|
// BookingWaitingConfirmation
|
||||||
|
BookingWaitingDriverConfirmation
|
||||||
|
BookingWaitingPassengerConfirmation
|
||||||
BookingConfirmed
|
BookingConfirmed
|
||||||
BookingCancelled
|
BookingCancelled
|
||||||
BookingCompletedPendingValidation
|
BookingCompletedPendingValidation
|
||||||
@@ -17,21 +26,28 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var bookingStatustoID = map[string]BookingStatus{
|
var bookingStatustoID = map[string]BookingStatus{
|
||||||
"WAITING_CONFIRMATION": BookingWaitingConfirmation,
|
"INITIATED": BookingInitiated,
|
||||||
"CONFIRMED": BookingConfirmed,
|
// "WAITING_CONFIRMATION": BookingWaitingConfirmation,
|
||||||
"CANCELLED": BookingCancelled,
|
"WAITING_DRIVER_CONFIRMATION": BookingWaitingDriverConfirmation,
|
||||||
"COMPLETED_PENDING_VALIDATION": BookingCompletedPendingValidation,
|
"WAITING_PASSENGER_CONFIRMATION": BookingWaitingPassengerConfirmation,
|
||||||
"VALIDATED": BookingValidated,
|
"CONFIRMED": BookingConfirmed,
|
||||||
|
"CANCELLED": BookingCancelled,
|
||||||
|
"COMPLETED_PENDING_VALIDATION": BookingCompletedPendingValidation,
|
||||||
|
"VALIDATED": BookingValidated,
|
||||||
}
|
}
|
||||||
|
|
||||||
var bookingStatustoString = map[BookingStatus]string{
|
var bookingStatustoString = map[BookingStatus]string{
|
||||||
BookingWaitingConfirmation: "WAITING_CONFIRMATION",
|
BookingInitiated: "INITIATED",
|
||||||
BookingConfirmed: "CONFIRMED",
|
// BookingWaitingConfirmation: "WAITING_CONFIRMATION",
|
||||||
BookingCancelled: "CANCELLED",
|
BookingWaitingDriverConfirmation: "WAITING_DRIVER_CONFIRMATION",
|
||||||
BookingCompletedPendingValidation: "COMPLETED_PENDING_VALIDATION",
|
BookingWaitingPassengerConfirmation: "WAITING_PASSENGER_CONFIRMATION",
|
||||||
BookingValidated: "VALIDATED",
|
BookingConfirmed: "CONFIRMED",
|
||||||
|
BookingCancelled: "CANCELLED",
|
||||||
|
BookingCompletedPendingValidation: "COMPLETED_PENDING_VALIDATION",
|
||||||
|
BookingValidated: "VALIDATED",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON transforms a booking status to its JSON representation
|
||||||
func (s BookingStatus) MarshalJSON() ([]byte, error) {
|
func (s BookingStatus) MarshalJSON() ([]byte, error) {
|
||||||
buffer := bytes.NewBufferString(`"`)
|
buffer := bytes.NewBufferString(`"`)
|
||||||
buffer.WriteString(bookingStatustoString[s])
|
buffer.WriteString(bookingStatustoString[s])
|
||||||
@@ -39,34 +55,68 @@ func (s BookingStatus) MarshalJSON() ([]byte, error) {
|
|||||||
return buffer.Bytes(), nil
|
return buffer.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalBSON transforms a booking status to its BSON representation for MongoDB storage
|
||||||
|
func (s BookingStatus) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
||||||
|
return bson.MarshalValue(bookingStatustoString[s])
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON transforms JSON to a BookingStatus
|
||||||
func (bs *BookingStatus) UnmarshalJSON(b []byte) error {
|
func (bs *BookingStatus) UnmarshalJSON(b []byte) error {
|
||||||
var j string
|
var j string
|
||||||
err := json.Unmarshal(b, &j)
|
err := json.Unmarshal(b, &j)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.
|
|
||||||
*bs = bookingStatustoID[j]
|
*bs = bookingStatustoID[j]
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type Booking struct {
|
// UnmarshalBSONValue transforms BSON from MongoDB to a BookingStatus
|
||||||
ID string `json:"id",bson:"_id"` // TODO check uuidv4
|
func (bs *BookingStatus) UnmarshalBSONValue(t bsontype.Type, b []byte) error {
|
||||||
Driver User `json:"driver"`
|
if t == bsontype.Null || len(b) == 0 {
|
||||||
Passenger User `json:"passenger"`
|
return nil
|
||||||
PassengerPickupDate JSONTime `json:"passengerPickupDate"`
|
}
|
||||||
PassengerPickupLat float64 `json:"passengerPickupLat"`
|
j, _, ok := bsoncore.ReadString(b)
|
||||||
PassengerPickupLng float64 `json:"passengerPickupLng"`
|
if !ok {
|
||||||
PassengerDropLat float64 `json:"passengerDropLat"`
|
return fmt.Errorf("cannot parse status")
|
||||||
PassengerDropLng float64 `json:"passengerDropLng"`
|
}
|
||||||
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty"`
|
*bs = bookingStatustoID[j]
|
||||||
PassengerDropAddress *string `json:"passengerDropAddress,omitempty"`
|
return nil
|
||||||
Status BookingStatus `json:"status"`
|
}
|
||||||
Distance *int64 `json:"distance,omitempty"`
|
|
||||||
Duration *time.Duration `json:"duration,omitempty"`
|
// String returns the string corresponding to the BookingStatus
|
||||||
WebUrl *string `json:"webUrl,omitempty"`
|
func (bs *BookingStatus) String() string {
|
||||||
Price Price `json:"price"`
|
if bs == nil {
|
||||||
Car *Car `json:"car,omitempty"`
|
return ""
|
||||||
DriverJourneyID string `json:"driverJourneyId"`
|
}
|
||||||
PassengerJourneyID string `json:"passengerJourneyId"`
|
return bookingStatustoString[*bs]
|
||||||
|
}
|
||||||
|
|
||||||
|
// BookingStatusFromString creates a new BookingStatus from the given string
|
||||||
|
func BookingStatusFromString(bs string) BookingStatus {
|
||||||
|
return bookingStatustoID[bs]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Booking describes the booking parameters and status, in the context of a "Booking by API" OCSS flow
|
||||||
|
type Booking struct {
|
||||||
|
ID string `json:"id" bson:"_id"`
|
||||||
|
Driver User `json:"driver"`
|
||||||
|
Passenger User `json:"passenger"`
|
||||||
|
PassengerPickupDate OCSSTime `json:"passengerPickupDate" bson:"passengerPickupDate"`
|
||||||
|
PassengerPickupLat float64 `json:"passengerPickupLat" bson:"passengerPickupLat"`
|
||||||
|
PassengerPickupLng float64 `json:"passengerPickupLng" bson:"passengerPickupLng"`
|
||||||
|
PassengerDropLat float64 `json:"passengerDropLat" bson:"passengerDropLat"`
|
||||||
|
PassengerDropLng float64 `json:"passengerDropLng" bson:"passengerDropLng"`
|
||||||
|
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty" bson:"passengerPickupAddress,omitempty"`
|
||||||
|
PassengerDropAddress *string `json:"passengerDropAddress,omitempty" bson:"passengerDropAddress,omitempty"`
|
||||||
|
Status BookingStatus `json:"status"`
|
||||||
|
Distance *int64 `json:"distance,omitempty" bson:"distance,omitempty"`
|
||||||
|
Duration *time.Duration `json:"duration,omitempty" bson:"duration,omitempty"`
|
||||||
|
WebUrl *string `json:"webUrl,omitempty" bson:"webUrl,omitempty"`
|
||||||
|
Price Price `json:"price"`
|
||||||
|
Car *Car `json:"car,omitempty" bson:"car,omitempty"`
|
||||||
|
DriverJourneyID string `json:"driverJourneyId" bson:"driverJourneyId"`
|
||||||
|
PassengerJourneyID string `json:"passengerJourneyId" bson:"passengerJourneyId"`
|
||||||
|
DriverCompensationAmount *float64 `json:"driverCompensationAmount,omitempty" bson:"driverCompensationAmount,omitempty"`
|
||||||
|
DriverCompensationCurrency *string `json:"driverCompensationCurrency,omitempty" bson:"driverCompensationCurrency,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/bsontype"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CarpoolBookingStatus describes he state of the booking event
|
||||||
type CarpoolBookingStatus int64
|
type CarpoolBookingStatus int64
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -39,6 +43,10 @@ func (s CarpoolBookingStatus) MarshalJSON() ([]byte, error) {
|
|||||||
return buffer.Bytes(), nil
|
return buffer.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s CarpoolBookingStatus) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
||||||
|
return bson.MarshalValue(carpoolBookingStatustoString[s])
|
||||||
|
}
|
||||||
|
|
||||||
func (bs *CarpoolBookingStatus) UnmarshalJSON(b []byte) error {
|
func (bs *CarpoolBookingStatus) UnmarshalJSON(b []byte) error {
|
||||||
var j string
|
var j string
|
||||||
err := json.Unmarshal(b, &j)
|
err := json.Unmarshal(b, &j)
|
||||||
@@ -50,6 +58,17 @@ func (bs *CarpoolBookingStatus) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bs *CarpoolBookingStatus) UnmarshalBSON(t bsontype.Type, b []byte) error {
|
||||||
|
var j string
|
||||||
|
err := bson.Unmarshal(b, &j)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.
|
||||||
|
*bs = carpoolBookingStatustoID[j]
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type CarpoolBookingEventData struct {
|
type CarpoolBookingEventData struct {
|
||||||
CarpoolBooking
|
CarpoolBooking
|
||||||
DriverCarpoolBooking
|
DriverCarpoolBooking
|
||||||
@@ -57,24 +76,24 @@ type CarpoolBookingEventData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CarpoolBookingEvent struct {
|
type CarpoolBookingEvent struct {
|
||||||
ID string `json:"id"` // TODO validate UUID
|
ID string `json:"id"`
|
||||||
IDToken string `json:"idToken"`
|
IDToken string `json:"idToken"`
|
||||||
Data CarpoolBookingEventData `json:"data"`
|
Data CarpoolBookingEventData `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CarpoolBooking struct {
|
type CarpoolBooking struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id" bson:"_id"`
|
||||||
PassengerPickupDate time.Time `json:"passengerPickupDate"`
|
PassengerPickupDate time.Time `json:"passengerPickupDate" bson:"passengerPickupDate"`
|
||||||
PassengerPickupLat float64 `json:"passengerPickupLat"`
|
PassengerPickupLat float64 `json:"passengerPickupLat" bson:"passengerPickupLat"`
|
||||||
PassengerPickupLng float64 `json:"passengerPickupLng"`
|
PassengerPickupLng float64 `json:"passengerPickupLng" bson:"passengerPickupLng"`
|
||||||
PassengerDropLat float64 `json:"passengerDropLat"`
|
PassengerDropLat float64 `json:"passengerDropLat" bson:"passengerDropLat"`
|
||||||
PassengerDropLng float64 `json:"passengerDropLng"`
|
PassengerDropLng float64 `json:"passengerDropLng" bson:"passengerDropLng"`
|
||||||
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty"`
|
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty" bson:"passengerPickupAddress,omitempty"`
|
||||||
PassengerDropAddress *string `json:"passengerDropAddress,omitempty"`
|
PassengerDropAddress *string `json:"passengerDropAddress,omitempty" bson:"passengerDropAddress,omitempty"`
|
||||||
Status CarpoolBookingStatus `json:"status"`
|
Status CarpoolBookingStatus `json:"status"`
|
||||||
Distance *int64 `json:"distance,omitempty"`
|
Distance *int64 `json:"distance,omitempty" bson:"distance,omitempty"`
|
||||||
Duration *time.Duration `json:"duration,omitempty"`
|
Duration *time.Duration `json:"duration,omitempty" bson:"duration,omitempty"`
|
||||||
WebUrl string `json:"webUrl"`
|
WebUrl string `json:"webUrl" bson:"webUrl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PassengerCarpoolBooking struct {
|
type PassengerCarpoolBooking struct {
|
||||||
@@ -84,5 +103,5 @@ type PassengerCarpoolBooking struct {
|
|||||||
type DriverCarpoolBooking struct {
|
type DriverCarpoolBooking struct {
|
||||||
Driver User `json:"driver"`
|
Driver User `json:"driver"`
|
||||||
Price Price `json:"price"`
|
Price Price `json:"price"`
|
||||||
Car *Car `json:"car,omitempty"`
|
Car *Car `json:"car,omitempty" bson:"car,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package ocss
|
package ocss
|
||||||
|
|
||||||
type Car struct {
|
type Car struct {
|
||||||
Model *string `json:"model,omitempty"`
|
Model *string `json:"model,omitempty" bson:"model,omitempty"`
|
||||||
Brand *string `json:"brand,omitempty"`
|
Brand *string `json:"brand,omitempty" bson:"brand,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,15 @@ package ocss
|
|||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
type Client struct{}
|
type Client struct {
|
||||||
|
BaseURL string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient(baseUrl string) *Client {
|
||||||
|
return &Client{
|
||||||
|
BaseURL: baseUrl,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c Client) GetDriverJourneys() ([]DriverJourney, error) {
|
func (c Client) GetDriverJourneys() ([]DriverJourney, error) {
|
||||||
return nil, errors.New("not implemented")
|
return nil, errors.New("not implemented")
|
||||||
|
|||||||
@@ -6,3 +6,8 @@ require (
|
|||||||
github.com/gorilla/schema v1.2.0
|
github.com/gorilla/schema v1.2.0
|
||||||
golang.org/x/crypto v0.7.0
|
golang.org/x/crypto v0.7.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/paulmach/orb v0.9.0 // indirect
|
||||||
|
go.mongodb.org/mongo-driver v1.11.1 // indirect
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,4 +1,74 @@
|
|||||||
|
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/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
|
github.com/golang/snappy v0.0.1/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/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
|
github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
|
||||||
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
|
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
|
||||||
|
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/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
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/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||||
|
github.com/paulmach/orb v0.9.0 h1:MwA1DqOKtvCgm7u9RZ/pnYejTeDJPnr0+0oFajBbJqk=
|
||||||
|
github.com/paulmach/orb v0.9.0/go.mod h1:SudmOk85SXtmXAB3sLGyJ6tZy/8pdfrV0o6ef98Xc30=
|
||||||
|
github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
|
||||||
|
github.com/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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
|
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/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
|
||||||
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
|
||||||
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
go.mongodb.org/mongo-driver v1.11.1 h1:QP0znIRTuL0jf1oBQoAoM0C6ZJfBK4kx0Uumtv1A7w8=
|
||||||
|
go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
|
||||||
|
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-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||||
|
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/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-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
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/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/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
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/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/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/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
package ocss
|
package ocss
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type JourneyScheduleType int64
|
type JourneyScheduleType int64
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -24,60 +18,27 @@ func (t JourneyScheduleType) MarshalJSON() ([]byte, error) {
|
|||||||
return []byte(types[t]), nil
|
return []byte(types[t]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type JSONTime time.Time
|
|
||||||
|
|
||||||
func (t JSONTime) MarshalJSON() ([]byte, error) {
|
|
||||||
//do your serializing here
|
|
||||||
stamp := fmt.Sprintf("%v", time.Time(t).Unix())
|
|
||||||
return []byte(stamp), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *JSONTime) UnmarshalJSON(b []byte) error {
|
|
||||||
var timestamp int64
|
|
||||||
err := json.Unmarshal(b, ×tamp)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
parsed := time.Unix(timestamp, 0)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
jsontime := JSONTime(parsed)
|
|
||||||
*t = jsontime
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *JSONTime) ToTime() *time.Time {
|
|
||||||
if t == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
time := time.Time(*t)
|
|
||||||
return &time
|
|
||||||
}
|
|
||||||
|
|
||||||
type JourneySchedule struct {
|
type JourneySchedule struct {
|
||||||
ID *string `json:"id,omitempty"`
|
ID *string `json:"id,omitempty"`
|
||||||
PassengerPickupDate JSONTime `json:"passengerPickupDate"`
|
PassengerPickupDate OCSSTime `json:"passengerPickupDate" bson:"passengerPickupDate"`
|
||||||
PassengerDepartureDate *JSONTime `json:"passengerDepartureDate,omitempty"`
|
// PassengerDepartureDate *OCSSTime `json:"passengerDepartureDate,omitempty"`
|
||||||
DriverDepartureDate *JSONTime `json:"driverDepartureDate,omitempty"`
|
DriverDepartureDate *OCSSTime `json:"driverDepartureDate,omitempty" bson:"driverDepartureDate,omitempty"`
|
||||||
WebUrl *string `json:"webUrl,omitempty"`
|
WebUrl *string `json:"webUrl,omitempty" bson:"webUrl,omitempty"`
|
||||||
Type JourneyScheduleType `json:"type"`
|
Type JourneyScheduleType `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DriverJourney struct {
|
type DriverJourney struct {
|
||||||
DriverTrip
|
DriverTrip
|
||||||
JourneySchedule
|
JourneySchedule
|
||||||
|
|
||||||
AvailableSteats *int64 `json:"requestedSeats,omitempty"`
|
AvailableSteats *int64 `json:"requestedSeats,omitempty" bson:"requestedSeats,omitempty"`
|
||||||
Price *Price `json:"price,omitempty"`
|
Price *Price `json:"price,omitempty" bson:"price,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PassengerJourney struct {
|
type PassengerJourney struct {
|
||||||
PassengerTrip
|
PassengerTrip
|
||||||
JourneySchedule
|
JourneySchedule
|
||||||
|
|
||||||
//TODO how to handle requested driverDepartureDate
|
// TODO how to handle requested driverDepartureDate
|
||||||
RequestedSteats *int64 `json:"requestedSeats,omitempty"`
|
RequestedSteats *int64 `json:"requestedSeats,omitempty" bson:"requestedSeats,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
136
interoperability/ocss/journeys_driver_functions.go
Normal file
136
interoperability/ocss/journeys_driver_functions.go
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
package ocss
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
geojson "github.com/paulmach/orb/geojson"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewDriverJourney(
|
||||||
|
id string,
|
||||||
|
operator string,
|
||||||
|
driver User,
|
||||||
|
passengerPickup geojson.Feature,
|
||||||
|
passengerDrop geojson.Feature,
|
||||||
|
duration time.Duration,
|
||||||
|
passengerPickupDate time.Time,
|
||||||
|
journeyType JourneyScheduleType,
|
||||||
|
) *DriverJourney {
|
||||||
|
var pickupAddress *string
|
||||||
|
if addr := passengerPickup.Properties.MustString("label", ""); addr != "" {
|
||||||
|
pickupAddress = &addr
|
||||||
|
}
|
||||||
|
var dropAddress *string
|
||||||
|
if addr := passengerDrop.Properties.MustString("label", ""); addr != "" {
|
||||||
|
dropAddress = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
return &DriverJourney{
|
||||||
|
DriverTrip: DriverTrip{
|
||||||
|
Driver: driver,
|
||||||
|
Trip: Trip{
|
||||||
|
Operator: operator,
|
||||||
|
PassengerPickupLat: passengerPickup.Point().Lat(),
|
||||||
|
PassengerPickupLng: passengerPickup.Point().Lon(),
|
||||||
|
PassengerPickupAddress: pickupAddress,
|
||||||
|
PassengerDropLat: passengerDrop.Point().Lat(),
|
||||||
|
PassengerDropLng: passengerDrop.Point().Lon(),
|
||||||
|
PassengerDropAddress: dropAddress,
|
||||||
|
Duration: duration,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
JourneySchedule: JourneySchedule{
|
||||||
|
ID: &id,
|
||||||
|
PassengerPickupDate: OCSSTime(passengerPickupDate),
|
||||||
|
Type: journeyType,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddDepartureToPickupWalkingDistance(distance int64) *DriverJourney {
|
||||||
|
j.DepartureToPickupWalkingDistance = &distance
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
func (j *DriverJourney) AddDepartureToPickupWalkingDuration(duration time.Duration) *DriverJourney {
|
||||||
|
j.DepartureToPickupWalkingDuration = &duration
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
func (j *DriverJourney) AddDepartureToPickupWalkingPolyline(polyline string) *DriverJourney {
|
||||||
|
j.DepartureToPickupWalkingPolyline = &polyline
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddDropoffToArrivalWalkingDistance(distance int64) *DriverJourney {
|
||||||
|
j.DropoffToArrivalWalkingDistance = &distance
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
func (j *DriverJourney) AddDropoffToArrivalWalkingDuration(duration time.Duration) *DriverJourney {
|
||||||
|
j.DropoffToArrivalWalkingDuration = &duration
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
func (j *DriverJourney) AddDropoffToArrivalWalkingPolyline(polyline string) *DriverJourney {
|
||||||
|
j.DropoffToArrivalWalkingPolyline = &polyline
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddCar(car Car) *DriverJourney {
|
||||||
|
j.Car = &car
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddDriverDeparture(location geojson.Feature) *DriverJourney {
|
||||||
|
lat := location.Point().Lat()
|
||||||
|
lon := location.Point().Lon()
|
||||||
|
|
||||||
|
j.DriverDepartureLat = &lat
|
||||||
|
j.DriverDepartureLng = &lon
|
||||||
|
if addr := location.Properties.MustString("label", ""); addr != "" {
|
||||||
|
j.DriverDepartureAddress = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddDriverArrival(location geojson.Feature) *DriverJourney {
|
||||||
|
lat := location.Point().Lat()
|
||||||
|
lon := location.Point().Lon()
|
||||||
|
|
||||||
|
j.DriverArrivalLat = &lat
|
||||||
|
j.DriverArrivalLng = &lon
|
||||||
|
if addr := location.Properties.MustString("label", ""); addr != "" {
|
||||||
|
j.DriverArrivalAddress = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddDistance(distance int64) *DriverJourney {
|
||||||
|
j.Distance = &distance
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddJourneyPolyline(polyline string) *DriverJourney {
|
||||||
|
j.JourneyPolyline = &polyline
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddPreferences(preferences Preferences) *DriverJourney {
|
||||||
|
j.Preferences = &preferences
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddAvailableSeats(seats int64) *DriverJourney {
|
||||||
|
j.AvailableSteats = &seats
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddDriverDepartureDate(date time.Time) *DriverJourney {
|
||||||
|
d := OCSSTime(date)
|
||||||
|
j.DriverDepartureDate = &d
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *DriverJourney) AddWebUrl(url string) *DriverJourney {
|
||||||
|
j.WebUrl = &url
|
||||||
|
return j
|
||||||
|
}
|
||||||
105
interoperability/ocss/journeys_passenger_functions.go
Normal file
105
interoperability/ocss/journeys_passenger_functions.go
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
package ocss
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
geojson "github.com/paulmach/orb/geojson"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewPassengerJourney(
|
||||||
|
id string,
|
||||||
|
operator string,
|
||||||
|
driver User,
|
||||||
|
passengerPickup geojson.Feature,
|
||||||
|
passengerDrop geojson.Feature,
|
||||||
|
duration time.Duration,
|
||||||
|
passengerPickupDate time.Time,
|
||||||
|
journeyType JourneyScheduleType,
|
||||||
|
) *PassengerJourney {
|
||||||
|
var pickupAddress *string
|
||||||
|
if addr := passengerPickup.Properties.MustString("label", ""); addr != "" {
|
||||||
|
pickupAddress = &addr
|
||||||
|
}
|
||||||
|
var dropAddress *string
|
||||||
|
if addr := passengerDrop.Properties.MustString("label", ""); addr != "" {
|
||||||
|
dropAddress = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
return &PassengerJourney{
|
||||||
|
PassengerTrip: PassengerTrip{
|
||||||
|
Passenger: driver,
|
||||||
|
Trip: Trip{
|
||||||
|
Operator: operator,
|
||||||
|
PassengerPickupLat: passengerPickup.Point().Lat(),
|
||||||
|
PassengerPickupLng: passengerPickup.Point().Lon(),
|
||||||
|
PassengerPickupAddress: pickupAddress,
|
||||||
|
PassengerDropLat: passengerDrop.Point().Lat(),
|
||||||
|
PassengerDropLng: passengerDrop.Point().Lon(),
|
||||||
|
PassengerDropAddress: dropAddress,
|
||||||
|
Duration: duration,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
JourneySchedule: JourneySchedule{
|
||||||
|
ID: &id,
|
||||||
|
PassengerPickupDate: OCSSTime(passengerPickupDate),
|
||||||
|
Type: journeyType,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddDriverDeparture(location geojson.Feature) *PassengerJourney {
|
||||||
|
lat := location.Point().Lat()
|
||||||
|
lon := location.Point().Lon()
|
||||||
|
|
||||||
|
j.DriverDepartureLat = &lat
|
||||||
|
j.DriverDepartureLng = &lon
|
||||||
|
if addr := location.Properties.MustString("label", ""); addr != "" {
|
||||||
|
j.DriverDepartureAddress = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddDriverArrival(location geojson.Feature) *PassengerJourney {
|
||||||
|
lat := location.Point().Lat()
|
||||||
|
lon := location.Point().Lon()
|
||||||
|
|
||||||
|
j.DriverArrivalLat = &lat
|
||||||
|
j.DriverArrivalLng = &lon
|
||||||
|
if addr := location.Properties.MustString("label", ""); addr != "" {
|
||||||
|
j.DriverArrivalAddress = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddDistance(distance int64) *PassengerJourney {
|
||||||
|
j.Distance = &distance
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddJourneyPolyline(polyline string) *PassengerJourney {
|
||||||
|
j.JourneyPolyline = &polyline
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddPreferences(preferences Preferences) *PassengerJourney {
|
||||||
|
j.Preferences = &preferences
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddAvailableSeats(seats int64) *PassengerJourney {
|
||||||
|
j.RequestedSteats = &seats
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddDriverDepartureDate(date time.Time) *PassengerJourney {
|
||||||
|
d := OCSSTime(date)
|
||||||
|
j.DriverDepartureDate = &d
|
||||||
|
return j
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *PassengerJourney) AddWebUrl(url string) *PassengerJourney {
|
||||||
|
j.WebUrl = &url
|
||||||
|
return j
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package ocss
|
package ocss
|
||||||
|
|
||||||
type Preferences struct {
|
type Preferences struct {
|
||||||
Smoking *bool `json:"smoking,omitempty"`
|
Smoking *bool `json:"smoking,omitempty" bson:"smoking,omitempty"`
|
||||||
Animals *bool `json:"animals,omitempty"`
|
Animals *bool `json:"animals,omitempty" bson:"animals,omitempty"`
|
||||||
Music *bool `json:"music,omitempty"`
|
Music *bool `json:"music,omitempty" bson:"music,omitempty"`
|
||||||
IsTalker *bool `json:"isTalker,omitempty"`
|
IsTalker *bool `json:"isTalker,omitempty" bson:"isTalker,omitempty"`
|
||||||
LuggageSize *int64 `json:"luggageSize,omitempty"`
|
LuggageSize *int64 `json:"luggageSize,omitempty" bson:"luggageSize,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ package ocss
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/bsontype"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PriceType int64
|
type PriceType int64
|
||||||
@@ -32,6 +37,10 @@ func (s PriceType) MarshalJSON() ([]byte, error) {
|
|||||||
return buffer.Bytes(), nil
|
return buffer.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s PriceType) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
||||||
|
return bson.MarshalValue(priceTypeToString[s])
|
||||||
|
}
|
||||||
|
|
||||||
func (bs *PriceType) UnmarshalJSON(b []byte) error {
|
func (bs *PriceType) UnmarshalJSON(b []byte) error {
|
||||||
var j string
|
var j string
|
||||||
err := json.Unmarshal(b, &j)
|
err := json.Unmarshal(b, &j)
|
||||||
@@ -43,8 +52,20 @@ func (bs *PriceType) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type Price struct {
|
func (bs *PriceType) UnmarshalBSONValue(t bsontype.Type, b []byte) error {
|
||||||
Type *PriceType `json:"type,omitempty"`
|
if t == bsontype.Null || len(b) == 0 {
|
||||||
Amount *float64 `json:"amount,omitempty"`
|
return nil
|
||||||
Currency *string `json:"currency,omitempty"`
|
}
|
||||||
|
j, _, ok := bsoncore.ReadString(b)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot parse status")
|
||||||
|
}
|
||||||
|
*bs = priceTypeToID[j]
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Price struct {
|
||||||
|
Type *PriceType `json:"type,omitempty" bson:"type,omitempty"`
|
||||||
|
Amount *float64 `json:"amount,omitempty" bson:"amount,omitempty"`
|
||||||
|
Currency *string `json:"currency,omitempty" bson:"currency,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func (bs *Day) UnmarshalJSON(b []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Schedule struct {
|
type Schedule struct {
|
||||||
PassengerPickupDay *Day `json:"passengerPickupDay,omitempty"`
|
PassengerPickupDay *Day `json:"passengerPickupDay,omitempty" bson:"passengerPickupDay,omitempty"`
|
||||||
|
|
||||||
JourneySchedules *[]JourneySchedule `json:"journeySchedules,omitempty"`
|
JourneySchedules *[]JourneySchedule `json:"journeySchedules,omitempty" bson:"journeySchedules,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ type GetPassengerRegularTripsRequest struct {
|
|||||||
type PatchBookingsRequest struct {
|
type PatchBookingsRequest struct {
|
||||||
BookingId string `json:"bookingId"`
|
BookingId string `json:"bookingId"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Message string `json:message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
|||||||
67
interoperability/ocss/time.go
Normal file
67
interoperability/ocss/time.go
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package ocss
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/bsontype"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OCSSTime time.Time
|
||||||
|
|
||||||
|
func (t OCSSTime) MarshalJSON() ([]byte, error) {
|
||||||
|
// do your serializing here
|
||||||
|
stamp := fmt.Sprintf("%v", time.Time(t).Unix())
|
||||||
|
return []byte(stamp), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
|
||||||
|
return bson.MarshalValue(time.Time(v))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *OCSSTime) ToTime() *time.Time {
|
||||||
|
if t == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
time := time.Time(*t)
|
||||||
|
return &time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *OCSSTime) UnmarshalJSON(b []byte) error {
|
||||||
|
var timestamp int64
|
||||||
|
err := json.Unmarshal(b, ×tamp)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
parsed := time.Unix(timestamp, 0)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ocsstime := OCSSTime(parsed)
|
||||||
|
*t = ocsstime
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *OCSSTime) UnmarshalBSONValue(bt bsontype.Type, b []byte) error {
|
||||||
|
if bt == bsontype.Null || len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
datetime, _, ok := bsoncore.ReadTime(b)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot parse time")
|
||||||
|
}
|
||||||
|
|
||||||
|
*t = OCSSTime(datetime)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *OCSSTime) Format(format string) string {
|
||||||
|
if format == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return t.ToTime().Format(format)
|
||||||
|
}
|
||||||
@@ -4,34 +4,34 @@ import "time"
|
|||||||
|
|
||||||
type Trip struct {
|
type Trip struct {
|
||||||
Operator string `json:"operator"`
|
Operator string `json:"operator"`
|
||||||
PassengerPickupLat float64 `json:"passengerPickupLat"`
|
PassengerPickupLat float64 `json:"passengerPickupLat" bson:"passengerPickupLat"`
|
||||||
PassengerPickupLng float64 `json:"passengerPickupLng"`
|
PassengerPickupLng float64 `json:"passengerPickupLng" bson:"passengerPickupLng"`
|
||||||
PassengerDropLat float64 `json:"passengerDropLat"`
|
PassengerDropLat float64 `json:"passengerDropLat" bson:"passengerDropLat"`
|
||||||
PassengerDropLng float64 `json:"passengerDropLng"`
|
PassengerDropLng float64 `json:"passengerDropLng" bson:"passengerDropLng"`
|
||||||
Duration time.Duration `json:"duration"`
|
Duration time.Duration `json:"duration"`
|
||||||
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty"`
|
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty" bson:"passengerPickupAddress,omitempty"`
|
||||||
PassengerDropAddress *string `json:"passengerDropAddress,omitempty"`
|
PassengerDropAddress *string `json:"passengerDropAddress,omitempty" bson:"passengerDropAddress,omitempty"`
|
||||||
Distance *int64 `json:"distance,omitempty"`
|
Distance *int64 `json:"distance,omitempty" bson:"distance,omitempty"`
|
||||||
DriverDepartureLat *float64 `json:"driverDepartureLat,omitempty"`
|
DriverDepartureLat *float64 `json:"driverDepartureLat,omitempty" bson:"driverDepartureLat,omitempty"`
|
||||||
DriverDepartureLng *float64 `json:"driverDepartureLng,omitempty"`
|
DriverDepartureLng *float64 `json:"driverDepartureLng,omitempty" bson:"driverDepartureLng,omitempty"`
|
||||||
DriverArrivalLat *float64 `json:"driverArrivalLat,omitempty"`
|
DriverArrivalLat *float64 `json:"driverArrivalLat,omitempty" bson:"driverArrivalLat,omitempty"`
|
||||||
DriverArrivalLng *float64 `json:"driverArrivalLng,omitempty"`
|
DriverArrivalLng *float64 `json:"driverArrivalLng,omitempty" bson:"driverArrivalLng,omitempty"`
|
||||||
DriverDepartureAddress *string `json:"driverDepartureAddress,omitempty"`
|
DriverDepartureAddress *string `json:"driverDepartureAddress,omitempty" bson:"driverDepartureAddress,omitempty"`
|
||||||
DriverArrivalAddress *string `json:"driverArrivalAddress,omitempty"`
|
DriverArrivalAddress *string `json:"driverArrivalAddress,omitempty" bson:"driverArrivalAddress,omitempty"`
|
||||||
JourneyPolyline *string `json:"journeyPolyline,omitempty"`
|
JourneyPolyline *string `json:"journeyPolyline,omitempty" bson:"journeyPolyline,omitempty"`
|
||||||
//WebUrl *string `json:"webUrl,omitempty"`
|
//WebUrl *string `json:"webUrl,omitempty"`
|
||||||
Preferences *Preferences `json:"preferences,omitempty"`
|
Preferences *Preferences `json:"preferences,omitempty" bson:"preferences,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DriverTrip struct {
|
type DriverTrip struct {
|
||||||
Driver User `json:"driver"`
|
Driver User `json:"driver"`
|
||||||
DepartureToPickupWalkingDistance *int64 `json:"departureToPickupWalkingDistance,omitempty"`
|
DepartureToPickupWalkingDistance *int64 `json:"departureToPickupWalkingDistance,omitempty" bson:"departureToPickupWalkingDistance,omitempty"`
|
||||||
DepartureToPickupWalkingDuration *time.Duration `json:"departureToPickupWalkingDuration,omitempty"`
|
DepartureToPickupWalkingDuration *time.Duration `json:"departureToPickupWalkingDuration,omitempty" bson:"departureToPickupWalkingDuration,omitempty"`
|
||||||
DepartureToPickupWalkingPolyline *string `json:"departureToPickupWalkingPolyline,omitempty"`
|
DepartureToPickupWalkingPolyline *string `json:"departureToPickupWalkingPolyline,omitempty" bson:"departureToPickupWalkingPolyline,omitempty"`
|
||||||
DropoffToArrivalWalkingDistance *int64 `json:"dropoffToArrivalWalkingDistance,omitempty"`
|
DropoffToArrivalWalkingDistance *int64 `json:"dropoffToArrivalWalkingDistance,omitempty" bson:"dropoffToArrivalWalkingDistance,omitempty"`
|
||||||
DropoffToArrivalWalkingDuration *time.Duration `json:"dropoffToArrivalWalkingDuration,omitempty"`
|
DropoffToArrivalWalkingDuration *time.Duration `json:"dropoffToArrivalWalkingDuration,omitempty" bson:"dropoffToArrivalWalkingDuration,omitempty"`
|
||||||
DropoffToArrivalWalkingPolyline *string `json:"dropoffToArrivalWalkingPolyline,omitempty"`
|
DropoffToArrivalWalkingPolyline *string `json:"dropoffToArrivalWalkingPolyline,omitempty" bson:"dropoffToArrivalWalkingPolyline,omitempty"`
|
||||||
Car *Car `json:"car,omitempty"`
|
Car *Car `json:"car,omitempty" bson:"car,omitempty"`
|
||||||
|
|
||||||
Trip
|
Trip
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,14 +43,24 @@ func (bs *Gender) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *Gender) ToString() *string {
|
||||||
|
if g == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
res := gendertoString[*g]
|
||||||
|
|
||||||
|
return &res
|
||||||
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Operator string `json:"operator"`
|
Operator string `json:"operator"`
|
||||||
Alias string `json:"alias"`
|
Alias string `json:"alias"`
|
||||||
FirstName *string `json:"firstName,omitempty"`
|
FirstName *string `json:"firstName,omitempty" bson:"firstName,omitempty"`
|
||||||
LastName *string `json:"lastName,omitempty"`
|
LastName *string `json:"lastName,omitempty" bson:"lastName,omitempty"`
|
||||||
Grade *int64 `json:"grade,omitempty"`
|
Grade *int64 `json:"grade,omitempty" bson:"grade,omitempty"`
|
||||||
Picture *string `json:"picture,omitempty"`
|
Picture *string `json:"picture,omitempty" bson:"picture,omitempty"`
|
||||||
Gender *Gender `json:"gender,omitempty"`
|
Gender *Gender `json:"gender,omitempty" bson:"gender,omitempty"`
|
||||||
VerifiedIdentity *bool `json:"verifiedIdentity,omitempty"`
|
VerifiedIdentity *bool `json:"verifiedIdentity,omitempty" bson:"verifiedIdentity,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -150,6 +150,13 @@ message CarpoolServiceBooking {
|
|||||||
optional CarpoolServiceCar car = 16;
|
optional CarpoolServiceCar car = 16;
|
||||||
string driver_journey_id = 17;
|
string driver_journey_id = 17;
|
||||||
string passenger_journey_id = 18;
|
string passenger_journey_id = 18;
|
||||||
|
|
||||||
|
optional CarpoolFeatureCollection driver_route = 30;
|
||||||
|
optional CarpoolFeatureCollection passenger_route = 31;
|
||||||
|
optional google.protobuf.Timestamp driverDepartureDate = 32;
|
||||||
|
optional double driver_compensation_amount = 33;
|
||||||
|
optional string driver_compensation_currency = 34;
|
||||||
|
optional string motivation = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CarpoolServicePreferences {
|
message CarpoolServicePreferences {
|
||||||
@@ -211,9 +218,10 @@ enum CarpoolServicePriceType {
|
|||||||
|
|
||||||
enum CarpoolServiceBookingStatus {
|
enum CarpoolServiceBookingStatus {
|
||||||
INITIATED = 0;
|
INITIATED = 0;
|
||||||
WAITING_CONFIRMATION = 1;
|
WAITING_DRIVER_CONFIRMATION = 1;
|
||||||
CONFIRMED = 2;
|
WAITING_PASSENGER_CONFIRMATION = 2;
|
||||||
CANCELLED = 3;
|
CONFIRMED = 3;
|
||||||
COMPLETED_PENDING_VALIDATION = 4;
|
CANCELLED = 4;
|
||||||
VALIDATED = 5;
|
COMPLETED_PENDING_VALIDATION = 5;
|
||||||
|
VALIDATED = 6;
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -10,18 +10,20 @@ service CarpoolService {
|
|||||||
// rpc XXXX(Request) returns (Response) {}
|
// rpc XXXX(Request) returns (Response) {}
|
||||||
rpc CreateRegularRoutes(CreateRegularRoutesRequest) returns (CreateRegularRoutesResponse) {}
|
rpc CreateRegularRoutes(CreateRegularRoutesRequest) returns (CreateRegularRoutesResponse) {}
|
||||||
rpc DeleteRegularRoutes(DeleteRegularRoutesRequest) returns (DeleteRegularRoutesResponse) {}
|
rpc DeleteRegularRoutes(DeleteRegularRoutesRequest) returns (DeleteRegularRoutesResponse) {}
|
||||||
|
rpc GetRegularRoutes(GetRegularRoutesRequest) returns (GetRegularRoutesResponse) {}
|
||||||
rpc GetUserPlanning(GetUserPlanningRequest) returns (GetUserPlanningResponse) {}
|
rpc GetUserPlanning(GetUserPlanningRequest) returns (GetUserPlanningResponse) {}
|
||||||
rpc GetPlannedTrip(GetPlannedTripRequest) returns (GetPlannedTripResponse) {}
|
rpc GetPlannedTrip(GetPlannedTripRequest) returns (GetPlannedTripResponse) {}
|
||||||
|
rpc GetUserBookings(GetUserBookingsRequest) returns (GetUserBookingsResponse) {}
|
||||||
|
rpc GetCarpoolBookings(GetCarpoolBookingsRequest) returns (GetCarpoolBookingsResponse) {}
|
||||||
|
|
||||||
// OCSS-like interaction
|
// OCSS interactions
|
||||||
rpc DriverJourneys(DriverJourneysRequest) returns (DriverJourneysResponse) {}
|
rpc DriverJourneys(DriverJourneysRequest) returns (DriverJourneysResponse) {}
|
||||||
rpc PassengerJourneys(PassengerJourneysRequest) returns (PassengerJourneysResponse) {}
|
rpc PassengerJourneys(PassengerJourneysRequest) returns (PassengerJourneysResponse) {}
|
||||||
rpc DriverRegularTrips(DriverRegularTripsRequest) returns (DriverRegularTripsResponse) {}
|
rpc DriverRegularTrips(DriverRegularTripsRequest) returns (DriverRegularTripsResponse) {}
|
||||||
rpc PassengerRegularTrips(PassengerRegularTripsRequest) returns (PassengerRegularTripsResponse) {}
|
rpc PassengerRegularTrips(PassengerRegularTripsRequest) returns (PassengerRegularTripsResponse) {}
|
||||||
rpc CreateBooking(CreateBookingRequest) returns (CreateBookingResponse) {}
|
rpc CreateBooking(CreateCarpoolBookingRequest) returns (CreateCarpoolBookingResponse) {}
|
||||||
rpc UpdateBooking(UpdateBookingRequest) returns (UpdateBookingResponse) {}
|
rpc UpdateBooking(UpdateCarpoolBookingRequest) returns (UpdateCarpoolBookingResponse) {}
|
||||||
rpc GetBooking(GetBookingRequest) returns (GetBookingResponse) {}
|
rpc GetBooking(GetCarpoolBookingRequest) returns (GetCarpoolBookingResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal trips and journeys management messages
|
// Internal trips and journeys management messages
|
||||||
@@ -37,6 +39,14 @@ message DeleteRegularRoutesRequest {
|
|||||||
|
|
||||||
message DeleteRegularRoutesResponse {}
|
message DeleteRegularRoutesResponse {}
|
||||||
|
|
||||||
|
message GetRegularRoutesRequest {
|
||||||
|
string user_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetRegularRoutesResponse {
|
||||||
|
repeated CarpoolFeatureCollection routes = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message GetUserPlanningRequest {
|
message GetUserPlanningRequest {
|
||||||
string user_id = 1;
|
string user_id = 1;
|
||||||
google.protobuf.Timestamp min_departure_date = 2;
|
google.protobuf.Timestamp min_departure_date = 2;
|
||||||
@@ -45,6 +55,7 @@ message GetUserPlanningRequest {
|
|||||||
|
|
||||||
message GetUserPlanningResponse {
|
message GetUserPlanningResponse {
|
||||||
map<string, CarpoolRoutesCollection> routes_by_dates = 1;
|
map<string, CarpoolRoutesCollection> routes_by_dates = 1;
|
||||||
|
bool missing_planning = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetPlannedTripRequest {
|
message GetPlannedTripRequest {
|
||||||
@@ -55,6 +66,25 @@ message GetPlannedTripResponse {
|
|||||||
CarpoolFeatureCollection planned_trip = 1;
|
CarpoolFeatureCollection planned_trip = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetUserBookingsRequest {
|
||||||
|
string user_id = 1;
|
||||||
|
optional google.protobuf.Timestamp min_date = 2;
|
||||||
|
optional google.protobuf.Timestamp max_date = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetUserBookingsResponse {
|
||||||
|
repeated CarpoolServiceBooking bookings = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCarpoolBookingsRequest {
|
||||||
|
optional google.protobuf.Timestamp min_date = 2;
|
||||||
|
optional google.protobuf.Timestamp max_date = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCarpoolBookingsResponse {
|
||||||
|
repeated CarpoolServiceBooking bookings = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// OCSS-like interaction messages
|
// OCSS-like interaction messages
|
||||||
@@ -68,6 +98,8 @@ message DriverJourneysRequest {
|
|||||||
optional double departure_radius = 7;
|
optional double departure_radius = 7;
|
||||||
optional double arrival_radius = 8;
|
optional double arrival_radius = 8;
|
||||||
optional int64 count = 9;
|
optional int64 count = 9;
|
||||||
|
optional string departure_address = 10;
|
||||||
|
optional string arrival_address = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DriverJourneysResponse {
|
message DriverJourneysResponse {
|
||||||
@@ -128,26 +160,26 @@ message PassengerRegularTripsResponse {
|
|||||||
repeated CarpoolServiceDriverRegularTrip driver_regular_trips = 1;
|
repeated CarpoolServiceDriverRegularTrip driver_regular_trips = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateBookingRequest {
|
message CreateCarpoolBookingRequest {
|
||||||
CarpoolServiceBooking booking = 1;
|
CarpoolServiceBooking booking = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateBookingResponse {
|
message CreateCarpoolBookingResponse {
|
||||||
CarpoolServiceBooking booking = 1;
|
CarpoolServiceBooking booking = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateBookingRequest {
|
message UpdateCarpoolBookingRequest {
|
||||||
string booking_id = 1;
|
string booking_id = 1;
|
||||||
CarpoolServiceBookingStatus status = 2;
|
CarpoolServiceBookingStatus status = 2;
|
||||||
string message = 3;
|
string message = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateBookingResponse {}
|
message UpdateCarpoolBookingResponse {}
|
||||||
|
|
||||||
message GetBookingRequest {
|
message GetCarpoolBookingRequest {
|
||||||
string booking_id = 1;
|
string booking_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetBookingResponse {
|
message GetCarpoolBookingResponse {
|
||||||
CarpoolServiceBooking booking = 1;
|
CarpoolServiceBooking booking = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-grpc v1.2.0
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
// - protoc v3.19.4
|
// - protoc v6.31.1
|
||||||
// source: carpool-service.proto
|
// source: carpool-service.proto
|
||||||
|
|
||||||
package proto
|
package proto
|
||||||
@@ -15,8 +15,25 @@ import (
|
|||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
// Requires gRPC-Go v1.32.0 or later.
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
const _ = grpc.SupportPackageIsVersion7
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
|
const (
|
||||||
|
CarpoolService_CreateRegularRoutes_FullMethodName = "/CarpoolService/CreateRegularRoutes"
|
||||||
|
CarpoolService_DeleteRegularRoutes_FullMethodName = "/CarpoolService/DeleteRegularRoutes"
|
||||||
|
CarpoolService_GetRegularRoutes_FullMethodName = "/CarpoolService/GetRegularRoutes"
|
||||||
|
CarpoolService_GetUserPlanning_FullMethodName = "/CarpoolService/GetUserPlanning"
|
||||||
|
CarpoolService_GetPlannedTrip_FullMethodName = "/CarpoolService/GetPlannedTrip"
|
||||||
|
CarpoolService_GetUserBookings_FullMethodName = "/CarpoolService/GetUserBookings"
|
||||||
|
CarpoolService_GetCarpoolBookings_FullMethodName = "/CarpoolService/GetCarpoolBookings"
|
||||||
|
CarpoolService_DriverJourneys_FullMethodName = "/CarpoolService/DriverJourneys"
|
||||||
|
CarpoolService_PassengerJourneys_FullMethodName = "/CarpoolService/PassengerJourneys"
|
||||||
|
CarpoolService_DriverRegularTrips_FullMethodName = "/CarpoolService/DriverRegularTrips"
|
||||||
|
CarpoolService_PassengerRegularTrips_FullMethodName = "/CarpoolService/PassengerRegularTrips"
|
||||||
|
CarpoolService_CreateBooking_FullMethodName = "/CarpoolService/CreateBooking"
|
||||||
|
CarpoolService_UpdateBooking_FullMethodName = "/CarpoolService/UpdateBooking"
|
||||||
|
CarpoolService_GetBooking_FullMethodName = "/CarpoolService/GetBooking"
|
||||||
|
)
|
||||||
|
|
||||||
// CarpoolServiceClient is the client API for CarpoolService service.
|
// CarpoolServiceClient is the client API for CarpoolService service.
|
||||||
//
|
//
|
||||||
@@ -26,16 +43,19 @@ type CarpoolServiceClient interface {
|
|||||||
// rpc XXXX(Request) returns (Response) {}
|
// rpc XXXX(Request) returns (Response) {}
|
||||||
CreateRegularRoutes(ctx context.Context, in *CreateRegularRoutesRequest, opts ...grpc.CallOption) (*CreateRegularRoutesResponse, error)
|
CreateRegularRoutes(ctx context.Context, in *CreateRegularRoutesRequest, opts ...grpc.CallOption) (*CreateRegularRoutesResponse, error)
|
||||||
DeleteRegularRoutes(ctx context.Context, in *DeleteRegularRoutesRequest, opts ...grpc.CallOption) (*DeleteRegularRoutesResponse, error)
|
DeleteRegularRoutes(ctx context.Context, in *DeleteRegularRoutesRequest, opts ...grpc.CallOption) (*DeleteRegularRoutesResponse, error)
|
||||||
|
GetRegularRoutes(ctx context.Context, in *GetRegularRoutesRequest, opts ...grpc.CallOption) (*GetRegularRoutesResponse, error)
|
||||||
GetUserPlanning(ctx context.Context, in *GetUserPlanningRequest, opts ...grpc.CallOption) (*GetUserPlanningResponse, error)
|
GetUserPlanning(ctx context.Context, in *GetUserPlanningRequest, opts ...grpc.CallOption) (*GetUserPlanningResponse, error)
|
||||||
GetPlannedTrip(ctx context.Context, in *GetPlannedTripRequest, opts ...grpc.CallOption) (*GetPlannedTripResponse, error)
|
GetPlannedTrip(ctx context.Context, in *GetPlannedTripRequest, opts ...grpc.CallOption) (*GetPlannedTripResponse, error)
|
||||||
// OCSS-like interaction
|
GetUserBookings(ctx context.Context, in *GetUserBookingsRequest, opts ...grpc.CallOption) (*GetUserBookingsResponse, error)
|
||||||
|
GetCarpoolBookings(ctx context.Context, in *GetCarpoolBookingsRequest, opts ...grpc.CallOption) (*GetCarpoolBookingsResponse, error)
|
||||||
|
// OCSS interactions
|
||||||
DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error)
|
DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error)
|
||||||
PassengerJourneys(ctx context.Context, in *PassengerJourneysRequest, opts ...grpc.CallOption) (*PassengerJourneysResponse, error)
|
PassengerJourneys(ctx context.Context, in *PassengerJourneysRequest, opts ...grpc.CallOption) (*PassengerJourneysResponse, error)
|
||||||
DriverRegularTrips(ctx context.Context, in *DriverRegularTripsRequest, opts ...grpc.CallOption) (*DriverRegularTripsResponse, error)
|
DriverRegularTrips(ctx context.Context, in *DriverRegularTripsRequest, opts ...grpc.CallOption) (*DriverRegularTripsResponse, error)
|
||||||
PassengerRegularTrips(ctx context.Context, in *PassengerRegularTripsRequest, opts ...grpc.CallOption) (*PassengerRegularTripsResponse, error)
|
PassengerRegularTrips(ctx context.Context, in *PassengerRegularTripsRequest, opts ...grpc.CallOption) (*PassengerRegularTripsResponse, error)
|
||||||
CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error)
|
CreateBooking(ctx context.Context, in *CreateCarpoolBookingRequest, opts ...grpc.CallOption) (*CreateCarpoolBookingResponse, error)
|
||||||
UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error)
|
UpdateBooking(ctx context.Context, in *UpdateCarpoolBookingRequest, opts ...grpc.CallOption) (*UpdateCarpoolBookingResponse, error)
|
||||||
GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error)
|
GetBooking(ctx context.Context, in *GetCarpoolBookingRequest, opts ...grpc.CallOption) (*GetCarpoolBookingResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type carpoolServiceClient struct {
|
type carpoolServiceClient struct {
|
||||||
@@ -47,8 +67,9 @@ func NewCarpoolServiceClient(cc grpc.ClientConnInterface) CarpoolServiceClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) CreateRegularRoutes(ctx context.Context, in *CreateRegularRoutesRequest, opts ...grpc.CallOption) (*CreateRegularRoutesResponse, error) {
|
func (c *carpoolServiceClient) CreateRegularRoutes(ctx context.Context, in *CreateRegularRoutesRequest, opts ...grpc.CallOption) (*CreateRegularRoutesResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(CreateRegularRoutesResponse)
|
out := new(CreateRegularRoutesResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/CreateRegularRoutes", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_CreateRegularRoutes_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -56,8 +77,19 @@ func (c *carpoolServiceClient) CreateRegularRoutes(ctx context.Context, in *Crea
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) DeleteRegularRoutes(ctx context.Context, in *DeleteRegularRoutesRequest, opts ...grpc.CallOption) (*DeleteRegularRoutesResponse, error) {
|
func (c *carpoolServiceClient) DeleteRegularRoutes(ctx context.Context, in *DeleteRegularRoutesRequest, opts ...grpc.CallOption) (*DeleteRegularRoutesResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(DeleteRegularRoutesResponse)
|
out := new(DeleteRegularRoutesResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/DeleteRegularRoutes", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_DeleteRegularRoutes_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *carpoolServiceClient) GetRegularRoutes(ctx context.Context, in *GetRegularRoutesRequest, opts ...grpc.CallOption) (*GetRegularRoutesResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetRegularRoutesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, CarpoolService_GetRegularRoutes_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -65,8 +97,9 @@ func (c *carpoolServiceClient) DeleteRegularRoutes(ctx context.Context, in *Dele
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) GetUserPlanning(ctx context.Context, in *GetUserPlanningRequest, opts ...grpc.CallOption) (*GetUserPlanningResponse, error) {
|
func (c *carpoolServiceClient) GetUserPlanning(ctx context.Context, in *GetUserPlanningRequest, opts ...grpc.CallOption) (*GetUserPlanningResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(GetUserPlanningResponse)
|
out := new(GetUserPlanningResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/GetUserPlanning", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_GetUserPlanning_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -74,8 +107,29 @@ func (c *carpoolServiceClient) GetUserPlanning(ctx context.Context, in *GetUserP
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) GetPlannedTrip(ctx context.Context, in *GetPlannedTripRequest, opts ...grpc.CallOption) (*GetPlannedTripResponse, error) {
|
func (c *carpoolServiceClient) GetPlannedTrip(ctx context.Context, in *GetPlannedTripRequest, opts ...grpc.CallOption) (*GetPlannedTripResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(GetPlannedTripResponse)
|
out := new(GetPlannedTripResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/GetPlannedTrip", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_GetPlannedTrip_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *carpoolServiceClient) GetUserBookings(ctx context.Context, in *GetUserBookingsRequest, opts ...grpc.CallOption) (*GetUserBookingsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetUserBookingsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, CarpoolService_GetUserBookings_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *carpoolServiceClient) GetCarpoolBookings(ctx context.Context, in *GetCarpoolBookingsRequest, opts ...grpc.CallOption) (*GetCarpoolBookingsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetCarpoolBookingsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, CarpoolService_GetCarpoolBookings_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -83,8 +137,9 @@ func (c *carpoolServiceClient) GetPlannedTrip(ctx context.Context, in *GetPlanne
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error) {
|
func (c *carpoolServiceClient) DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(DriverJourneysResponse)
|
out := new(DriverJourneysResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/DriverJourneys", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_DriverJourneys_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -92,8 +147,9 @@ func (c *carpoolServiceClient) DriverJourneys(ctx context.Context, in *DriverJou
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) PassengerJourneys(ctx context.Context, in *PassengerJourneysRequest, opts ...grpc.CallOption) (*PassengerJourneysResponse, error) {
|
func (c *carpoolServiceClient) PassengerJourneys(ctx context.Context, in *PassengerJourneysRequest, opts ...grpc.CallOption) (*PassengerJourneysResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(PassengerJourneysResponse)
|
out := new(PassengerJourneysResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/PassengerJourneys", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_PassengerJourneys_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -101,8 +157,9 @@ func (c *carpoolServiceClient) PassengerJourneys(ctx context.Context, in *Passen
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) DriverRegularTrips(ctx context.Context, in *DriverRegularTripsRequest, opts ...grpc.CallOption) (*DriverRegularTripsResponse, error) {
|
func (c *carpoolServiceClient) DriverRegularTrips(ctx context.Context, in *DriverRegularTripsRequest, opts ...grpc.CallOption) (*DriverRegularTripsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(DriverRegularTripsResponse)
|
out := new(DriverRegularTripsResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/DriverRegularTrips", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_DriverRegularTrips_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -110,35 +167,39 @@ func (c *carpoolServiceClient) DriverRegularTrips(ctx context.Context, in *Drive
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) PassengerRegularTrips(ctx context.Context, in *PassengerRegularTripsRequest, opts ...grpc.CallOption) (*PassengerRegularTripsResponse, error) {
|
func (c *carpoolServiceClient) PassengerRegularTrips(ctx context.Context, in *PassengerRegularTripsRequest, opts ...grpc.CallOption) (*PassengerRegularTripsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(PassengerRegularTripsResponse)
|
out := new(PassengerRegularTripsResponse)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/PassengerRegularTrips", in, out, opts...)
|
err := c.cc.Invoke(ctx, CarpoolService_PassengerRegularTrips_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error) {
|
func (c *carpoolServiceClient) CreateBooking(ctx context.Context, in *CreateCarpoolBookingRequest, opts ...grpc.CallOption) (*CreateCarpoolBookingResponse, error) {
|
||||||
out := new(CreateBookingResponse)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/CreateBooking", in, out, opts...)
|
out := new(CreateCarpoolBookingResponse)
|
||||||
|
err := c.cc.Invoke(ctx, CarpoolService_CreateBooking_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error) {
|
func (c *carpoolServiceClient) UpdateBooking(ctx context.Context, in *UpdateCarpoolBookingRequest, opts ...grpc.CallOption) (*UpdateCarpoolBookingResponse, error) {
|
||||||
out := new(UpdateBookingResponse)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/UpdateBooking", in, out, opts...)
|
out := new(UpdateCarpoolBookingResponse)
|
||||||
|
err := c.cc.Invoke(ctx, CarpoolService_UpdateBooking_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *carpoolServiceClient) GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error) {
|
func (c *carpoolServiceClient) GetBooking(ctx context.Context, in *GetCarpoolBookingRequest, opts ...grpc.CallOption) (*GetCarpoolBookingResponse, error) {
|
||||||
out := new(GetBookingResponse)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
err := c.cc.Invoke(ctx, "/CarpoolService/GetBooking", in, out, opts...)
|
out := new(GetCarpoolBookingResponse)
|
||||||
|
err := c.cc.Invoke(ctx, CarpoolService_GetBooking_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -147,28 +208,34 @@ func (c *carpoolServiceClient) GetBooking(ctx context.Context, in *GetBookingReq
|
|||||||
|
|
||||||
// CarpoolServiceServer is the server API for CarpoolService service.
|
// CarpoolServiceServer is the server API for CarpoolService service.
|
||||||
// All implementations must embed UnimplementedCarpoolServiceServer
|
// All implementations must embed UnimplementedCarpoolServiceServer
|
||||||
// for forward compatibility
|
// for forward compatibility.
|
||||||
type CarpoolServiceServer interface {
|
type CarpoolServiceServer interface {
|
||||||
// Internal trips and journeys management
|
// Internal trips and journeys management
|
||||||
// rpc XXXX(Request) returns (Response) {}
|
// rpc XXXX(Request) returns (Response) {}
|
||||||
CreateRegularRoutes(context.Context, *CreateRegularRoutesRequest) (*CreateRegularRoutesResponse, error)
|
CreateRegularRoutes(context.Context, *CreateRegularRoutesRequest) (*CreateRegularRoutesResponse, error)
|
||||||
DeleteRegularRoutes(context.Context, *DeleteRegularRoutesRequest) (*DeleteRegularRoutesResponse, error)
|
DeleteRegularRoutes(context.Context, *DeleteRegularRoutesRequest) (*DeleteRegularRoutesResponse, error)
|
||||||
|
GetRegularRoutes(context.Context, *GetRegularRoutesRequest) (*GetRegularRoutesResponse, error)
|
||||||
GetUserPlanning(context.Context, *GetUserPlanningRequest) (*GetUserPlanningResponse, error)
|
GetUserPlanning(context.Context, *GetUserPlanningRequest) (*GetUserPlanningResponse, error)
|
||||||
GetPlannedTrip(context.Context, *GetPlannedTripRequest) (*GetPlannedTripResponse, error)
|
GetPlannedTrip(context.Context, *GetPlannedTripRequest) (*GetPlannedTripResponse, error)
|
||||||
// OCSS-like interaction
|
GetUserBookings(context.Context, *GetUserBookingsRequest) (*GetUserBookingsResponse, error)
|
||||||
|
GetCarpoolBookings(context.Context, *GetCarpoolBookingsRequest) (*GetCarpoolBookingsResponse, error)
|
||||||
|
// OCSS interactions
|
||||||
DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error)
|
DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error)
|
||||||
PassengerJourneys(context.Context, *PassengerJourneysRequest) (*PassengerJourneysResponse, error)
|
PassengerJourneys(context.Context, *PassengerJourneysRequest) (*PassengerJourneysResponse, error)
|
||||||
DriverRegularTrips(context.Context, *DriverRegularTripsRequest) (*DriverRegularTripsResponse, error)
|
DriverRegularTrips(context.Context, *DriverRegularTripsRequest) (*DriverRegularTripsResponse, error)
|
||||||
PassengerRegularTrips(context.Context, *PassengerRegularTripsRequest) (*PassengerRegularTripsResponse, error)
|
PassengerRegularTrips(context.Context, *PassengerRegularTripsRequest) (*PassengerRegularTripsResponse, error)
|
||||||
CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error)
|
CreateBooking(context.Context, *CreateCarpoolBookingRequest) (*CreateCarpoolBookingResponse, error)
|
||||||
UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error)
|
UpdateBooking(context.Context, *UpdateCarpoolBookingRequest) (*UpdateCarpoolBookingResponse, error)
|
||||||
GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error)
|
GetBooking(context.Context, *GetCarpoolBookingRequest) (*GetCarpoolBookingResponse, error)
|
||||||
mustEmbedUnimplementedCarpoolServiceServer()
|
mustEmbedUnimplementedCarpoolServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedCarpoolServiceServer must be embedded to have forward compatible implementations.
|
// UnimplementedCarpoolServiceServer must be embedded to have
|
||||||
type UnimplementedCarpoolServiceServer struct {
|
// forward compatible implementations.
|
||||||
}
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedCarpoolServiceServer struct{}
|
||||||
|
|
||||||
func (UnimplementedCarpoolServiceServer) CreateRegularRoutes(context.Context, *CreateRegularRoutesRequest) (*CreateRegularRoutesResponse, error) {
|
func (UnimplementedCarpoolServiceServer) CreateRegularRoutes(context.Context, *CreateRegularRoutesRequest) (*CreateRegularRoutesResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateRegularRoutes not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateRegularRoutes not implemented")
|
||||||
@@ -176,12 +243,21 @@ func (UnimplementedCarpoolServiceServer) CreateRegularRoutes(context.Context, *C
|
|||||||
func (UnimplementedCarpoolServiceServer) DeleteRegularRoutes(context.Context, *DeleteRegularRoutesRequest) (*DeleteRegularRoutesResponse, error) {
|
func (UnimplementedCarpoolServiceServer) DeleteRegularRoutes(context.Context, *DeleteRegularRoutesRequest) (*DeleteRegularRoutesResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteRegularRoutes not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method DeleteRegularRoutes not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedCarpoolServiceServer) GetRegularRoutes(context.Context, *GetRegularRoutesRequest) (*GetRegularRoutesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetRegularRoutes not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) GetUserPlanning(context.Context, *GetUserPlanningRequest) (*GetUserPlanningResponse, error) {
|
func (UnimplementedCarpoolServiceServer) GetUserPlanning(context.Context, *GetUserPlanningRequest) (*GetUserPlanningResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserPlanning not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetUserPlanning not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) GetPlannedTrip(context.Context, *GetPlannedTripRequest) (*GetPlannedTripResponse, error) {
|
func (UnimplementedCarpoolServiceServer) GetPlannedTrip(context.Context, *GetPlannedTripRequest) (*GetPlannedTripResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetPlannedTrip not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetPlannedTrip not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedCarpoolServiceServer) GetUserBookings(context.Context, *GetUserBookingsRequest) (*GetUserBookingsResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetUserBookings not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedCarpoolServiceServer) GetCarpoolBookings(context.Context, *GetCarpoolBookingsRequest) (*GetCarpoolBookingsResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetCarpoolBookings not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error) {
|
func (UnimplementedCarpoolServiceServer) DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method DriverJourneys not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method DriverJourneys not implemented")
|
||||||
}
|
}
|
||||||
@@ -194,16 +270,17 @@ func (UnimplementedCarpoolServiceServer) DriverRegularTrips(context.Context, *Dr
|
|||||||
func (UnimplementedCarpoolServiceServer) PassengerRegularTrips(context.Context, *PassengerRegularTripsRequest) (*PassengerRegularTripsResponse, error) {
|
func (UnimplementedCarpoolServiceServer) PassengerRegularTrips(context.Context, *PassengerRegularTripsRequest) (*PassengerRegularTripsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method PassengerRegularTrips not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method PassengerRegularTrips not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error) {
|
func (UnimplementedCarpoolServiceServer) CreateBooking(context.Context, *CreateCarpoolBookingRequest) (*CreateCarpoolBookingResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateBooking not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateBooking not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error) {
|
func (UnimplementedCarpoolServiceServer) UpdateBooking(context.Context, *UpdateCarpoolBookingRequest) (*UpdateCarpoolBookingResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error) {
|
func (UnimplementedCarpoolServiceServer) GetBooking(context.Context, *GetCarpoolBookingRequest) (*GetCarpoolBookingResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetBooking not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetBooking not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCarpoolServiceServer) mustEmbedUnimplementedCarpoolServiceServer() {}
|
func (UnimplementedCarpoolServiceServer) mustEmbedUnimplementedCarpoolServiceServer() {}
|
||||||
|
func (UnimplementedCarpoolServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
// UnsafeCarpoolServiceServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeCarpoolServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
// Use of this interface is not recommended, as added methods to CarpoolServiceServer will
|
// Use of this interface is not recommended, as added methods to CarpoolServiceServer will
|
||||||
@@ -213,6 +290,13 @@ type UnsafeCarpoolServiceServer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RegisterCarpoolServiceServer(s grpc.ServiceRegistrar, srv CarpoolServiceServer) {
|
func RegisterCarpoolServiceServer(s grpc.ServiceRegistrar, srv CarpoolServiceServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedCarpoolServiceServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
s.RegisterService(&CarpoolService_ServiceDesc, srv)
|
s.RegisterService(&CarpoolService_ServiceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +310,7 @@ func _CarpoolService_CreateRegularRoutes_Handler(srv interface{}, ctx context.Co
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/CreateRegularRoutes",
|
FullMethod: CarpoolService_CreateRegularRoutes_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).CreateRegularRoutes(ctx, req.(*CreateRegularRoutesRequest))
|
return srv.(CarpoolServiceServer).CreateRegularRoutes(ctx, req.(*CreateRegularRoutesRequest))
|
||||||
@@ -244,7 +328,7 @@ func _CarpoolService_DeleteRegularRoutes_Handler(srv interface{}, ctx context.Co
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/DeleteRegularRoutes",
|
FullMethod: CarpoolService_DeleteRegularRoutes_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).DeleteRegularRoutes(ctx, req.(*DeleteRegularRoutesRequest))
|
return srv.(CarpoolServiceServer).DeleteRegularRoutes(ctx, req.(*DeleteRegularRoutesRequest))
|
||||||
@@ -252,6 +336,24 @@ func _CarpoolService_DeleteRegularRoutes_Handler(srv interface{}, ctx context.Co
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _CarpoolService_GetRegularRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetRegularRoutesRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(CarpoolServiceServer).GetRegularRoutes(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: CarpoolService_GetRegularRoutes_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(CarpoolServiceServer).GetRegularRoutes(ctx, req.(*GetRegularRoutesRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _CarpoolService_GetUserPlanning_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _CarpoolService_GetUserPlanning_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetUserPlanningRequest)
|
in := new(GetUserPlanningRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -262,7 +364,7 @@ func _CarpoolService_GetUserPlanning_Handler(srv interface{}, ctx context.Contex
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/GetUserPlanning",
|
FullMethod: CarpoolService_GetUserPlanning_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).GetUserPlanning(ctx, req.(*GetUserPlanningRequest))
|
return srv.(CarpoolServiceServer).GetUserPlanning(ctx, req.(*GetUserPlanningRequest))
|
||||||
@@ -280,7 +382,7 @@ func _CarpoolService_GetPlannedTrip_Handler(srv interface{}, ctx context.Context
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/GetPlannedTrip",
|
FullMethod: CarpoolService_GetPlannedTrip_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).GetPlannedTrip(ctx, req.(*GetPlannedTripRequest))
|
return srv.(CarpoolServiceServer).GetPlannedTrip(ctx, req.(*GetPlannedTripRequest))
|
||||||
@@ -288,6 +390,42 @@ func _CarpoolService_GetPlannedTrip_Handler(srv interface{}, ctx context.Context
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _CarpoolService_GetUserBookings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetUserBookingsRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(CarpoolServiceServer).GetUserBookings(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: CarpoolService_GetUserBookings_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(CarpoolServiceServer).GetUserBookings(ctx, req.(*GetUserBookingsRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _CarpoolService_GetCarpoolBookings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetCarpoolBookingsRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(CarpoolServiceServer).GetCarpoolBookings(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: CarpoolService_GetCarpoolBookings_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(CarpoolServiceServer).GetCarpoolBookings(ctx, req.(*GetCarpoolBookingsRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _CarpoolService_DriverJourneys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _CarpoolService_DriverJourneys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(DriverJourneysRequest)
|
in := new(DriverJourneysRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -298,7 +436,7 @@ func _CarpoolService_DriverJourneys_Handler(srv interface{}, ctx context.Context
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/DriverJourneys",
|
FullMethod: CarpoolService_DriverJourneys_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).DriverJourneys(ctx, req.(*DriverJourneysRequest))
|
return srv.(CarpoolServiceServer).DriverJourneys(ctx, req.(*DriverJourneysRequest))
|
||||||
@@ -316,7 +454,7 @@ func _CarpoolService_PassengerJourneys_Handler(srv interface{}, ctx context.Cont
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/PassengerJourneys",
|
FullMethod: CarpoolService_PassengerJourneys_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).PassengerJourneys(ctx, req.(*PassengerJourneysRequest))
|
return srv.(CarpoolServiceServer).PassengerJourneys(ctx, req.(*PassengerJourneysRequest))
|
||||||
@@ -334,7 +472,7 @@ func _CarpoolService_DriverRegularTrips_Handler(srv interface{}, ctx context.Con
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/DriverRegularTrips",
|
FullMethod: CarpoolService_DriverRegularTrips_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).DriverRegularTrips(ctx, req.(*DriverRegularTripsRequest))
|
return srv.(CarpoolServiceServer).DriverRegularTrips(ctx, req.(*DriverRegularTripsRequest))
|
||||||
@@ -352,7 +490,7 @@ func _CarpoolService_PassengerRegularTrips_Handler(srv interface{}, ctx context.
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/PassengerRegularTrips",
|
FullMethod: CarpoolService_PassengerRegularTrips_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).PassengerRegularTrips(ctx, req.(*PassengerRegularTripsRequest))
|
return srv.(CarpoolServiceServer).PassengerRegularTrips(ctx, req.(*PassengerRegularTripsRequest))
|
||||||
@@ -361,7 +499,7 @@ func _CarpoolService_PassengerRegularTrips_Handler(srv interface{}, ctx context.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _CarpoolService_CreateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _CarpoolService_CreateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(CreateBookingRequest)
|
in := new(CreateCarpoolBookingRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -370,16 +508,16 @@ func _CarpoolService_CreateBooking_Handler(srv interface{}, ctx context.Context,
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/CreateBooking",
|
FullMethod: CarpoolService_CreateBooking_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).CreateBooking(ctx, req.(*CreateBookingRequest))
|
return srv.(CarpoolServiceServer).CreateBooking(ctx, req.(*CreateCarpoolBookingRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _CarpoolService_UpdateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _CarpoolService_UpdateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(UpdateBookingRequest)
|
in := new(UpdateCarpoolBookingRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -388,16 +526,16 @@ func _CarpoolService_UpdateBooking_Handler(srv interface{}, ctx context.Context,
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/UpdateBooking",
|
FullMethod: CarpoolService_UpdateBooking_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).UpdateBooking(ctx, req.(*UpdateBookingRequest))
|
return srv.(CarpoolServiceServer).UpdateBooking(ctx, req.(*UpdateCarpoolBookingRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _CarpoolService_GetBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _CarpoolService_GetBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GetBookingRequest)
|
in := new(GetCarpoolBookingRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -406,10 +544,10 @@ func _CarpoolService_GetBooking_Handler(srv interface{}, ctx context.Context, de
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/CarpoolService/GetBooking",
|
FullMethod: CarpoolService_GetBooking_FullMethodName,
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(CarpoolServiceServer).GetBooking(ctx, req.(*GetBookingRequest))
|
return srv.(CarpoolServiceServer).GetBooking(ctx, req.(*GetCarpoolBookingRequest))
|
||||||
}
|
}
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
@@ -429,6 +567,10 @@ var CarpoolService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "DeleteRegularRoutes",
|
MethodName: "DeleteRegularRoutes",
|
||||||
Handler: _CarpoolService_DeleteRegularRoutes_Handler,
|
Handler: _CarpoolService_DeleteRegularRoutes_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetRegularRoutes",
|
||||||
|
Handler: _CarpoolService_GetRegularRoutes_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GetUserPlanning",
|
MethodName: "GetUserPlanning",
|
||||||
Handler: _CarpoolService_GetUserPlanning_Handler,
|
Handler: _CarpoolService_GetUserPlanning_Handler,
|
||||||
@@ -437,6 +579,14 @@ var CarpoolService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetPlannedTrip",
|
MethodName: "GetPlannedTrip",
|
||||||
Handler: _CarpoolService_GetPlannedTrip_Handler,
|
Handler: _CarpoolService_GetPlannedTrip_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetUserBookings",
|
||||||
|
Handler: _CarpoolService_GetUserBookings_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetCarpoolBookings",
|
||||||
|
Handler: _CarpoolService_GetCarpoolBookings_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "DriverJourneys",
|
MethodName: "DriverJourneys",
|
||||||
Handler: _CarpoolService_DriverJourneys_Handler,
|
Handler: _CarpoolService_DriverJourneys_Handler,
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package proto
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
||||||
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (j *CarpoolServiceDriverJourney) ToOCSS() ocss.DriverJourney {
|
func (j *CarpoolServiceDriverJourney) ToOCSS() ocss.DriverJourney {
|
||||||
|
|
||||||
var departureToPickupWalkingDuration *time.Duration
|
var departureToPickupWalkingDuration *time.Duration
|
||||||
if j.DepartureToPickupWalkingDuration != nil {
|
if j.DepartureToPickupWalkingDuration != nil {
|
||||||
dtpw := time.Duration(*j.DepartureToPickupWalkingDuration)
|
dtpw := time.Duration(*j.DepartureToPickupWalkingDuration)
|
||||||
@@ -39,9 +40,9 @@ func (j *CarpoolServiceDriverJourney) ToOCSS() ocss.DriverJourney {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var driverDepartureDate *ocss.JSONTime
|
var driverDepartureDate *ocss.OCSSTime
|
||||||
if j.DriverDepartureDate != nil {
|
if j.DriverDepartureDate != nil {
|
||||||
ddd := ocss.JSONTime(j.DriverDepartureDate.AsTime())
|
ddd := ocss.OCSSTime(j.DriverDepartureDate.AsTime())
|
||||||
driverDepartureDate = &ddd
|
driverDepartureDate = &ddd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +109,8 @@ func (j *CarpoolServiceDriverJourney) ToOCSS() ocss.DriverJourney {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
JourneySchedule: ocss.JourneySchedule{
|
JourneySchedule: ocss.JourneySchedule{
|
||||||
PassengerPickupDate: ocss.JSONTime(j.PassengerPickupDate.AsTime()),
|
ID: &j.Id,
|
||||||
|
PassengerPickupDate: ocss.OCSSTime(j.PassengerPickupDate.AsTime()),
|
||||||
DriverDepartureDate: driverDepartureDate,
|
DriverDepartureDate: driverDepartureDate,
|
||||||
WebUrl: j.WebUrl,
|
WebUrl: j.WebUrl,
|
||||||
Type: j.Type.ToOCSS(),
|
Type: j.Type.ToOCSS(),
|
||||||
@@ -131,9 +133,9 @@ func (j *CarpoolServicePassengerJourney) ToOCSS() ocss.PassengerJourney {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var driverDepartureDate *ocss.JSONTime
|
var driverDepartureDate *ocss.OCSSTime
|
||||||
if j.DriverDepartureDate != nil {
|
if j.DriverDepartureDate != nil {
|
||||||
ddd := ocss.JSONTime(j.DriverDepartureDate.AsTime())
|
ddd := ocss.OCSSTime(j.DriverDepartureDate.AsTime())
|
||||||
driverDepartureDate = &ddd
|
driverDepartureDate = &ddd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +173,8 @@ func (j *CarpoolServicePassengerJourney) ToOCSS() ocss.PassengerJourney {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
JourneySchedule: ocss.JourneySchedule{
|
JourneySchedule: ocss.JourneySchedule{
|
||||||
PassengerPickupDate: ocss.JSONTime(j.PassengerPickupDate.AsTime()),
|
ID: &j.Id,
|
||||||
|
PassengerPickupDate: ocss.OCSSTime(j.PassengerPickupDate.AsTime()),
|
||||||
DriverDepartureDate: driverDepartureDate,
|
DriverDepartureDate: driverDepartureDate,
|
||||||
WebUrl: j.WebUrl,
|
WebUrl: j.WebUrl,
|
||||||
Type: j.Type.ToOCSS(),
|
Type: j.Type.ToOCSS(),
|
||||||
@@ -180,6 +183,245 @@ func (j *CarpoolServicePassengerJourney) ToOCSS() ocss.PassengerJourney {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *CarpoolServiceBooking) ToOCSS() ocss.Booking {
|
||||||
|
var duration *time.Duration
|
||||||
|
if b.Duration != nil {
|
||||||
|
d := time.Duration(*b.Duration) * time.Second
|
||||||
|
duration = &d
|
||||||
|
}
|
||||||
|
|
||||||
|
pt := ocss.Free
|
||||||
|
am := 0.0
|
||||||
|
cu := "EUR"
|
||||||
|
price := ocss.Price{
|
||||||
|
Type: &pt,
|
||||||
|
Amount: &am,
|
||||||
|
Currency: &cu,
|
||||||
|
}
|
||||||
|
if b.Price != nil {
|
||||||
|
pricetype := ocss.Unknown
|
||||||
|
if b.Price.Type != nil {
|
||||||
|
if *b.Price.Type == CarpoolServicePriceType_FREE {
|
||||||
|
pricetype = ocss.Free
|
||||||
|
} else if *b.Price.Type == CarpoolServicePriceType_PAYING {
|
||||||
|
pricetype = ocss.Paying
|
||||||
|
}
|
||||||
|
}
|
||||||
|
price = ocss.Price{
|
||||||
|
Type: &pricetype,
|
||||||
|
Amount: b.Price.Amount,
|
||||||
|
Currency: b.Price.Currency,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
status := ocss.BookingInitiated
|
||||||
|
if b.Status == CarpoolServiceBookingStatus_WAITING_DRIVER_CONFIRMATION {
|
||||||
|
status = ocss.BookingWaitingDriverConfirmation
|
||||||
|
} else if b.Status == CarpoolServiceBookingStatus_WAITING_PASSENGER_CONFIRMATION {
|
||||||
|
status = ocss.BookingWaitingPassengerConfirmation
|
||||||
|
} else if b.Status == CarpoolServiceBookingStatus_CONFIRMED {
|
||||||
|
status = ocss.BookingConfirmed
|
||||||
|
} else if b.Status == CarpoolServiceBookingStatus_COMPLETED_PENDING_VALIDATION {
|
||||||
|
status = ocss.BookingCompletedPendingValidation
|
||||||
|
} else if b.Status == CarpoolServiceBookingStatus_VALIDATED {
|
||||||
|
status = ocss.BookingValidated
|
||||||
|
} else if b.Status == CarpoolServiceBookingStatus_CANCELLED {
|
||||||
|
status = ocss.BookingCancelled
|
||||||
|
}
|
||||||
|
|
||||||
|
return ocss.Booking{
|
||||||
|
ID: b.Id,
|
||||||
|
Driver: ocss.User{
|
||||||
|
ID: b.Driver.Id,
|
||||||
|
Operator: b.Driver.Operator,
|
||||||
|
Alias: b.Driver.Alias,
|
||||||
|
FirstName: b.Driver.FirstName,
|
||||||
|
LastName: b.Driver.LastName,
|
||||||
|
Grade: b.Driver.Grade,
|
||||||
|
Picture: b.Driver.Picture,
|
||||||
|
Gender: GenderToOCSS(b.Driver.Gender),
|
||||||
|
VerifiedIdentity: b.Driver.VerifiedIdentity,
|
||||||
|
},
|
||||||
|
Passenger: ocss.User{
|
||||||
|
ID: b.Passenger.Id,
|
||||||
|
Operator: b.Passenger.Operator,
|
||||||
|
Alias: b.Passenger.Alias,
|
||||||
|
FirstName: b.Passenger.FirstName,
|
||||||
|
LastName: b.Passenger.LastName,
|
||||||
|
Grade: b.Passenger.Grade,
|
||||||
|
Picture: b.Passenger.Picture,
|
||||||
|
Gender: GenderToOCSS(b.Passenger.Gender),
|
||||||
|
VerifiedIdentity: b.Passenger.VerifiedIdentity,
|
||||||
|
},
|
||||||
|
PassengerPickupDate: ocss.OCSSTime(b.PassengerPickupDate.AsTime()),
|
||||||
|
PassengerPickupLat: b.PassengerPickupLat,
|
||||||
|
PassengerPickupLng: b.PassengerPickupLng,
|
||||||
|
PassengerDropLat: b.PassengerDropLat,
|
||||||
|
PassengerDropLng: b.PassengerDropLng,
|
||||||
|
PassengerPickupAddress: b.PassengerPickupAddress,
|
||||||
|
PassengerDropAddress: b.PassengerDropAddress,
|
||||||
|
Distance: b.Distance,
|
||||||
|
Duration: duration,
|
||||||
|
WebUrl: b.WebUrl,
|
||||||
|
Price: price,
|
||||||
|
Status: status,
|
||||||
|
DriverJourneyID: b.DriverJourneyId,
|
||||||
|
PassengerJourneyID: b.PassengerJourneyId,
|
||||||
|
DriverCompensationAmount: b.DriverCompensationAmount,
|
||||||
|
DriverCompensationCurrency: b.DriverCompensationCurrency,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func BookingFromOCSS(b ocss.Booking) *CarpoolServiceBooking {
|
||||||
|
passengerPickupDate := b.PassengerPickupDate.ToTime()
|
||||||
|
status := CarpoolServiceBookingStatus_INITIATED
|
||||||
|
if b.Status == ocss.BookingWaitingDriverConfirmation {
|
||||||
|
status = CarpoolServiceBookingStatus_WAITING_DRIVER_CONFIRMATION
|
||||||
|
} else if b.Status == ocss.BookingWaitingPassengerConfirmation {
|
||||||
|
status = CarpoolServiceBookingStatus_WAITING_PASSENGER_CONFIRMATION
|
||||||
|
} else if b.Status == ocss.BookingConfirmed {
|
||||||
|
status = CarpoolServiceBookingStatus_CONFIRMED
|
||||||
|
} else if b.Status == ocss.BookingCompletedPendingValidation {
|
||||||
|
status = CarpoolServiceBookingStatus_COMPLETED_PENDING_VALIDATION
|
||||||
|
} else if b.Status == ocss.BookingValidated {
|
||||||
|
status = CarpoolServiceBookingStatus_VALIDATED
|
||||||
|
} else if b.Status == ocss.BookingCancelled {
|
||||||
|
status = CarpoolServiceBookingStatus_CANCELLED
|
||||||
|
}
|
||||||
|
|
||||||
|
var duration *int64
|
||||||
|
if b.Duration != nil {
|
||||||
|
d := int64(b.Duration.Seconds())
|
||||||
|
duration = &d
|
||||||
|
}
|
||||||
|
|
||||||
|
var pricetype *CarpoolServicePriceType
|
||||||
|
if b.Price.Type != nil {
|
||||||
|
if *b.Price.Type == ocss.Free {
|
||||||
|
pt := CarpoolServicePriceType_FREE
|
||||||
|
pricetype = &pt
|
||||||
|
} else if *b.Price.Type == ocss.Paying {
|
||||||
|
pt := CarpoolServicePriceType_PAYING
|
||||||
|
pricetype = &pt
|
||||||
|
} else if *b.Price.Type == ocss.Unknown {
|
||||||
|
pt := CarpoolServicePriceType_UNKNOWN
|
||||||
|
pricetype = &pt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
price := CarpoolServicePrice{
|
||||||
|
Amount: b.Price.Amount,
|
||||||
|
Currency: b.Price.Currency,
|
||||||
|
Type: pricetype,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &CarpoolServiceBooking{
|
||||||
|
Id: b.ID,
|
||||||
|
Driver: &CarpoolServiceUser{
|
||||||
|
Id: b.Driver.ID,
|
||||||
|
Operator: b.Driver.Operator,
|
||||||
|
Alias: b.Driver.Alias,
|
||||||
|
FirstName: b.Driver.FirstName,
|
||||||
|
LastName: b.Driver.LastName,
|
||||||
|
Grade: b.Driver.Grade,
|
||||||
|
Picture: b.Driver.Picture,
|
||||||
|
Gender: b.Driver.Gender.ToString(),
|
||||||
|
VerifiedIdentity: b.Driver.VerifiedIdentity,
|
||||||
|
},
|
||||||
|
Passenger: &CarpoolServiceUser{
|
||||||
|
Id: b.Passenger.ID,
|
||||||
|
Operator: b.Passenger.Operator,
|
||||||
|
Alias: b.Passenger.Alias,
|
||||||
|
FirstName: b.Passenger.FirstName,
|
||||||
|
LastName: b.Passenger.LastName,
|
||||||
|
Grade: b.Passenger.Grade,
|
||||||
|
Picture: b.Passenger.Picture,
|
||||||
|
Gender: b.Passenger.Gender.ToString(),
|
||||||
|
VerifiedIdentity: b.Passenger.VerifiedIdentity,
|
||||||
|
},
|
||||||
|
PassengerPickupDate: timestamppb.New(*passengerPickupDate),
|
||||||
|
PassengerPickupLat: b.PassengerPickupLat,
|
||||||
|
PassengerPickupLng: b.PassengerPickupLng,
|
||||||
|
PassengerDropLat: b.PassengerDropLat,
|
||||||
|
PassengerDropLng: b.PassengerDropLng,
|
||||||
|
PassengerPickupAddress: b.PassengerPickupAddress,
|
||||||
|
PassengerDropAddress: b.PassengerDropAddress,
|
||||||
|
Status: status,
|
||||||
|
Distance: b.Distance,
|
||||||
|
Duration: duration,
|
||||||
|
WebUrl: b.WebUrl,
|
||||||
|
Price: &price,
|
||||||
|
DriverJourneyId: b.DriverJourneyID,
|
||||||
|
PassengerJourneyId: b.PassengerJourneyID,
|
||||||
|
DriverCompensationAmount: b.DriverCompensationAmount,
|
||||||
|
DriverCompensationCurrency: b.DriverCompensationCurrency,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func BookingFromInternal(b internal.Booking) *CarpoolServiceBooking {
|
||||||
|
booking := BookingFromOCSS(b.Booking)
|
||||||
|
|
||||||
|
if b.DriverRoute != nil {
|
||||||
|
serializedDriverRoute, err := b.DriverRoute.MarshalJSON()
|
||||||
|
if err == nil {
|
||||||
|
booking.DriverRoute = &CarpoolFeatureCollection{
|
||||||
|
Serialized: string(serializedDriverRoute),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.PassengerRoute != nil {
|
||||||
|
serializedPassengerRoute, err := b.PassengerRoute.MarshalJSON()
|
||||||
|
if err == nil {
|
||||||
|
booking.PassengerRoute = &CarpoolFeatureCollection{
|
||||||
|
Serialized: string(serializedPassengerRoute),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
booking.Motivation = b.Motivation
|
||||||
|
|
||||||
|
return booking
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s CarpoolServiceBookingStatus) ToOCSS() ocss.BookingStatus {
|
||||||
|
if s == CarpoolServiceBookingStatus_INITIATED {
|
||||||
|
return ocss.BookingInitiated
|
||||||
|
} else if s == CarpoolServiceBookingStatus_WAITING_DRIVER_CONFIRMATION {
|
||||||
|
return ocss.BookingWaitingDriverConfirmation
|
||||||
|
} else if s == CarpoolServiceBookingStatus_WAITING_PASSENGER_CONFIRMATION {
|
||||||
|
return ocss.BookingWaitingPassengerConfirmation
|
||||||
|
} else if s == CarpoolServiceBookingStatus_CONFIRMED {
|
||||||
|
return ocss.BookingConfirmed
|
||||||
|
} else if s == CarpoolServiceBookingStatus_COMPLETED_PENDING_VALIDATION {
|
||||||
|
return ocss.BookingCompletedPendingValidation
|
||||||
|
} else if s == CarpoolServiceBookingStatus_VALIDATED {
|
||||||
|
return ocss.BookingValidated
|
||||||
|
} else if s == CarpoolServiceBookingStatus_CANCELLED {
|
||||||
|
return ocss.BookingCancelled
|
||||||
|
}
|
||||||
|
|
||||||
|
return ocss.BookingInitiated
|
||||||
|
}
|
||||||
|
|
||||||
|
func BookingStatusFromOCSS(b ocss.BookingStatus) CarpoolServiceBookingStatus {
|
||||||
|
if b == ocss.BookingInitiated {
|
||||||
|
return CarpoolServiceBookingStatus_INITIATED
|
||||||
|
} else if b == ocss.BookingWaitingDriverConfirmation {
|
||||||
|
return CarpoolServiceBookingStatus_WAITING_DRIVER_CONFIRMATION
|
||||||
|
} else if b == ocss.BookingWaitingPassengerConfirmation {
|
||||||
|
return CarpoolServiceBookingStatus_WAITING_PASSENGER_CONFIRMATION
|
||||||
|
} else if b == ocss.BookingConfirmed {
|
||||||
|
return CarpoolServiceBookingStatus_CONFIRMED
|
||||||
|
} else if b == ocss.BookingCompletedPendingValidation {
|
||||||
|
return CarpoolServiceBookingStatus_COMPLETED_PENDING_VALIDATION
|
||||||
|
} else if b == ocss.BookingValidated {
|
||||||
|
return CarpoolServiceBookingStatus_VALIDATED
|
||||||
|
} else if b == ocss.BookingCancelled {
|
||||||
|
return CarpoolServiceBookingStatus_CANCELLED
|
||||||
|
}
|
||||||
|
return CarpoolServiceBookingStatus_INITIATED
|
||||||
|
}
|
||||||
|
|
||||||
func (t CarpoolServiceJourneyType) ToOCSS() ocss.JourneyScheduleType {
|
func (t CarpoolServiceJourneyType) ToOCSS() ocss.JourneyScheduleType {
|
||||||
if t == CarpoolServiceJourneyType_DYNAMIC {
|
if t == CarpoolServiceJourneyType_DYNAMIC {
|
||||||
return ocss.Dynamic
|
return ocss.Dynamic
|
||||||
|
|||||||
110
servers/grpc/server/book.go
Normal file
110
servers/grpc/server/book.go
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package grpcserver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/servers/grpc/proto"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s *CarpoolServiceServerImpl) CreateBooking(ctx context.Context, req *proto.CreateCarpoolBookingRequest) (*proto.CreateCarpoolBookingResponse, error) {
|
||||||
|
booking := req.Booking.ToOCSS()
|
||||||
|
createdBooking, err := s.Handler.Book(booking, req.Booking.Motivation)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "could not create booking - %s", err.Error())
|
||||||
|
}
|
||||||
|
return &proto.CreateCarpoolBookingResponse{
|
||||||
|
Booking: proto.BookingFromInternal(*createdBooking),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CarpoolServiceServerImpl) GetUserBookings(ctx context.Context, req *proto.GetUserBookingsRequest) (*proto.GetUserBookingsResponse, error) {
|
||||||
|
log.Debug().
|
||||||
|
Str("user", req.UserId).
|
||||||
|
Str("mindate", req.MinDate.AsTime().Format(time.RFC3339)).
|
||||||
|
Any("maxdate", req.MaxDate).
|
||||||
|
Msg("grpc server - GetUserBookings")
|
||||||
|
|
||||||
|
userid := req.UserId
|
||||||
|
var mindate *time.Time
|
||||||
|
if req.MinDate != nil {
|
||||||
|
d := req.MinDate.AsTime()
|
||||||
|
mindate = &d
|
||||||
|
}
|
||||||
|
var maxdate *time.Time
|
||||||
|
if req.MaxDate != nil {
|
||||||
|
d := req.MaxDate.AsTime()
|
||||||
|
maxdate = &d
|
||||||
|
}
|
||||||
|
|
||||||
|
bookings, err := s.Handler.GetUserBookings(userid, mindate, maxdate)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "error retrieving user bookings - %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []*proto.CarpoolServiceBooking{}
|
||||||
|
|
||||||
|
for _, b := range bookings {
|
||||||
|
nb := proto.BookingFromInternal(b)
|
||||||
|
results = append(results, nb)
|
||||||
|
}
|
||||||
|
return &proto.GetUserBookingsResponse{
|
||||||
|
Bookings: results,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CarpoolServiceServerImpl) GetCarpoolBookings(ctx context.Context, req *proto.GetCarpoolBookingsRequest) (*proto.GetCarpoolBookingsResponse, error) {
|
||||||
|
log.Debug().
|
||||||
|
Time("mindate", req.MinDate.AsTime()).
|
||||||
|
Time("maxdate", req.MaxDate.AsTime()).
|
||||||
|
Msg("grpc server - GetUserBookings")
|
||||||
|
|
||||||
|
var mindate *time.Time
|
||||||
|
if req.MinDate != nil {
|
||||||
|
d := req.MinDate.AsTime()
|
||||||
|
mindate = &d
|
||||||
|
}
|
||||||
|
var maxdate *time.Time
|
||||||
|
if req.MaxDate != nil {
|
||||||
|
d := req.MaxDate.AsTime()
|
||||||
|
maxdate = &d
|
||||||
|
}
|
||||||
|
|
||||||
|
bookings, err := s.Handler.GetBookings(mindate, maxdate)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "error retrieving user bookings - %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []*proto.CarpoolServiceBooking{}
|
||||||
|
|
||||||
|
for _, b := range bookings {
|
||||||
|
nb := proto.BookingFromInternal(b)
|
||||||
|
results = append(results, nb)
|
||||||
|
}
|
||||||
|
return &proto.GetCarpoolBookingsResponse{
|
||||||
|
Bookings: results,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CarpoolServiceServerImpl) UpdateBooking(ctx context.Context, req *proto.UpdateCarpoolBookingRequest) (*proto.UpdateCarpoolBookingResponse, error) {
|
||||||
|
err := s.Handler.UpdateBookingStatus(req.BookingId, req.Status.ToOCSS())
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "could not update booking status")
|
||||||
|
}
|
||||||
|
return &proto.UpdateCarpoolBookingResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CarpoolServiceServerImpl) GetBooking(ctx context.Context, req *proto.GetCarpoolBookingRequest) (*proto.GetCarpoolBookingResponse, error) {
|
||||||
|
result, err := s.Handler.GetBooking(req.BookingId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue retrieving booking in handler")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.GetCarpoolBookingResponse{
|
||||||
|
Booking: proto.BookingFromInternal(*result),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@@ -32,14 +32,44 @@ func (s *CarpoolServiceServerImpl) CreateRegularRoutes(ctx context.Context, req
|
|||||||
return &proto.CreateRegularRoutesResponse{}, nil
|
return &proto.CreateRegularRoutesResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) DeleteRegularRoutes(context.Context, *proto.DeleteRegularRoutesRequest) (*proto.DeleteRegularRoutesResponse, error) {
|
func (s *CarpoolServiceServerImpl) DeleteRegularRoutes(ctx context.Context, req *proto.DeleteRegularRoutesRequest) (*proto.DeleteRegularRoutesResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteTrips not implemented")
|
err := s.Handler.DeleteRegularRoutes(req.Ids)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &proto.DeleteRegularRoutesResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CarpoolServiceServerImpl) GetRegularRoutes(ctx context.Context, req *proto.GetRegularRoutesRequest) (*proto.GetRegularRoutesResponse, error) {
|
||||||
|
log.Debug().Msg("grpc CarpoolService - GetRegularRoutes")
|
||||||
|
|
||||||
|
routes, err := s.Handler.GetUserRegularRoutes(req.UserId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Internal, "could not retrieve user routes : %s", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []*proto.CarpoolFeatureCollection{}
|
||||||
|
|
||||||
|
for _, r := range routes {
|
||||||
|
serialized, err := r.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error marshaling route")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
results = append(results, &proto.CarpoolFeatureCollection{
|
||||||
|
Serialized: string(serialized),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.GetRegularRoutesResponse{
|
||||||
|
Routes: results,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) GetUserPlanning(ctx context.Context, req *proto.GetUserPlanningRequest) (*proto.GetUserPlanningResponse, error) {
|
func (s *CarpoolServiceServerImpl) GetUserPlanning(ctx context.Context, req *proto.GetUserPlanningRequest) (*proto.GetUserPlanningResponse, error) {
|
||||||
log.Debug().Msg("grpc CarpoolService - GetRegularUserRoutes")
|
log.Debug().Msg("grpc CarpoolService - GetUserPlanning")
|
||||||
|
|
||||||
planned_schedules, err := s.Handler.GetUserPlanning(req.UserId, req.MinDepartureDate.AsTime(), req.MaxDepartureDate.AsTime())
|
planned_schedules, missing_planning, err := s.Handler.GetUserPlanning(req.UserId, req.MinDepartureDate.AsTime(), req.MaxDepartureDate.AsTime())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "could not get user planning : %s", err.Error())
|
return nil, status.Errorf(codes.Internal, "could not get user planning : %s", err.Error())
|
||||||
}
|
}
|
||||||
@@ -52,10 +82,11 @@ func (s *CarpoolServiceServerImpl) GetUserPlanning(ctx context.Context, req *pro
|
|||||||
Collection: []*proto.CarpoolFeatureCollection{},
|
Collection: []*proto.CarpoolFeatureCollection{},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scheds {
|
for _, sched := range scheds {
|
||||||
s.Route.ExtraMembers["departure_date"] = s.DepartureDate
|
sched.Route.ExtraMembers["departure_date"] = sched.DepartureDate
|
||||||
s.Route.ExtraMembers["id"] = s.ID
|
sched.Route.ExtraMembers["id"] = sched.ID
|
||||||
fcraw, _ := s.Route.FeatureCollection().MarshalJSON()
|
sched.Route.ExtraMembers["operator"] = s.Handler.InternalOperatorID
|
||||||
|
fcraw, _ := sched.Route.MarshalJSON()
|
||||||
results[k].Collection = append(results[k].Collection, &proto.CarpoolFeatureCollection{
|
results[k].Collection = append(results[k].Collection, &proto.CarpoolFeatureCollection{
|
||||||
Serialized: string(fcraw),
|
Serialized: string(fcraw),
|
||||||
})
|
})
|
||||||
@@ -63,7 +94,8 @@ func (s *CarpoolServiceServerImpl) GetUserPlanning(ctx context.Context, req *pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &proto.GetUserPlanningResponse{
|
return &proto.GetUserPlanningResponse{
|
||||||
RoutesByDates: results,
|
RoutesByDates: results,
|
||||||
|
MissingPlanning: missing_planning,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +105,23 @@ func (s *CarpoolServiceServerImpl) GetPlannedTrip(ctx context.Context, req *prot
|
|||||||
return nil, status.Errorf(codes.Internal, "could not retrieve planned trip - %s", err.Error())
|
return nil, status.Errorf(codes.Internal, "could not retrieve planned trip - %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
planned_trip.Route.ExtraMembers["id"] = planned_trip.ID
|
||||||
planned_trip.Route.ExtraMembers["departure_date"] = planned_trip.DepartureDate
|
planned_trip.Route.ExtraMembers["departure_date"] = planned_trip.DepartureDate
|
||||||
|
planned_trip.Route.ExtraMembers["operator"] = s.Handler.InternalOperatorID
|
||||||
|
planned_trip.Route.ExtraMembers["driver_distance"] = planned_trip.Itinerary.Distance
|
||||||
|
if planned_trip.Itinerary.Legs != nil && len(planned_trip.Itinerary.Legs) > 1 {
|
||||||
|
planned_trip.Route.ExtraMembers["passenger_distance"] = planned_trip.Itinerary.Legs[1].Distance
|
||||||
|
}
|
||||||
|
|
||||||
serialized, err := planned_trip.Route.FeatureCollection().MarshalJSON()
|
// Add passenger pickup and drop information to extra members for frontend access
|
||||||
|
if planned_trip.PassengerPickup != nil {
|
||||||
|
planned_trip.Route.ExtraMembers["passenger_pickup"] = planned_trip.PassengerPickup
|
||||||
|
}
|
||||||
|
if planned_trip.PassengerDrop != nil {
|
||||||
|
planned_trip.Route.ExtraMembers["passenger_drop"] = planned_trip.PassengerDrop
|
||||||
|
}
|
||||||
|
|
||||||
|
serialized, err := planned_trip.Route.MarshalJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("grpc GetPlannedTrip - could not serialize feature collection")
|
log.Error().Err(err).Msg("grpc GetPlannedTrip - could not serialize feature collection")
|
||||||
return nil, status.Errorf(codes.Internal, "could not serialize feature collection")
|
return nil, status.Errorf(codes.Internal, "could not serialize feature collection")
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/servers/grpc/proto"
|
"git.coopgo.io/coopgo-platform/carpool-service/servers/grpc/proto"
|
||||||
"github.com/paulmach/orb"
|
"github.com/paulmach/orb"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@@ -13,13 +14,33 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (*proto.DriverJourneysResponse, error) {
|
func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (*proto.DriverJourneysResponse, error) {
|
||||||
log.Debug().
|
|
||||||
Str("departure date", req.DepartureDate.String()).
|
|
||||||
Msg("grpc server - DriverJourneys")
|
|
||||||
|
|
||||||
departure := orb.Point{req.DepartureLng, req.DepartureLat}
|
departure := orb.Point{req.DepartureLng, req.DepartureLat}
|
||||||
arrival := orb.Point{req.ArrivalLng, req.ArrivalLat}
|
arrival := orb.Point{req.ArrivalLng, req.ArrivalLat}
|
||||||
|
|
||||||
|
// Create features with addresses
|
||||||
|
departureFeature := geojson.NewFeature(departure)
|
||||||
|
arrivalFeature := geojson.NewFeature(arrival)
|
||||||
|
|
||||||
|
if req.DepartureAddress != nil && *req.DepartureAddress != "" {
|
||||||
|
if departureFeature.Properties == nil {
|
||||||
|
departureFeature.Properties = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
departureFeature.Properties["label"] = *req.DepartureAddress
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.ArrivalAddress != nil && *req.ArrivalAddress != "" {
|
||||||
|
if arrivalFeature.Properties == nil {
|
||||||
|
arrivalFeature.Properties = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
arrivalFeature.Properties["label"] = *req.ArrivalAddress
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debug().
|
||||||
|
Str("departure date", req.DepartureDate.String()).
|
||||||
|
Any("departure", departure).
|
||||||
|
Any("arrival", arrival).
|
||||||
|
Msg("grpc server - DriverJourneys")
|
||||||
|
|
||||||
td := 900 * time.Second
|
td := 900 * time.Second
|
||||||
if req.TimeDelta != nil {
|
if req.TimeDelta != nil {
|
||||||
td = time.Duration(*req.TimeDelta) * time.Second
|
td = time.Duration(*req.TimeDelta) * time.Second
|
||||||
@@ -37,7 +58,7 @@ func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *prot
|
|||||||
Int64("td", int64(td)).
|
Int64("td", int64(td)).
|
||||||
Msg("DriverJourneys show dates")
|
Msg("DriverJourneys show dates")
|
||||||
|
|
||||||
journeys, err := s.Handler.GetDriverJourneys(departure, arrival, req.DepartureRadius, req.ArrivalRadius, minDate, maxDate, req.Count)
|
journeys, err := s.Handler.GetDriverJourneys(departureFeature, arrivalFeature, req.DepartureRadius, req.ArrivalRadius, minDate, maxDate, req.Count)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("error finding driver journeys")
|
log.Error().Err(err).Msg("error finding driver journeys")
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -69,13 +90,24 @@ func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *prot
|
|||||||
distance = &dist
|
distance = &dist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator := "internal"
|
||||||
|
if usermap["operator"] != nil {
|
||||||
|
operator = usermap["operator"].(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
alias := ""
|
||||||
|
if usermap["alias"] != nil {
|
||||||
|
alias = usermap["alias"].(string)
|
||||||
|
}
|
||||||
|
|
||||||
results = append(results, &proto.CarpoolServiceDriverJourney{
|
results = append(results, &proto.CarpoolServiceDriverJourney{
|
||||||
|
Id: journeyId,
|
||||||
Driver: &proto.CarpoolServiceUser{
|
Driver: &proto.CarpoolServiceUser{
|
||||||
Id: usermap["id"].(string),
|
Id: usermap["id"].(string),
|
||||||
Operator: usermap["operator"].(string),
|
Operator: operator,
|
||||||
Alias: usermap["alias"].(string),
|
Alias: alias,
|
||||||
},
|
},
|
||||||
Operator: "ridygo.fr",
|
Operator: s.Handler.InternalOperatorID,
|
||||||
PassengerPickupLat: req.DepartureLat,
|
PassengerPickupLat: req.DepartureLat,
|
||||||
PassengerPickupLng: req.DepartureLng,
|
PassengerPickupLng: req.DepartureLng,
|
||||||
PassengerDropLat: req.ArrivalLat,
|
PassengerDropLat: req.ArrivalLat,
|
||||||
@@ -86,9 +118,8 @@ func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *prot
|
|||||||
DriverArrivalLng: &driverArrivalLng,
|
DriverArrivalLng: &driverArrivalLng,
|
||||||
DriverDepartureAddress: driverDepartureAddress,
|
DriverDepartureAddress: driverDepartureAddress,
|
||||||
DriverArrivalAddress: driverArrivalAddress,
|
DriverArrivalAddress: driverArrivalAddress,
|
||||||
Duration: int64(duration),
|
Duration: int64(duration.Seconds()),
|
||||||
Distance: distance,
|
Distance: distance,
|
||||||
Id: journeyId,
|
|
||||||
PassengerPickupDate: timestamppb.New(j.DepartureDate.Add(j.Itinerary.Legs[0].Duration)),
|
PassengerPickupDate: timestamppb.New(j.DepartureDate.Add(j.Itinerary.Legs[0].Duration)),
|
||||||
DriverDepartureDate: timestamppb.New(j.DepartureDate),
|
DriverDepartureDate: timestamppb.New(j.DepartureDate),
|
||||||
Type: proto.CarpoolServiceJourneyType_PLANNED,
|
Type: proto.CarpoolServiceJourneyType_PLANNED,
|
||||||
@@ -100,6 +131,7 @@ func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *prot
|
|||||||
DriverJourneys: results,
|
DriverJourneys: results,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) PassengerJourneys(ctx context.Context, req *proto.PassengerJourneysRequest) (*proto.PassengerJourneysResponse, error) {
|
func (s *CarpoolServiceServerImpl) PassengerJourneys(ctx context.Context, req *proto.PassengerJourneysRequest) (*proto.PassengerJourneysResponse, error) {
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("departure date", req.DepartureDate.String()).
|
Str("departure date", req.DepartureDate.String()).
|
||||||
@@ -137,25 +169,26 @@ func (s *CarpoolServiceServerImpl) PassengerJourneys(ctx context.Context, req *p
|
|||||||
passengerPickupAddress = &ppa
|
passengerPickupAddress = &ppa
|
||||||
}
|
}
|
||||||
var passengerDropAddress *string
|
var passengerDropAddress *string
|
||||||
if pda := j.Route.Features[0].Properties.MustString("label", ""); pda != "" {
|
if pda := j.Route.Features[1].Properties.MustString("label", ""); pda != "" {
|
||||||
passengerDropAddress = &pda
|
passengerDropAddress = &pda
|
||||||
}
|
}
|
||||||
driverDepartureDate := timestamppb.New(j.DepartureDate.Add(-j.Itinerary.Legs[0].Duration))
|
driverDepartureDate := timestamppb.New(j.DepartureDate.Add(-j.Itinerary.Legs[0].Duration))
|
||||||
duration := time.Duration(0)
|
duration := time.Duration(0)
|
||||||
var distance *int64
|
var distance *int64
|
||||||
if len(j.Itinerary.Legs) > 2 {
|
if len(j.Itinerary.Legs) > 2 {
|
||||||
duration = j.Itinerary.Legs[1].Duration / time.Second
|
duration = j.Itinerary.Legs[1].Duration
|
||||||
dist := int64(j.Itinerary.Legs[1].Distance)
|
dist := int64(j.Itinerary.Legs[1].Distance)
|
||||||
distance = &dist
|
distance = &dist
|
||||||
}
|
}
|
||||||
|
|
||||||
results = append(results, &proto.CarpoolServicePassengerJourney{
|
results = append(results, &proto.CarpoolServicePassengerJourney{
|
||||||
|
Id: journeyId,
|
||||||
Passenger: &proto.CarpoolServiceUser{
|
Passenger: &proto.CarpoolServiceUser{
|
||||||
Id: usermap["id"].(string),
|
Id: usermap["id"].(string),
|
||||||
Operator: usermap["operator"].(string),
|
Operator: usermap["operator"].(string),
|
||||||
Alias: usermap["alias"].(string),
|
Alias: usermap["alias"].(string),
|
||||||
},
|
},
|
||||||
Operator: "ridygo.fr",
|
Operator: s.Handler.InternalOperatorID,
|
||||||
PassengerPickupLat: passengerDepartureLat,
|
PassengerPickupLat: passengerDepartureLat,
|
||||||
PassengerPickupLng: passengerDepartureLng,
|
PassengerPickupLng: passengerDepartureLng,
|
||||||
PassengerDropLat: passengerArrivalLat,
|
PassengerDropLat: passengerArrivalLat,
|
||||||
@@ -166,9 +199,8 @@ func (s *CarpoolServiceServerImpl) PassengerJourneys(ctx context.Context, req *p
|
|||||||
DriverDepartureLng: &req.DepartureLng,
|
DriverDepartureLng: &req.DepartureLng,
|
||||||
DriverArrivalLat: &req.ArrivalLat,
|
DriverArrivalLat: &req.ArrivalLat,
|
||||||
DriverArrivalLng: &req.ArrivalLng,
|
DriverArrivalLng: &req.ArrivalLng,
|
||||||
Duration: int64(duration),
|
Duration: int64(duration.Seconds()),
|
||||||
Distance: distance,
|
Distance: distance,
|
||||||
Id: journeyId,
|
|
||||||
PassengerPickupDate: passengerDepartureDate,
|
PassengerPickupDate: passengerDepartureDate,
|
||||||
DriverDepartureDate: driverDepartureDate,
|
DriverDepartureDate: driverDepartureDate,
|
||||||
Type: proto.CarpoolServiceJourneyType_PLANNED,
|
Type: proto.CarpoolServiceJourneyType_PLANNED,
|
||||||
@@ -180,9 +212,11 @@ func (s *CarpoolServiceServerImpl) PassengerJourneys(ctx context.Context, req *p
|
|||||||
PassengerJourneys: results,
|
PassengerJourneys: results,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) DriverRegularTrips(context.Context, *proto.DriverRegularTripsRequest) (*proto.DriverRegularTripsResponse, error) {
|
func (s *CarpoolServiceServerImpl) DriverRegularTrips(context.Context, *proto.DriverRegularTripsRequest) (*proto.DriverRegularTripsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method DriverRegularTrips not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method DriverRegularTrips not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) PassengerRegularTrips(context.Context, *proto.PassengerRegularTripsRequest) (*proto.PassengerRegularTripsResponse, error) {
|
func (s *CarpoolServiceServerImpl) PassengerRegularTrips(context.Context, *proto.PassengerRegularTripsRequest) (*proto.PassengerRegularTripsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method PassengerRegularTrips not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method PassengerRegularTrips not implemented")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package grpcserver
|
package grpcserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
@@ -10,9 +9,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CarpoolServiceServerImpl struct {
|
type CarpoolServiceServerImpl struct {
|
||||||
@@ -27,16 +24,6 @@ func NewCarpoolServiceServer(handler *handler.CarpoolServiceHandler) *CarpoolSer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CarpoolServiceServerImpl) CreateBooking(context.Context, *proto.CreateBookingRequest) (*proto.CreateBookingResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateBooking not implemented")
|
|
||||||
}
|
|
||||||
func (s *CarpoolServiceServerImpl) UpdateBooking(context.Context, *proto.UpdateBookingRequest) (*proto.UpdateBookingResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
|
|
||||||
}
|
|
||||||
func (s *CarpoolServiceServerImpl) GetBooking(context.Context, *proto.GetBookingRequest) (*proto.GetBookingResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetBooking not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func Run(done chan error, cfg *viper.Viper, handler *handler.CarpoolServiceHandler) {
|
func Run(done chan error, cfg *viper.Viper, handler *handler.CarpoolServiceHandler) {
|
||||||
var (
|
var (
|
||||||
dev_env = cfg.GetBool("dev_env")
|
dev_env = cfg.GetBool("dev_env")
|
||||||
|
|||||||
@@ -2,23 +2,26 @@ package ocssapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *OCSSApiService) PostBookings(ctx context.Context, booking ocss.Booking) (*ocss.Booking, error) {
|
func (s *OCSSApiService) PostBookings(ctx context.Context, booking ocss.Booking) (*ocss.Booking, error) {
|
||||||
result, err := s.Handler.Book(booking)
|
result, err := s.Handler.Book(booking, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("issue in booking")
|
log.Error().Err(err).Msg("issue in booking")
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &result.BookingDefinition, nil
|
return &result.Booking, nil
|
||||||
}
|
}
|
||||||
func (s *OCSSApiService) PatchBookings(ctx context.Context, bookingId string, status ocss.BookingStatus, message *string) error {
|
func (s *OCSSApiService) PatchBookings(ctx context.Context, bookingId string, status ocss.BookingStatus, message *string) error {
|
||||||
return errors.New("booking not found")
|
err := s.Handler.UpdateBookingStatus(bookingId, status)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
func (s *OCSSApiService) GetBookings(ctx context.Context, bookingId string) (*ocss.Booking, error) {
|
func (s *OCSSApiService) GetBookings(ctx context.Context, bookingId string) (*ocss.Booking, error) {
|
||||||
result, err := s.Handler.GetBooking(bookingId)
|
result, err := s.Handler.GetBooking(bookingId)
|
||||||
@@ -27,5 +30,5 @@ func (s *OCSSApiService) GetBookings(ctx context.Context, bookingId string) (*oc
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &result.BookingDefinition, nil
|
return &result.Booking, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
||||||
"github.com/paulmach/orb"
|
"github.com/paulmach/orb"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,6 +14,10 @@ func (s *OCSSApiService) GetDriverJourneys(ctx context.Context, departureLat flo
|
|||||||
departure := orb.Point{departureLng, departureLat}
|
departure := orb.Point{departureLng, departureLat}
|
||||||
arrival := orb.Point{arrivalLng, arrivalLat}
|
arrival := orb.Point{arrivalLng, arrivalLat}
|
||||||
|
|
||||||
|
// Create features for the handler (OCSS doesn't provide addresses, so they'll be empty)
|
||||||
|
departureFeature := geojson.NewFeature(departure)
|
||||||
|
arrivalFeature := geojson.NewFeature(arrival)
|
||||||
|
|
||||||
td := 900 * time.Second
|
td := 900 * time.Second
|
||||||
if timeDelta != nil {
|
if timeDelta != nil {
|
||||||
td = *timeDelta
|
td = *timeDelta
|
||||||
@@ -21,7 +26,7 @@ func (s *OCSSApiService) GetDriverJourneys(ctx context.Context, departureLat flo
|
|||||||
minDate := departureDate.Add(-td * time.Second)
|
minDate := departureDate.Add(-td * time.Second)
|
||||||
maxDate := departureDate.Add(td * time.Second)
|
maxDate := departureDate.Add(td * time.Second)
|
||||||
|
|
||||||
journeys, err := s.Handler.GetDriverJourneys(departure, arrival, departureRadius, arrivalRadius, minDate, maxDate, count)
|
journeys, err := s.Handler.GetDriverJourneys(departureFeature, arrivalFeature, departureRadius, arrivalRadius, minDate, maxDate, count)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -36,7 +41,7 @@ func (s *OCSSApiService) GetDriverJourneys(ctx context.Context, departureLat flo
|
|||||||
driverDepartureLng := j.Route.Features[0].Point().Lon()
|
driverDepartureLng := j.Route.Features[0].Point().Lon()
|
||||||
driverArrivalLat := j.Route.Features[1].Point().Lat()
|
driverArrivalLat := j.Route.Features[1].Point().Lat()
|
||||||
driverArrivalLng := j.Route.Features[1].Point().Lon()
|
driverArrivalLng := j.Route.Features[1].Point().Lon()
|
||||||
driverDepartureDate := ocss.JSONTime(j.DepartureDate)
|
driverDepartureDate := ocss.OCSSTime(j.DepartureDate)
|
||||||
duration := time.Duration(0)
|
duration := time.Duration(0)
|
||||||
var distance *int64
|
var distance *int64
|
||||||
if len(j.Itinerary.Legs) > 2 {
|
if len(j.Itinerary.Legs) > 2 {
|
||||||
@@ -53,7 +58,7 @@ func (s *OCSSApiService) GetDriverJourneys(ctx context.Context, departureLat flo
|
|||||||
Alias: usermap["alias"].(string),
|
Alias: usermap["alias"].(string),
|
||||||
},
|
},
|
||||||
Trip: ocss.Trip{
|
Trip: ocss.Trip{
|
||||||
Operator: "ridygo.fr",
|
Operator: s.Handler.InternalOperatorID,
|
||||||
PassengerPickupLat: departureLat,
|
PassengerPickupLat: departureLat,
|
||||||
PassengerPickupLng: departureLng,
|
PassengerPickupLng: departureLng,
|
||||||
PassengerDropLat: arrivalLat,
|
PassengerDropLat: arrivalLat,
|
||||||
@@ -68,7 +73,7 @@ func (s *OCSSApiService) GetDriverJourneys(ctx context.Context, departureLat flo
|
|||||||
},
|
},
|
||||||
JourneySchedule: ocss.JourneySchedule{
|
JourneySchedule: ocss.JourneySchedule{
|
||||||
ID: &journeyId,
|
ID: &journeyId,
|
||||||
PassengerPickupDate: ocss.JSONTime(j.DepartureDate.Add(j.Itinerary.Legs[0].Duration)),
|
PassengerPickupDate: ocss.OCSSTime(j.DepartureDate.Add(j.Itinerary.Legs[0].Duration)),
|
||||||
DriverDepartureDate: &driverDepartureDate,
|
DriverDepartureDate: &driverDepartureDate,
|
||||||
Type: ocss.Planned,
|
Type: ocss.Planned,
|
||||||
},
|
},
|
||||||
@@ -109,8 +114,8 @@ func (s *OCSSApiService) GetPassengerJourneys(ctx context.Context, departureLat
|
|||||||
passengerDepartureLng := j.Route.Features[0].Point().Lon()
|
passengerDepartureLng := j.Route.Features[0].Point().Lon()
|
||||||
passengerArrivalLat := j.Route.Features[1].Point().Lat()
|
passengerArrivalLat := j.Route.Features[1].Point().Lat()
|
||||||
passengerArrivalLng := j.Route.Features[1].Point().Lon()
|
passengerArrivalLng := j.Route.Features[1].Point().Lon()
|
||||||
passengerDepartureDate := ocss.JSONTime(j.DepartureDate)
|
passengerDepartureDate := ocss.OCSSTime(j.DepartureDate)
|
||||||
driverDepartureDate := ocss.JSONTime(j.DepartureDate.Add(-j.Itinerary.Legs[0].Duration))
|
driverDepartureDate := ocss.OCSSTime(j.DepartureDate.Add(-j.Itinerary.Legs[0].Duration))
|
||||||
duration := time.Duration(0)
|
duration := time.Duration(0)
|
||||||
var distance *int64
|
var distance *int64
|
||||||
log.Debug().Any("itinerary", j.Itinerary).Msg("debug itinerary")
|
log.Debug().Any("itinerary", j.Itinerary).Msg("debug itinerary")
|
||||||
@@ -128,7 +133,7 @@ func (s *OCSSApiService) GetPassengerJourneys(ctx context.Context, departureLat
|
|||||||
Alias: usermap["alias"].(string),
|
Alias: usermap["alias"].(string),
|
||||||
},
|
},
|
||||||
Trip: ocss.Trip{
|
Trip: ocss.Trip{
|
||||||
Operator: "ridygo.fr",
|
Operator: s.Handler.InternalOperatorID,
|
||||||
PassengerPickupLat: passengerDepartureLat,
|
PassengerPickupLat: passengerDepartureLat,
|
||||||
PassengerPickupLng: passengerDepartureLng,
|
PassengerPickupLng: passengerDepartureLng,
|
||||||
PassengerDropLat: passengerArrivalLat,
|
PassengerDropLat: passengerArrivalLat,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
||||||
@@ -45,7 +46,6 @@ func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = client.Connect(context.TODO())
|
err = client.Connect(context.TODO())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return MongoDBStorage{}, err
|
return MongoDBStorage{}, err
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,6 @@ func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s MongoDBStorage) CreateRegularRoutes(routes []*geojson.FeatureCollection) error {
|
func (s MongoDBStorage) CreateRegularRoutes(routes []*geojson.FeatureCollection) error {
|
||||||
|
|
||||||
log.Debug().Msg("Storage - CreateRegularRoutes")
|
log.Debug().Msg("Storage - CreateRegularRoutes")
|
||||||
|
|
||||||
documents := []any{}
|
documents := []any{}
|
||||||
@@ -179,6 +178,15 @@ func (s MongoDBStorage) GetDriverRegularRoutesForTile(day string, gridId int64)
|
|||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) DeleteRegularRoutes(ids []string) error {
|
||||||
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["regular_routes"])
|
||||||
|
_, err := collection.DeleteMany(context.Background(), bson.M{"_id": bson.M{"$in": ids}})
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error deleteing regular routes")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (s MongoDBStorage) GetPassengerRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error) {
|
func (s MongoDBStorage) GetPassengerRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error) {
|
||||||
findOptions := options.Find()
|
findOptions := options.Find()
|
||||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["regular_routes"])
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["regular_routes"])
|
||||||
@@ -222,71 +230,7 @@ func (s MongoDBStorage) GetPassengerRegularRoutesForTile(day string, gridId int6
|
|||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s MongoDBStorage) PersistedKVPut(documents []any) error {
|
|
||||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["persisted_kv"])
|
|
||||||
if _, err := collection.InsertMany(context.TODO(), documents); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (s MongoDBStorage) PersistedKVGet(id string, document any) error {
|
|
||||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["persisted_kv"])
|
|
||||||
err := collection.FindOne(context.TODO(), bson.M{"_id": id}).Decode(document)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s MongoDBStorage) StoreSearchResults(searchresults []internal.SearchResult) error {
|
|
||||||
|
|
||||||
log.Debug().Msg("Storage - StoreSearchResults")
|
|
||||||
|
|
||||||
documents := []any{}
|
|
||||||
for _, sr := range searchresults {
|
|
||||||
documents = append(documents, sr)
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.PersistedKVPut(documents)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s MongoDBStorage) GetSearchResult(id string) (*internal.SearchResult, error) {
|
|
||||||
|
|
||||||
var result internal.SearchResult
|
|
||||||
err := s.PersistedKVGet(id, &result)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s MongoDBStorage) StoreRouteSchedules(js []internal.PlannedRouteSchedule) error {
|
|
||||||
|
|
||||||
log.Debug().Msg("Storage - StoreRouteSchedules")
|
|
||||||
|
|
||||||
documents := []any{}
|
|
||||||
for _, sr := range js {
|
|
||||||
documents = append(documents, sr)
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.PersistedKVPut(documents)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s MongoDBStorage) GetRouteSchedule(id string) (*internal.PlannedRouteSchedule, error) {
|
|
||||||
|
|
||||||
var result internal.PlannedRouteSchedule
|
|
||||||
err := s.PersistedKVGet(id, &result)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s MongoDBStorage) CreateBooking(booking internal.Booking) error {
|
func (s MongoDBStorage) CreateBooking(booking internal.Booking) error {
|
||||||
|
|
||||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||||
_, err := collection.InsertOne(context.TODO(), booking)
|
_, err := collection.InsertOne(context.TODO(), booking)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -294,6 +238,7 @@ func (s MongoDBStorage) CreateBooking(booking internal.Booking) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s MongoDBStorage) GetBooking(id string) (booking *internal.Booking, err error) {
|
func (s MongoDBStorage) GetBooking(id string) (booking *internal.Booking, err error) {
|
||||||
var b internal.Booking
|
var b internal.Booking
|
||||||
log.Debug().Str("booking id", id).Msg("get booking in DB")
|
log.Debug().Str("booking id", id).Msg("get booking in DB")
|
||||||
@@ -307,6 +252,126 @@ func (s MongoDBStorage) GetBooking(id string) (booking *internal.Booking, err er
|
|||||||
return &b, nil
|
return &b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) GetUserBookings(userid string) ([]internal.Booking, error) {
|
||||||
|
findOptions := options.Find()
|
||||||
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||||
|
cur, err := collection.Find(context.TODO(), bson.M{
|
||||||
|
"$or": []bson.M{
|
||||||
|
{"driver.id": userid},
|
||||||
|
{"passenger.id": userid},
|
||||||
|
},
|
||||||
|
}, findOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var bookings []internal.Booking
|
||||||
|
for cur.Next(context.TODO()) {
|
||||||
|
var elem internal.Booking
|
||||||
|
|
||||||
|
if err := cur.Decode(&elem); err != nil {
|
||||||
|
log.Error().Err(err).Msg("error reading bookings response")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
bookings = append(bookings, elem)
|
||||||
|
}
|
||||||
|
|
||||||
|
return bookings, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) GetAllBookings() ([]internal.Booking, error) {
|
||||||
|
findOptions := options.Find()
|
||||||
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||||
|
cur, err := collection.Find(context.TODO(), bson.M{}, findOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var bookings []internal.Booking
|
||||||
|
for cur.Next(context.TODO()) {
|
||||||
|
var elem internal.Booking
|
||||||
|
|
||||||
|
if err := cur.Decode(&elem); err != nil {
|
||||||
|
log.Error().Err(err).Msg("error reading bookings response")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
bookings = append(bookings, elem)
|
||||||
|
}
|
||||||
|
|
||||||
|
return bookings, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) UpdateBookingStatus(bookingid string, status string) error {
|
||||||
|
log.Debug().Str("booking id", bookingid).Str("status", status).Msg("update booking status in DB")
|
||||||
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||||
|
|
||||||
|
filter := bson.M{"_id": bookingid}
|
||||||
|
update := bson.M{"$set": bson.M{"status": status}}
|
||||||
|
|
||||||
|
result, err := collection.UpdateOne(context.TODO(), filter, update)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error updating booking status")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if result.MatchedCount == 0 {
|
||||||
|
return errors.New("booking not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debug().Int64("modified count", result.ModifiedCount).Msg("booking status updated")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) PersistedKVPut(documents []any) error {
|
||||||
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["persisted_kv"])
|
||||||
|
if _, err := collection.InsertMany(context.TODO(), documents); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) PersistedKVGet(id string, document any) error {
|
||||||
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["persisted_kv"])
|
||||||
|
err := collection.FindOne(context.TODO(), bson.M{"_id": id}).Decode(document)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) StoreRouteSchedules(js []internal.PlannedRouteSchedule) error {
|
||||||
|
log.Debug().Msg("Storage - StoreRouteSchedules")
|
||||||
|
|
||||||
|
documents := []any{}
|
||||||
|
for _, sr := range js {
|
||||||
|
documents = append(documents, sr)
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.PersistedKVPut(documents)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s MongoDBStorage) GetRouteSchedule(id string) (*internal.PlannedRouteSchedule, error) {
|
||||||
|
var result internal.PlannedRouteSchedule
|
||||||
|
err := s.PersistedKVGet(id, &result)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v := range result.Route.ExtraMembers {
|
||||||
|
if val, ok := v.(primitive.D); ok {
|
||||||
|
em := map[string]any{}
|
||||||
|
jsonbytes, _ := bson.MarshalExtJSON(val, true, true)
|
||||||
|
json.Unmarshal(jsonbytes, &em)
|
||||||
|
result.Route.ExtraMembers[k] = em
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
// func (s MongoDBStorage) CreatePassengerRegularTrips(trips []*geojson.FeatureCollection) error {
|
// func (s MongoDBStorage) CreatePassengerRegularTrips(trips []*geojson.FeatureCollection) error {
|
||||||
|
|
||||||
// log.Debug().Msg("Storage - CreatePassengerRegularTrips")
|
// log.Debug().Msg("Storage - CreatePassengerRegularTrips")
|
||||||
@@ -328,3 +393,7 @@ func (s MongoDBStorage) GetBooking(id string) (booking *internal.Booking, err er
|
|||||||
|
|
||||||
// return nil
|
// return nil
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
func (s MongoDBStorage) Migrate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
562
storage/postgresql.go
Normal file
562
storage/postgresql.go
Normal file
@@ -0,0 +1,562 @@
|
|||||||
|
package storage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"ariga.io/atlas/sql/postgres"
|
||||||
|
"ariga.io/atlas/sql/schema"
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/internal"
|
||||||
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
||||||
|
"github.com/lib/pq"
|
||||||
|
_ "github.com/lib/pq"
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"github.com/stretchr/objx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PostgresqlStorage struct {
|
||||||
|
DbConnection *sql.DB
|
||||||
|
Schema string
|
||||||
|
Tables map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPostgresqlStorage(cfg *viper.Viper) (PostgresqlStorage, error) {
|
||||||
|
var (
|
||||||
|
host = cfg.GetString("storage.db.psql.host")
|
||||||
|
port = cfg.GetString("storage.db.psql.port")
|
||||||
|
user = cfg.GetString("storage.db.psql.user")
|
||||||
|
password = cfg.GetString("storage.db.psql.password")
|
||||||
|
dbname = cfg.GetString("storage.db.psql.dbname")
|
||||||
|
sslmode = cfg.GetString("storage.db.psql.sslmode")
|
||||||
|
pg_schema = cfg.GetString("storage.db.psql.schema")
|
||||||
|
pgtables_regular_routes = cfg.GetString("storage.db.psql.tables.regular_routes")
|
||||||
|
pgtables_regular_route_schedules = cfg.GetString("storage.db.psql.tables.regular_route_schedules")
|
||||||
|
pgtables_punctual_routes = cfg.GetString("storage.db.psql.tables.punctual_routes")
|
||||||
|
pgtables_bookings = cfg.GetString("storage.db.psql.tables.bookings")
|
||||||
|
pgtables_journeys_cache = cfg.GetString("storage.db.psql.tables.journeys_cache")
|
||||||
|
)
|
||||||
|
portInt, _ := strconv.Atoi(port)
|
||||||
|
psqlconn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s", host, portInt, user, password, dbname, sslmode)
|
||||||
|
db, err := sql.Open("postgres", psqlconn)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("opening connection to postgresql failed")
|
||||||
|
return PostgresqlStorage{}, fmt.Errorf("connection to postgresql failed")
|
||||||
|
}
|
||||||
|
err = db.Ping()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("ping to postgresql failed")
|
||||||
|
return PostgresqlStorage{}, fmt.Errorf("connection to postgresql database failed")
|
||||||
|
}
|
||||||
|
return PostgresqlStorage{
|
||||||
|
DbConnection: db,
|
||||||
|
Schema: pg_schema,
|
||||||
|
Tables: map[string]string{
|
||||||
|
"regular_routes": fmt.Sprintf("%s.%s", pg_schema, pgtables_regular_routes),
|
||||||
|
"regular_route_schedules": fmt.Sprintf("%s.%s", pg_schema, pgtables_regular_route_schedules),
|
||||||
|
"punctual_routes": fmt.Sprintf("%s.%s", pg_schema, pgtables_punctual_routes),
|
||||||
|
"bookings": fmt.Sprintf("%s.%s", pg_schema, pgtables_bookings),
|
||||||
|
"journeys_cache": fmt.Sprintf("%s.%s", pg_schema, pgtables_journeys_cache),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) CreateRegularRoutes(routes []*geojson.FeatureCollection) error {
|
||||||
|
log.Debug().Msg("Postgresql Storage - CreateRegularRoutes")
|
||||||
|
|
||||||
|
tx, err := s.DbConnection.Begin()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error initializing transaction")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx.Rollback()
|
||||||
|
|
||||||
|
req_routes := fmt.Sprintf(`INSERT INTO %s (id, user_id, routes_group_id, grid_ids, is_driver, is_passenger, route)
|
||||||
|
VALUES ($1, $2, $3, $4,$5, $6, $7)`, s.Tables["regular_routes"])
|
||||||
|
stmt_routes, err := tx.Prepare(req_routes)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error preparing regular routes statement for multiple inserts")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer stmt_routes.Close()
|
||||||
|
|
||||||
|
req_schedules := fmt.Sprintf(`INSERT INTO %s (route_id, day, time_of_day) VALUES ($1, $2, $3)`, s.Tables["regular_route_schedules"])
|
||||||
|
stmt_schedules, err := tx.Prepare(req_schedules)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error preparing schedules statement for multiple inserts")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer stmt_schedules.Close()
|
||||||
|
|
||||||
|
for _, fc := range routes {
|
||||||
|
if fc != nil {
|
||||||
|
id := fc.ExtraMembers.MustString("id")
|
||||||
|
properties := objx.New(fc.ExtraMembers["properties"])
|
||||||
|
userid := properties.Get("user.id").Str()
|
||||||
|
gridids := fc.ExtraMembers["grid_ids"]
|
||||||
|
groupid := fc.ExtraMembers["routes_group_id"]
|
||||||
|
isdriver := properties.Get("is_driver").Bool()
|
||||||
|
ispassenger := properties.Get("is_passenger").Bool()
|
||||||
|
route, err := fc.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error creating regular route")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = stmt_routes.Exec(id, userid, groupid, pq.Array(gridids), isdriver, ispassenger, route)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error inserting regular route")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
schedules := properties.Get("schedules")
|
||||||
|
if schedules == nil {
|
||||||
|
err = errors.New("could not get schedules for route")
|
||||||
|
log.Error().Err(err).Str("route id", id).Msg("issue in CreateRegularRoute")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, schedule := range schedules.MustObjxMapSlice() {
|
||||||
|
day := schedule.Get("day").Str()
|
||||||
|
timeOfDay := schedule.Get("time_of_day").Str()
|
||||||
|
_, err = stmt_schedules.Exec(id, day, timeOfDay)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue creating route schedule")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = tx.Commit(); err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue committing transaction")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetUserRegularRoutes(userid string) ([]*geojson.FeatureCollection, error) {
|
||||||
|
req := fmt.Sprintf(`select id, route
|
||||||
|
from %s where user_id = $1`, s.Tables["regular_routes"])
|
||||||
|
rows, err := s.DbConnection.Query(req, userid)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("request", req).Str("user id", userid).Msg("GetUserRegularRoutes query issue")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []*geojson.FeatureCollection{}
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
|
||||||
|
var id string
|
||||||
|
var route []byte
|
||||||
|
err := rows.Scan(
|
||||||
|
&id,
|
||||||
|
&route,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
fc, err := geojson.UnmarshalFeatureCollection(route)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results = append(results, fc)
|
||||||
|
}
|
||||||
|
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) DeleteRegularRoutes(ids []string) error {
|
||||||
|
req := fmt.Sprintf(`delete from %s where id in $1`, s.Tables["regular_routes"])
|
||||||
|
_, err := s.DbConnection.Exec(req, ids)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error in postgresql request - delete regular routes")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetDriverRegularRoutesForTile(day string, gridId int64) (regular_routes []*geojson.FeatureCollection, err error) {
|
||||||
|
req := fmt.Sprintf(`select id, route
|
||||||
|
from %s inner join %s on id = route_id
|
||||||
|
where is_driver = true and day = $1 and $2 = ANY (grid_ids)`, s.Tables["regular_routes"], s.Tables["regular_route_schedules"])
|
||||||
|
rows, err := s.DbConnection.Query(req, day, gridId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("GetDriverRegularRoutesForTile query error")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []*geojson.FeatureCollection{}
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
|
||||||
|
var id string
|
||||||
|
var route []byte
|
||||||
|
err := rows.Scan(
|
||||||
|
&id,
|
||||||
|
&route,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
fc, err := geojson.UnmarshalFeatureCollection(route)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results = append(results, fc)
|
||||||
|
}
|
||||||
|
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetPassengerRegularRoutesForTile(day string, gridId int64) (regular_routes []*geojson.FeatureCollection, err error) {
|
||||||
|
req := fmt.Sprintf(`select id, route
|
||||||
|
from %s join %s on id = route_id
|
||||||
|
where is_passenger = true and day = $1 and $2 = ANY (grid_ids)`, s.Tables["regular_routes"], s.Tables["regular_route_schedules"])
|
||||||
|
rows, err := s.DbConnection.Query(req, day, gridId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []*geojson.FeatureCollection{}
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
|
||||||
|
var id string
|
||||||
|
var route []byte
|
||||||
|
err := rows.Scan(
|
||||||
|
&id,
|
||||||
|
&route,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
fc, err := geojson.UnmarshalFeatureCollection(route)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
results = append(results, fc)
|
||||||
|
}
|
||||||
|
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) CreateBooking(booking internal.Booking) error {
|
||||||
|
req := fmt.Sprintf(`insert into %s (id, booking, status, driver_route, passenger_route)
|
||||||
|
values($1, $2, $3, $4, $5)`, s.Tables["bookings"])
|
||||||
|
|
||||||
|
id := booking.ID
|
||||||
|
status := booking.Status.String()
|
||||||
|
|
||||||
|
jsonbooking, err := json.Marshal(booking)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue marshalling booking to json")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsondriverroute, jsonpassengerroute *[]byte
|
||||||
|
if booking.DriverRoute != nil {
|
||||||
|
jdr, err := booking.DriverRoute.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error marshalling driver route")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
jsondriverroute = &jdr
|
||||||
|
}
|
||||||
|
if booking.PassengerRoute != nil {
|
||||||
|
jpr, err := booking.PassengerRoute.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error marshalling passenger route")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonpassengerroute = &jpr
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = s.DbConnection.Exec(req, id, jsonbooking, status, jsondriverroute, jsonpassengerroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("request", req).Msg("error creating booking")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetBooking(id string) (*internal.Booking, error) {
|
||||||
|
req := fmt.Sprintf(`select booking, status, driver_route, passenger_route
|
||||||
|
from %s where id=$1`, s.Tables["bookings"])
|
||||||
|
var booking ocss.Booking
|
||||||
|
var status string
|
||||||
|
var bookingbytes, driverroute, passengerroute []byte
|
||||||
|
err := s.DbConnection.QueryRow(req, id).Scan(
|
||||||
|
&bookingbytes,
|
||||||
|
&status,
|
||||||
|
&driverroute,
|
||||||
|
&passengerroute,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("booking id", id).Msg("not able to get and scan booking")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(bookingbytes, &booking)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue unmarshalling booking")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override booking status
|
||||||
|
booking.Status = ocss.BookingStatusFromString(status)
|
||||||
|
|
||||||
|
var dr, pr *geojson.FeatureCollection
|
||||||
|
if driverroute != nil {
|
||||||
|
dr, err = geojson.UnmarshalFeatureCollection(driverroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not unmarshal driver route feature collection")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if passengerroute != nil {
|
||||||
|
pr, err = geojson.UnmarshalFeatureCollection(passengerroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not unmarshal passenger route feature collection")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return &internal.Booking{
|
||||||
|
Booking: booking,
|
||||||
|
DriverRoute: dr,
|
||||||
|
PassengerRoute: pr,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) UpdateBookingStatus(bookingid string, status string) error {
|
||||||
|
req := fmt.Sprintf(`update %s set status = $1 where id=$2`, s.Tables["bookings"])
|
||||||
|
_, err := s.DbConnection.Exec(req, status, bookingid)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("request", req).Str("booking id", bookingid).Str("status", status).Msg("error while updating booking status")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetUserBookings(userid string) ([]internal.Booking, error) {
|
||||||
|
req := fmt.Sprintf(`select booking, status, driver_route, passenger_route from %s
|
||||||
|
where booking->'driver'->>'id' = $1 or booking->'passenger'->>'id' = $2`, s.Tables["bookings"])
|
||||||
|
rows, err := s.DbConnection.Query(req, userid, userid)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("user id", userid).Msg("GetUserBookings query issue")
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []internal.Booking{}
|
||||||
|
for rows.Next() {
|
||||||
|
var booking ocss.Booking
|
||||||
|
var status string
|
||||||
|
var bookingbytes, driverroute, passengerroute []byte
|
||||||
|
err := rows.Scan(
|
||||||
|
&bookingbytes,
|
||||||
|
&status,
|
||||||
|
&driverroute,
|
||||||
|
&passengerroute,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("not able to get and scan booking in GetUsersBooking")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(bookingbytes, &booking)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue unmarshalling booking in GetUsersBooking")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override booking status
|
||||||
|
booking.Status = ocss.BookingStatusFromString(status)
|
||||||
|
|
||||||
|
var dr, pr *geojson.FeatureCollection
|
||||||
|
if driverroute != nil {
|
||||||
|
dr, err = geojson.UnmarshalFeatureCollection(driverroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not unmarshal driver route feature collection")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if passengerroute != nil {
|
||||||
|
pr, err = geojson.UnmarshalFeatureCollection(passengerroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not unmarshal passenger route feature collection")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
results = append(results, internal.Booking{
|
||||||
|
Booking: booking,
|
||||||
|
DriverRoute: dr,
|
||||||
|
PassengerRoute: pr,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetAllBookings() ([]internal.Booking, error) {
|
||||||
|
req := fmt.Sprintf(`select booking, status, driver_route, passenger_route from %s
|
||||||
|
where 1=1`, s.Tables["bookings"])
|
||||||
|
rows, err := s.DbConnection.Query(req)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("GetUserBookings query issue")
|
||||||
|
}
|
||||||
|
|
||||||
|
results := []internal.Booking{}
|
||||||
|
for rows.Next() {
|
||||||
|
var booking ocss.Booking
|
||||||
|
var status string
|
||||||
|
var bookingbytes, driverroute, passengerroute []byte
|
||||||
|
err := rows.Scan(
|
||||||
|
&bookingbytes,
|
||||||
|
&status,
|
||||||
|
&driverroute,
|
||||||
|
&passengerroute,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("not able to get and scan booking in GetUsersBooking")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(bookingbytes, &booking)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue unmarshalling booking in GetUsersBooking")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override booking status
|
||||||
|
booking.Status = ocss.BookingStatusFromString(status)
|
||||||
|
|
||||||
|
var dr, pr *geojson.FeatureCollection
|
||||||
|
if driverroute != nil {
|
||||||
|
dr, err = geojson.UnmarshalFeatureCollection(driverroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not unmarshal driver route feature collection")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if passengerroute != nil {
|
||||||
|
pr, err = geojson.UnmarshalFeatureCollection(passengerroute)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("could not unmarshal passenger route feature collection")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
results = append(results, internal.Booking{
|
||||||
|
Booking: booking,
|
||||||
|
DriverRoute: dr,
|
||||||
|
PassengerRoute: pr,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) StoreRouteSchedules(journeys []internal.PlannedRouteSchedule) error {
|
||||||
|
tx, err := s.DbConnection.Begin()
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue starting pg transaction")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx.Rollback()
|
||||||
|
|
||||||
|
req := fmt.Sprintf("insert into %s (id, data) values ($1, $2)", s.Tables["journeys_cache"])
|
||||||
|
stmt, err := tx.Prepare(req)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue creating prepared statement in StoreRouteSchedules")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, j := range journeys {
|
||||||
|
jsonjourney, err := json.Marshal(j)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error unmarshalling Route Schedule")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
stmt.Exec(j.ID, jsonjourney)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = tx.Commit(); err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue while commiting transaction in StoreRouteSchedules")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) GetRouteSchedule(id string) (*internal.PlannedRouteSchedule, error) {
|
||||||
|
req := fmt.Sprintf("select data from %s where id = $1", s.Tables["journeys_cache"])
|
||||||
|
var jsonjourney []byte
|
||||||
|
err := s.DbConnection.QueryRow(req, id).Scan(
|
||||||
|
&jsonjourney,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("issue scanning result in GetRouteSchedule")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var result internal.PlannedRouteSchedule
|
||||||
|
err = json.Unmarshal(jsonjourney, &result)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("error unmarshalling returned route schedule")
|
||||||
|
}
|
||||||
|
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PostgresqlStorage) Migrate() error {
|
||||||
|
ctx := context.Background()
|
||||||
|
driver, err := postgres.Open(s.DbConnection)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
existing, err := driver.InspectRealm(ctx, &schema.InspectRealmOption{Schemas: []string{s.Schema}})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var desired schema.Realm
|
||||||
|
|
||||||
|
hcl, err := os.ReadFile("postgresql/schema.hcl")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = postgres.EvalHCLBytes(hcl, &desired, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
diff, err := driver.RealmDiff(existing, &desired)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = driver.ApplyChanges(ctx, diff)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
104
storage/postgresql/schema.hcl
Normal file
104
storage/postgresql/schema.hcl
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
table "bookings" {
|
||||||
|
schema = schema.carpool_service
|
||||||
|
column "id" {
|
||||||
|
null = false
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "booking" {
|
||||||
|
null = false
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
column "status" {
|
||||||
|
null = false
|
||||||
|
type = enum.booking_status
|
||||||
|
}
|
||||||
|
column "driver_route" {
|
||||||
|
null = true
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
column "passenger_route" {
|
||||||
|
null = true
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
primary_key {
|
||||||
|
columns = [column.id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table "journeys_cache" {
|
||||||
|
schema = schema.carpool_service
|
||||||
|
column "id" {
|
||||||
|
null = false
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "data" {
|
||||||
|
null = false
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
column "created_at" {
|
||||||
|
null = false
|
||||||
|
type = timestamptz
|
||||||
|
default = sql("now()")
|
||||||
|
}
|
||||||
|
primary_key {
|
||||||
|
columns = [column.id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table "regular_route_schedules" {
|
||||||
|
schema = schema.carpool_service
|
||||||
|
column "route_id" {
|
||||||
|
null = false
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "day" {
|
||||||
|
null = false
|
||||||
|
type = enum.day
|
||||||
|
}
|
||||||
|
column "time_of_day" {
|
||||||
|
null = false
|
||||||
|
type = time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table "regular_routes" {
|
||||||
|
schema = schema.carpool_service
|
||||||
|
column "id" {
|
||||||
|
null = false
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "user_id" {
|
||||||
|
null = false
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "routes_group_id" {
|
||||||
|
null = true
|
||||||
|
type = uuid
|
||||||
|
}
|
||||||
|
column "grid_ids" {
|
||||||
|
null = true
|
||||||
|
type = sql("numeric[]")
|
||||||
|
}
|
||||||
|
column "is_driver" {
|
||||||
|
null = true
|
||||||
|
type = boolean
|
||||||
|
}
|
||||||
|
column "is_passenger" {
|
||||||
|
null = true
|
||||||
|
type = boolean
|
||||||
|
}
|
||||||
|
column "route" {
|
||||||
|
null = false
|
||||||
|
type = jsonb
|
||||||
|
}
|
||||||
|
primary_key {
|
||||||
|
columns = [column.id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enum "booking_status" {
|
||||||
|
schema = schema.carpool_service
|
||||||
|
values = ["INITIATED", "WAITING_PASSENGER_CONFIRMATION", "WAITING_DRIVER_CONFIRMATION", "CONFIRMED", "CANCELLED", "COMPLETED_PENDING_VALIDATION", "VALIDATED"]
|
||||||
|
}
|
||||||
|
enum "day" {
|
||||||
|
schema = schema.carpool_service
|
||||||
|
values = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
|
||||||
|
}
|
||||||
|
schema "carpool_service" {
|
||||||
|
}
|
||||||
134
storage/postgresql_test.go
Normal file
134
storage/postgresql_test.go
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
package storage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/paulmach/orb/geojson"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
var cfg *viper.Viper
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
cfg = viper.New()
|
||||||
|
cfg.SetDefault("storage.db.psql.host", "localhost")
|
||||||
|
cfg.SetDefault("storage.db.psql.port", "5432")
|
||||||
|
cfg.SetDefault("storage.db.psql.user", "postgres")
|
||||||
|
cfg.SetDefault("storage.db.psql.password", "postgres")
|
||||||
|
cfg.SetDefault("storage.db.psql.dbname", "carpool_service_tests")
|
||||||
|
cfg.SetDefault("storage.db.psql.sslmode", "disable")
|
||||||
|
cfg.SetDefault("storage.db.psql.schema", "carpool_service")
|
||||||
|
cfg.SetDefault("storage.db.psql.tables.regular_routes", "regular_routes")
|
||||||
|
cfg.SetDefault("storage.db.psql.tables.regular_route_schedules", "regular_route_schedules")
|
||||||
|
cfg.SetDefault("storage.db.psql.tables.punctual_routes", "punctual_routes")
|
||||||
|
cfg.SetDefault("storage.db.psql.tables.bookings", "bookings")
|
||||||
|
cfg.SetDefault("storage.db.psql.tables.journeys_cache", "journeys_cache")
|
||||||
|
cfg.SetConfigName("config") // Override default values in a config.yaml file within this directory
|
||||||
|
cfg.AddConfigPath(".")
|
||||||
|
cfg.ReadInConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_Initialize(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
err = storage.Migrate()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
_, err = storage.DbConnection.Exec(fmt.Sprintf("DELETE FROM %s;", storage.Tables["regular_routes"]))
|
||||||
|
require.NoError(t, err)
|
||||||
|
_, err = storage.DbConnection.Exec(fmt.Sprintf("DELETE FROM %s;", storage.Tables["regular_route_schedules"]))
|
||||||
|
require.NoError(t, err)
|
||||||
|
// _, err = storage.DbConnection.Exec(fmt.Sprintf("DELETE FROM %s;", storage.Tables["punctual_routes"]))
|
||||||
|
// require.NoError(t, err)
|
||||||
|
_, err = storage.DbConnection.Exec(fmt.Sprintf("DELETE FROM %s;", storage.Tables["journeys_cache"]))
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_CreateRegularRoutes(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
fc1, err := geojson.UnmarshalFeatureCollection([]byte(regularroute1))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
fc2, err := geojson.UnmarshalFeatureCollection([]byte(regularroute2))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
fc3, err := geojson.UnmarshalFeatureCollection([]byte(regularroute3))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
fc4, err := geojson.UnmarshalFeatureCollection([]byte(regularroute4))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
fc5, err := geojson.UnmarshalFeatureCollection([]byte(regularroute5))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
fc6, err := geojson.UnmarshalFeatureCollection([]byte(regularroute6))
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = storage.CreateRegularRoutes([]*geojson.FeatureCollection{fc1, fc2, fc3, fc4, fc5, fc6})
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_GetUserRegularRoutes(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
results, err := storage.GetUserRegularRoutes("ca435b62-3162-4c79-983a-2a0f4fb16aa0")
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Len(t, results, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_GetRegularRoutesForTile(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
results, err := storage.GetDriverRegularRoutesForTile("MON", 48067)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Len(t, results, 3)
|
||||||
|
|
||||||
|
results, err = storage.GetPassengerRegularRoutesForTile("MON", 48067)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Len(t, results, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_CreateBooking(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
err = storage.CreateBooking(booking1)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = storage.CreateBooking(booking2)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = storage.CreateBooking(booking3)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_GetBooking(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
_, err = storage.GetBooking(booking1id)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPostgresqlStorage_GetUserBookings(t *testing.T) {
|
||||||
|
storage, err := NewPostgresqlStorage(cfg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer storage.DbConnection.Close()
|
||||||
|
|
||||||
|
results, err := storage.GetUserBookings(bookinguser1)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Len(t, results, 2)
|
||||||
|
}
|
||||||
@@ -11,30 +11,35 @@ import (
|
|||||||
type Storage interface {
|
type Storage interface {
|
||||||
CreateRegularRoutes([]*geojson.FeatureCollection) error
|
CreateRegularRoutes([]*geojson.FeatureCollection) error
|
||||||
GetUserRegularRoutes(userid string) ([]*geojson.FeatureCollection, error)
|
GetUserRegularRoutes(userid string) ([]*geojson.FeatureCollection, error)
|
||||||
|
DeleteRegularRoutes(ids []string) error
|
||||||
GetDriverRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error)
|
GetDriverRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error)
|
||||||
GetPassengerRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error)
|
GetPassengerRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error)
|
||||||
|
|
||||||
CreateBooking(internal.Booking) error
|
CreateBooking(internal.Booking) error
|
||||||
GetBooking(id string) (*internal.Booking, error)
|
GetBooking(id string) (*internal.Booking, error)
|
||||||
|
GetUserBookings(userid string) ([]internal.Booking, error)
|
||||||
|
GetAllBookings() ([]internal.Booking, error)
|
||||||
|
UpdateBookingStatus(bookingid string, status string) error
|
||||||
|
|
||||||
// Caching temporary results
|
// Caching temporary results
|
||||||
PersistedKVPut(documents []any) error
|
// PersistedKVPut(documents []any) error
|
||||||
PersistedKVGet(id string, document any) error
|
// PersistedKVGet(id string, document any) error
|
||||||
StoreSearchResults([]internal.SearchResult) error
|
|
||||||
GetSearchResult(id string) (*internal.SearchResult, error)
|
|
||||||
StoreRouteSchedules([]internal.PlannedRouteSchedule) error
|
StoreRouteSchedules([]internal.PlannedRouteSchedule) error
|
||||||
GetRouteSchedule(id string) (*internal.PlannedRouteSchedule, error)
|
GetRouteSchedule(id string) (*internal.PlannedRouteSchedule, error)
|
||||||
|
|
||||||
|
Migrate() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorage(cfg *viper.Viper) (Storage, error) {
|
func NewStorage(cfg *viper.Viper) (Storage, error) {
|
||||||
var (
|
storage_type := cfg.GetString("storage.db.type")
|
||||||
storage_type = cfg.GetString("storage.db.type")
|
|
||||||
)
|
|
||||||
|
|
||||||
switch storage_type {
|
switch storage_type {
|
||||||
case "mongodb":
|
case "mongodb":
|
||||||
s, err := NewMongoDBStorage(cfg)
|
s, err := NewMongoDBStorage(cfg)
|
||||||
return s, err
|
return s, err
|
||||||
|
case "psql":
|
||||||
|
s, err := NewPostgresqlStorage(cfg)
|
||||||
|
return s, err
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("storage type %v is not supported", storage_type)
|
return nil, fmt.Errorf("storage type %v is not supported", storage_type)
|
||||||
}
|
}
|
||||||
|
|||||||
1092
storage/storage_test.go
Normal file
1092
storage/storage_test.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -63,7 +63,7 @@ func (h *TilesHandler) GetTile(driverOrPassenger string, date time.Time, gridid
|
|||||||
for _, r := range routes {
|
for _, r := range routes {
|
||||||
|
|
||||||
rr := internal.RegularRoute(*r)
|
rr := internal.RegularRoute(*r)
|
||||||
schedules, err := rr.PlannedJourneySchedules(date0h, date24h)
|
schedules, err := rr.PlannedRouteSchedules(date0h, date24h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err)
|
log.Error().Err(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user