Compare commits

...

7 Commits

Author SHA1 Message Date
Salim Amine Bou Aram 41ff83d232 removing conf from main 2024-11-01 01:26:34 +01:00
Salim Amine Bou Aram 45cada4fa5 replacing depracated grpc Dial + camelcases vars + fixing issues 2024-11-01 01:23:34 +01:00
Salim Amine Bou Aram 41bcb74462 fixing Geo 2024-11-01 01:03:07 +01:00
Salim Amine Bou Aram 8956914969 rm idea 2024-10-31 20:39:18 +01:00
Salim Amine Bou Aram ef2768c431 refacto 2024-10-31 20:32:54 +01:00
Maxime 5628125ad3 changements de Maxime retiré 2024-10-30 10:16:37 +01:00
adelcasse bd2f54cd89 Ajouter LICENSE.md 2024-09-19 05:22:02 +00:00
37 changed files with 1932 additions and 1031 deletions

30
.gitignore vendored Normal file
View File

@ -0,0 +1,30 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
*.cover*
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
vendor/
vendor*/
*.lock
go.sum
# Jetbrain IDE files
.idea/
.idea/*
.idea/**/*
config.yaml
# other
/scripts
/test-*

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/silvermobi.iml" filepath="$PROJECT_DIR$/.idea/silvermobi.iml" />
</modules>
</component>
</project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

660
LICENSE.md Normal file
View 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/>.

View File

@ -1,80 +0,0 @@
service_name: SILVERMOBI
storage:
db:
type: psql
psql:
host: localhost
dbname: coopgo_platform
user: postgres
password: postgres
sslmode: disable
port: 5432
schema: silvermobi_backend
tables:
users_firebase: users_firebase
services:
internal:
mobility_accounts:
type: grpc
dial: 0.0.0.0:8090
push:
type: gorush-grpc
dial: 0.0.0.0:8095
external:
grpc:
enable: true
ip: 192.168.0.111
port: 8099
web:
enable: true
port: 8098
moncomptemobilite:
enable: true
port: 8097
oidc:
provider: https://idp-fabmob.stg.hub.flowbird.io/auth/realms/mcm
client_id: ridygo-pub
# redirect_url: "http://192.168.1.27:8097/callbacks/oidc/cee"
redirect_url: "http://192.168.1.27:8097/callbacks/oidc/cee"
# redirect_url: "http://localhost:8097/callbacks/oidc/cee"
certinergy:
enable: true
port: 8100
jwt_key: 6mt29Z4rkCPmib9ckigPWFbaDTQFUPyK
# jwt_key : UjXnZr4u7x!A%D*G-KaPdSgVkYp3s5v8 # PROD
clients:
- name: certinergy
id: cd11c681-4168-4bdf-8f2d-9e3ade5fac8d
bearer: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjZDExYzY4MS00MTY4LTRiZGYtOGYyZC05ZTNhZGU1ZmFjOGQiLCJuYW1lIjoiY2VydGluZXJneSIsImlhdCI6MTUxNjIzOTAyMn0.tPwn3uD_6T4FjOTehYDRNg39x2A4E9FFv6qTgduODaA
# bearer: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjZDExYzY4MS00MTY4LTRiZGYtOGYyZC05ZTNhZGU1ZmFjOGQiLCJuYW1lIjoiY2VydGluZXJneSIsImlhdCI6MTUxNjIzOTAyMn0.LAr2l5X9XFRbPRPQvZLt8AWyfzbFGS5BO9MlB4U5HJo # PROD
solidarity_service:
address: 0.0.0.0:8089
identification:
local:
jwt_secret: JWT_KEY
ttl: 20000s
carpooling_proofs:
rpc_registry:
base_url: https://api.demo.covoiturage.beta.gouv.fr
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiN2Y4MTQwNzYtOTJmOS00NjExLTlhMmItZjA0MzU4MmMwOWI3IiwibyI6OSwicyI6Im9wZXJhdG9yIiwicCI6WyJjb21tb24uY2VydGlmaWNhdGUuZmluZCIsImNvbW1vbi5jb21wYW55LmZldGNoIiwiY29tbW9uLmNvbXBhbnkuZmluZCIsImNvbW1vbi5ob25vci5zYXZlIiwiY29tbW9uLmhvbm9yLnN0YXRzIiwiY29tbW9uLm9wZXJhdG9yLmxpc3QiLCJjb21tb24ub3BlcmF0b3IuZmluZCIsImNvbW1vbi5wb2xpY3kubGlzdCIsImNvbW1vbi5wb2xpY3kubGlzdC50ZW1wbGF0ZXMiLCJjb21tb24udGVycml0b3J5LmZpbmQiLCJjb21tb24udGVycml0b3J5Lmxpc3QiLCJjb21tb24udGVycml0b3J5LnJlYWQiLCJjb21tb24udHJpcC5zdGF0cyIsImNvbW1vbi51c2VyLnVwZGF0ZSIsImNvbW1vbi51c2VyLmZpbmQiLCJjb21tb24udXNlci5wb2xpY3lTaW11bGF0ZSIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLmNyZWF0ZSIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLmNhbmNlbCIsIm9wZXJhdG9yLmFjcXVpc2l0aW9uLnN0YXR1cyIsIm9wZXJhdG9yLmNlcnRpZmljYXRlLmNyZWF0ZSIsIm9wZXJhdG9yLmNlcnRpZmljYXRlLmRvd25sb2FkIiwib3BlcmF0b3IucG9saWN5LnNpbXVsYXRlLmZ1dHVyZSJdLCJ2IjoyLCJpYXQiOjE2NzgwOTg0NTR9.b4ezR41U4kGwa6FVF0-JyvqEE1kKtxGEa5gzqh4ctTU
geocoder:
type: pelias
pelias:
base_url: https://geocode.ridygo.fr
routing:
type: valhalla
valhalla:
base_url: https://valhalla.coopgo.io/
emailing:
smtp:
host: mail.gandi.net
port: 587
username: support@parcoursmob.fr
password: Sc1tYc00p

4
go.mod
View File

@ -1,6 +1,8 @@
module git.coopgo.io/coopgo-apps/silvermobi
go 1.19
go 1.21
toolchain go1.23.2
require (
git.coopgo.io/coopgo-platform/geocode v0.0.0-20230329105149-1f31b361814e

View File

@ -2,15 +2,19 @@ package handler
import (
"context"
"git.coopgo.io/coopgo-apps/silvermobi/models"
"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
)
func (h *SilvermobiHandler) GetAccountInfos(ctx context.Context, id string) (account *models.Account, err error) {
resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, &grpcapi.GetAccountRequest{Id: id})
if err != nil {
func (h *SilverMobiHandler) GetAccountInfos(ctx context.Context, id string) (account *models.Account, err error) {
var resp *grpcapi.GetAccountResponse
if resp, err = h.Services.MobilityAccounts.Client.GetAccount(ctx, &grpcapi.GetAccountRequest{Id: id}); err != nil {
return nil, err
}
account = h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
return account, nil
}

View File

@ -3,49 +3,61 @@ package handler
import (
"context"
"time"
"git.coopgo.io/coopgo-apps/silvermobi/models"
)
func (h *SilvermobiHandler) Login(ctx context.Context, username string, password string) (jwt string, err error) {
account, err := h.Services.MobilityAccounts.Login(ctx, username, password, "silvermobi")
if err != nil {
func (h *SilverMobiHandler) Login(ctx context.Context, username string, password string) (jwt string, err error) {
var (
account *models.Account
pTTL time.Duration
)
if account, err = h.Services.MobilityAccounts.Login(ctx, username, password, "silvermobi"); err != nil {
return
}
key := h.Config.GetString("identification.local.jwt_secret")
ttl := h.Config.GetString("identification.local.ttl")
parsedttl, err := time.ParseDuration(ttl)
if err != nil {
if pTTL, err = time.ParseDuration(ttl); err != nil {
return "", err
}
return account.CreateToken(parsedttl, key)
return account.CreateToken(pTTL, key)
}
func (h *SilvermobiHandler) Register(ctx context.Context, username string, password string, email string, phone_number string, first_name string, last_name string) (jwt string, err error) {
account, err := h.Services.MobilityAccounts.Register(
func (h *SilverMobiHandler) Register(ctx context.Context, username string, password string, email string,
phoneNumber string, firstName string, lastName string) (jwt string, err error) {
var (
account *models.Account
pTTL time.Duration
)
if account, err = h.Services.MobilityAccounts.Register(
ctx,
username,
password,
email,
phone_number,
phoneNumber,
map[string]any{
"first_name": first_name,
"last_name": last_name,
"first_name": firstName,
"last_name": lastName,
"email": email,
"phone_number": phone_number,
"phone_number": phoneNumber,
},
"silvermobi",
)
if err != nil {
); err != nil {
return "", err
}
key := h.Config.GetString("identification.local.jwt_secret")
ttl := h.Config.GetString("identification.local.ttl")
parsedttl, err := time.ParseDuration(ttl)
if err != nil {
if pTTL, err = time.ParseDuration(ttl); err != nil {
return "", err
}
return account.CreateToken(parsedttl, key)
return account.CreateToken(pTTL, key)
}

View File

@ -3,8 +3,9 @@ package handler
import (
"context"
"crypto/rand"
"crypto/tls"
"encoding/base64"
"git.coopgo.io/coopgo-apps/silvermobi/models"
gomail "gopkg.in/mail.v2"
)
@ -18,29 +19,50 @@ func generateRandomPassword(length int) (string, error) {
return password, nil
}
func (h *SilvermobiHandler) ForgetAccount(ctx context.Context, username string, namespace string) (response bool, access_Code string) {
account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, username, namespace)
if err == nil {
message := []byte("Hello dear,\nYour new Silvermobi password is: ")
password, _ := generateRandomPassword(10)
update := h.Services.MobilityAccounts.UpdatePassword(ctx, account.ID, password)
if update == false {
return false, ""
}
m := gomail.NewMessage()
m.SetHeader("From", h.Config.GetString("emailing.smtp.username"))
m.SetHeader("To", username)
m.SetHeader("Subject", "Silvermobi Password Recovery")
message = append(message, []byte(password)...)
m.SetBody("text/plain", string(message))
d := gomail.NewDialer(h.Config.GetString("emailing.smtp.host"), h.Config.GetInt("emailing.smtp.port"), h.Config.GetString("emailing.smtp.username"),
h.Config.GetString("emailing.smtp.password"))
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
if err := d.DialAndSend(m); err != nil {
return false, ""
}
return true, password
} else {
func (h *SilverMobiHandler) ForgetAccount(ctx context.Context, username string, namespace string) (response bool,
accessCode string) {
var (
err error
account *models.Account
)
account, err = h.Services.MobilityAccounts.GetAccountUsername(ctx, username, namespace)
if err != nil {
return false, ""
}
message := []byte("Hello dear,\nYour new Silvermobi password is: ")
password, _ := generateRandomPassword(10)
if update := h.Services.MobilityAccounts.UpdatePassword(ctx, account.ID, password); !update {
return false, ""
}
m := gomail.NewMessage()
m.SetHeader("From", h.Config.GetString("emailing.smtp.username"))
m.SetHeader("To", username)
m.SetHeader("Subject", "Silvermobi Password Recovery")
message = append(message, []byte(password)...)
m.SetBody("text/plain", string(message))
d := gomail.NewDialer(
h.Config.GetString("emailing.smtp.host"),
h.Config.GetInt("emailing.smtp.port"),
h.Config.GetString("emailing.smtp.username"),
h.Config.GetString("emailing.smtp.password"),
)
d.StartTLSPolicy = gomail.MandatoryStartTLS
if err = d.DialAndSend(m); err != nil {
return false, ""
}
return true, password
}

View File

@ -2,12 +2,13 @@ package handler
import (
"fmt"
"git.coopgo.io/coopgo-platform/routing-service"
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
"google.golang.org/genproto/googleapis/maps/routing/v2"
)
func (h *SilvermobiHandler) GeoAutocomplete(text string, lat, lon float64) (*geojson.FeatureCollection, error) {
func (h *SilverMobiHandler) GeoAutocomplete(text string) (*geojson.FeatureCollection, error) {
result, err := h.Services.Geocoder.Autocomplete(text)
if err != nil {
return nil, err
@ -15,36 +16,45 @@ func (h *SilvermobiHandler) GeoAutocomplete(text string, lat, lon float64) (*geo
return result, nil
}
func (h *SilvermobiHandler) GeoRoute(locations geojson.FeatureCollection) (route *routing.Route, err error) {
route_locations := []orb.Point{}
features_type := ""
func (h *SilverMobiHandler) GeoRoute(locations geojson.FeatureCollection) (route *routing.Route, err error) {
var (
routeLocations []orb.Point
featuresType string
)
for _, f := range locations.Features {
ft := f.Geometry.GeoJSONType()
if features_type != "" && ft != features_type {
return nil, fmt.Errorf("mixing different types of geometries in the feature collection is not allowed : %s and %s found", features_type, ft)
if ft != featuresType {
return nil, fmt.Errorf("mixing different types of geometries in"+
" the feature collection is not allowed : %s and %s found", featuresType, ft)
}
features_type = ft
featuresType = ft
if features_type == "Point" {
if featuresType == "Point" {
if point, ok := f.Geometry.(orb.Point); ok {
route_locations = append(route_locations, point)
routeLocations = append(routeLocations, point)
} else {
return nil, fmt.Errorf("invalid geometry type for point")
}
} else {
return nil, fmt.Errorf("feature type %s not supported", features_type)
return nil, fmt.Errorf("feature type %s not supported", featuresType)
}
}
if route, err = h.Services.Routing.Route(routeLocations); err != nil {
return nil, err
}
return route, nil
}
func (h *SilvermobiHandler) GeoReturnRoute(locations geojson.FeatureCollection) (route *routing.Route, err error) {
func (h *SilverMobiHandler) GeoReturnRoute(locations geojson.FeatureCollection) (route *routing.Route, err error) {
loc := locations
route.Polyline.String()
reverse(loc.Features)
return h.GeoRoute(loc)

View File

@ -6,14 +6,15 @@ import (
"github.com/spf13/viper"
)
type SilvermobiHandler struct {
type SilverMobiHandler struct {
Config *viper.Viper
Services *services.ServicesHandler
Services *services.ServiceHandler
Storage storage.Storage
}
func NewSilvermobiHandler(cfg *viper.Viper, services *services.ServicesHandler, storage storage.Storage) (*SilvermobiHandler, error) {
return &SilvermobiHandler{
func NewSilverMobiHandler(cfg *viper.Viper, services *services.ServiceHandler,
storage storage.Storage) (*SilverMobiHandler, error) {
return &SilverMobiHandler{
Config: cfg,
Services: services,
Storage: storage,

View File

@ -2,63 +2,69 @@ package handler
import (
"context"
"crypto/tls"
"git.coopgo.io/coopgo-apps/silvermobi/services"
"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
gomail "gopkg.in/mail.v2"
)
func (h *SilvermobiHandler) PutFirebase(ctx context.Context, id string, token string, device_platform string) (err error) {
err = h.Storage.CreateFirebaseToken(id, token, device_platform)
func (h *SilverMobiHandler) PutFirebase(ctx context.Context, id string, token string, devicePlatform string) (err error) {
err = h.Storage.CreateFirebaseToken(id, token, devicePlatform)
return err
}
func (h *SilvermobiHandler) SendNotification(id, title, message string) (err error) {
firebase_token, platfrom, _ := h.Storage.GetFirebaseToken(id)
func (h *SilverMobiHandler) SendNotification(id, title, message string) error {
firebaseToken, platform, err := h.Storage.GetFirebaseToken(id)
if err != nil {
return err
}
if platfrom == "android" {
_ = h.Services.Push.Send(
services.Notification{
Platform: services.PushToAndroid,
Recipients: []string{firebase_token},
Title: title,
Message: message,
},
)
notify := services.Notification{
Recipients: []string{firebaseToken},
Title: title,
Message: message,
}
if platform == "android" {
notify.Platform = services.PushToAndroid
err = h.Services.Push.Send(notify)
} else {
_ = h.Services.Push.Send(
services.Notification{
Platform: services.PushToIos,
Recipients: []string{firebase_token},
Title: title,
Message: message,
},
)
notify.Platform = services.PushToIos
err = h.Services.Push.Send(notify)
}
return nil
return err
}
func (h *SilvermobiHandler) SendEmail(id, title, message string) (err error) {
resp, err := h.Services.MobilityAccounts.Client.GetAccount(context.Background(), &grpcapi.GetAccountRequest{Id: id})
if err != nil {
func (h *SilverMobiHandler) SendEmail(id, title, message string) (err error) {
var resp *grpcapi.GetAccountResponse
if resp, err = h.Services.MobilityAccounts.Client.GetAccount(context.Background(),
&grpcapi.GetAccountRequest{Id: id}); err != nil {
return err
}
account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
m := gomail.NewMessage()
m.SetHeader("From", h.Config.GetString("emailing.smtp.username"))
m.SetHeader("To", account.Email)
m.SetHeader("Subject", title)
m.SetBody("text/plain", message)
d := gomail.NewDialer(h.Config.GetString("emailing.smtp.host"), h.Config.GetInt("emailing.smtp.port"), h.Config.GetString("emailing.smtp.username"),
d := gomail.NewDialer(
h.Config.GetString("emailing.smtp.host"),
h.Config.GetInt("emailing.smtp.port"),
h.Config.GetString("emailing.smtp.username"),
h.Config.GetString("emailing.smtp.password"))
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
if err := d.DialAndSend(m); err != nil {
d.StartTLSPolicy = gomail.MandatoryStartTLS
if err = d.DialAndSend(m); err != nil {
return err
}
return nil
}

View File

@ -3,48 +3,53 @@ package handler
import (
"context"
"fmt"
"math/rand"
"git.coopgo.io/coopgo-apps/silvermobi/services"
"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"math/rand"
)
func (h *SilvermobiHandler) UpdatePhoneNumber(ctx context.Context, id string, phone_number string) error {
func (h *SilverMobiHandler) UpdatePhoneNumber(ctx context.Context, id string, phoneNumber string) (err error) {
code := rand.Intn(9999)
err := h.Services.MobilityAccounts.UpdatePhoneNumber(
if err = h.Services.MobilityAccounts.UpdatePhoneNumber(
ctx,
id,
phone_number,
phoneNumber,
false,
fmt.Sprintf("%04d", code),
)
if err != nil {
); err != nil {
log.Error().Err(err).Msg("updating phone number failed")
return err
}
err = h.Services.Push.Send(
if err = h.Services.Push.Send(
services.Notification{
Platform: services.PushToSMSFactor,
Recipients: []string{phone_number[1:]},
Recipients: []string{phoneNumber[1:]},
Title: "SILVERMOBI",
Message: fmt.Sprintf("SILVERMOBI - Votre code de validation : %04d", code),
},
)
if err != nil {
); err != nil {
log.Error().Err(err).Msg("issue sending verification code by sms")
return err
}
return nil
}
func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, id string, phone_number string, verification_code string) error {
func (h *SilverMobiHandler) VerifyPhoneNumber(ctx context.Context, id string, phoneNumber string,
verificationCode string) error {
request := &grpcapi.GetAccountRequest{
Id: id,
}
resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
if err != nil {
return err
}
@ -52,20 +57,21 @@ func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, id string, ph
account_ := resp.Account
log.Debug().
Str("phone_number", phone_number).
Str("phone_number", phoneNumber).
Str("account.phone_number", account_.Authentication.Local.PhoneNumber).
Str("verification_code", verification_code).
Str("verification_code", verificationCode).
Str("account.verification_code", account_.Authentication.Local.PhoneNumberValidation.ValidationCode).
Msg("Verify phone number")
if account_.Authentication.Local.PhoneNumber != phone_number || account_.Authentication.Local.PhoneNumberValidation.ValidationCode != verification_code {
return errors.New("cound not validate phone number : verification code mismatch")
if account_.Authentication.Local.PhoneNumber != phoneNumber ||
account_.Authentication.Local.PhoneNumberValidation.ValidationCode != verificationCode {
return errors.New("could not validate phone number : verification code mismatch")
}
err = h.Services.MobilityAccounts.UpdatePhoneNumber(
ctx,
id,
phone_number,
phoneNumber,
true,
"",
)
@ -76,7 +82,7 @@ func (h *SilvermobiHandler) VerifyPhoneNumber(ctx context.Context, id string, ph
return nil
}
func (h *SilvermobiHandler) UpdateBirthDate(ctx context.Context, id string, birthdate string) error {
func (h *SilverMobiHandler) UpdateBirthDate(ctx context.Context, id string, birthdate string) error {
err := h.Services.MobilityAccounts.UpdateAccountBirthDate(ctx, id, "silvermobi", birthdate)
if err != nil {
return err
@ -84,69 +90,86 @@ func (h *SilvermobiHandler) UpdateBirthDate(ctx context.Context, id string, birt
return nil
}
func (h *SilvermobiHandler) SetAccountType(ctx context.Context, id string, accountType string) error {
func (h *SilverMobiHandler) SetAccountType(ctx context.Context, id string, accountType string) error {
err := h.Services.MobilityAccounts.SetAccountType(ctx, id, accountType)
if err != nil {
return err
}
return nil
}
func (h *SilvermobiHandler) GetAccountType(ctx context.Context, id string) (account_type string, err error) {
func (h *SilverMobiHandler) GetAccountType(ctx context.Context, id string) (accountType string, err error) {
var resp *grpcapi.GetAccountResponse
request := &grpcapi.GetAccountRequest{
Id: id,
}
resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
if err != nil {
if resp, err = h.Services.MobilityAccounts.Client.GetAccount(ctx, request); err != nil {
return "", err
log.Error().Err(err).Msg("Failed get account type")
}
account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
if account.Type != "" {
return account.Type, nil
}
return "", errors.New("account type not set")
}
func (h *SilvermobiHandler) GetAccountPhone(ctx context.Context, id string) (phone_number string, err error) {
func (h *SilverMobiHandler) GetAccountPhone(ctx context.Context, id string) (phoneNumber string, err error) {
var resp *grpcapi.GetAccountResponse
request := &grpcapi.GetAccountRequest{
Id: id,
}
resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
if err != nil {
return "", err
log.Error().Err(err).Msg("Failed get account type")
}
account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
if account.PhoneNumber != "" {
if resp, err = h.Services.MobilityAccounts.Client.GetAccount(ctx, request); err != nil {
return "", err
}
account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
if account.PhoneNumber != "" {
return account.PhoneNumber, nil
}
return "", errors.New("invalid request ")
}
func (h *SilvermobiHandler) CheckValidation(ctx context.Context, id string) (phone_validation, birth_validation, type_validation bool, err error) {
func (h *SilverMobiHandler) CheckValidation(ctx context.Context, id string) (phoneValidation, birthValidation,
typeValidation bool, err error) {
var resp *grpcapi.GetAccountResponse
request := &grpcapi.GetAccountRequest{
Id: id,
}
resp, err := h.Services.MobilityAccounts.Client.GetAccount(ctx, request)
if err != nil {
if resp, err = h.Services.MobilityAccounts.Client.GetAccount(ctx, request); err != nil {
return false, false, false, err
log.Error().Err(err).Msg("Failed get validation response")
}
account := h.Services.MobilityAccounts.ToAccountModel(resp.Account.ToStorageType())
phone_validation = false
birth_validation = false
type_validation = false
phoneValidation = false
birthValidation = false
typeValidation = false
if account.LocalCredentials.PhoneNumberVerified {
phone_validation = true
phoneValidation = true
}
if account.BirthDate != "" {
birth_validation = true
birthValidation = true
}
if account.Type != "" {
type_validation = true
typeValidation = true
}
log.Info().Msg("Getting phone and birth validation for " + account.Email)
return phone_validation, birth_validation, type_validation, nil
return phoneValidation, birthValidation, typeValidation, nil
}

View File

@ -2,15 +2,17 @@ package handler
import "context"
func (h *SilvermobiHandler) UpdatePassword(ctx context.Context, username string, password string) (response bool) {
func (h *SilverMobiHandler) UpdatePassword(ctx context.Context, username string, password string) (response bool) {
account, err := h.Services.MobilityAccounts.GetAccountUsername(ctx, username, "silvermobi")
if err != nil {
return false
}
result := h.Services.MobilityAccounts.UpdatePassword(ctx, account.ID, password)
if result == true {
return true
} else {
return false
}
return false
}

22
main.go
View File

@ -10,35 +10,39 @@ import (
)
func main() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
cfg, err := ReadConfig()
if err != nil {
panic(err)
}
var (
grpc_enable = cfg.GetBool("services.external.grpc.enable")
grpcEnable = cfg.GetBool("services.external.grpc.enable")
svc *services.ServiceHandler
stg storage.Storage
hdl *handler.SilverMobiHandler
)
services, err := services.NewServicesHandler(cfg)
if err != nil {
if svc, err = services.NewServicesHandler(cfg); err != nil {
log.Fatal().Err(err).Msg("failed starting services handler")
}
storage, err := storage.NewPostgresqlStorage(cfg)
if err != nil {
if stg, err = storage.NewPostgresqlStorage(cfg); err != nil {
log.Fatal().Err(err).Msg("failed starting storage handler")
}
handler, err := handler.NewSilvermobiHandler(cfg, services, storage)
if err != nil {
if hdl, err = handler.NewSilverMobiHandler(cfg, svc, stg); err != nil {
log.Fatal().Err(err).Msg("failed starting ridygo handler")
}
failed := make(chan error)
if grpc_enable {
if grpcEnable {
log.Info().Msg("Running gRPC server")
go grpcserver.Run(failed, cfg, handler)
go grpcserver.Run(failed, cfg, hdl)
}
err = <-failed

View File

@ -1,8 +1,9 @@
package models
import (
"github.com/golang-jwt/jwt/v4"
"time"
"github.com/golang-jwt/jwt/v4"
)
type Account struct {
@ -36,11 +37,11 @@ type UserClaims struct {
}
func (account Account) CreateToken(ttl time.Duration, key string) (token string, err error) {
expires_at := jwt.NewNumericDate(time.Now().Add(ttl))
expiresAt := jwt.NewNumericDate(time.Now().Add(ttl))
claims := UserClaims{
RegisteredClaims: jwt.RegisteredClaims{
Subject: account.ID,
ExpiresAt: expires_at,
ExpiresAt: expiresAt,
},
}

View File

@ -131,21 +131,21 @@ func (PriceType) EnumDescriptor() ([]byte, []int) {
return file_solidarity_api_types_proto_rawDescGZIP(), []int{1}
}
type BookingSilvermobiStatus int32
type BookingStatus int32
const (
BookingSilvermobiStatus_INITIATED BookingSilvermobiStatus = 0
BookingSilvermobiStatus_WAITING_DRIVER_CONFIRMATION BookingSilvermobiStatus = 1
BookingSilvermobiStatus_WAITING_PASSENGER_CONFIRMATION BookingSilvermobiStatus = 2
BookingSilvermobiStatus_CONFIRMED BookingSilvermobiStatus = 3
BookingSilvermobiStatus_CANCELLED BookingSilvermobiStatus = 4
BookingSilvermobiStatus_COMPLETED_PENDING_VALIDATION BookingSilvermobiStatus = 5
BookingSilvermobiStatus_VALIDATED BookingSilvermobiStatus = 6
BookingStatus_INITIATED BookingStatus = 0
BookingStatus_WAITING_DRIVER_CONFIRMATION BookingStatus = 1
BookingStatus_WAITING_PASSENGER_CONFIRMATION BookingStatus = 2
BookingStatus_CONFIRMED BookingStatus = 3
BookingStatus_CANCELLED BookingStatus = 4
BookingStatus_COMPLETED_PENDING_VALIDATION BookingStatus = 5
BookingStatus_VALIDATED BookingStatus = 6
)
// Enum value maps for BookingSilvermobiStatus.
// Enum value maps for BookingStatus.
var (
BookingSilvermobiStatus_name = map[int32]string{
BookingStatus_name = map[int32]string{
0: "INITIATED",
1: "WAITING_DRIVER_CONFIRMATION",
2: "WAITING_PASSENGER_CONFIRMATION",
@ -154,7 +154,7 @@ var (
5: "COMPLETED_PENDING_VALIDATION",
6: "VALIDATED",
}
BookingSilvermobiStatus_value = map[string]int32{
BookingStatus_value = map[string]int32{
"INITIATED": 0,
"WAITING_DRIVER_CONFIRMATION": 1,
"WAITING_PASSENGER_CONFIRMATION": 2,
@ -165,30 +165,30 @@ var (
}
)
func (x BookingSilvermobiStatus) Enum() *BookingSilvermobiStatus {
p := new(BookingSilvermobiStatus)
func (x BookingStatus) Enum() *BookingStatus {
p := new(BookingStatus)
*p = x
return p
}
func (x BookingSilvermobiStatus) String() string {
func (x BookingStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (BookingSilvermobiStatus) Descriptor() protoreflect.EnumDescriptor {
func (BookingStatus) Descriptor() protoreflect.EnumDescriptor {
return file_solidarity_api_types_proto_enumTypes[2].Descriptor()
}
func (BookingSilvermobiStatus) Type() protoreflect.EnumType {
func (BookingStatus) Type() protoreflect.EnumType {
return &file_solidarity_api_types_proto_enumTypes[2]
}
func (x BookingSilvermobiStatus) Number() protoreflect.EnumNumber {
func (x BookingStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use BookingSilvermobiStatus.Descriptor instead.
func (BookingSilvermobiStatus) EnumDescriptor() ([]byte, []int) {
// Deprecated: Use BookingStatus.Descriptor instead.
func (BookingStatus) EnumDescriptor() ([]byte, []int) {
return file_solidarity_api_types_proto_rawDescGZIP(), []int{2}
}
@ -720,22 +720,22 @@ func (x *RegularAvailabilitySlot) GetEndTime() string {
return ""
}
type BookingSilvermobiRequest struct {
type BookingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
PassengerId string `protobuf:"bytes,2,opt,name=passengerId,proto3" json:"passengerId,omitempty"`
DriverId string `protobuf:"bytes,3,opt,name=driverId,proto3" json:"driverId,omitempty"`
Status BookingSilvermobiStatus `protobuf:"varint,4,opt,name=status,proto3,enum=BookingSilvermobiStatus" json:"status,omitempty"`
DepartureAddress *Feature `protobuf:"bytes,5,opt,name=departure_address,json=departureAddress,proto3" json:"departure_address,omitempty"`
DestinationAddress *Feature `protobuf:"bytes,6,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"`
PickupDate *timestamp.Timestamp `protobuf:"bytes,7,opt,name=pickup_date,json=pickupDate,proto3" json:"pickup_date,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
PassengerId string `protobuf:"bytes,2,opt,name=passengerId,proto3" json:"passengerId,omitempty"`
DriverId string `protobuf:"bytes,3,opt,name=driverId,proto3" json:"driverId,omitempty"`
Status BookingStatus `protobuf:"varint,4,opt,name=status,proto3,enum=BookingStatus" json:"status,omitempty"`
DepartureAddress *Feature `protobuf:"bytes,5,opt,name=departure_address,json=departureAddress,proto3" json:"departure_address,omitempty"`
DestinationAddress *Feature `protobuf:"bytes,6,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"`
PickupDate *timestamp.Timestamp `protobuf:"bytes,7,opt,name=pickup_date,json=pickupDate,proto3" json:"pickup_date,omitempty"`
}
func (x *BookingSilvermobiRequest) Reset() {
*x = BookingSilvermobiRequest{}
func (x *BookingRequest) Reset() {
*x = BookingRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_types_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -743,13 +743,13 @@ func (x *BookingSilvermobiRequest) Reset() {
}
}
func (x *BookingSilvermobiRequest) String() string {
func (x *BookingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BookingSilvermobiRequest) ProtoMessage() {}
func (*BookingRequest) ProtoMessage() {}
func (x *BookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
func (x *BookingRequest) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_types_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -761,81 +761,81 @@ func (x *BookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use BookingSilvermobiRequest.ProtoReflect.Descriptor instead.
func (*BookingSilvermobiRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use BookingRequest.ProtoReflect.Descriptor instead.
func (*BookingRequest) Descriptor() ([]byte, []int) {
return file_solidarity_api_types_proto_rawDescGZIP(), []int{7}
}
func (x *BookingSilvermobiRequest) GetId() string {
func (x *BookingRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *BookingSilvermobiRequest) GetPassengerId() string {
func (x *BookingRequest) GetPassengerId() string {
if x != nil {
return x.PassengerId
}
return ""
}
func (x *BookingSilvermobiRequest) GetDriverId() string {
func (x *BookingRequest) GetDriverId() string {
if x != nil {
return x.DriverId
}
return ""
}
func (x *BookingSilvermobiRequest) GetStatus() BookingSilvermobiStatus {
func (x *BookingRequest) GetStatus() BookingStatus {
if x != nil {
return x.Status
}
return BookingSilvermobiStatus_INITIATED
return BookingStatus_INITIATED
}
func (x *BookingSilvermobiRequest) GetDepartureAddress() *Feature {
func (x *BookingRequest) GetDepartureAddress() *Feature {
if x != nil {
return x.DepartureAddress
}
return nil
}
func (x *BookingSilvermobiRequest) GetDestinationAddress() *Feature {
func (x *BookingRequest) GetDestinationAddress() *Feature {
if x != nil {
return x.DestinationAddress
}
return nil
}
func (x *BookingSilvermobiRequest) GetPickupDate() *timestamp.Timestamp {
func (x *BookingRequest) GetPickupDate() *timestamp.Timestamp {
if x != nil {
return x.PickupDate
}
return nil
}
type BookingSilvermobi struct {
type Booking struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Driver *User `protobuf:"bytes,2,opt,name=driver,proto3" json:"driver,omitempty"`
Passenger *User `protobuf:"bytes,3,opt,name=passenger,proto3" json:"passenger,omitempty"`
PassengerPickupDate *timestamp.Timestamp `protobuf:"bytes,4,opt,name=passengerPickupDate,proto3" json:"passengerPickupDate,omitempty"`
PassengerDepartureRoute *Feature `protobuf:"bytes,5,opt,name=passenger_departure_route,json=passengerDepartureRoute,proto3" json:"passenger_departure_route,omitempty"`
PassengerDestinationRoute *Feature `protobuf:"bytes,6,opt,name=passenger_destination_route,json=passengerDestinationRoute,proto3" json:"passenger_destination_route,omitempty"`
Status BookingSilvermobiStatus `protobuf:"varint,7,opt,name=status,proto3,enum=BookingSilvermobiStatus" json:"status,omitempty"`
Duration int64 `protobuf:"varint,8,opt,name=duration,proto3" json:"duration,omitempty"`
Distance int64 `protobuf:"varint,9,opt,name=distance,proto3" json:"distance,omitempty"`
Price *Price `protobuf:"bytes,10,opt,name=price,proto3" json:"price,omitempty"`
Car *Car `protobuf:"bytes,11,opt,name=car,proto3" json:"car,omitempty"`
PickupDate *timestamp.Timestamp `protobuf:"bytes,12,opt,name=pickup_date,json=pickupDate,proto3" json:"pickup_date,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Driver *User `protobuf:"bytes,2,opt,name=driver,proto3" json:"driver,omitempty"`
Passenger *User `protobuf:"bytes,3,opt,name=passenger,proto3" json:"passenger,omitempty"`
PassengerPickupDate *timestamp.Timestamp `protobuf:"bytes,4,opt,name=passengerPickupDate,proto3" json:"passengerPickupDate,omitempty"`
PassengerDepartureRoute *Feature `protobuf:"bytes,5,opt,name=passenger_departure_route,json=passengerDepartureRoute,proto3" json:"passenger_departure_route,omitempty"`
PassengerDestinationRoute *Feature `protobuf:"bytes,6,opt,name=passenger_destination_route,json=passengerDestinationRoute,proto3" json:"passenger_destination_route,omitempty"`
Status BookingStatus `protobuf:"varint,7,opt,name=status,proto3,enum=BookingStatus" json:"status,omitempty"`
Duration int64 `protobuf:"varint,8,opt,name=duration,proto3" json:"duration,omitempty"`
Distance int64 `protobuf:"varint,9,opt,name=distance,proto3" json:"distance,omitempty"`
Price *Price `protobuf:"bytes,10,opt,name=price,proto3" json:"price,omitempty"`
Car *Car `protobuf:"bytes,11,opt,name=car,proto3" json:"car,omitempty"`
PickupDate *timestamp.Timestamp `protobuf:"bytes,12,opt,name=pickup_date,json=pickupDate,proto3" json:"pickup_date,omitempty"`
}
func (x *BookingSilvermobi) Reset() {
*x = BookingSilvermobi{}
func (x *Booking) Reset() {
*x = Booking{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_types_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -843,13 +843,13 @@ func (x *BookingSilvermobi) Reset() {
}
}
func (x *BookingSilvermobi) String() string {
func (x *Booking) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BookingSilvermobi) ProtoMessage() {}
func (*Booking) ProtoMessage() {}
func (x *BookingSilvermobi) ProtoReflect() protoreflect.Message {
func (x *Booking) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_types_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -861,89 +861,89 @@ func (x *BookingSilvermobi) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use BookingSilvermobi.ProtoReflect.Descriptor instead.
func (*BookingSilvermobi) Descriptor() ([]byte, []int) {
// Deprecated: Use Booking.ProtoReflect.Descriptor instead.
func (*Booking) Descriptor() ([]byte, []int) {
return file_solidarity_api_types_proto_rawDescGZIP(), []int{8}
}
func (x *BookingSilvermobi) GetId() string {
func (x *Booking) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *BookingSilvermobi) GetDriver() *User {
func (x *Booking) GetDriver() *User {
if x != nil {
return x.Driver
}
return nil
}
func (x *BookingSilvermobi) GetPassenger() *User {
func (x *Booking) GetPassenger() *User {
if x != nil {
return x.Passenger
}
return nil
}
func (x *BookingSilvermobi) GetPassengerPickupDate() *timestamp.Timestamp {
func (x *Booking) GetPassengerPickupDate() *timestamp.Timestamp {
if x != nil {
return x.PassengerPickupDate
}
return nil
}
func (x *BookingSilvermobi) GetPassengerDepartureRoute() *Feature {
func (x *Booking) GetPassengerDepartureRoute() *Feature {
if x != nil {
return x.PassengerDepartureRoute
}
return nil
}
func (x *BookingSilvermobi) GetPassengerDestinationRoute() *Feature {
func (x *Booking) GetPassengerDestinationRoute() *Feature {
if x != nil {
return x.PassengerDestinationRoute
}
return nil
}
func (x *BookingSilvermobi) GetStatus() BookingSilvermobiStatus {
func (x *Booking) GetStatus() BookingStatus {
if x != nil {
return x.Status
}
return BookingSilvermobiStatus_INITIATED
return BookingStatus_INITIATED
}
func (x *BookingSilvermobi) GetDuration() int64 {
func (x *Booking) GetDuration() int64 {
if x != nil {
return x.Duration
}
return 0
}
func (x *BookingSilvermobi) GetDistance() int64 {
func (x *Booking) GetDistance() int64 {
if x != nil {
return x.Distance
}
return 0
}
func (x *BookingSilvermobi) GetPrice() *Price {
func (x *Booking) GetPrice() *Price {
if x != nil {
return x.Price
}
return nil
}
func (x *BookingSilvermobi) GetCar() *Car {
func (x *Booking) GetCar() *Car {
if x != nil {
return x.Car
}
return nil
}
func (x *BookingSilvermobi) GetPickupDate() *timestamp.Timestamp {
func (x *Booking) GetPickupDate() *timestamp.Timestamp {
if x != nil {
return x.PickupDate
}
@ -1335,121 +1335,118 @@ var file_solidarity_api_types_proto_rawDesc = []byte{
0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72,
0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22,
0xc9, 0x02, 0x0a, 0x18, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65,
0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a,
0x0a, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x42, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x11,
0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72,
0x65, 0x52, 0x10, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x12, 0x39, 0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74,
0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b,
0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
0x0a, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x22, 0xa2, 0x04, 0x0a, 0x11,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62,
0x69, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x64, 0x12, 0x1d, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72,
0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61, 0x73, 0x73,
0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x13,
0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44,
0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72,
0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70, 0x61, 0x72,
0x74, 0x75, 0x72, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x1b, 0x70, 0x61, 0x73,
0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08,
0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e,
0x67, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f,
0x75, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c,
0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20,
0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a,
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x50,
0x72, 0x69, 0x63, 0x65, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x03, 0x63,
0x61, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x43, 0x61, 0x72, 0x52, 0x03,
0x63, 0x61, 0x72, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61,
0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65,
0x22, 0x31, 0x0a, 0x03, 0x43, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x14, 0x0a,
0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72,
0x61, 0x6e, 0x64, 0x22, 0x97, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
0x63, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a,
0x07, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63,
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x12, 0x1b, 0x0a,
0x09, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,
0x52, 0x08, 0x69, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x75,
0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0b, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x5b, 0x0a,
0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a,
0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xdd, 0x01, 0x0a, 0x04, 0x55,
0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72,
0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66,
0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x05,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70,
0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x69,
0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18,
0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x2b, 0x0a,
0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69,
0x65, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2a, 0x4a, 0x0a, 0x09, 0x44, 0x61,
0x79, 0x4f, 0x66, 0x57, 0x65, 0x65, 0x6b, 0x12, 0x07, 0x0a, 0x03, 0x4d, 0x4f, 0x4e, 0x10, 0x00,
0x12, 0x07, 0x0a, 0x03, 0x54, 0x55, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x57, 0x45, 0x44,
0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x48, 0x55, 0x10, 0x04, 0x12, 0x07, 0x0a, 0x03, 0x46,
0x52, 0x49, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x41, 0x54, 0x10, 0x06, 0x12, 0x07, 0x0a,
0x03, 0x53, 0x55, 0x4e, 0x10, 0x07, 0x2a, 0x2e, 0x0a, 0x09, 0x50, 0x72, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x52, 0x45, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a,
0x06, 0x50, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b,
0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0xbc, 0x01, 0x0a, 0x17, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10,
0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x49,
0x56, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e,
0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x41,
0x53, 0x53, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41,
0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52,
0x4d, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c,
0x45, 0x44, 0x10, 0x04, 0x12, 0x20, 0x0a, 0x1c, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45,
0x44, 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41,
0x54, 0x49, 0x4f, 0x4e, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41,
0x54, 0x45, 0x44, 0x10, 0x06, 0x2a, 0x25, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70,
0x65, 0x12, 0x0a, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x10, 0x00, 0x12, 0x0d, 0x0a,
0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x10, 0x01, 0x42, 0x45, 0x5a, 0x43,
0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f,
0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f,
0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0xb5, 0x02, 0x0a, 0x0e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x49,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64,
0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x61,
0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x10, 0x64,
0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12,
0x39, 0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46,
0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x69,
0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x70, 0x69, 0x63,
0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x22, 0x8e, 0x04, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76,
0x65, 0x72, 0x12, 0x23, 0x0a, 0x09, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x09, 0x70, 0x61,
0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65,
0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x52, 0x13, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x69, 0x63, 0x6b, 0x75,
0x70, 0x44, 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67,
0x65, 0x72, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x6f, 0x75,
0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75,
0x72, 0x65, 0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x70,
0x61, 0x72, 0x74, 0x75, 0x72, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x48, 0x0a, 0x1b, 0x70,
0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x08, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73,
0x65, 0x6e, 0x67, 0x65, 0x72, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a,
0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52,
0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x69, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x05, 0x70, 0x72,
0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x03, 0x63, 0x61, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x04, 0x2e, 0x43, 0x61, 0x72, 0x52, 0x03, 0x63, 0x61, 0x72, 0x12, 0x3b, 0x0a, 0x0b, 0x70,
0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x70, 0x69,
0x63, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x65, 0x22, 0x31, 0x0a, 0x03, 0x43, 0x61, 0x72, 0x12,
0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x22, 0x97, 0x01, 0x0a, 0x0b,
0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73,
0x6d, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x6d,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x12,
0x14, 0x0a, 0x05, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
0x6d, 0x75, 0x73, 0x69, 0x63, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x74, 0x61, 0x6c, 0x6b,
0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x54, 0x61, 0x6c, 0x6b,
0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69,
0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6c, 0x75, 0x67, 0x67, 0x61, 0x67,
0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x5b, 0x0a, 0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1e,
0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x50,
0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06,
0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
0x63, 0x79, 0x22, 0xdd, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61,
0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61,
0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x67, 0x72,
0x61, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67,
0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65,
0x64, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08,
0x52, 0x10, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69,
0x74, 0x79, 0x2a, 0x4a, 0x0a, 0x09, 0x44, 0x61, 0x79, 0x4f, 0x66, 0x57, 0x65, 0x65, 0x6b, 0x12,
0x07, 0x0a, 0x03, 0x4d, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x55, 0x45, 0x10,
0x01, 0x12, 0x07, 0x0a, 0x03, 0x57, 0x45, 0x44, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x48,
0x55, 0x10, 0x04, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x52, 0x49, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03,
0x53, 0x41, 0x54, 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x55, 0x4e, 0x10, 0x07, 0x2a, 0x2e,
0x0a, 0x09, 0x50, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46,
0x52, 0x45, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x10,
0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x2a, 0xb2,
0x01, 0x0a, 0x0d, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12,
0x1f, 0x0a, 0x1b, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45,
0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01,
0x12, 0x22, 0x0a, 0x1e, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x41, 0x53, 0x53,
0x45, 0x4e, 0x47, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x41, 0x54, 0x49,
0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45,
0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44,
0x10, 0x04, 0x12, 0x20, 0x0a, 0x1c, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x5f,
0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49,
0x4f, 0x4e, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x45,
0x44, 0x10, 0x06, 0x2a, 0x25, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12,
0x0a, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x70,
0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x10, 0x01, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69,
0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70,
0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69,
0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1469,7 +1466,7 @@ var file_solidarity_api_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_solidarity_api_types_proto_goTypes = []interface{}{
(DayOfWeek)(0), // 0: DayOfWeek
(PriceType)(0), // 1: PriceType
(BookingSilvermobiStatus)(0), // 2: BookingSilvermobiStatus
(BookingStatus)(0), // 2: BookingStatus
(UserType)(0), // 3: UserType
(*Feature)(nil), // 4: Feature
(*DriverJourney)(nil), // 5: DriverJourney
@ -1478,8 +1475,8 @@ var file_solidarity_api_types_proto_goTypes = []interface{}{
(*DriverRequest)(nil), // 8: DriverRequest
(*PunctualAvailabilitySlot)(nil), // 9: PunctualAvailabilitySlot
(*RegularAvailabilitySlot)(nil), // 10: RegularAvailabilitySlot
(*BookingSilvermobiRequest)(nil), // 11: BookingSilvermobiRequest
(*BookingSilvermobi)(nil), // 12: BookingSilvermobi
(*BookingRequest)(nil), // 11: BookingRequest
(*Booking)(nil), // 12: Booking
(*Car)(nil), // 13: Car
(*Preferences)(nil), // 14: Preferences
(*Price)(nil), // 15: Price
@ -1501,19 +1498,19 @@ var file_solidarity_api_types_proto_depIdxs = []int32{
13, // 11: DriverRequest.car:type_name -> Car
17, // 12: PunctualAvailabilitySlot.date:type_name -> google.protobuf.Timestamp
0, // 13: RegularAvailabilitySlot.dayOfWeek:type_name -> DayOfWeek
2, // 14: BookingSilvermobiRequest.status:type_name -> BookingSilvermobiStatus
4, // 15: BookingSilvermobiRequest.departure_address:type_name -> Feature
4, // 16: BookingSilvermobiRequest.destination_address:type_name -> Feature
17, // 17: BookingSilvermobiRequest.pickup_date:type_name -> google.protobuf.Timestamp
16, // 18: BookingSilvermobi.driver:type_name -> User
16, // 19: BookingSilvermobi.passenger:type_name -> User
17, // 20: BookingSilvermobi.passengerPickupDate:type_name -> google.protobuf.Timestamp
4, // 21: BookingSilvermobi.passenger_departure_route:type_name -> Feature
4, // 22: BookingSilvermobi.passenger_destination_route:type_name -> Feature
2, // 23: BookingSilvermobi.status:type_name -> BookingSilvermobiStatus
15, // 24: BookingSilvermobi.price:type_name -> Price
13, // 25: BookingSilvermobi.car:type_name -> Car
17, // 26: BookingSilvermobi.pickup_date:type_name -> google.protobuf.Timestamp
2, // 14: BookingRequest.status:type_name -> BookingStatus
4, // 15: BookingRequest.departure_address:type_name -> Feature
4, // 16: BookingRequest.destination_address:type_name -> Feature
17, // 17: BookingRequest.pickup_date:type_name -> google.protobuf.Timestamp
16, // 18: Booking.driver:type_name -> User
16, // 19: Booking.passenger:type_name -> User
17, // 20: Booking.passengerPickupDate:type_name -> google.protobuf.Timestamp
4, // 21: Booking.passenger_departure_route:type_name -> Feature
4, // 22: Booking.passenger_destination_route:type_name -> Feature
2, // 23: Booking.status:type_name -> BookingStatus
15, // 24: Booking.price:type_name -> Price
13, // 25: Booking.car:type_name -> Car
17, // 26: Booking.pickup_date:type_name -> google.protobuf.Timestamp
1, // 27: Price.type:type_name -> PriceType
28, // [28:28] is the sub-list for method output_type
28, // [28:28] is the sub-list for method input_type
@ -1613,7 +1610,7 @@ func file_solidarity_api_types_proto_init() {
}
}
file_solidarity_api_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BookingSilvermobiRequest); i {
switch v := v.(*BookingRequest); i {
case 0:
return &v.state
case 1:
@ -1625,7 +1622,7 @@ func file_solidarity_api_types_proto_init() {
}
}
file_solidarity_api_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BookingSilvermobi); i {
switch v := v.(*Booking); i {
case 0:
return &v.state
case 1:

View File

@ -58,24 +58,24 @@ enum DayOfWeek {
SUN = 7;
}
message BookingSilvermobiRequest {
message BookingRequest {
string id = 1;
string passengerId = 2;
string driverId = 3;
BookingSilvermobiStatus status = 4;
BookingStatus status = 4;
Feature departure_address =5;
Feature destination_address = 6;
google.protobuf.Timestamp pickup_date = 7;
}
message BookingSilvermobi {
message Booking {
string id = 1;
User driver = 2;
User passenger = 3;
google.protobuf.Timestamp passengerPickupDate =4;
Feature passenger_departure_route = 5;
Feature passenger_destination_route = 6;
BookingSilvermobiStatus status = 7;
BookingStatus status = 7;
int64 duration = 8;
int64 distance = 9;
Price price = 10;
@ -121,7 +121,7 @@ message User {
bool verified_identity = 8;
}
enum BookingSilvermobiStatus {
enum BookingStatus {
INITIATED = 0;
WAITING_DRIVER_CONFIRMATION = 1;
WAITING_PASSENGER_CONFIRMATION = 2;

View File

@ -296,16 +296,16 @@ func (x *DriverAvailabilitiesResponse) GetMessage() string {
return ""
}
type CreateBookingSilvermobiRequest struct {
type CreateBookingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Booking *BookingSilvermobiRequest `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
Booking *BookingRequest `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
}
func (x *CreateBookingSilvermobiRequest) Reset() {
*x = CreateBookingSilvermobiRequest{}
func (x *CreateBookingRequest) Reset() {
*x = CreateBookingRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -313,13 +313,13 @@ func (x *CreateBookingSilvermobiRequest) Reset() {
}
}
func (x *CreateBookingSilvermobiRequest) String() string {
func (x *CreateBookingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateBookingSilvermobiRequest) ProtoMessage() {}
func (*CreateBookingRequest) ProtoMessage() {}
func (x *CreateBookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
func (x *CreateBookingRequest) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -331,28 +331,28 @@ func (x *CreateBookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use CreateBookingSilvermobiRequest.ProtoReflect.Descriptor instead.
func (*CreateBookingSilvermobiRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use CreateBookingRequest.ProtoReflect.Descriptor instead.
func (*CreateBookingRequest) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{5}
}
func (x *CreateBookingSilvermobiRequest) GetBooking() *BookingSilvermobiRequest {
func (x *CreateBookingRequest) GetBooking() *BookingRequest {
if x != nil {
return x.Booking
}
return nil
}
type CreateBookingSilvermobiResponse struct {
type CreateBookingResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Booking *BookingSilvermobi `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
Booking *Booking `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
}
func (x *CreateBookingSilvermobiResponse) Reset() {
*x = CreateBookingSilvermobiResponse{}
func (x *CreateBookingResponse) Reset() {
*x = CreateBookingResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -360,13 +360,13 @@ func (x *CreateBookingSilvermobiResponse) Reset() {
}
}
func (x *CreateBookingSilvermobiResponse) String() string {
func (x *CreateBookingResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateBookingSilvermobiResponse) ProtoMessage() {}
func (*CreateBookingResponse) ProtoMessage() {}
func (x *CreateBookingSilvermobiResponse) ProtoReflect() protoreflect.Message {
func (x *CreateBookingResponse) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -378,30 +378,30 @@ func (x *CreateBookingSilvermobiResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use CreateBookingSilvermobiResponse.ProtoReflect.Descriptor instead.
func (*CreateBookingSilvermobiResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use CreateBookingResponse.ProtoReflect.Descriptor instead.
func (*CreateBookingResponse) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{6}
}
func (x *CreateBookingSilvermobiResponse) GetBooking() *BookingSilvermobi {
func (x *CreateBookingResponse) GetBooking() *Booking {
if x != nil {
return x.Booking
}
return nil
}
type UpdateBookingSilvermobiRequest struct {
type UpdateBookingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
BookingId string `protobuf:"bytes,1,opt,name=booking_id,json=bookingId,proto3" json:"booking_id,omitempty"`
Status BookingSilvermobiStatus `protobuf:"varint,2,opt,name=status,proto3,enum=BookingSilvermobiStatus" json:"status,omitempty"`
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
BookingId string `protobuf:"bytes,1,opt,name=booking_id,json=bookingId,proto3" json:"booking_id,omitempty"`
Status BookingStatus `protobuf:"varint,2,opt,name=status,proto3,enum=BookingStatus" json:"status,omitempty"`
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *UpdateBookingSilvermobiRequest) Reset() {
*x = UpdateBookingSilvermobiRequest{}
func (x *UpdateBookingRequest) Reset() {
*x = UpdateBookingRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -409,13 +409,13 @@ func (x *UpdateBookingSilvermobiRequest) Reset() {
}
}
func (x *UpdateBookingSilvermobiRequest) String() string {
func (x *UpdateBookingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateBookingSilvermobiRequest) ProtoMessage() {}
func (*UpdateBookingRequest) ProtoMessage() {}
func (x *UpdateBookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
func (x *UpdateBookingRequest) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -427,33 +427,33 @@ func (x *UpdateBookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use UpdateBookingSilvermobiRequest.ProtoReflect.Descriptor instead.
func (*UpdateBookingSilvermobiRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use UpdateBookingRequest.ProtoReflect.Descriptor instead.
func (*UpdateBookingRequest) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{7}
}
func (x *UpdateBookingSilvermobiRequest) GetBookingId() string {
func (x *UpdateBookingRequest) GetBookingId() string {
if x != nil {
return x.BookingId
}
return ""
}
func (x *UpdateBookingSilvermobiRequest) GetStatus() BookingSilvermobiStatus {
func (x *UpdateBookingRequest) GetStatus() BookingStatus {
if x != nil {
return x.Status
}
return BookingSilvermobiStatus_INITIATED
return BookingStatus_INITIATED
}
func (x *UpdateBookingSilvermobiRequest) GetMessage() string {
func (x *UpdateBookingRequest) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type UpdateBookingSilvermobiResponse struct {
type UpdateBookingResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -462,8 +462,8 @@ type UpdateBookingSilvermobiResponse struct {
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *UpdateBookingSilvermobiResponse) Reset() {
*x = UpdateBookingSilvermobiResponse{}
func (x *UpdateBookingResponse) Reset() {
*x = UpdateBookingResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -471,13 +471,13 @@ func (x *UpdateBookingSilvermobiResponse) Reset() {
}
}
func (x *UpdateBookingSilvermobiResponse) String() string {
func (x *UpdateBookingResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateBookingSilvermobiResponse) ProtoMessage() {}
func (*UpdateBookingResponse) ProtoMessage() {}
func (x *UpdateBookingSilvermobiResponse) ProtoReflect() protoreflect.Message {
func (x *UpdateBookingResponse) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -489,26 +489,26 @@ func (x *UpdateBookingSilvermobiResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use UpdateBookingSilvermobiResponse.ProtoReflect.Descriptor instead.
func (*UpdateBookingSilvermobiResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use UpdateBookingResponse.ProtoReflect.Descriptor instead.
func (*UpdateBookingResponse) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{8}
}
func (x *UpdateBookingSilvermobiResponse) GetSuccess() bool {
func (x *UpdateBookingResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *UpdateBookingSilvermobiResponse) GetMessage() string {
func (x *UpdateBookingResponse) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type GetBookingSilvermobiRequest struct {
type GetBookingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -516,8 +516,8 @@ type GetBookingSilvermobiRequest struct {
BookingId string `protobuf:"bytes,1,opt,name=booking_id,json=bookingId,proto3" json:"booking_id,omitempty"`
}
func (x *GetBookingSilvermobiRequest) Reset() {
*x = GetBookingSilvermobiRequest{}
func (x *GetBookingRequest) Reset() {
*x = GetBookingRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -525,13 +525,13 @@ func (x *GetBookingSilvermobiRequest) Reset() {
}
}
func (x *GetBookingSilvermobiRequest) String() string {
func (x *GetBookingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetBookingSilvermobiRequest) ProtoMessage() {}
func (*GetBookingRequest) ProtoMessage() {}
func (x *GetBookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
func (x *GetBookingRequest) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -543,28 +543,28 @@ func (x *GetBookingSilvermobiRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetBookingSilvermobiRequest.ProtoReflect.Descriptor instead.
func (*GetBookingSilvermobiRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use GetBookingRequest.ProtoReflect.Descriptor instead.
func (*GetBookingRequest) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{9}
}
func (x *GetBookingSilvermobiRequest) GetBookingId() string {
func (x *GetBookingRequest) GetBookingId() string {
if x != nil {
return x.BookingId
}
return ""
}
type GetBookingSilvermobiResponse struct {
type GetBookingResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Booking *BookingSilvermobi `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
Booking *Booking `protobuf:"bytes,1,opt,name=booking,proto3" json:"booking,omitempty"`
}
func (x *GetBookingSilvermobiResponse) Reset() {
*x = GetBookingSilvermobiResponse{}
func (x *GetBookingResponse) Reset() {
*x = GetBookingResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_solidarity_api_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -572,13 +572,13 @@ func (x *GetBookingSilvermobiResponse) Reset() {
}
}
func (x *GetBookingSilvermobiResponse) String() string {
func (x *GetBookingResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetBookingSilvermobiResponse) ProtoMessage() {}
func (*GetBookingResponse) ProtoMessage() {}
func (x *GetBookingSilvermobiResponse) ProtoReflect() protoreflect.Message {
func (x *GetBookingResponse) ProtoReflect() protoreflect.Message {
mi := &file_solidarity_api_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -590,12 +590,12 @@ func (x *GetBookingSilvermobiResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetBookingSilvermobiResponse.ProtoReflect.Descriptor instead.
func (*GetBookingSilvermobiResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use GetBookingResponse.ProtoReflect.Descriptor instead.
func (*GetBookingResponse) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{10}
}
func (x *GetBookingSilvermobiResponse) GetBooking() *BookingSilvermobi {
func (x *GetBookingResponse) GetBooking() *Booking {
if x != nil {
return x.Booking
}
@ -607,9 +607,9 @@ type GetBookingsByStatusRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Status BookingSilvermobiStatus `protobuf:"varint,1,opt,name=status,proto3,enum=BookingSilvermobiStatus" json:"status,omitempty"`
Type UserType `protobuf:"varint,2,opt,name=type,proto3,enum=UserType" json:"type,omitempty"`
UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Status BookingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=BookingStatus" json:"status,omitempty"`
Type UserType `protobuf:"varint,2,opt,name=type,proto3,enum=UserType" json:"type,omitempty"`
UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
}
func (x *GetBookingsByStatusRequest) Reset() {
@ -644,11 +644,11 @@ func (*GetBookingsByStatusRequest) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{11}
}
func (x *GetBookingsByStatusRequest) GetStatus() BookingSilvermobiStatus {
func (x *GetBookingsByStatusRequest) GetStatus() BookingStatus {
if x != nil {
return x.Status
}
return BookingSilvermobiStatus_INITIATED
return BookingStatus_INITIATED
}
func (x *GetBookingsByStatusRequest) GetType() UserType {
@ -772,7 +772,7 @@ type GetBookingsByStatusResponse struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Booking []*BookingSilvermobi `protobuf:"bytes,1,rep,name=booking,proto3" json:"booking,omitempty"`
Booking []*Booking `protobuf:"bytes,1,rep,name=booking,proto3" json:"booking,omitempty"`
}
func (x *GetBookingsByStatusResponse) Reset() {
@ -807,7 +807,7 @@ func (*GetBookingsByStatusResponse) Descriptor() ([]byte, []int) {
return file_solidarity_api_proto_rawDescGZIP(), []int{14}
}
func (x *GetBookingsByStatusResponse) GetBooking() []*BookingSilvermobi {
func (x *GetBookingsByStatusResponse) GetBooking() []*Booking {
if x != nil {
return x.Booking
}
@ -860,44 +860,37 @@ var file_solidarity_api_proto_rawDesc = []byte{
0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22,
0x55, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x33, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76,
0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x62,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x4f, 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62,
0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x62, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x42, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x07,
0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x8b, 0x01, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d,
0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f,
0x41, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22,
0x77, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6b, 0x69,
0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18,
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x4b, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x32, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x55, 0x0a, 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3c, 0x0a, 0x1b,
0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72,
0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x62,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x22, 0x4c, 0x0a, 0x1c, 0x47, 0x65,
0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f,
0x62, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x62, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x42, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52,
0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x22, 0x86, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x53, 0x74, 0x61, 0x74, 0x75,
0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x12, 0x47, 0x65, 0x74,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x22, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x22, 0x7c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x0e, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79,
0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
@ -915,62 +908,55 @@ var file_solidarity_api_proto_rawDesc = []byte{
0x12, 0x37, 0x0a, 0x0f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x6a, 0x6f, 0x75, 0x72, 0x6e,
0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x72, 0x69, 0x76,
0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x52, 0x0e, 0x64, 0x72, 0x69, 0x76, 0x65,
0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x22, 0x4b, 0x0a, 0x1b, 0x47, 0x65, 0x74,
0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x22, 0x41, 0x0a, 0x1b, 0x47, 0x65, 0x74,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x07, 0x62,
0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x32, 0xcc, 0x05, 0x0a, 0x11, 0x53, 0x6f, 0x6c, 0x69, 0x64,
0x61, 0x72, 0x69, 0x74, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x1e,
0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72,
0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1c,
0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76,
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x1d, 0x2e, 0x44,
0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74,
0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x61, 0x0a,
0x1f, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75,
0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73,
0x12, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61,
0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a,
0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69,
0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x5e, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x12, 0x1f, 0x2e, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65,
0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76,
0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x5e, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x12, 0x1f, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65,
0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76,
0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x55, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69,
0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x12, 0x1c, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x53, 0x69, 0x6c, 0x76, 0x65, 0x72, 0x6d, 0x6f, 0x62, 0x69, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x42, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b,
0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x47, 0x65,
0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x44,
0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e,
0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f,
0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x43, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72,
0x54, 0x72, 0x69, 0x70, 0x12, 0x15, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72,
0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x61,
0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f,
0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c,
0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74,
0x79, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x42, 0x6f, 0x6f, 0x6b,
0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x32, 0xf2, 0x04, 0x0a,
0x11, 0x53, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x12, 0x5f, 0x0a, 0x1e, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52,
0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69,
0x74, 0x69, 0x65, 0x73, 0x12, 0x1c, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x52, 0x65, 0x67,
0x75, 0x6c, 0x61, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69,
0x65, 0x73, 0x1a, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x69, 0x6c,
0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x1f, 0x53, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72,
0x50, 0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69,
0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x50,
0x75, 0x6e, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c,
0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x1d, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76,
0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x16, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0a, 0x47, 0x65,
0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f,
0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47,
0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e,
0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x47, 0x65, 0x74,
0x42, 0x6f, 0x6f, 0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f,
0x6b, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x44, 0x72, 0x69, 0x76, 0x65,
0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e, 0x44, 0x72, 0x69, 0x76,
0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x17, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65,
0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x10,
0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70,
0x12, 0x15, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x65, 0x6e,
0x67, 0x65, 0x72, 0x54, 0x72, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e,
0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f,
0x72, 0x6d, 0x2f, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x72, 0x69, 0x74, 0x79, 0x2d, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x72,
0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -987,33 +973,33 @@ func file_solidarity_api_proto_rawDescGZIP() []byte {
var file_solidarity_api_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_solidarity_api_proto_goTypes = []interface{}{
(*PassengerTripRequest)(nil), // 0: PassengerTripRequest
(*DriverRegularAvailabilities)(nil), // 1: DriverRegularAvailabilities
(*DriverPunctualAvailabilities)(nil), // 2: DriverPunctualAvailabilities
(*PassengerTripResponse)(nil), // 3: PassengerTripResponse
(*DriverAvailabilitiesResponse)(nil), // 4: DriverAvailabilitiesResponse
(*CreateBookingSilvermobiRequest)(nil), // 5: CreateBookingSilvermobiRequest
(*CreateBookingSilvermobiResponse)(nil), // 6: CreateBookingSilvermobiResponse
(*UpdateBookingSilvermobiRequest)(nil), // 7: UpdateBookingSilvermobiRequest
(*UpdateBookingSilvermobiResponse)(nil), // 8: UpdateBookingSilvermobiResponse
(*GetBookingSilvermobiRequest)(nil), // 9: GetBookingSilvermobiRequest
(*GetBookingSilvermobiResponse)(nil), // 10: GetBookingSilvermobiResponse
(*GetBookingsByStatusRequest)(nil), // 11: GetBookingsByStatusRequest
(*DriverJourneysRequest)(nil), // 12: DriverJourneysRequest
(*DriverJourneysResponse)(nil), // 13: DriverJourneysResponse
(*GetBookingsByStatusResponse)(nil), // 14: GetBookingsByStatusResponse
(*User)(nil), // 15: User
(*Preferences)(nil), // 16: Preferences
(*DriverRequest)(nil), // 17: DriverRequest
(*RegularAvailabilitySlot)(nil), // 18: RegularAvailabilitySlot
(*PunctualAvailabilitySlot)(nil), // 19: PunctualAvailabilitySlot
(*BookingSilvermobiRequest)(nil), // 20: BookingSilvermobiRequest
(*BookingSilvermobi)(nil), // 21: BookingSilvermobi
(BookingSilvermobiStatus)(0), // 22: BookingSilvermobiStatus
(UserType)(0), // 23: UserType
(*Feature)(nil), // 24: Feature
(*timestamp.Timestamp)(nil), // 25: google.protobuf.Timestamp
(*DriverJourney)(nil), // 26: DriverJourney
(*PassengerTripRequest)(nil), // 0: PassengerTripRequest
(*DriverRegularAvailabilities)(nil), // 1: DriverRegularAvailabilities
(*DriverPunctualAvailabilities)(nil), // 2: DriverPunctualAvailabilities
(*PassengerTripResponse)(nil), // 3: PassengerTripResponse
(*DriverAvailabilitiesResponse)(nil), // 4: DriverAvailabilitiesResponse
(*CreateBookingRequest)(nil), // 5: CreateBookingRequest
(*CreateBookingResponse)(nil), // 6: CreateBookingResponse
(*UpdateBookingRequest)(nil), // 7: UpdateBookingRequest
(*UpdateBookingResponse)(nil), // 8: UpdateBookingResponse
(*GetBookingRequest)(nil), // 9: GetBookingRequest
(*GetBookingResponse)(nil), // 10: GetBookingResponse
(*GetBookingsByStatusRequest)(nil), // 11: GetBookingsByStatusRequest
(*DriverJourneysRequest)(nil), // 12: DriverJourneysRequest
(*DriverJourneysResponse)(nil), // 13: DriverJourneysResponse
(*GetBookingsByStatusResponse)(nil), // 14: GetBookingsByStatusResponse
(*User)(nil), // 15: User
(*Preferences)(nil), // 16: Preferences
(*DriverRequest)(nil), // 17: DriverRequest
(*RegularAvailabilitySlot)(nil), // 18: RegularAvailabilitySlot
(*PunctualAvailabilitySlot)(nil), // 19: PunctualAvailabilitySlot
(*BookingRequest)(nil), // 20: BookingRequest
(*Booking)(nil), // 21: Booking
(BookingStatus)(0), // 22: BookingStatus
(UserType)(0), // 23: UserType
(*Feature)(nil), // 24: Feature
(*timestamp.Timestamp)(nil), // 25: google.protobuf.Timestamp
(*DriverJourney)(nil), // 26: DriverJourney
}
var file_solidarity_api_proto_depIdxs = []int32{
15, // 0: PassengerTripRequest.passenger:type_name -> User
@ -1022,29 +1008,29 @@ var file_solidarity_api_proto_depIdxs = []int32{
18, // 3: DriverRegularAvailabilities.driver_availabilities:type_name -> RegularAvailabilitySlot
17, // 4: DriverPunctualAvailabilities.driver_request:type_name -> DriverRequest
19, // 5: DriverPunctualAvailabilities.driver_availabilities:type_name -> PunctualAvailabilitySlot
20, // 6: CreateBookingSilvermobiRequest.booking:type_name -> BookingSilvermobiRequest
21, // 7: CreateBookingSilvermobiResponse.booking:type_name -> BookingSilvermobi
22, // 8: UpdateBookingSilvermobiRequest.status:type_name -> BookingSilvermobiStatus
21, // 9: GetBookingSilvermobiResponse.booking:type_name -> BookingSilvermobi
22, // 10: GetBookingsByStatusRequest.status:type_name -> BookingSilvermobiStatus
20, // 6: CreateBookingRequest.booking:type_name -> BookingRequest
21, // 7: CreateBookingResponse.booking:type_name -> Booking
22, // 8: UpdateBookingRequest.status:type_name -> BookingStatus
21, // 9: GetBookingResponse.booking:type_name -> Booking
22, // 10: GetBookingsByStatusRequest.status:type_name -> BookingStatus
23, // 11: GetBookingsByStatusRequest.type:type_name -> UserType
24, // 12: DriverJourneysRequest.departure:type_name -> Feature
25, // 13: DriverJourneysRequest.departure_date:type_name -> google.protobuf.Timestamp
26, // 14: DriverJourneysResponse.driver_journeys:type_name -> DriverJourney
21, // 15: GetBookingsByStatusResponse.booking:type_name -> BookingSilvermobi
21, // 15: GetBookingsByStatusResponse.booking:type_name -> Booking
1, // 16: SolidarityService.SetDriverRegularAvailabilities:input_type -> DriverRegularAvailabilities
2, // 17: SolidarityService.SetDriverPunctualAvailabilities:input_type -> DriverPunctualAvailabilities
5, // 18: SolidarityService.CreateBookingSilvermobi:input_type -> CreateBookingSilvermobiRequest
7, // 19: SolidarityService.UpdateBookingSilvermobi:input_type -> UpdateBookingSilvermobiRequest
9, // 20: SolidarityService.GetBookingSilvermobi:input_type -> GetBookingSilvermobiRequest
5, // 18: SolidarityService.CreateBooking:input_type -> CreateBookingRequest
7, // 19: SolidarityService.UpdateBooking:input_type -> UpdateBookingRequest
9, // 20: SolidarityService.GetBooking:input_type -> GetBookingRequest
11, // 21: SolidarityService.GetBookingsByStatus:input_type -> GetBookingsByStatusRequest
12, // 22: SolidarityService.DriverJourneys:input_type -> DriverJourneysRequest
0, // 23: SolidarityService.SetPassengerTrip:input_type -> PassengerTripRequest
4, // 24: SolidarityService.SetDriverRegularAvailabilities:output_type -> DriverAvailabilitiesResponse
4, // 25: SolidarityService.SetDriverPunctualAvailabilities:output_type -> DriverAvailabilitiesResponse
6, // 26: SolidarityService.CreateBookingSilvermobi:output_type -> CreateBookingSilvermobiResponse
8, // 27: SolidarityService.UpdateBookingSilvermobi:output_type -> UpdateBookingSilvermobiResponse
10, // 28: SolidarityService.GetBookingSilvermobi:output_type -> GetBookingSilvermobiResponse
6, // 26: SolidarityService.CreateBooking:output_type -> CreateBookingResponse
8, // 27: SolidarityService.UpdateBooking:output_type -> UpdateBookingResponse
10, // 28: SolidarityService.GetBooking:output_type -> GetBookingResponse
14, // 29: SolidarityService.GetBookingsByStatus:output_type -> GetBookingsByStatusResponse
13, // 30: SolidarityService.DriverJourneys:output_type -> DriverJourneysResponse
3, // 31: SolidarityService.SetPassengerTrip:output_type -> PassengerTripResponse
@ -1123,7 +1109,7 @@ func file_solidarity_api_proto_init() {
}
}
file_solidarity_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateBookingSilvermobiRequest); i {
switch v := v.(*CreateBookingRequest); i {
case 0:
return &v.state
case 1:
@ -1135,7 +1121,7 @@ func file_solidarity_api_proto_init() {
}
}
file_solidarity_api_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateBookingSilvermobiResponse); i {
switch v := v.(*CreateBookingResponse); i {
case 0:
return &v.state
case 1:
@ -1147,7 +1133,7 @@ func file_solidarity_api_proto_init() {
}
}
file_solidarity_api_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateBookingSilvermobiRequest); i {
switch v := v.(*UpdateBookingRequest); i {
case 0:
return &v.state
case 1:
@ -1159,7 +1145,7 @@ func file_solidarity_api_proto_init() {
}
}
file_solidarity_api_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateBookingSilvermobiResponse); i {
switch v := v.(*UpdateBookingResponse); i {
case 0:
return &v.state
case 1:
@ -1171,7 +1157,7 @@ func file_solidarity_api_proto_init() {
}
}
file_solidarity_api_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBookingSilvermobiRequest); i {
switch v := v.(*GetBookingRequest); i {
case 0:
return &v.state
case 1:
@ -1183,7 +1169,7 @@ func file_solidarity_api_proto_init() {
}
}
file_solidarity_api_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBookingSilvermobiResponse); i {
switch v := v.(*GetBookingResponse); i {
case 0:
return &v.state
case 1:

View File

@ -6,9 +6,9 @@ import "solidarity-api-types.proto";
service SolidarityService {
rpc SetDriverRegularAvailabilities(DriverRegularAvailabilities) returns (DriverAvailabilitiesResponse) {}
rpc SetDriverPunctualAvailabilities(DriverPunctualAvailabilities) returns (DriverAvailabilitiesResponse) {}
rpc CreateBookingSilvermobi(CreateBookingSilvermobiRequest) returns (CreateBookingSilvermobiResponse) {}
rpc UpdateBookingSilvermobi(UpdateBookingSilvermobiRequest) returns (UpdateBookingSilvermobiResponse) {}
rpc GetBookingSilvermobi(GetBookingSilvermobiRequest) returns (GetBookingSilvermobiResponse) {}
rpc CreateBooking(CreateBookingRequest) returns (CreateBookingResponse) {}
rpc UpdateBooking(UpdateBookingRequest) returns (UpdateBookingResponse) {}
rpc GetBooking(GetBookingRequest) returns (GetBookingResponse) {}
rpc GetBookingsByStatus(GetBookingsByStatusRequest) returns (GetBookingsByStatusResponse) {}
rpc DriverJourneys(DriverJourneysRequest) returns (DriverJourneysResponse) {}
rpc SetPassengerTrip(PassengerTripRequest) returns (PassengerTripResponse) {}
@ -41,35 +41,35 @@ message DriverAvailabilitiesResponse {
string message = 2;
}
message CreateBookingSilvermobiRequest {
BookingSilvermobiRequest booking = 1;
message CreateBookingRequest {
BookingRequest booking = 1;
}
message CreateBookingSilvermobiResponse {
BookingSilvermobi booking = 1;
message CreateBookingResponse {
Booking booking = 1;
}
message UpdateBookingSilvermobiRequest {
message UpdateBookingRequest {
string booking_id = 1;
BookingSilvermobiStatus status = 2;
BookingStatus status = 2;
string message = 3;
}
message UpdateBookingSilvermobiResponse {
message UpdateBookingResponse {
bool success = 1;
string message = 2;
}
message GetBookingSilvermobiRequest {
message GetBookingRequest {
string booking_id = 1;
}
message GetBookingSilvermobiResponse {
BookingSilvermobi booking = 1;
message GetBookingResponse {
Booking booking = 1;
}
message GetBookingsByStatusRequest{
BookingSilvermobiStatus status = 1;
BookingStatus status = 1;
UserType type = 2;
string user_id = 3;
}
@ -84,5 +84,5 @@ message DriverJourneysResponse {
}
message GetBookingsByStatusResponse{
repeated BookingSilvermobi booking = 1;
repeated Booking booking = 1;
}

View File

@ -21,9 +21,9 @@ const _ = grpc.SupportPackageIsVersion9
const (
SolidarityService_SetDriverRegularAvailabilities_FullMethodName = "/SolidarityService/SetDriverRegularAvailabilities"
SolidarityService_SetDriverPunctualAvailabilities_FullMethodName = "/SolidarityService/SetDriverPunctualAvailabilities"
SolidarityService_CreateBookingSilvermobi_FullMethodName = "/SolidarityService/CreateBookingSilvermobi"
SolidarityService_UpdateBookingSilvermobi_FullMethodName = "/SolidarityService/UpdateBookingSilvermobi"
SolidarityService_GetBookingSilvermobi_FullMethodName = "/SolidarityService/GetBookingSilvermobi"
SolidarityService_CreateBooking_FullMethodName = "/SolidarityService/CreateBooking"
SolidarityService_UpdateBooking_FullMethodName = "/SolidarityService/UpdateBooking"
SolidarityService_GetBooking_FullMethodName = "/SolidarityService/GetBooking"
SolidarityService_GetBookingsByStatus_FullMethodName = "/SolidarityService/GetBookingsByStatus"
SolidarityService_DriverJourneys_FullMethodName = "/SolidarityService/DriverJourneys"
SolidarityService_SetPassengerTrip_FullMethodName = "/SolidarityService/SetPassengerTrip"
@ -35,9 +35,9 @@ const (
type SolidarityServiceClient interface {
SetDriverRegularAvailabilities(ctx context.Context, in *DriverRegularAvailabilities, opts ...grpc.CallOption) (*DriverAvailabilitiesResponse, error)
SetDriverPunctualAvailabilities(ctx context.Context, in *DriverPunctualAvailabilities, opts ...grpc.CallOption) (*DriverAvailabilitiesResponse, error)
CreateBookingSilvermobi(ctx context.Context, in *CreateBookingSilvermobiRequest, opts ...grpc.CallOption) (*CreateBookingSilvermobiResponse, error)
UpdateBookingSilvermobi(ctx context.Context, in *UpdateBookingSilvermobiRequest, opts ...grpc.CallOption) (*UpdateBookingSilvermobiResponse, error)
GetBookingSilvermobi(ctx context.Context, in *GetBookingSilvermobiRequest, opts ...grpc.CallOption) (*GetBookingSilvermobiResponse, error)
CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error)
UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error)
GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error)
GetBookingsByStatus(ctx context.Context, in *GetBookingsByStatusRequest, opts ...grpc.CallOption) (*GetBookingsByStatusResponse, error)
DriverJourneys(ctx context.Context, in *DriverJourneysRequest, opts ...grpc.CallOption) (*DriverJourneysResponse, error)
SetPassengerTrip(ctx context.Context, in *PassengerTripRequest, opts ...grpc.CallOption) (*PassengerTripResponse, error)
@ -71,30 +71,30 @@ func (c *solidarityServiceClient) SetDriverPunctualAvailabilities(ctx context.Co
return out, nil
}
func (c *solidarityServiceClient) CreateBookingSilvermobi(ctx context.Context, in *CreateBookingSilvermobiRequest, opts ...grpc.CallOption) (*CreateBookingSilvermobiResponse, error) {
func (c *solidarityServiceClient) CreateBooking(ctx context.Context, in *CreateBookingRequest, opts ...grpc.CallOption) (*CreateBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateBookingSilvermobiResponse)
err := c.cc.Invoke(ctx, SolidarityService_CreateBookingSilvermobi_FullMethodName, in, out, cOpts...)
out := new(CreateBookingResponse)
err := c.cc.Invoke(ctx, SolidarityService_CreateBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityServiceClient) UpdateBookingSilvermobi(ctx context.Context, in *UpdateBookingSilvermobiRequest, opts ...grpc.CallOption) (*UpdateBookingSilvermobiResponse, error) {
func (c *solidarityServiceClient) UpdateBooking(ctx context.Context, in *UpdateBookingRequest, opts ...grpc.CallOption) (*UpdateBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateBookingSilvermobiResponse)
err := c.cc.Invoke(ctx, SolidarityService_UpdateBookingSilvermobi_FullMethodName, in, out, cOpts...)
out := new(UpdateBookingResponse)
err := c.cc.Invoke(ctx, SolidarityService_UpdateBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *solidarityServiceClient) GetBookingSilvermobi(ctx context.Context, in *GetBookingSilvermobiRequest, opts ...grpc.CallOption) (*GetBookingSilvermobiResponse, error) {
func (c *solidarityServiceClient) GetBooking(ctx context.Context, in *GetBookingRequest, opts ...grpc.CallOption) (*GetBookingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetBookingSilvermobiResponse)
err := c.cc.Invoke(ctx, SolidarityService_GetBookingSilvermobi_FullMethodName, in, out, cOpts...)
out := new(GetBookingResponse)
err := c.cc.Invoke(ctx, SolidarityService_GetBooking_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@ -137,9 +137,9 @@ func (c *solidarityServiceClient) SetPassengerTrip(ctx context.Context, in *Pass
type SolidarityServiceServer interface {
SetDriverRegularAvailabilities(context.Context, *DriverRegularAvailabilities) (*DriverAvailabilitiesResponse, error)
SetDriverPunctualAvailabilities(context.Context, *DriverPunctualAvailabilities) (*DriverAvailabilitiesResponse, error)
CreateBookingSilvermobi(context.Context, *CreateBookingSilvermobiRequest) (*CreateBookingSilvermobiResponse, error)
UpdateBookingSilvermobi(context.Context, *UpdateBookingSilvermobiRequest) (*UpdateBookingSilvermobiResponse, error)
GetBookingSilvermobi(context.Context, *GetBookingSilvermobiRequest) (*GetBookingSilvermobiResponse, error)
CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error)
UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error)
GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error)
GetBookingsByStatus(context.Context, *GetBookingsByStatusRequest) (*GetBookingsByStatusResponse, error)
DriverJourneys(context.Context, *DriverJourneysRequest) (*DriverJourneysResponse, error)
SetPassengerTrip(context.Context, *PassengerTripRequest) (*PassengerTripResponse, error)
@ -159,14 +159,14 @@ func (UnimplementedSolidarityServiceServer) SetDriverRegularAvailabilities(conte
func (UnimplementedSolidarityServiceServer) SetDriverPunctualAvailabilities(context.Context, *DriverPunctualAvailabilities) (*DriverAvailabilitiesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetDriverPunctualAvailabilities not implemented")
}
func (UnimplementedSolidarityServiceServer) CreateBookingSilvermobi(context.Context, *CreateBookingSilvermobiRequest) (*CreateBookingSilvermobiResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateBookingSilvermobi not implemented")
func (UnimplementedSolidarityServiceServer) CreateBooking(context.Context, *CreateBookingRequest) (*CreateBookingResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateBooking not implemented")
}
func (UnimplementedSolidarityServiceServer) UpdateBookingSilvermobi(context.Context, *UpdateBookingSilvermobiRequest) (*UpdateBookingSilvermobiResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateBookingSilvermobi not implemented")
func (UnimplementedSolidarityServiceServer) UpdateBooking(context.Context, *UpdateBookingRequest) (*UpdateBookingResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateBooking not implemented")
}
func (UnimplementedSolidarityServiceServer) GetBookingSilvermobi(context.Context, *GetBookingSilvermobiRequest) (*GetBookingSilvermobiResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBookingSilvermobi not implemented")
func (UnimplementedSolidarityServiceServer) GetBooking(context.Context, *GetBookingRequest) (*GetBookingResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBooking not implemented")
}
func (UnimplementedSolidarityServiceServer) GetBookingsByStatus(context.Context, *GetBookingsByStatusRequest) (*GetBookingsByStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBookingsByStatus not implemented")
@ -234,56 +234,56 @@ func _SolidarityService_SetDriverPunctualAvailabilities_Handler(srv interface{},
return interceptor(ctx, in, info, handler)
}
func _SolidarityService_CreateBookingSilvermobi_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateBookingSilvermobiRequest)
func _SolidarityService_CreateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateBookingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityServiceServer).CreateBookingSilvermobi(ctx, in)
return srv.(SolidarityServiceServer).CreateBooking(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityService_CreateBookingSilvermobi_FullMethodName,
FullMethod: SolidarityService_CreateBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityServiceServer).CreateBookingSilvermobi(ctx, req.(*CreateBookingSilvermobiRequest))
return srv.(SolidarityServiceServer).CreateBooking(ctx, req.(*CreateBookingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityService_UpdateBookingSilvermobi_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBookingSilvermobiRequest)
func _SolidarityService_UpdateBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBookingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityServiceServer).UpdateBookingSilvermobi(ctx, in)
return srv.(SolidarityServiceServer).UpdateBooking(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityService_UpdateBookingSilvermobi_FullMethodName,
FullMethod: SolidarityService_UpdateBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityServiceServer).UpdateBookingSilvermobi(ctx, req.(*UpdateBookingSilvermobiRequest))
return srv.(SolidarityServiceServer).UpdateBooking(ctx, req.(*UpdateBookingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SolidarityService_GetBookingSilvermobi_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBookingSilvermobiRequest)
func _SolidarityService_GetBooking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBookingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SolidarityServiceServer).GetBookingSilvermobi(ctx, in)
return srv.(SolidarityServiceServer).GetBooking(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SolidarityService_GetBookingSilvermobi_FullMethodName,
FullMethod: SolidarityService_GetBooking_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SolidarityServiceServer).GetBookingSilvermobi(ctx, req.(*GetBookingSilvermobiRequest))
return srv.(SolidarityServiceServer).GetBooking(ctx, req.(*GetBookingRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -358,16 +358,16 @@ var SolidarityService_ServiceDesc = grpc.ServiceDesc{
Handler: _SolidarityService_SetDriverPunctualAvailabilities_Handler,
},
{
MethodName: "CreateBookingSilvermobi",
Handler: _SolidarityService_CreateBookingSilvermobi_Handler,
MethodName: "CreateBooking",
Handler: _SolidarityService_CreateBooking_Handler,
},
{
MethodName: "UpdateBookingSilvermobi",
Handler: _SolidarityService_UpdateBookingSilvermobi_Handler,
MethodName: "UpdateBooking",
Handler: _SolidarityService_UpdateBooking_Handler,
},
{
MethodName: "GetBookingSilvermobi",
Handler: _SolidarityService_GetBookingSilvermobi_Handler,
MethodName: "GetBooking",
Handler: _SolidarityService_GetBooking_Handler,
},
{
MethodName: "GetBookingsByStatus",

View File

@ -2,32 +2,48 @@ package grpcserver
import (
"context"
"strings"
"git.coopgo.io/coopgo-apps/silvermobi/models"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"strings"
)
func (s SilvermobiGRPCService) GetAccountInfo(ctx context.Context, req *grpcproto.AccountInfoRequest) (res *grpcproto.AccountInfoResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) GetAccountInfo(ctx context.Context,
req *grpcproto.AccountInfoRequest) (res *grpcproto.AccountInfoResponse, err error) {
var (
md metadata.MD
account *models.Account
authHeader []string
ok bool
)
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
account, err := s.Handler.GetAccountInfos(context.Background(), id)
if account, err = s.Handler.GetAccountInfos(context.Background(), id); err != nil {
return nil, err
}
log.Info().
Str("ID", account.ID).
Msg("GetAccountInfo")
if err != nil {
return nil, err
}
return &grpcproto.AccountInfoResponse{
FirstName: account.FirstName,
LastName: account.LastName,

View File

@ -8,13 +8,15 @@ import (
"github.com/rs/zerolog/log"
)
func (s SilvermobiGRPCService) AuthLogin(ctx context.Context, req *grpcproto.AuthLoginRequest) (res *grpcproto.AuthLoginResponse, err error) {
func (s SilvermobiGRPCService) AuthLogin(ctx context.Context,
req *grpcproto.AuthLoginRequest) (res *grpcproto.AuthLoginResponse, err error) {
var jwt string
log.Info().
Str("username", req.Username).
Msg("AuthLogin")
jwt, err := s.Handler.Login(ctx, req.Username, req.Password)
if err != nil {
if jwt, err = s.Handler.Login(ctx, req.Username, req.Password); err != nil {
log.Error().
Err(err).
Str("username", req.Username).
@ -28,13 +30,16 @@ func (s SilvermobiGRPCService) AuthLogin(ctx context.Context, req *grpcproto.Aut
}, nil
}
func (s SilvermobiGRPCService) AuthRegister(ctx context.Context, req *grpcproto.AuthRegisterRequest) (res *grpcproto.AuthRegisterResponse, err error) {
func (s SilvermobiGRPCService) AuthRegister(ctx context.Context,
req *grpcproto.AuthRegisterRequest) (res *grpcproto.AuthRegisterResponse, err error) {
var jwt string
log.Info().
Str("username", req.Email).
Msg("AuthRegister")
jwt, err := s.Handler.Register(ctx, req.Email, req.Password, req.Email, req.PhoneNumber, req.FirstName, req.LastName)
if err != nil {
if jwt, err = s.Handler.Register(ctx, req.Email, req.Password,
req.Email, req.PhoneNumber, req.FirstName, req.LastName); err != nil {
log.Error().Err(err).Msg("AuthRegister failed")
return nil, errors.New("could not register user")
}

View File

@ -2,44 +2,57 @@ package grpcserver
import (
"context"
"strings"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"strings"
)
func (s SilvermobiGRPCService) PutFirebaseToken(ctx context.Context, req *grpcproto.FirebaseTokenRequest) (resp *grpcproto.FirebaseTokenResponse, err error) {
func (s SilvermobiGRPCService) PutFirebaseToken(ctx context.Context,
req *grpcproto.FirebaseTokenRequest) (resp *grpcproto.FirebaseTokenResponse, err error) {
var (
ok bool
md metadata.MD
authHeader []string
)
if req.Token == "" || req.DevicePlatform == "" {
return &grpcproto.FirebaseTokenResponse{
Result: false,
}, nil
}
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return &grpcproto.FirebaseTokenResponse{
Result: false,
}, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return &grpcproto.FirebaseTokenResponse{
Result: false,
}, status.Errorf(codes.Unauthenticated, "Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
log.Info().
Str("User ID", id).
Msg("PutFirebaseToken")
err = s.Handler.PutFirebase(context.Background(), id, req.Token, req.DevicePlatform)
if err != nil {
if err = s.Handler.PutFirebase(context.Background(), id, req.Token, req.DevicePlatform); err != nil {
return &grpcproto.FirebaseTokenResponse{
Result: false,
}, status.Errorf(codes.Unknown, "Database error")
}
return &grpcproto.FirebaseTokenResponse{
Result: true,
}, nil

View File

@ -2,26 +2,30 @@ package grpcserver
import (
"context"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/rs/zerolog/log"
)
func (s SilvermobiGRPCService) ForgetAccount(ctx context.Context, req *grpcproto.ForgetAccountRequest) (res *grpcproto.ForgetAccountResponse, err error) {
func (s SilvermobiGRPCService) ForgetAccount(ctx context.Context,
req *grpcproto.ForgetAccountRequest) (res *grpcproto.ForgetAccountResponse, err error) {
log.Info().
Str("username", req.Username).
Str("namespace", req.Namespace).
Msg("ForgetAccount")
response, access_code := s.Handler.ForgetAccount(ctx, req.Username, req.Namespace)
response, accessCode := s.Handler.ForgetAccount(ctx, req.Username, req.Namespace)
if response == true {
return &grpcproto.ForgetAccountResponse{
Response: true,
AccessCode: access_code,
}, nil
} else {
return &grpcproto.ForgetAccountResponse{
Response: false,
AccessCode: "",
AccessCode: accessCode,
}, nil
}
return &grpcproto.ForgetAccountResponse{
Response: false,
AccessCode: "",
}, nil
}

View File

@ -2,47 +2,46 @@ package grpcserver
import (
"context"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"git.coopgo.io/coopgo-platform/routing-service"
"github.com/google/uuid"
"github.com/paulmach/orb/geojson"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"io"
)
func (s SilvermobiGRPCService) GeoAutocomplete(ctx context.Context, in *grpcproto.GeoAutocompleteRequest) (resp *grpcproto.GeoAutocompleteResponse, err error) {
func (s SilvermobiGRPCService) GeoAutocomplete(ctx context.Context,
in *grpcproto.GeoAutocompleteRequest) (resp *grpcproto.GeoAutocompleteResponse, err error) {
var (
results *geojson.FeatureCollection
rawFc []byte
)
log.Info().
Str("text", in.Text).
Msg("GeoAutocompleteRequest")
requestid := uuid.NewString()
log.Debug().Str("requestid", requestid).Msg("GRPC GeoAutocomplete start")
if err == io.EOF {
log.Debug().Str("requestid", requestid).Msg("GRPC GeoAutocomplete EOF")
requestID := uuid.NewString()
log.Debug().Str("requestID", requestID).Msg("GRPC GeoAutocomplete start")
if results, err = s.Handler.GeoAutocomplete(in.Text); err != nil {
log.Error().Str("requestID", requestID).Err(err).Msg("GRPC GeoAutocomplete geocoding error")
return nil, err
}
if err != nil {
log.Error().Str("requestid", requestid).Err(err).Msg("GRPC GeoAutocomplete other error")
return nil, err
}
results, err := s.Handler.GeoAutocomplete(in.Text, in.Lat, in.Lon)
if err != nil {
log.Error().Str("requestid", requestid).Err(err).Msg("GRPC GeoAutocomplete geocoding error")
return nil, err
}
rawfc, err := results.MarshalJSON()
if err != nil {
log.Error().Str("requestid", requestid).Err(err).Msg("GRPC GeoAutocomplete protocol buffer conversion error")
if rawFc, err = results.MarshalJSON(); err != nil {
log.Error().Str("requestID", requestID).Err(err).Msg("GRPC GeoAutocomplete " +
"protocol buffer conversion error")
return nil, err
}
resp = &grpcproto.GeoAutocompleteResponse{
FeatureCollection: &grpcproto.GeoAutocompleteResponse_FeatureCollectionRaw{
FeatureCollectionRaw: string(rawfc),
FeatureCollectionRaw: string(rawFc),
},
}
@ -50,50 +49,58 @@ func (s SilvermobiGRPCService) GeoAutocomplete(ctx context.Context, in *grpcprot
}
func (s SilvermobiGRPCService) GeoRoute(ctx context.Context, req *grpcproto.GeoRouteRequest) (*grpcproto.GeoRouteResponse, error) {
locations_raw, ok := req.Locations.(*grpcproto.GeoRouteRequest_LocationsRaw)
func (s SilvermobiGRPCService) GeoRoute(ctx context.Context,
req *grpcproto.GeoRouteRequest) (*grpcproto.GeoRouteResponse, error) {
locationsRaw, ok := req.Locations.(*grpcproto.GeoRouteRequest_LocationsRaw)
var route *routing.Route
if !ok {
return nil, status.Errorf(codes.InvalidArgument, "could not read departure")
}
locations, err := geojson.UnmarshalFeatureCollection([]byte(locations_raw.LocationsRaw))
locations, err := geojson.UnmarshalFeatureCollection([]byte(locationsRaw.LocationsRaw))
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
route, err := s.Handler.GeoRoute(*locations)
if err != nil {
if route, err = s.Handler.GeoRoute(*locations); err != nil {
return nil, err
}
return &grpcproto.GeoRouteResponse{
Polyline: route.Polyline.String(),
Polyline: route.Summary.Polyline,
}, nil
}
func (s SilvermobiGRPCService) GeoRouteWithReturn(ctx context.Context, req *grpcproto.GeoRouteWithReturnRequest) (*grpcproto.GeoRouteWithReturnResponse, error) {
locations_raw, ok := req.Locations.(*grpcproto.GeoRouteWithReturnRequest_LocationsRaw)
func (s SilvermobiGRPCService) GeoRouteWithReturn(ctx context.Context,
req *grpcproto.GeoRouteWithReturnRequest) (*grpcproto.GeoRouteWithReturnResponse, error) {
var (
route, returnRoute *routing.Route
)
locationsRaw, ok := req.Locations.(*grpcproto.GeoRouteWithReturnRequest_LocationsRaw)
if !ok {
return nil, status.Errorf(codes.InvalidArgument, "could not read departure")
}
locations, err := geojson.UnmarshalFeatureCollection([]byte(locations_raw.LocationsRaw))
locations, err := geojson.UnmarshalFeatureCollection([]byte(locationsRaw.LocationsRaw))
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
route, err := s.Handler.GeoRoute(*locations)
if err != nil {
if route, err = s.Handler.GeoRoute(*locations); err != nil {
return nil, err
}
return_route, err := s.Handler.GeoReturnRoute(*locations)
if err != nil {
if returnRoute, err = s.Handler.GeoReturnRoute(*locations); err != nil {
return nil, err
}
return &grpcproto.GeoRouteWithReturnResponse{
Polyline: route.Polyline.String(),
ReturnPolyline: return_route.Polyline.String(),
Polyline: route.Summary.Polyline,
ReturnPolyline: returnRoute.Summary.Polyline,
}, nil
}

View File

@ -4,28 +4,38 @@ import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"strings"
"time"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"strings"
"time"
)
func (s SilvermobiGRPCService) SetPhoneNumber(ctx context.Context, req *grpcproto.SetPhoneNumberRequest) (res *grpcproto.SetPhoneNumberResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) SetPhoneNumber(ctx context.Context,
req *grpcproto.SetPhoneNumberRequest) (res *grpcproto.SetPhoneNumberResponse, err error) {
var (
md metadata.MD
authHeader []string
ok bool
)
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
log.Info().
Str("User ID", id).
Msg("SetPhoneNumber")
@ -40,20 +50,33 @@ func (s SilvermobiGRPCService) SetPhoneNumber(ctx context.Context, req *grpcprot
return &grpcproto.SetPhoneNumberResponse{Ok: true}, nil
}
func (s SilvermobiGRPCService) VerifyPhoneNumber(ctx context.Context, req *grpcproto.VerifyPhoneNumberRequest) (res *grpcproto.VerifyPhoneNumberResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) VerifyPhoneNumber(ctx context.Context,
req *grpcproto.VerifyPhoneNumberRequest) (res *grpcproto.VerifyPhoneNumberResponse, err error) {
var (
md metadata.MD
authHeader []string
ok bool
)
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
return nil, status.Errorf(codes.Unauthenticated,
"Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
log.Info().
Str("User ID", id).
Msg("VerifyPhoneNumber")
if err = s.Handler.VerifyPhoneNumber(
context.Background(),
id,
@ -66,21 +89,31 @@ func (s SilvermobiGRPCService) VerifyPhoneNumber(ctx context.Context, req *grpcp
return &grpcproto.VerifyPhoneNumberResponse{Ok: true}, nil
}
func (s SilvermobiGRPCService) SetBirthDate(ctx context.Context, req *grpcproto.BirthDateRequest) (res *grpcproto.BirthDateResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) SetBirthDate(ctx context.Context,
req *grpcproto.BirthDateRequest) (res *grpcproto.BirthDateResponse, err error) {
var (
md metadata.MD
authHeader []string
ok bool
)
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
log.Info().
Str("User ID", id).
Msg("SetBirthDate")
birthdate := time.Unix(req.Birthdate.Seconds, int64(req.Birthdate.Nanos)).UTC()
birthdateString := birthdate.Format("2006-01-02T15:04:05Z")
if err = s.Handler.UpdateBirthDate(ctx, id, birthdateString); err != nil {
@ -92,55 +125,85 @@ func (s SilvermobiGRPCService) SetBirthDate(ctx context.Context, req *grpcproto.
}, nil
}
func (s SilvermobiGRPCService) SetAccountType(ctx context.Context, req *grpcproto.AccountTypeRequest) (res *grpcproto.AccountTypeResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) SetAccountType(ctx context.Context,
req *grpcproto.AccountTypeRequest) (res *grpcproto.AccountTypeResponse, err error) {
var (
md metadata.MD
authHeader []string
ok bool
)
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
return nil, status.Errorf(codes.Unauthenticated,
"Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
log.Info().
Str("User ID", id).
Msg("SetAccountType")
if req.GetType() != grpcproto.AccountTypeRequest_PASSENGER && req.GetType() != grpcproto.AccountTypeRequest_DRIVER {
return nil, status.Errorf(codes.InvalidArgument, "Type should be PASSENGER or DRIVER")
}
if err = s.Handler.SetAccountType(ctx, id, req.GetType().String()); err != nil {
return nil, err
}
return &grpcproto.AccountTypeResponse{
Ok: true,
}, nil
}
func (s SilvermobiGRPCService) GetAccountType(ctx context.Context, req *grpcproto.AccountTypeRequest) (res *grpcproto.AccountTypeResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) GetAccountType(ctx context.Context,
req *grpcproto.AccountTypeRequest) (res *grpcproto.AccountTypeResponse, err error) {
var (
md metadata.MD
authHeader []string
ok bool
accountType string
responseType grpcproto.AccountTypeResponse_AccountType
)
if md, ok = metadata.FromIncomingContext(ctx); !ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
log.Info().
Str("User ID", id).
Msg("GetAccountType")
if req.Request == false || !req.Request {
return nil, status.Errorf(codes.InvalidArgument, "request arg should be true")
}
account_type, err := s.Handler.GetAccountType(ctx, id)
if err != nil {
if accountType, err = s.Handler.GetAccountType(ctx, id); err != nil {
return nil, err
}
var responseType grpcproto.AccountTypeResponse_AccountType
switch account_type {
switch accountType {
case "PASSENGER":
responseType = grpcproto.AccountTypeResponse_PASSENGER
case "DRIVER":
@ -157,45 +220,66 @@ func (s SilvermobiGRPCService) GetAccountType(ctx context.Context, req *grpcprot
}
func (s SilvermobiGRPCService) GetValidation(ctx context.Context, req *grpcproto.ValidationRequest) (res *grpcproto.ValidationResponse, err error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
func (s SilvermobiGRPCService) GetValidation(ctx context.Context,
req *grpcproto.ValidationRequest) (res *grpcproto.ValidationResponse, err error) {
var (
md metadata.MD
authHeader []string
ok, phoneValidation, birthValidation, typeValidation bool
)
if md, ok = metadata.FromIncomingContext(ctx); ok {
return nil, status.Errorf(codes.Unauthenticated, "Missing metadata")
}
authHeader, ok := md["authorization"]
authHeader, ok = md["authorization"]
if !ok || len(authHeader) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "Missing authorization header")
}
tokenString := strings.TrimPrefix(authHeader[0], "Bearer ")
id := ExtractIdFromToken(tokenString)
fmt.Println(id)
phone_validation, birth_validation, type_validation, err := s.Handler.CheckValidation(ctx, id)
if err != nil {
if phoneValidation, birthValidation, typeValidation, err = s.Handler.CheckValidation(ctx, id); err != nil {
return nil, err
}
return &grpcproto.ValidationResponse{
Phone: phone_validation,
Birthdate: birth_validation,
Type: type_validation,
Phone: phoneValidation,
Birthdate: birthValidation,
Type: typeValidation,
}, nil
}
func ExtractIdFromToken(tokenString string) string {
var (
err error
payloadBytes []byte
payloadMap map[string]interface{}
id string
ok bool
)
parts := strings.Split(tokenString, ".")
if len(parts) != 3 {
return ""
}
payloadBytes, err := base64.RawStdEncoding.DecodeString(parts[1])
if err != nil {
if payloadBytes, err = base64.RawStdEncoding.DecodeString(parts[1]); err != nil {
return ""
}
var payloadMap map[string]interface{}
if err := json.Unmarshal(payloadBytes, &payloadMap); err != nil {
if err = json.Unmarshal(payloadBytes, &payloadMap); err != nil {
return ""
}
id, ok := payloadMap["sub"].(string)
if !ok {
if id, ok = payloadMap["sub"].(string); !ok {
return ""
}
return id
}

View File

@ -2,19 +2,20 @@ package grpcserver
import (
"context"
"fmt"
"net"
"git.coopgo.io/coopgo-apps/silvermobi/handler"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/golang-jwt/jwt/v4"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcauth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
grpcctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"
"net"
)
type contextKey string
@ -42,62 +43,78 @@ func NoAuth(method string) bool {
return false
}
func UnaryAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.UnaryServerInterceptor {
func UnaryAuthServerInterceptor(authFunc grpcauth.AuthFunc) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
var (
newCtx context.Context
err error
)
print(info.FullMethod)
if NoAuth(info.FullMethod) {
return handler(ctx, req)
}
var newCtx context.Context
var err error
newCtx, err = authFunc(ctx)
if err != nil {
if newCtx, err = authFunc(ctx); err != nil {
return nil, err
}
return handler(newCtx, req)
}
}
func StreamAuthServerInterceptor(authFunc grpc_auth.AuthFunc) grpc.StreamServerInterceptor {
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
func StreamAuthServerInterceptor(authFunc grpcauth.AuthFunc) grpc.StreamServerInterceptor {
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo,
handler grpc.StreamHandler) error {
var (
newCtx context.Context
err error
)
if NoAuth(info.FullMethod) {
wrapped := grpc_middleware.WrapServerStream(stream)
wrapped := grpcmiddleware.WrapServerStream(stream)
wrapped.WrappedContext = stream.Context()
return handler(srv, wrapped)
}
var newCtx context.Context
var err error
newCtx, err = authFunc(stream.Context())
if err != nil {
if newCtx, err = authFunc(stream.Context()); err != nil {
return err
}
wrapped := grpc_middleware.WrapServerStream(stream)
wrapped := grpcmiddleware.WrapServerStream(stream)
wrapped.WrappedContext = newCtx
return handler(srv, wrapped)
}
}
type SilvermobiGRPCService struct {
Config *viper.Viper
Handler *handler.SilvermobiHandler
Handler *handler.SilverMobiHandler
grpcproto.UnimplementedSilvermobiGRPCServer
}
type SolidarityService struct {
Config *viper.Viper
Handler *handler.SilvermobiHandler
SolidarityClient grpcproto.SolidarityServiceClient
grpcproto.UnimplementedSolidarityServiceServer // Add this client
Config *viper.Viper
Handler *handler.SilverMobiHandler
SolidarityClient grpcproto.SolidarityServiceClient
grpcproto.UnimplementedSolidarityServiceServer
}
func NewSolidarityService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SolidarityService {
func NewSolidarityService(cfg *viper.Viper, handler *handler.SilverMobiHandler) SolidarityService {
solidarityServiceAddress := cfg.GetString("solidarity_service.address")
conn, err := grpc.Dial(solidarityServiceAddress, grpc.WithInsecure())
conn, err := grpc.NewClient(solidarityServiceAddress, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatal().Err(err)
}
solidarityClient := grpcproto.NewSolidarityServiceClient(conn)
return SolidarityService{
Config: cfg,
Handler: handler,
@ -105,63 +122,70 @@ func NewSolidarityService(cfg *viper.Viper, handler *handler.SilvermobiHandler)
}
}
func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilvermobiHandler) SilvermobiGRPCService {
func NewSilvermobiGRPCService(cfg *viper.Viper, handler *handler.SilverMobiHandler) SilvermobiGRPCService {
return SilvermobiGRPCService{
Config: cfg,
Handler: handler,
}
}
func Run(done chan error, cfg *viper.Viper, handler *handler.SilvermobiHandler) {
func Run(done chan error, cfg *viper.Viper, handler *handler.SilverMobiHandler) {
var (
address = cfg.GetString("services.external.grpc.ip") + ":" + cfg.GetString("services.external.grpc.port")
jwt_secret = cfg.GetString("identification.local.jwt_secret")
address = cfg.GetString("services.external.grpc.ip") + ":" + cfg.GetString("services.external.grpc.port")
jwtSecret = cfg.GetString("identification.local.jwt_secret")
)
log.Info().Msg("GRPC server on " + address)
server := grpc.NewServer(
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
grpc_ctxtags.StreamServerInterceptor(),
StreamAuthServerInterceptor(GRPCAuthFunc(jwt_secret)),
grpc.StreamInterceptor(grpcmiddleware.ChainStreamServer(
grpcctxtags.StreamServerInterceptor(),
StreamAuthServerInterceptor(GRPCAuthFunc(jwtSecret)),
)),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
grpc_ctxtags.UnaryServerInterceptor(),
UnaryAuthServerInterceptor(GRPCAuthFunc(jwt_secret)),
grpc.UnaryInterceptor(grpcmiddleware.ChainUnaryServer(
grpcctxtags.UnaryServerInterceptor(),
UnaryAuthServerInterceptor(GRPCAuthFunc(jwtSecret)),
)),
)
solidarity_service := NewSolidarityService(cfg, handler)
solidarityService := NewSolidarityService(cfg, handler)
silvermobi_service := NewSilvermobiGRPCService(cfg, handler)
grpcproto.RegisterSilvermobiGRPCServer(server, silvermobi_service)
grpcproto.RegisterSolidarityServiceServer(server, &solidarity_service)
silvermobiService := NewSilvermobiGRPCService(cfg, handler)
grpcproto.RegisterSilvermobiGRPCServer(server, silvermobiService)
grpcproto.RegisterSolidarityServiceServer(server, &solidarityService)
l, err := net.Listen("tcp", address)
if err != nil {
log.Fatal().Err(err)
}
if err := server.Serve(l); err != nil {
if err = server.Serve(l); err != nil {
log.Error().Err(err).Msg("gRPC service ended")
done <- err
}
}
func GRPCAuthFunc(jwtKey string) grpc_auth.AuthFunc {
func GRPCAuthFunc(jwtKey string) grpcauth.AuthFunc {
return func(ctx context.Context) (context.Context, error) {
tokenString, err := grpc_auth.AuthFromMD(ctx, "bearer")
var token *jwt.Token
tokenString, err := grpcauth.AuthFromMD(ctx, "bearer")
if err != nil {
return nil, err
}
claims := jwt.MapClaims{}
token, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) {
token, err = jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) {
return []byte(jwtKey), nil
})
if err != nil || !token.Valid {
fmt.Println(err)
return nil, status.Errorf(codes.Unauthenticated, "Invalid or expired token")
}
ctx = context.WithValue(ctx, contextKeyUser, claims["sub"].(string))
return ctx, nil
}
}

View File

@ -2,76 +2,106 @@ package grpcserver
import (
"context"
"fmt"
"git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/rs/zerolog/log"
)
func (s *SolidarityService) SetDriverRegularAvailabilities(ctx context.Context, req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
func (s *SolidarityService) SetDriverRegularAvailabilities(ctx context.Context,
req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
log.Info().
Str("Driver ID", req.DriverRequest.Driver.Id).
Msg("SetDriverRegularAvailabilities")
resp, err = s.SolidarityClient.SetDriverRegularAvailabilities(ctx, req)
return resp, err
}
func (s *SolidarityService) SetDriverPunctualAvailabilities(ctx context.Context, req *proto.DriverPunctualAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
func (s *SolidarityService) SetDriverPunctualAvailabilities(ctx context.Context,
req *proto.DriverPunctualAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) {
log.Info().
Str("Driver ID", req.DriverRequest.Driver.Id).
Msg("SetDriverRegularAvailabilities")
resp, err = s.SolidarityClient.SetDriverPunctualAvailabilities(ctx, req)
return resp, err
}
func (s *SolidarityService) CreateBooking(ctx context.Context, req *proto.CreateBookingSilvermobiRequest) (resp *proto.CreateBookingSilvermobiResponse, err error) {
func (s *SolidarityService) CreateBooking(ctx context.Context,
req *proto.CreateBookingRequest) (resp *proto.CreateBookingResponse, err error) {
log.Info().
Str("Booking ID", req.Booking.Id).
Msg("CreateBooking")
resp, err = s.SolidarityClient.CreateBookingSilvermobi(ctx, req)
if err == nil {
_ = s.Handler.SendNotification(req.Booking.DriverId, "Silvermobi", "Vous avez reçu une demande de trajet. \n Pour plus de détails, veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi.")
err = s.Handler.SendEmail(req.Booking.DriverId, "Silvermobi", "Vous avez reçu une demande de trajet. \n Pour plus de détails, veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi.")
fmt.Println(err)
if resp, err = s.SolidarityClient.CreateBooking(ctx, req); err != nil {
return nil, err
}
if err = s.Handler.SendNotification(req.Booking.DriverId,
"Silvermobi", "Vous avez reçu une demande de trajet. "+
"\n Pour plus de détails, veuillez consulter"+
" l'interface \"Mes Trajets\" dans l'application SilverMobi."); err != nil {
return nil, err
}
if err = s.Handler.SendEmail(req.Booking.DriverId, "Silvermobi",
"Vous avez reçu une demande de trajet. \n Pour plus de détails, "+
"veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi."); err != nil {
return nil, err
}
return resp, err
}
func (s *SolidarityService) UpdateBooking(ctx context.Context, req *proto.UpdateBookingSilvermobiRequest) (resp *proto.UpdateBookingSilvermobiResponse, err error) {
func (s *SolidarityService) UpdateBooking(ctx context.Context,
req *proto.UpdateBookingRequest) (resp *proto.UpdateBookingResponse, err error) {
log.Info().
Str("Booking ID", req.BookingId).
Msg("UpdateBooking")
resp, err = s.SolidarityClient.UpdateBookingSilvermobi(ctx, req)
resp, err = s.SolidarityClient.UpdateBooking(ctx, req)
return resp, err
}
func (s *SolidarityService) GetBooking(ctx context.Context, req *proto.GetBookingSilvermobiRequest) (resp *proto.GetBookingSilvermobiResponse, err error) {
func (s *SolidarityService) GetBooking(ctx context.Context,
req *proto.GetBookingRequest) (resp *proto.GetBookingResponse, err error) {
log.Info().
Str("Booking ID", req.BookingId).
Msg("GetBooking")
resp, err = s.SolidarityClient.GetBookingSilvermobi(ctx, req)
resp, err = s.SolidarityClient.GetBooking(ctx, req)
return resp, err
}
func (s *SolidarityService) GetBookingsByStatus(ctx context.Context, req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) {
func (s *SolidarityService) GetBookingsByStatus(ctx context.Context,
req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) {
log.Info().
Str("User ID", req.UserId).
Msg("GetBookingByStatus")
resp, err = s.SolidarityClient.GetBookingsByStatus(ctx, req)
return resp, err
}
func (s *SolidarityService) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) {
func (s *SolidarityService) DriverJourneys(ctx context.Context,
req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) {
log.Info().
Str("Address", req.Departure.Address).
Msg("DriverJourneys")
resp, err = s.SolidarityClient.DriverJourneys(ctx, req)
return resp, err
}
func (s *SolidarityService) SetPassengerTrip(ctx context.Context, req *proto.PassengerTripRequest) (resp *proto.PassengerTripResponse, err error) {
func (s *SolidarityService) SetPassengerTrip(ctx context.Context,
req *proto.PassengerTripRequest) (resp *proto.PassengerTripResponse, err error) {
log.Info().
Str("Passenger ID", req.Passenger.Id).
Msg("SetPassengerTrip")
resp, err = s.SolidarityClient.SetPassengerTrip(ctx, req)
return resp, err
}

View File

@ -2,22 +2,27 @@ package grpcserver
import (
"context"
grpcproto "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
"github.com/rs/zerolog/log"
)
func (s SilvermobiGRPCService) UpdatePassword(ctx context.Context, req *grpcproto.UpdatePasswordRequest) (res *grpcproto.UpdatePasswordResponse, err error) {
func (s SilvermobiGRPCService) UpdatePassword(ctx context.Context,
req *grpcproto.UpdatePasswordRequest) (res *grpcproto.UpdatePasswordResponse, err error) {
log.Info().
Str("username", req.Email).
Msg("Update Password")
result := s.Handler.UpdatePassword(ctx, req.Email, req.Password)
if result == true {
if result {
return &grpcproto.UpdatePasswordResponse{
Response: true,
}, nil
} else {
return &grpcproto.UpdatePasswordResponse{
Response: false,
}, nil
}
return &grpcproto.UpdatePasswordResponse{
Response: false,
}, nil
}

View File

@ -2,10 +2,12 @@ package services
import (
"context"
"git.coopgo.io/coopgo-apps/silvermobi/models"
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
ma "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/types/known/structpb"
)
@ -14,7 +16,8 @@ type MobilityAccountService struct {
}
func NewMobilityAccountService(mobilityAccountsDial string) (MobilityAccountService, error) {
mobilityAccountsConn, err := grpc.Dial(mobilityAccountsDial, grpc.WithInsecure())
mobilityAccountsConn, err := grpc.NewClient(mobilityAccountsDial,
grpc.WithTransportCredentials(insecure.NewCredentials()))
client := mobilityaccounts.NewMobilityAccountsClient(mobilityAccountsConn)
if err != nil {
@ -42,6 +45,7 @@ func (s MobilityAccountService) Login(ctx context.Context, username, password, n
func (s MobilityAccountService) UpdateAccountData(ctx context.Context, id string, data map[string]any) error {
d, err := structpb.NewStruct(data)
if err != nil {
return err
}
@ -63,14 +67,17 @@ func (s MobilityAccountService) UpdatePassword(ctx context.Context, id string, p
Id: id,
Password: password,
})
if err == nil {
return true
} else {
if err != nil {
return false
}
return true
}
func (s MobilityAccountService) GetAccountUsername(ctx context.Context, username string, namespace string) (*models.Account, error) {
func (s MobilityAccountService) GetAccountUsername(ctx context.Context,
username string, namespace string) (*models.Account, error) {
resp, err := s.Client.GetAccountUsername(ctx, &mobilityaccounts.GetAccountUsernameRequest{
Username: username,
Namespace: namespace,
@ -78,17 +85,22 @@ func (s MobilityAccountService) GetAccountUsername(ctx context.Context, username
if err != nil {
return nil, err
}
return s.ToAccountModel(resp.Account.ToStorageType()), nil
}
func (s MobilityAccountService) Register(ctx context.Context, username string, password string, email string, phone_number string, data map[string]any, namespace string) (*models.Account, error) {
func (s MobilityAccountService) Register(ctx context.Context, username string, password string,
email string, phoneNumber string, data map[string]any, namespace string) (*models.Account, error) {
var resp *mobilityaccounts.RegisterResponse
account := &ma.Account{
Authentication: ma.AccountAuth{
Local: ma.LocalAuth{
Username: username,
Password: password,
Email: email,
PhoneNumber: phone_number,
PhoneNumber: phoneNumber,
},
},
Namespace: namespace,
@ -100,28 +112,26 @@ func (s MobilityAccountService) Register(ctx context.Context, username string, p
return nil, err
}
resp, err := s.Client.Register(ctx, &mobilityaccounts.RegisterRequest{
if resp, err = s.Client.Register(ctx, &mobilityaccounts.RegisterRequest{
Account: acc,
})
if err != nil {
}); err != nil {
return nil, err
}
return s.ToAccountModel(resp.Account.ToStorageType()), nil
}
func (s MobilityAccountService) UpdatePhoneNumber(ctx context.Context, accountid string, phone_number string, verified bool, verification_code string) error {
_, err := s.Client.UpdatePhoneNumber(
func (s MobilityAccountService) UpdatePhoneNumber(ctx context.Context, accountID string, phoneNumber string,
verified bool, verificationCode string) error {
if _, err := s.Client.UpdatePhoneNumber(
ctx,
&mobilityaccounts.UpdatePhoneNumberRequest{
Id: accountid,
PhoneNumber: phone_number,
Id: accountID,
PhoneNumber: phoneNumber,
Verified: verified,
VerificationCode: verification_code,
VerificationCode: verificationCode,
},
)
if err != nil {
); err != nil {
return err
}
@ -129,20 +139,30 @@ func (s MobilityAccountService) UpdatePhoneNumber(ctx context.Context, accountid
}
func (s MobilityAccountService) SetAccountType(ctx context.Context, id string, accountType string) error {
account, err := s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{
var (
account *mobilityaccounts.GetAccountResponse
err error
)
if account, err = s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{
Id: id,
})
if err != nil {
}); err != nil {
return err
}
data := make(map[string]interface{})
data["type"] = accountType
dataStruct := &structpb.Struct{
Fields: make(map[string]*structpb.Value),
}
for key, value := range data {
stringValue, ok := value.(string)
if !ok {
continue
}
@ -153,22 +173,34 @@ func (s MobilityAccountService) SetAccountType(ctx context.Context, id string, a
},
}
}
account.Account.Data = dataStruct
_, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
if _, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
Account: account.Account,
})
if err != nil {
}); err != nil {
return err
}
return nil
}
func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, id string, namespace string, birthdate string) error {
account, err := s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{
func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, id string,
namespace string, birthdate string) error {
var (
account *mobilityaccounts.GetAccountResponse
err error
)
if account, err = s.Client.GetAccount(ctx, &mobilityaccounts.GetAccountRequest{
Id: id,
})
}); err != nil {
return err
}
data := make(map[string]interface{})
data["birthdate"] = birthdate
dataStruct := &structpb.Struct{
@ -177,6 +209,7 @@ func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, id s
for key, value := range data {
stringValue, ok := value.(string)
if !ok {
continue
}
@ -187,47 +220,56 @@ func (s MobilityAccountService) UpdateAccountBirthDate(ctx context.Context, id s
},
}
}
account.Account.Data = dataStruct
_, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
if _, err = s.Client.UpdateData(ctx, &mobilityaccounts.UpdateDataRequest{
Account: account.Account,
})
if err != nil {
}); err != nil {
return err
}
return nil
}
func (s MobilityAccountService) ToAccountModel(account ma.Account) *models.Account {
first_name := account.Data["first_name"].(string)
last_name := account.Data["last_name"].(string)
birth_date, ok := account.Data["birthdate"].(string)
if !ok {
birth_date = ""
var (
accountType, birthDate, phoneNumber, email string
ok bool
)
firstName := account.Data["first_name"].(string)
lastName := account.Data["last_name"].(string)
if birthDate, ok = account.Data["birthdate"].(string); !ok {
birthDate = ""
}
accountType, ok := account.Data["type"].(string)
if !ok {
if accountType, ok = account.Data["type"].(string); !ok {
accountType = ""
}
phone_number, ok := account.Data["phone_number"].(string)
if !ok {
phone_number = ""
if phoneNumber, ok = account.Data["phone_number"].(string); !ok {
phoneNumber = ""
}
email, ok := account.Data["email"].(string)
if !ok {
if email, ok = account.Data["email"].(string); !ok {
email = ""
}
return &models.Account{
ID: account.ID,
FirstName: first_name,
LastName: last_name,
FirstName: firstName,
LastName: lastName,
Email: email,
BirthDate: birth_date,
BirthDate: birthDate,
Type: accountType,
LocalCredentials: models.LocalCredentials{
Email: account.Authentication.Local.Email,
EmailVerified: account.Authentication.Local.EmailValidation.Validated,
EmailValidationCode: account.Authentication.Local.EmailValidation.ValidationCode,
PhoneNumber: phone_number,
PhoneNumber: phoneNumber,
PhoneNumberVerified: account.Authentication.Local.PhoneNumberValidation.Validated,
},
}

View File

@ -2,11 +2,12 @@ package services
import (
"context"
"google.golang.org/protobuf/types/known/structpb"
"github.com/appleboy/gorush/rpc/proto"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/types/known/structpb"
)
const (
@ -36,7 +37,8 @@ type PushService struct {
}
func NewPushService(address string) (*PushService, error) {
conn, err := grpc.Dial(address, grpc.WithInsecure())
conn, err := grpc.NewClient(address,
grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
@ -48,6 +50,12 @@ func NewPushService(address string) (*PushService, error) {
}
func (s *PushService) Send(notification Notification) error {
var (
resp *proto.NotificationReply
err error
)
log.Debug().
Int32("Platform", notification.Platform).
Strs("recipients", notification.Recipients).
@ -55,7 +63,7 @@ func (s *PushService) Send(notification Notification) error {
Str("notification_title", notification.Title).
Msg("Send notification")
resp, err := s.Client.Send(context.Background(), &proto.NotificationRequest{
if resp, err = s.Client.Send(context.Background(), &proto.NotificationRequest{
Data: notification.Data,
ID: notification.ID,
Platform: notification.Platform,
@ -67,9 +75,7 @@ func (s *PushService) Send(notification Notification) error {
Title: notification.Title,
Body: notification.Message,
},
})
if err != nil {
}); err != nil {
return err
}

View File

@ -2,53 +2,58 @@ package services
import (
"git.coopgo.io/coopgo-platform/geocode"
routing "git.coopgo.io/coopgo-platform/routing-service"
"git.coopgo.io/coopgo-platform/routing-service"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
)
type ServicesHandler struct {
type ServiceHandler struct {
MobilityAccounts MobilityAccountService
Push *PushService
Geocoder geocode.Geocoder
Routing routing.RoutingService
}
func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
func NewServicesHandler(cfg *viper.Viper) (*ServiceHandler, error) {
var (
mobilityAccountsDial = cfg.GetString("services.internal.mobility_accounts.dial")
pushDial = cfg.GetString("services.internal.push.dial")
geocoder_type = cfg.GetString("geocoder.type")
pelias_base_url = cfg.GetString("geocoder.pelias.base_url")
routing_service_type = cfg.GetString("routing.type")
valhalla_base_url = cfg.GetString("routing.valhalla.base_url")
geocoderType = cfg.GetString("geocoder.type")
peliasBaseUrl = cfg.GetString("geocoder.pelias.base_url")
routingServiceType = cfg.GetString("routing.type")
valhallaBaseUrl = cfg.GetString("routing.valhalla.base_url")
mobilityAccounts MobilityAccountService
push *PushService
geocoder geocode.Geocoder
routingsvc routing.RoutingService
err error
)
mobilityAccounts, err := NewMobilityAccountService(mobilityAccountsDial)
if err != nil {
if mobilityAccounts, err = NewMobilityAccountService(mobilityAccountsDial); err != nil {
log.Fatal().Err(err).Msg("Could not connect to Mobility Accounts Service")
return nil, err
}
push, err := NewPushService(pushDial)
if err != nil {
if push, err = NewPushService(pushDial); err != nil {
log.Fatal().Err(err).Msg("Could not connect to Push Notifications Service")
return nil, err
}
geocoder, err := geocode.NewGeocoder(geocoder_type, pelias_base_url)
if err != nil {
if geocoder, err = geocode.NewGeocoder(geocoderType, peliasBaseUrl); err != nil {
log.Fatal().Err(err).Msg("Could not initiate the Geocoder service")
return nil, err
}
routing, err := routing.NewRoutingService(routing_service_type, valhalla_base_url)
if err != nil {
if routingsvc, err = routing.NewRoutingService(routingServiceType, valhallaBaseUrl); err != nil {
log.Fatal().Err(err).Msg("Could not initiate the routing service")
return nil, err
}
return &ServicesHandler{
return &ServiceHandler{
MobilityAccounts: mobilityAccounts,
Push: push,
Geocoder: geocoder,
Routing: routing,
Geocoder: geocoder,
Routing: routingsvc,
}, nil
}

View File

@ -3,12 +3,13 @@ package storage
import (
"database/sql"
"fmt"
"strconv"
"strings"
"github.com/google/uuid"
_ "github.com/lib/pq"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"strconv"
"strings"
)
type PostgresqlStorage struct {
@ -19,70 +20,79 @@ type PostgresqlStorage struct {
func NewPostgresqlStorage(cfg *viper.Viper) (PostgresqlStorage, error) {
var (
host = cfg.GetString("storage.db.psql.host")
port = cfg.GetString("storage.db.psql.port")
user = cfg.GetString("storage.db.psql.user")
password = cfg.GetString("storage.db.psql.password")
dbname = cfg.GetString("storage.db.psql.dbname")
sslmode = cfg.GetString("storage.db.psql.sslmode")
pg_schema = cfg.GetString("storage.db.psql.schema")
pgtables_users_firebase = cfg.GetString("storage.db.psql.tables.users_firebase")
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")
pgSchema = cfg.GetString("storage.db.psql.schema")
pgtablesUsersFirebase = cfg.GetString("storage.db.psql.tables.users_firebase")
)
portInt, _ := strconv.Atoi(port)
psqlconn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s", host, portInt, user, password, dbname, sslmode)
db, err := sql.Open("postgres", psqlconn)
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 {
if err = db.Ping(); 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,
Schema: pgSchema,
Tables: map[string]string{
"users_firebase": fmt.Sprintf("%s.%s", pg_schema, pgtables_users_firebase),
"users_firebase": fmt.Sprintf("%s.%s", pgSchema, pgtablesUsersFirebase),
},
}, nil
}
func (s PostgresqlStorage) CreateFirebaseToken(user_id string, fcm_token string, device_platform string) (err error) {
_, err = uuid.Parse(user_id)
if err != nil {
func (s PostgresqlStorage) CreateFirebaseToken(userId string, fcmToken string, devicePlatform string) (err error) {
if _, err = uuid.Parse(userId); err != nil {
log.Error().Err(err).Msg("Postgresql Storage CreateFirebaseToken invalid User ID")
return err
}
_, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s (user_id , fcm_token , device_platform) VALUES($1,$2,$3)", s.Tables["users_firebase"]),
user_id,
fcm_token,
device_platform)
if err != nil {
if _, err = s.DbConnection.Exec(fmt.Sprintf("INSERT INTO %s "+
"(user_id , fcm_token , device_platform) VALUES($1,$2,$3)", s.Tables["users_firebase"]),
userId,
fcmToken,
devicePlatform); err != nil {
if strings.Contains(err.Error(), "duplicate key") {
_ = s.UpdateFirebaseToken(user_id, device_platform, fcm_token)
_ = s.UpdateFirebaseToken(userId, devicePlatform, fcmToken)
}
}
return nil
}
func (s PostgresqlStorage) GetFirebaseToken(user_id string) (fcm string, device_platform string, err error) {
err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT fcm_token , device_platform FROM %s WHERE user_id = $1", s.Tables["users_firebase"]), user_id).
func (s PostgresqlStorage) GetFirebaseToken(userId string) (fcm string, devicePlatform string, err error) {
if err = s.DbConnection.QueryRow(fmt.Sprintf("SELECT fcm_token , "+
"device_platform FROM %s WHERE user_id = $1", s.Tables["users_firebase"]), userId).
Scan(
&fcm,
&device_platform,
)
if err != nil {
&devicePlatform,
); err != nil {
return "", "", err
}
return fcm, device_platform, nil
return fcm, devicePlatform, nil
}
func (s PostgresqlStorage) UpdateFirebaseToken(user_id string, fcm_token string, device_platform string) error {
query := fmt.Sprintf("UPDATE %s SET fcm_token = $1 device_platform = $2 WHERE user_id = $3", s.Tables["users_firebase"])
_, err := s.DbConnection.Exec(query, fcm_token, device_platform, user_id)
if err != nil {
func (s PostgresqlStorage) UpdateFirebaseToken(userId string, fcmToken string, devicePlatform string) error {
query := fmt.Sprintf("UPDATE %s SET fcm_token ="+
" $1 device_platform = $2 WHERE user_id = $3", s.Tables["users_firebase"])
if _, err := s.DbConnection.Exec(query, fcmToken, devicePlatform, userId); err != nil {
return err
}
return nil
}

View File

@ -2,24 +2,25 @@ package storage
import (
"fmt"
"github.com/spf13/viper"
)
type Storage interface {
CreateFirebaseToken(user_id string, fcm_token string, device_platform string) (err error)
UpdateFirebaseToken(user_id string, fcm_token string, device_platform string) error
GetFirebaseToken(user_id string) (fcm string, device_platform string, err error)
CreateFirebaseToken(userId string, fcmToken string, devicePlatform string) (err error)
UpdateFirebaseToken(userId string, fcmToken string, devicePlatform string) error
GetFirebaseToken(userId string) (fcm string, devicePlatform string, err error)
}
func NewStorage(cfg *viper.Viper) (Storage, error) {
var (
storage_type = cfg.GetString("storage.db.type")
storageType = cfg.GetString("storage.db.type")
)
switch storage_type {
switch storageType {
case "psql":
s, err := NewPostgresqlStorage(cfg)
return s, err
default:
return nil, fmt.Errorf("storage type %v is not supported", storage_type)
return nil, fmt.Errorf("storage type %v is not supported", storageType)
}
}