Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a495be6bb2 | ||
|
|
986f422824 | ||
|
|
bfcd04c701 | ||
|
|
0cf6f231a3 | ||
|
|
77f8d9f87a | ||
|
|
ee058aa3b3 | ||
|
|
f1031c14df | ||
|
|
98e3627f29 | ||
|
|
22e46cb841 | ||
|
|
7475be603c | ||
|
|
06577df0ad | ||
|
|
048681e8ad | ||
|
|
975d0495a8 | ||
|
|
09f384fce0 | ||
|
|
53374dfdfc | ||
|
|
82bd51e6f0 | ||
|
|
8c6a70b0be | ||
|
|
b723189fda | ||
|
|
ca160d1543 |
@@ -8,3 +8,11 @@
|
||||
/var/
|
||||
/vendor/
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
# Draw.io backup file.
|
||||
*bkp
|
||||
|
||||
###> symfony/asset-mapper ###
|
||||
/public/assets/
|
||||
/assets/vendor/
|
||||
###< symfony/asset-mapper ###
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"php.suggest.basic": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "modificationsIfAvailable"
|
||||
}
|
||||
+9
-2
@@ -84,11 +84,18 @@ RUN set -eux; \
|
||||
|
||||
# copy sources
|
||||
COPY --link . ./
|
||||
RUN rm -Rf frankenphp/
|
||||
|
||||
# Remove development data.
|
||||
RUN rm -Rf frankenphp/ \
|
||||
rm -Rf .gitea/ \
|
||||
rm -Rf .vscode/ \
|
||||
rm -Rf public/images
|
||||
|
||||
# Setup application.
|
||||
RUN set -eux; \
|
||||
mkdir -p var/cache var/log; \
|
||||
composer dump-autoload --classmap-authoritative --no-dev; \
|
||||
composer dump-env prod; \
|
||||
composer run-script --no-dev post-install-cmd; \
|
||||
chmod +x bin/console; sync;
|
||||
chmod +x bin/console; sync; \
|
||||
php bin/console asset-map:compile
|
||||
|
||||
@@ -1,19 +1,661 @@
|
||||
Copyright (c) Fabien Potencier
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
Preamble
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
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.
|
||||
|
||||
SomniaRooms - A room booking platform.
|
||||
Copyright (C) 2024 - Daniel García
|
||||
|
||||
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/>.
|
||||
@@ -9,31 +9,90 @@ Powered by:
|
||||
## Commands:
|
||||
|
||||
Build containers:
|
||||
```
|
||||
```bash
|
||||
docker compose build --no-cache
|
||||
```
|
||||
|
||||
Start Containers:
|
||||
```
|
||||
```bash
|
||||
docker compose up --pull always -d --wait
|
||||
docker compose --env-file .\.env.local up -d --wait
|
||||
```
|
||||
|
||||
Stop containers
|
||||
```
|
||||
```bash
|
||||
docker compose down --remove-orphans
|
||||
```
|
||||
|
||||
To use xdebug in VSCode you may need to configure some environment vars. A .env file (`.env.local`) can be used as:
|
||||
```shell
|
||||
XDEBUG_MODE=develop,debug
|
||||
XDEBUG_DISCOVER_CLIENT_HOST=1
|
||||
XDEBUG_IDEKEY=docker
|
||||
XDEBUG_LOG=/dev/stdout
|
||||
```
|
||||
|
||||
|
||||
### Prod:
|
||||
|
||||
You can use docker compose for prod or build and deploy a prod image.
|
||||
When deploying to a production environment a production build should be used.
|
||||
Then, deployment can be done as containers or using docker-compose.
|
||||
|
||||
**Build Prod image**
|
||||
|
||||
To build a production image:
|
||||
```
|
||||
docker build -t somniarooms:prod --target frankenphp_prod .
|
||||
```
|
||||
|
||||
**Deploy prod image**
|
||||
|
||||
You may use a env file to configure the SomniaRoom container:
|
||||
|
||||
```shell
|
||||
SERVER_NAME=localhost
|
||||
DATABASE_URL=postgresql://app:!ChangeMe!@somniadb:5432/somniarooms?serverVersion=16&charset=utf8
|
||||
APP_SECRET=MYSECRET
|
||||
MERCURE_PUBLISHER_JWT_KEY=MYCADDY_MERCURE_JWT_SECRET
|
||||
MERCURE_SUBSCRIBER_JWT_KEY=MYCADDY_MERCURE_JWT_SECRET
|
||||
FRANKENPHP_CONFIG="" #-> Avoid using FrankenPHP workers, as don't play well with Easyadmin.
|
||||
```
|
||||
|
||||
You need a database for using SomniaRooms.
|
||||
To run one on a container you can use this that match this example config:
|
||||
```bash
|
||||
docker run -d --name somniarooms-db --hostname somniadb -p 5432:5432 --env=POSTGRES_DB=somniarooms --env=POSTGRES_PASSWORD=!ChangeMe! --env=POSTGRES_USER=app --env=PGDATA=/var/lib/postgresql/data --volume=somniarooms_db:/var/lib/postgresql/data --network somniarooms-network postgres:16-alpine
|
||||
```
|
||||
|
||||
Then SomniaRooms can be deployed on a container (change --env-file value to the created file):
|
||||
```bash
|
||||
docker run -d -it -p 80:80 -p 443:443 --name somniarooms --env-file ./env.prod.local somniarooms:prod
|
||||
```
|
||||
|
||||
When deploying to prod is recomended to mount some directories as a docker volume or hostpath. This makes sure data is preserved after deleting the container.
|
||||
- Image directory (`/app/public/images`)
|
||||
|
||||
If you are deploying your DB as a container, check the database docs and make sure database data won't be lost when updating or deleting the container. This example configuration store postgress data on a unnamed docket volume.
|
||||
|
||||
```bash
|
||||
docker run -d -it -p 80:80 -p 443:443 --name somniarooms --env-file ./.env.prod.local --volume=somniarooms_images:/app/public/images:rw --network somniarooms-network somniarooms:prod
|
||||
```
|
||||
|
||||
If you want your app and DB to comunicate using it's hostname (like on this example) you should create a docker network.
|
||||
```bash
|
||||
docker network create somniarooms-network
|
||||
```
|
||||
|
||||
|
||||
## Running the app!
|
||||
|
||||
Go to the app address (`https://localhost`) and it will show Symfony welcome page (or a error when running on prod).
|
||||
|
||||
Go to addres `https://localhost/setup` to inicialize app users and data.
|
||||
Then, you the admin panel is at `https://localhost/admin`
|
||||
|
||||
You may login using default admin user:
|
||||
```
|
||||
user: admin
|
||||
pass: admin
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Welcome to your app's main JavaScript file!
|
||||
*
|
||||
* This file will be included onto the page via the importmap() Twig function,
|
||||
* which should already be in your base.html.twig.
|
||||
*/
|
||||
import './styles/app.css';
|
||||
|
||||
console.log('SomniaRooms Admin Panel - Assets loaded! 🎉');
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
php:
|
||||
image: ${IMAGES_PREFIX:-}app-php
|
||||
image: somniarooms
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
|
||||
@@ -41,6 +41,7 @@ services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
image: postgres:${POSTGRES_VERSION:-16}-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-app}
|
||||
# You should definitely change the password in production
|
||||
|
||||
+12
-3
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dgm/somnia-rooms",
|
||||
"type": "project",
|
||||
"license": "GPL-3.0",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "A FOSS Hotel room booking system.",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
@@ -14,21 +14,29 @@
|
||||
"doctrine/doctrine-migrations-bundle": "^3.3",
|
||||
"doctrine/orm": "^3.1",
|
||||
"easycorp/easyadmin-bundle": "^4.10",
|
||||
"nelmio/api-doc-bundle": "^4.30",
|
||||
"nelmio/cors-bundle": "^2.4",
|
||||
"phpdocumentor/reflection-docblock": "^5.4",
|
||||
"phpstan/phpdoc-parser": "^1.28",
|
||||
"runtime/frankenphp-symfony": "^0.2.0",
|
||||
"symfony/asset": "7.0.*",
|
||||
"symfony/asset-mapper": "7.0.*",
|
||||
"symfony/console": "7.0.*",
|
||||
"symfony/dotenv": "7.0.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/form": "7.0.*",
|
||||
"symfony/framework-bundle": "7.0.*",
|
||||
"symfony/mime": "7.0.*",
|
||||
"symfony/property-access": "7.0.*",
|
||||
"symfony/property-info": "7.0.*",
|
||||
"symfony/runtime": "7.0.*",
|
||||
"symfony/security-bundle": "7.0.*",
|
||||
"symfony/serializer": "7.0.*",
|
||||
"symfony/yaml": "7.0.*"
|
||||
"symfony/twig-bundle": "7.0.*",
|
||||
"symfony/var-exporter": "7.0.4",
|
||||
"symfony/yaml": "7.0.*",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/twig": "^2.12|^3.0"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
@@ -61,7 +69,8 @@
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
||||
"importmap:install": "symfony-cmd"
|
||||
},
|
||||
"post-install-cmd": [
|
||||
"@auto-scripts"
|
||||
|
||||
Generated
+796
-25
@@ -4,8 +4,89 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f177a4872c4ced09856f94d423de0b21",
|
||||
"content-hash": "20c33276e1944c7bb2e51459e4f90463",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/semver",
|
||||
"version": "3.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/semver.git",
|
||||
"reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6",
|
||||
"reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.3.2 || ^7.0 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.4",
|
||||
"symfony/phpunit-bridge": "^4.2 || ^5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Composer\\Semver\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nils Adermann",
|
||||
"email": "[email protected]",
|
||||
"homepage": "http://www.naderman.de"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "[email protected]",
|
||||
"homepage": "http://seld.be"
|
||||
},
|
||||
{
|
||||
"name": "Rob Bast",
|
||||
"email": "[email protected]",
|
||||
"homepage": "http://robbast.nl"
|
||||
}
|
||||
],
|
||||
"description": "Semver library that offers utilities, version constraint parsing and validation.",
|
||||
"keywords": [
|
||||
"semantic",
|
||||
"semver",
|
||||
"validation",
|
||||
"versioning"
|
||||
],
|
||||
"support": {
|
||||
"irc": "ircs://irc.libera.chat:6697/composer",
|
||||
"issues": "https://github.com/composer/semver/issues",
|
||||
"source": "https://github.com/composer/semver/tree/3.4.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-12T11:35:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "2.2.0",
|
||||
@@ -1320,6 +1401,128 @@
|
||||
],
|
||||
"time": "2024-04-19T18:13:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nelmio/api-doc-bundle",
|
||||
"version": "v4.30.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nelmio/NelmioApiDocBundle.git",
|
||||
"reference": "277fa17b912be31b5170e49f0924b1028058c938"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/277fa17b912be31b5170e49f0924b1028058c938",
|
||||
"reference": "277fa17b912be31b5170e49f0924b1028058c938",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.4",
|
||||
"phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0",
|
||||
"phpdocumentor/type-resolver": "^1.8.2",
|
||||
"psr/cache": "^1.0 || ^2.0 || ^3.0",
|
||||
"psr/container": "^1.0 || ^2.0",
|
||||
"psr/log": "^1.0 || ^2.0 || ^3.0",
|
||||
"symfony/config": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/console": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/deprecation-contracts": "^2.1 || ^3",
|
||||
"symfony/framework-bundle": "^5.4.24 || ^6.4 || ^7.0",
|
||||
"symfony/http-foundation": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/options-resolver": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/property-info": "^5.4.10 || ^6.4 || ^7.0",
|
||||
"symfony/routing": "^5.4 || ^6.4 || ^7.0",
|
||||
"zircote/swagger-php": "^4.6.1"
|
||||
},
|
||||
"conflict": {
|
||||
"zircote/swagger-php": "4.8.7"
|
||||
},
|
||||
"require-dev": {
|
||||
"api-platform/core": "^2.7.0 || ^3",
|
||||
"composer/package-versions-deprecated": "1.11.99.1",
|
||||
"doctrine/annotations": "^2.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.52",
|
||||
"friendsofsymfony/rest-bundle": "^2.8 || ^3.0",
|
||||
"jms/serializer": "^1.14 || ^3.0",
|
||||
"jms/serializer-bundle": "^2.3 || ^3.0 || ^4.0 || ^5.0",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpstan/phpstan-phpunit": "^1.3",
|
||||
"phpstan/phpstan-strict-rules": "^1.5",
|
||||
"phpstan/phpstan-symfony": "^1.3",
|
||||
"phpunit/phpunit": "^9.6 || ^10.5",
|
||||
"symfony/asset": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/browser-kit": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/cache": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/dom-crawler": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/expression-language": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/form": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/phpunit-bridge": "^6.4",
|
||||
"symfony/property-access": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/security-csrf": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/serializer": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/stopwatch": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/templating": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/twig-bundle": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/uid": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/validator": "^5.4 || ^6.4 || ^7.0",
|
||||
"willdurand/hateoas-bundle": "^1.0 || ^2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"api-platform/core": "For using an API oriented framework.",
|
||||
"doctrine/annotations": "For using doctrine annotations",
|
||||
"friendsofsymfony/rest-bundle": "For using the parameters annotations.",
|
||||
"jms/serializer-bundle": "For describing your models.",
|
||||
"symfony/asset": "For using the Swagger UI.",
|
||||
"symfony/cache": "For using a PSR-6 compatible cache implementation with the API doc generator.",
|
||||
"symfony/form": "For describing your form type models.",
|
||||
"symfony/monolog-bundle": "For using a PSR-3 compatible logger implementation with the API PHP describer.",
|
||||
"symfony/security-csrf": "For using csrf protection tokens in forms.",
|
||||
"symfony/serializer": "For describing your models.",
|
||||
"symfony/twig-bundle": "For using the Swagger UI.",
|
||||
"symfony/validator": "For describing the validation constraints in your models.",
|
||||
"willdurand/hateoas-bundle": "For extracting HATEOAS metadata."
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Nelmio\\ApiDocBundle\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Generates documentation for your REST API from annotations and attributes",
|
||||
"keywords": [
|
||||
"api",
|
||||
"doc",
|
||||
"documentation",
|
||||
"rest"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nelmio/NelmioApiDocBundle/issues",
|
||||
"source": "https://github.com/nelmio/NelmioApiDocBundle/tree/v4.30.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/DjordyKoert",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-14T10:54:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nelmio/cors-bundle",
|
||||
"version": "2.4.0",
|
||||
@@ -1908,16 +2111,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/asset",
|
||||
"version": "v7.0.3",
|
||||
"version": "v7.0.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/asset.git",
|
||||
"reference": "3ae493792fc17cc31b84e231f30f2d154575f171"
|
||||
"reference": "0f106714bb8d857560edd2ada7f387d2f437c830"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/asset/zipball/3ae493792fc17cc31b84e231f30f2d154575f171",
|
||||
"reference": "3ae493792fc17cc31b84e231f30f2d154575f171",
|
||||
"url": "https://api.github.com/repos/symfony/asset/zipball/0f106714bb8d857560edd2ada7f387d2f437c830",
|
||||
"reference": "0f106714bb8d857560edd2ada7f387d2f437c830",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1957,7 +2160,7 @@
|
||||
"description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/asset/tree/v7.0.3"
|
||||
"source": "https://github.com/symfony/asset/tree/v7.0.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1973,7 +2176,85 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-23T15:02:46+00:00"
|
||||
"time": "2024-05-31T14:55:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/asset-mapper",
|
||||
"version": "v7.0.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/asset-mapper.git",
|
||||
"reference": "06e0ef3522bc1942192892094907d27f1a660cae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/asset-mapper/zipball/06e0ef3522bc1942192892094907d27f1a660cae",
|
||||
"reference": "06e0ef3522bc1942192892094907d27f1a660cae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer/semver": "^3.0",
|
||||
"php": ">=8.2",
|
||||
"symfony/filesystem": "^6.4|^7.0",
|
||||
"symfony/http-client": "^6.4|^7.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<6.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/asset": "^6.4|^7.0",
|
||||
"symfony/browser-kit": "^6.4|^7.0",
|
||||
"symfony/console": "^6.4|^7.0",
|
||||
"symfony/event-dispatcher-contracts": "^3.0",
|
||||
"symfony/finder": "^6.4|^7.0",
|
||||
"symfony/framework-bundle": "^6.4|^7.0",
|
||||
"symfony/http-foundation": "^6.4|^7.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0",
|
||||
"symfony/web-link": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\AssetMapper\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Maps directories of assets & makes them available in a public directory with versioned filenames.",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/asset-mapper/tree/v7.0.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-09T18:35:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/cache",
|
||||
@@ -3381,6 +3662,176 @@
|
||||
],
|
||||
"time": "2024-03-27T19:55:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-client",
|
||||
"version": "v7.0.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-client.git",
|
||||
"reference": "3ae495c67ba9c3b504fecd070a6c28b4143088cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-client/zipball/3ae495c67ba9c3b504fecd070a6c28b4143088cf",
|
||||
"reference": "3ae495c67ba9c3b504fecd070a6c28b4143088cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/http-client-contracts": "^3.4.1",
|
||||
"symfony/service-contracts": "^2.5|^3"
|
||||
},
|
||||
"conflict": {
|
||||
"php-http/discovery": "<1.15",
|
||||
"symfony/http-foundation": "<6.4"
|
||||
},
|
||||
"provide": {
|
||||
"php-http/async-client-implementation": "*",
|
||||
"php-http/client-implementation": "*",
|
||||
"psr/http-client-implementation": "1.0",
|
||||
"symfony/http-client-implementation": "3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"amphp/amp": "^2.5",
|
||||
"amphp/http-client": "^4.2.1",
|
||||
"amphp/http-tunnel": "^1.0",
|
||||
"amphp/socket": "^1.1",
|
||||
"guzzlehttp/promises": "^1.4|^2.0",
|
||||
"nyholm/psr7": "^1.0",
|
||||
"php-http/httplug": "^1.0|^2.0",
|
||||
"psr/http-client": "^1.0",
|
||||
"symfony/dependency-injection": "^6.4|^7.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0",
|
||||
"symfony/messenger": "^6.4|^7.0",
|
||||
"symfony/process": "^6.4|^7.0",
|
||||
"symfony/stopwatch": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\HttpClient\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"http"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-client/tree/v7.0.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-17T06:06:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-client-contracts",
|
||||
"version": "v3.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-client-contracts.git",
|
||||
"reference": "20414d96f391677bf80078aa55baece78b82647d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d",
|
||||
"reference": "20414d96f391677bf80078aa55baece78b82647d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Contracts\\HttpClient\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Test/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Generic abstractions related to HTTP clients",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"abstractions",
|
||||
"contracts",
|
||||
"decoupling",
|
||||
"interfaces",
|
||||
"interoperability",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-18T09:32:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v7.0.6",
|
||||
@@ -3652,6 +4103,90 @@
|
||||
],
|
||||
"time": "2024-01-23T15:02:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v7.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "60757ea7d562ae1756c1f430a6f7872156a15f32"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/60757ea7d562ae1756c1f430a6f7872156a15f32",
|
||||
"reference": "60757ea7d562ae1756c1f430a6f7872156a15f32",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/polyfill-intl-idn": "^1.10",
|
||||
"symfony/polyfill-mbstring": "^1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"egulias/email-validator": "~3.0.0",
|
||||
"phpdocumentor/reflection-docblock": "<3.2.2",
|
||||
"phpdocumentor/type-resolver": "<1.4.0",
|
||||
"symfony/mailer": "<6.4",
|
||||
"symfony/serializer": "<6.4.3|>7.0,<7.0.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"egulias/email-validator": "^2.1.10|^3.1|^4",
|
||||
"league/html-to-markdown": "^5.0",
|
||||
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
|
||||
"symfony/dependency-injection": "^6.4|^7.0",
|
||||
"symfony/process": "^6.4|^7.0",
|
||||
"symfony/property-access": "^6.4|^7.0",
|
||||
"symfony/property-info": "^6.4|^7.0",
|
||||
"symfony/serializer": "^6.4.3|^7.0.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Mime\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Allows manipulating MIME messages",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v7.0.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-28T09:58:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v7.0.0",
|
||||
@@ -3953,6 +4488,89 @@
|
||||
],
|
||||
"time": "2024-01-29T20:12:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "c36586dcf89a12315939e00ec9b4474adcb1d773"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773",
|
||||
"reference": "c36586dcf89a12315939e00ec9b4474adcb1d773",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"symfony/polyfill-intl-normalizer": "^1.10"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Intl\\Idn\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Laurent Bassin",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Trevor Rowbotham",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"idn",
|
||||
"intl",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.29.0",
|
||||
@@ -5881,24 +6499,22 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-exporter",
|
||||
"version": "v7.0.6",
|
||||
"version": "v7.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-exporter.git",
|
||||
"reference": "c74c568d2a15a1d407cf40d61ea82bc2d521e27b"
|
||||
"reference": "dfb0acb6803eb714f05d97dd4c5abe6d5fa9fe41"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/c74c568d2a15a1d407cf40d61ea82bc2d521e27b",
|
||||
"reference": "c74c568d2a15a1d407cf40d61ea82bc2d521e27b",
|
||||
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/dfb0acb6803eb714f05d97dd4c5abe6d5fa9fe41",
|
||||
"reference": "dfb0acb6803eb714f05d97dd4c5abe6d5fa9fe41",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/property-access": "^6.4|^7.0",
|
||||
"symfony/serializer": "^6.4|^7.0",
|
||||
"symfony/var-dumper": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
@@ -5937,7 +6553,7 @@
|
||||
"serialize"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/var-exporter/tree/v7.0.6"
|
||||
"source": "https://github.com/symfony/var-exporter/tree/v7.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -5953,7 +6569,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-20T21:25:22+00:00"
|
||||
"time": "2024-02-26T10:35:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
@@ -6027,25 +6643,99 @@
|
||||
"time": "2024-01-23T15:02:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.9.3",
|
||||
"name": "twig/extra-bundle",
|
||||
"version": "v3.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58"
|
||||
"url": "https://github.com/twigphp/twig-extra-bundle.git",
|
||||
"reference": "21a9a7aa9f79d4493bb6fed4eb2794339f9551f5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58",
|
||||
"reference": "a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58",
|
||||
"url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/21a9a7aa9f79d4493bb6fed4eb2794339f9551f5",
|
||||
"reference": "21a9a7aa9f79d4493bb6fed4eb2794339f9551f5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"php": ">=8.0.2",
|
||||
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
|
||||
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"league/commonmark": "^1.0|^2.0",
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0",
|
||||
"twig/cache-extra": "^3.0",
|
||||
"twig/cssinliner-extra": "^3.0",
|
||||
"twig/html-extra": "^3.0",
|
||||
"twig/inky-extra": "^3.0",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"twig/markdown-extra": "^3.0",
|
||||
"twig/string-extra": "^3.0"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Twig\\Extra\\TwigExtraBundle\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "[email protected]",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"description": "A Symfony bundle for extra Twig extensions",
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"keywords": [
|
||||
"bundle",
|
||||
"extra",
|
||||
"twig"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.13.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-01T20:39:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/polyfill-ctype": "^1.8",
|
||||
"symfony/polyfill-mbstring": "^1.3",
|
||||
"symfony/polyfill-php80": "^1.22"
|
||||
"symfony/polyfill-php81": "^1.29"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/container": "^1.0|^2.0",
|
||||
@@ -6091,7 +6781,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.9.3"
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.14.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -6103,7 +6793,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-18T11:59:33+00:00"
|
||||
"time": "2024-09-09T17:55:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
@@ -6162,6 +6852,87 @@
|
||||
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
|
||||
},
|
||||
"time": "2022-06-03T18:03:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zircote/swagger-php",
|
||||
"version": "4.10.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zircote/swagger-php.git",
|
||||
"reference": "e462ff5269ea0ec91070edd5d51dc7215bdea3b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/e462ff5269ea0ec91070edd5d51dc7215bdea3b6",
|
||||
"reference": "e462ff5269ea0ec91070edd5d51dc7215bdea3b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.2",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||
"symfony/deprecation-contracts": "^2 || ^3",
|
||||
"symfony/finder": ">=2.2",
|
||||
"symfony/yaml": ">=3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/package-versions-deprecated": "^1.11",
|
||||
"doctrine/annotations": "^1.7 || ^2.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.17 || ^3.47.1",
|
||||
"phpstan/phpstan": "^1.6",
|
||||
"phpunit/phpunit": ">=8",
|
||||
"vimeo/psalm": "^4.23"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/annotations": "^1.7 || ^2.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/openapi"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OpenApi\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Robert Allen",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Bob Fanger",
|
||||
"email": "[email protected]",
|
||||
"homepage": "https://bfanger.nl"
|
||||
},
|
||||
{
|
||||
"name": "Martin Rademacher",
|
||||
"email": "[email protected]",
|
||||
"homepage": "https://radebatz.net"
|
||||
}
|
||||
],
|
||||
"description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations",
|
||||
"homepage": "https://github.com/zircote/swagger-php/",
|
||||
"keywords": [
|
||||
"api",
|
||||
"json",
|
||||
"rest",
|
||||
"service discovery"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/zircote/swagger-php/issues",
|
||||
"source": "https://github.com/zircote/swagger-php/tree/4.10.6"
|
||||
},
|
||||
"time": "2024-07-26T03:04:43+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
||||
@@ -10,4 +10,6 @@ return [
|
||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
|
||||
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
|
||||
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
|
||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
|
||||
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
framework:
|
||||
asset_mapper:
|
||||
# The paths to make available to the asset mapper.
|
||||
paths:
|
||||
- assets/
|
||||
@@ -0,0 +1,9 @@
|
||||
nelmio_api_doc:
|
||||
documentation:
|
||||
info:
|
||||
title: SomniaRooms
|
||||
description: A FOSS Hotel room booking system.
|
||||
version: 1.0.0
|
||||
areas: # to filter documented areas
|
||||
path_patterns:
|
||||
- ^/api(?!/doc$) # Accepts routes under /api except /api/doc
|
||||
@@ -0,0 +1,10 @@
|
||||
# Expose your documentation as JSON swagger compliant
|
||||
app.swagger:
|
||||
path: /api/doc.json
|
||||
methods: GET
|
||||
defaults: { _controller: nelmio_api_doc.controller.swagger }
|
||||
|
||||
app.swagger_ui:
|
||||
path: /api/swagger
|
||||
methods: GET
|
||||
defaults: { _controller: nelmio_api_doc.controller.swagger_ui }
|
||||
@@ -20,5 +20,9 @@ services:
|
||||
- '../src/Entity/'
|
||||
- '../src/Kernel.php'
|
||||
|
||||
App\Service\FileUploaderService:
|
||||
arguments:
|
||||
$targetDirectory: 'images/'
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+90
-5
@@ -15,7 +15,7 @@ SomniaRooms back-end and front-end can run on the same machine, but some config
|
||||
### Deploy back-end and front-end on different servers (different ip address).
|
||||
If your servers have different IP addresses everything is a little bit easier. You can set-up subdomains for each one.
|
||||
|
||||
Use the following docker compose files for back-end and front-end.
|
||||
Use the following docker compose files to deploy back-end and front-end on different servers.
|
||||
|
||||
Back-end:
|
||||
```yml
|
||||
@@ -25,7 +25,8 @@ services:
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
SERVER_NAME: https://api.somnia.dev # <-- Your hostname here!
|
||||
DATABASE_URL: postgresql://somnia:ChangeMe!@database/somniarooms?serverVersion=16&ch> MERCURE_PUBLISHER_JWT_KEY: ChangeThisMercureHubJWTSecretKey!
|
||||
DATABASE_URL: postgresql://somnia:ChangeMe!@database/somniarooms?serverVersion=16&charset=utf8
|
||||
MERCURE_PUBLISHER_JWT_KEY: ChangeThisMercureHubJWTSecretKey!
|
||||
MERCURE_SUBSCRIBER_JWT_KEY: ChangeThisMercureHubJWTSecretKey!
|
||||
APP_SECRET: ChangeMySecret
|
||||
FRANKENPHP_CONFIG: "" # <-- Dont touch this line unless you know what are doing.
|
||||
@@ -71,7 +72,7 @@ volumes:
|
||||
```
|
||||
|
||||
Config details
|
||||
- SERVER_NAME -> if set to https a SSL cert will be obtained. If you set http, SSL will be disabled.
|
||||
- SERVER_NAME -> if set to https a SSL cert will be obtained. If you set http, SSL will be disabled. (Read more about this [here](https://caddyserver.com/docs/automatic-https))
|
||||
|
||||
|
||||
Front-end:
|
||||
@@ -95,7 +96,7 @@ services:
|
||||
|
||||
|
||||
### Deploy on the same server.
|
||||
Right now, it's quite difficult to set back-end app on a port different from 80/443. Back-end uses Caddy as webserver and automatically try to get SSL certs from let's encrypt.
|
||||
Right now, it's quite difficult to set back-end app on a port different from 80/443. Back-end uses Caddy as webserver and automatically try to get SSL certs from let's encrypt. If back-end port is changed, back-end server address should be http to avoid failed TLS challenges.
|
||||
|
||||
My go-to option will be using some reverse-proxy to redirect requests to back or front by domain name.
|
||||
|
||||
@@ -140,6 +141,8 @@ services:
|
||||
MERCURE_SUBSCRIBER_JWT_KEY: ChangeThisMercureHubJWTSecretKey!
|
||||
APP_SECRET: ChangeMySecret
|
||||
FRANKENPHP_CONFIG: "" # <-- Dont touch this line unless you know what are doing.
|
||||
TRUSTED_HOSTS: api.somnia.dev
|
||||
TRUSTED_PROXIES: reverse-proxy
|
||||
volumes:
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
@@ -152,6 +155,7 @@ services:
|
||||
- "traefik.http.routers.somniarooms-back.entrypoints=websecure"
|
||||
- "traefik.http.routers.somniarooms-back.tls=true"
|
||||
- "traefik.http.routers.somniarooms-back.tls.certresolver=lets-encrypt"
|
||||
- "traefik.http.services.somniarooms-back.loadbalancer.server.port=80"
|
||||
|
||||
somniarooms-front:
|
||||
image: gitea.uberelectronnetwork.cc/somnia/somniaroomsapp:devbuild
|
||||
@@ -164,7 +168,10 @@ services:
|
||||
- somniarooms-back
|
||||
labels:
|
||||
- "traefik.http.routers.somniarooms-front.rule=Host(`app.somnia.dev`)" # <-- Your front-end hostname here!
|
||||
|
||||
- "traefik.http.routers.somniarooms-front.entrypoints=websecure"
|
||||
- "traefik.http.routers.somniarooms-front.tls=true"
|
||||
- "traefik.http.routers.somniarooms-front.tls.certresolver=lets-encrypt"
|
||||
- "traefik.http.services.somniarooms-front.loadbalancer.server.port=80"
|
||||
|
||||
database:
|
||||
image: postgres:16-alpine
|
||||
@@ -189,6 +196,84 @@ volumes:
|
||||
|
||||
```
|
||||
|
||||
If you dont care about SSL, you can set it up using HTTP only.
|
||||
You may need to use different ports for back-end and front-end.
|
||||
|
||||
This setup uses the following config:
|
||||
- back-end -> port 8001.
|
||||
- front-end -> port 80.
|
||||
|
||||
```yml
|
||||
services:
|
||||
somniarooms-back:
|
||||
image: gitea.uberelectronnetwork.cc/somnia/somniarooms:devbuild
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# Server name should be "HTTP" to disable auto certs.
|
||||
# Set listening port as well if different from 80/443.
|
||||
# If a server name is set, Caddy will only work for that name. You can set all you need comma separated.
|
||||
# You can "wildcard" as well if that's your thing...
|
||||
# SERVER_NAME: :8001
|
||||
SERVER_NAME: http://api.somnia.dev:8001, http://IP:8001
|
||||
DATABASE_URL: postgresql://somnia:ChangeMe!@database/somniarooms?serverVersion=16&charset=utf8
|
||||
MERCURE_PUBLISHER_JWT_KEY: ChangeThisMercureHubJWTSecretKey!
|
||||
MERCURE_SUBSCRIBER_JWT_KEY: ChangeThisMercureHubJWTSecretKey!
|
||||
FRANKENPHP_CONFIG: ""
|
||||
APP_SECRET: ChangeMySecret
|
||||
TRUSTED_HOSTS: api.somnia.dev
|
||||
volumes:
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
ports:
|
||||
# HTTP
|
||||
# Target port must be the same as SERVER_NAME. Caddy will use SERVER_NAME port instead of 80/443 if set.
|
||||
- target: 8001
|
||||
published: 8001
|
||||
depends_on:
|
||||
- database
|
||||
|
||||
somniarooms-front:
|
||||
image: gitea.uberelectronnetwork.cc/somnia/somniaroomsapp:devbuild
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# You should set your public IP/hostname to back-end.
|
||||
# You may have problems with CORS... Make sure back and front have same domain or allow requests for those domains.
|
||||
SOMNIAROOMS_BACKEND_HOST: http://api.somnia.dev
|
||||
SOMNIAROOMS_BACKEND_PORT: 8001 # <-- Set back-end published port.
|
||||
ports:
|
||||
# HTTP
|
||||
- target: 80
|
||||
published: 80
|
||||
# HTTPS.
|
||||
# Uncomment if HTTPS is available. You should configure certs by yourself here.
|
||||
#- target: 443
|
||||
# published: 443
|
||||
depends_on:
|
||||
- somniarooms-back
|
||||
|
||||
database:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_DB: somniarooms
|
||||
# You should definitely change the password in production. Remember to change DATABASE_URL as well.
|
||||
POSTGRES_PASSWORD: ChangeMe!
|
||||
POSTGRES_USER: somnia
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready"]
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
volumes:
|
||||
- database_data:/var/lib/postgresql/data:rw
|
||||
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/db/data:/var/lib/postgresql/data:rw
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
database_data:
|
||||
```
|
||||
|
||||
|
||||
## What's next?
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Returns the importmap for this application.
|
||||
*
|
||||
* - "path" is a path inside the asset mapper system. Use the
|
||||
* "debug:asset-map" command to see the full list of paths.
|
||||
*
|
||||
* - "entrypoint" (JavaScript only) set to true for any module that will
|
||||
* be used as an "entrypoint" (and passed to the importmap() Twig function).
|
||||
*
|
||||
* The "importmap:require" command can be used to add new entries to this file.
|
||||
*/
|
||||
return [
|
||||
'app' => [
|
||||
'path' => './assets/app.js',
|
||||
'entrypoint' => true,
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240604185317 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP SEQUENCE config_variable_id_seq CASCADE');
|
||||
$this->addSql('DROP INDEX uniq_718569538a90aba9');
|
||||
$this->addSql('ALTER TABLE config_variable DROP CONSTRAINT config_variable_pkey');
|
||||
$this->addSql('ALTER TABLE config_variable DROP id');
|
||||
$this->addSql('ALTER TABLE config_variable ALTER section SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE config_variable ALTER section TYPE VARCHAR(255)');
|
||||
$this->addSql('ALTER TABLE config_variable ADD PRIMARY KEY (key)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('CREATE SEQUENCE config_variable_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('DROP INDEX config_variable_pkey');
|
||||
$this->addSql('ALTER TABLE config_variable ADD id INT NOT NULL');
|
||||
$this->addSql('ALTER TABLE config_variable ALTER section DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE config_variable ALTER section TYPE VARCHAR(64)');
|
||||
$this->addSql('CREATE UNIQUE INDEX uniq_718569538a90aba9 ON config_variable (key)');
|
||||
$this->addSql('ALTER TABLE config_variable ADD PRIMARY KEY (id)');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240909114239 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP SEQUENCE room_category_details_id_seq CASCADE');
|
||||
$this->addSql('ALTER TABLE room_category_details DROP CONSTRAINT fk_3735fabb67333dd');
|
||||
$this->addSql('DROP TABLE room_category_details');
|
||||
$this->addSql('ALTER TABLE room_category_photo ADD photo_order INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE room_category_photo DROP kind');
|
||||
$this->addSql('ALTER TABLE room_fare DROP CONSTRAINT FK_35C9B213A7233EF2');
|
||||
$this->addSql('ALTER TABLE room_fare ADD CONSTRAINT FK_35C9B213A7233EF2 FOREIGN KEY (fare_table_id) REFERENCES fare_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('CREATE SEQUENCE room_category_details_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE room_category_details (id INT NOT NULL, room_category_id INT NOT NULL, details_section VARCHAR(255) NOT NULL, detail_value VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX idx_3735fabb67333dd ON room_category_details (room_category_id)');
|
||||
$this->addSql('ALTER TABLE room_category_details ADD CONSTRAINT fk_3735fabb67333dd FOREIGN KEY (room_category_id) REFERENCES room_category (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE room_fare DROP CONSTRAINT fk_35c9b213a7233ef2');
|
||||
$this->addSql('ALTER TABLE room_fare ADD CONSTRAINT fk_35c9b213a7233ef2 FOREIGN KEY (fare_table_id) REFERENCES fare_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE room_category_photo ADD kind VARCHAR(30) NOT NULL');
|
||||
$this->addSql('ALTER TABLE room_category_photo DROP photo_order');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240909131104 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SEQUENCE bed_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE bed_type (id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, icon_url VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE room_category_bed_type (room_category_id INT NOT NULL, bed_type_id INT NOT NULL, amount INT NOT NULL, PRIMARY KEY(room_category_id, bed_type_id))');
|
||||
$this->addSql('CREATE INDEX IDX_FB45954567333DD ON room_category_bed_type (room_category_id)');
|
||||
$this->addSql('CREATE INDEX IDX_FB4595458158330E ON room_category_bed_type (bed_type_id)');
|
||||
$this->addSql('ALTER TABLE room_category_bed_type ADD CONSTRAINT FK_FB45954567333DD FOREIGN KEY (room_category_id) REFERENCES room_category (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE room_category_bed_type ADD CONSTRAINT FK_FB4595458158330E FOREIGN KEY (bed_type_id) REFERENCES bed_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('DROP SEQUENCE bed_type_id_seq CASCADE');
|
||||
$this->addSql('ALTER TABLE room_category_bed_type DROP CONSTRAINT FK_FB45954567333DD');
|
||||
$this->addSql('ALTER TABLE room_category_bed_type DROP CONSTRAINT FK_FB4595458158330E');
|
||||
$this->addSql('DROP TABLE bed_type');
|
||||
$this->addSql('DROP TABLE room_category_bed_type');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240910160534 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE room_category DROP bed_type');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE room_category ADD bed_type VARCHAR(64) DEFAULT NULL');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240916181831 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE room_category ADD order_home_page SMALLINT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE room_category DROP order_home_page');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
images/
|
||||
+6
-8
@@ -2,23 +2,21 @@
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\RoomCategoryDetails;
|
||||
use App\Entity\BedType;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField;
|
||||
|
||||
class RoomCategoryDetailsCrudController extends AbstractCrudController
|
||||
class BedTypeCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return RoomCategoryDetails::class;
|
||||
return BedType::class;
|
||||
}
|
||||
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
TextField::new('detailsSection'),
|
||||
TextField::new('detailValue'),
|
||||
];
|
||||
yield TextField::new('name');
|
||||
yield UrlField::new('iconUrl');
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\ConfigVariable;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
use App\Enum\ConfigSectionType;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class ConfigVariableCrudController extends AbstractCrudController
|
||||
{
|
||||
@@ -14,10 +16,14 @@ class ConfigVariableCrudController extends AbstractCrudController
|
||||
return ConfigVariable::class;
|
||||
}
|
||||
|
||||
public function configureCrud(Crud $crud): Crud
|
||||
{
|
||||
return $crud;
|
||||
}
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
yield TextField::new('section');
|
||||
yield ChoiceField::new ('section')->setChoices(ConfigSectionType::cases());
|
||||
yield TextField::new ('key');
|
||||
yield TextField::new ('value');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Service\FileUploaderService;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Asset\PathPackage;
|
||||
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Component\Validator\Constraints\File;
|
||||
|
||||
#[IsGranted("ROLE_ADMIN")]
|
||||
class PhotoManagerAdminController extends AbstractController
|
||||
{
|
||||
|
||||
private AdminUrlGenerator $adminUrlGenerator;
|
||||
private FileUploaderService $fileUploader;
|
||||
|
||||
public function __construct(
|
||||
AdminUrlGenerator $adminUrlGenerator,
|
||||
FileUploaderService $fu
|
||||
) {
|
||||
$this->adminUrlGenerator = $adminUrlGenerator;
|
||||
$this->fileUploader = $fu;
|
||||
}
|
||||
|
||||
|
||||
#[Route('/admin/photos', name: 'admin_photos')]
|
||||
public function index(): Response
|
||||
{
|
||||
$fileData = [];
|
||||
|
||||
$dir = $this->fileUploader->getTargetDirectory();
|
||||
$pathPackage = new PathPackage($dir, new EmptyVersionStrategy());
|
||||
|
||||
foreach (glob($dir . '*.*') as $file) {
|
||||
$filename = basename($file);
|
||||
$fileData[] = [
|
||||
"filename" => $filename,
|
||||
"url" => $pathPackage->getUrl($filename),
|
||||
];
|
||||
}
|
||||
|
||||
//return new JsonResponse(["dir" => $dir, "response" => $fileData]);
|
||||
|
||||
return $this->render('admin/photo_manager/index.html.twig', [
|
||||
'photoList' => $fileData,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/photos/upload', name: 'admin_photos_upload')]
|
||||
public function uploadPhoto(
|
||||
Request $request
|
||||
): Response {
|
||||
|
||||
$form = $this->createFormBuilder()
|
||||
->add('file', FileType::class, [
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'constraints' => [
|
||||
new File([
|
||||
'maxSize' => '2048k',
|
||||
'mimeTypes' => [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/svg+xml',
|
||||
'image/webp',
|
||||
],
|
||||
'mimeTypesMessage' => 'Please upload a valid image!',
|
||||
])
|
||||
],
|
||||
])
|
||||
->add('submit', SubmitType::class)
|
||||
->getForm();
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
/** @var UploadedFile $uploadedPhoto */
|
||||
$uploadedPhoto = $form->get('file')->getData();
|
||||
|
||||
if ($uploadedPhoto) {
|
||||
$filename = $this->fileUploader->upload($uploadedPhoto);
|
||||
}
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_photos')->generateUrl();
|
||||
return $this->redirect($url);
|
||||
}
|
||||
|
||||
return $this->render('admin/adminEdit.html.twig', [
|
||||
'form' => $form,
|
||||
'ElementName' => "Photo",
|
||||
'ElementType' => "New Photo",
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/photos/remove/{filename}', name: 'admin_photos_remove')]
|
||||
public function remove(string $filename): Response
|
||||
{
|
||||
$filePath = $this->fileUploader->getTargetDirectory() . $filename;
|
||||
$deleted = $this->fileUploader->deleteFile($filePath);
|
||||
|
||||
if (!$deleted) {
|
||||
throw new HttpException("404", "File can't be deleted");
|
||||
}
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_photos')->generateUrl();
|
||||
return $this->redirect($url);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
#[IsGranted("ROLE_ADMIN")]
|
||||
class RoomAvailabilityAdminController extends AbstractController
|
||||
{
|
||||
|
||||
private $adminUrlGenerator;
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
@@ -63,7 +62,7 @@ class RoomAvailabilityAdminController extends AbstractController
|
||||
//TODOME: Aquí deberíamos llevar a una página de error o algo.
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_roomAvailability_category', [
|
||||
'categoryId' => $item->getId(),
|
||||
'categoryId' => $categoryId,
|
||||
])->generateUrl();
|
||||
return $this->redirect($url);
|
||||
}
|
||||
@@ -129,19 +128,4 @@ class RoomAvailabilityAdminController extends AbstractController
|
||||
'categoryId' => $categoryId,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/roomAvailabilityTEST/', name: 'admin_roomAvailability_test')]
|
||||
public function availabilityTest(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$avl = new RoomAvailability();
|
||||
|
||||
$avl->setDay(new \DateTime("2024-04-24"));
|
||||
$avl->setRoomCategory($entityManager->find(RoomCategory::class, 4));
|
||||
$avl->setNumAvailable(2);
|
||||
|
||||
$entityManager->persist($avl);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->json($avl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\RoomCategory;
|
||||
use App\Entity\RoomCategoryBedType;
|
||||
use App\Repository\RoomCategoryRepository;
|
||||
use App\Repository\RoomCategoryBedTypeRepository;
|
||||
use App\Form\RoomCategoryBedTypeFormType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
#[IsGranted("ROLE_ADMIN")]
|
||||
class RoomCategoryBedTypeAdminController extends AbstractController
|
||||
{
|
||||
private $adminUrlGenerator;
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
public function __construct(AdminUrlGenerator $adminUrlGenerator, EntityManagerInterface $em)
|
||||
{
|
||||
$this->adminUrlGenerator = $adminUrlGenerator;
|
||||
$this->entityManager = $em;
|
||||
}
|
||||
|
||||
#[Route('/admin/roomCategoryBedType', name: 'admin_roomCategoryBedType')]
|
||||
public function index(RoomCategoryRepository $catRepo): Response
|
||||
{
|
||||
$categoryList = $catRepo->findAll();
|
||||
|
||||
return $this->render('admin/room_category_bed_type_admin/index.html.twig', [
|
||||
'roomCategoryList' => $categoryList,
|
||||
]);
|
||||
}
|
||||
|
||||
// List BedTypes from category.
|
||||
#[Route('/admin/roomCategoryBedType/{categoryId}', name: 'admin_roomCategoryBedType_category')]
|
||||
public function categoryBedTypes(RoomCategoryRepository $catRepo, RoomCategoryBedTypeRepository $repo, string $categoryId): Response
|
||||
{
|
||||
$category = $catRepo->find($categoryId);
|
||||
$bedTypeList = $repo->findByRoomCategory($categoryId);
|
||||
|
||||
return $this->render('admin/room_category_bed_type_admin/categoryBedTypes.html.twig', [
|
||||
'categoryData' => $category,
|
||||
'bedTypeList' => $bedTypeList,
|
||||
]);
|
||||
}
|
||||
|
||||
// Create a RoomCategory BedType.
|
||||
#[Route('/admin/roomCategoryBedType/{categoryId}/new', name: 'admin_roomCategoryBedType_category_create')]
|
||||
public function createCategoryBedType(Request $request, RoomCategoryBedTypeRepository $repo, string $categoryId): Response
|
||||
{
|
||||
$roomCatBedType = new RoomCategoryBedType();
|
||||
$roomCategoryItem = $this->entityManager->find(RoomCategory::class, $categoryId);
|
||||
$roomCatBedType->setRoomCategory($roomCategoryItem);
|
||||
|
||||
$form = $this->createForm(RoomCategoryBedTypeFormType::class, $roomCatBedType, [
|
||||
'selectRoomCategory' => false,
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
// $form->getData() holds the submitted values
|
||||
// but, the original `$availabilityItem` variable has also been updated
|
||||
|
||||
$this->entityManager->persist($roomCatBedType);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_roomCategoryBedType_category', [
|
||||
'categoryId' => $roomCatBedType->getRoomCategory()->getId(),
|
||||
])->generateUrl();
|
||||
|
||||
return $this->redirect($url);
|
||||
}
|
||||
|
||||
return $this->render('admin/adminEdit.html.twig', [
|
||||
'form' => $form,
|
||||
'ElementType' => "Room Categoy Bed Type",
|
||||
'ElementName' => "Room Categoy - " . $roomCategoryItem
|
||||
]);
|
||||
}
|
||||
|
||||
// Edit a RoomCategory BedType.
|
||||
#[Route('/admin/roomCategoryBedType/{categoryId}/{bedTypeId}/edit', name: 'admin_roomCategoryBedType_category_update')]
|
||||
public function updateCategoryBedType(Request $request, RoomCategoryBedTypeRepository $repo, string $categoryId, string $bedTypeId): Response
|
||||
{
|
||||
$categoryBedTypeItem = $repo->find(["bedType" => $bedTypeId, "roomCategory" => $categoryId]);
|
||||
|
||||
if ($categoryBedTypeItem == null) {
|
||||
//TODOME: Aquí deberíamos llevar a una página de error o algo.
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_roomCategoryBedType_category', [
|
||||
'categoryId' => $categoryId,
|
||||
])->generateUrl();
|
||||
return $this->redirect($url);
|
||||
}
|
||||
|
||||
$form = $this->createForm(RoomCategoryBedTypeFormType::class, $categoryBedTypeItem, [
|
||||
'selectRoomCategory' => false,
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
// $form->getData() holds the submitted values
|
||||
// but, the original `$categoryBedTypeItem` variable has also been updated
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_roomCategoryBedType_category', [
|
||||
'categoryId' => $categoryId,
|
||||
])->generateUrl();
|
||||
|
||||
return $this->redirect($url);
|
||||
}
|
||||
|
||||
return $this->render('admin/adminEdit.html.twig', [
|
||||
'form' => $form,
|
||||
'ElementType' => "Room Categoy Bed Type",
|
||||
'ElementName' => "Room Categoy - " . $categoryBedTypeItem->getRoomCategory()
|
||||
]);
|
||||
}
|
||||
|
||||
// Remove a RoomCategoryBedType.
|
||||
#[Route('/admin/roomCategoryBedType/{categoryId}/{bedTypeId}/remove', name: 'admin_roomCategoryBedType_category_remove')]
|
||||
public function removeCategoryBedType(RoomCategoryBedTypeRepository $repo, string $categoryId, string $bedTypeId) : Response {
|
||||
$categoryBedTypeItem = $repo->find(["bedType" => $bedTypeId, "roomCategory" => $categoryId]);
|
||||
if(!$categoryBedTypeItem) {
|
||||
throw $this->createNotFoundException('Element not found');
|
||||
}
|
||||
|
||||
$this->entityManager->remove($categoryBedTypeItem);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$url = $this->adminUrlGenerator->setRoute('admin_roomCategoryBedType_category', [
|
||||
'categoryId' => $categoryId,
|
||||
])->generateUrl();
|
||||
return $this->redirect($url);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\RoomCategoryBedType;
|
||||
use App\Form\RoomCategoryBedTypeForm;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Page;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
@@ -27,14 +30,10 @@ class RoomCategoryCrudController extends AbstractCrudController
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
//IdField::new('id'),
|
||||
TextField::new('name'),
|
||||
TextField::new('description'),
|
||||
TextField::new('bedType'),
|
||||
IntegerField::new('maxGuestNum'),
|
||||
CollectionField::new('roomCategoryDetails')->useEntryCrudForm(),
|
||||
CollectionField::new('roomCategoryPhotos')->useEntryCrudForm()
|
||||
];
|
||||
yield TextField::new('name');
|
||||
yield TextField::new('description');
|
||||
yield IntegerField::new('maxGuestNum');
|
||||
yield IntegerField::new('orderHomePage');
|
||||
yield CollectionField::new('roomCategoryPhotos')->useEntryCrudForm();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Controller\Admin;
|
||||
use App\Entity\RoomCategoryPhoto;
|
||||
use App\Entity\RoomCategoryPhotoKinds;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\{TextField, ChoiceField};
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\{TextField, IntegerField};
|
||||
|
||||
class RoomCategoryPhotoCrudController extends AbstractCrudController
|
||||
{
|
||||
@@ -18,7 +18,7 @@ class RoomCategoryPhotoCrudController extends AbstractCrudController
|
||||
{
|
||||
yield TextField::new('path');
|
||||
yield TextField::new('altText');
|
||||
yield ChoiceField::new('kind')->setChoices(['Main' => 'main', 'Bathroom' => 'bathroom', 'Other' => 'other']);
|
||||
yield IntegerField::new('photoOrder');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,8 @@ class RoomFareCrudController extends AbstractCrudController
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
$fieldFareTable = AssociationField::new ('fareTable')->setRequired(true);
|
||||
$fieldFareTable = AssociationField::new('fareTable')->setRequired(true)
|
||||
->formatValue(fn ($value) => $value->getComment() . " (" . $value->getRoomCategory() . ")");
|
||||
if ($pageName == Crud::PAGE_EDIT) {
|
||||
$fieldFareTable->setDisabled(true);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\BedType;
|
||||
use App\Entity\Booking;
|
||||
use App\Entity\ConfigVariable;
|
||||
use App\Entity\FareTable;
|
||||
@@ -41,6 +42,13 @@ class SomniaDashboardController extends AbstractDashboardController
|
||||
yield MenuItem::linkToCrud('Fare Tables', 'fas fa-table', FareTable::class);
|
||||
yield MenuItem::linkToCrud('Room Fares', 'fas fa-tag', RoomFare::class);
|
||||
|
||||
yield MenuItem::Section('Category Configuration');
|
||||
yield MenuItem::linkToCrud('Bed Types', 'fas fa-bed', BedType::class);
|
||||
yield MenuItem::linkToRoute('Bed Type - category', 'fas fa-bed', 'admin_roomCategoryBedType');
|
||||
|
||||
yield MenuItem::Section('Resources');
|
||||
yield MenuItem::linkToRoute('Photos', 'fas fa-image', 'admin_photos');
|
||||
|
||||
yield MenuItem::Section('App Management');
|
||||
yield MenuItem::linkToCrud('Config Vars', 'fas fa-gear', ConfigVariable::class);
|
||||
yield MenuItem::linkToCrud('Users', 'fas fa-user', User::class)
|
||||
|
||||
@@ -8,60 +8,97 @@ use App\Entity\BookingRoom;
|
||||
use App\Repository\BookingRepository;
|
||||
use App\Repository\RoomCategoryRepository;
|
||||
use App\Repository\RoomAvailabilityRepository;
|
||||
use App\Request\BookingCreateRequest;
|
||||
use App\Request\BookingDetailsRequest;
|
||||
use App\Response\BookingCreateResponse;
|
||||
use App\Service\PricesService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use OpenApi\Attributes as OA;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
|
||||
class BookingController extends AbstractController
|
||||
{
|
||||
#[Route('/api/booking/details', name: 'app_booking_details')]
|
||||
public function getBookingDetails(Request $request, BookingRepository $repoBooking): JsonResponse
|
||||
{
|
||||
$payload = $request->toArray();
|
||||
if (\is_null($payload)) {
|
||||
/**
|
||||
* Get booking details
|
||||
*/
|
||||
#[Route('/api/booking/details', name: 'app_booking_details', methods: ["POST"], format: "json")]
|
||||
#[OA\Tag(name: "Booking")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns booking details',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: Booking::class),
|
||||
)
|
||||
)]
|
||||
#[OA\RequestBody(
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: BookingDetailsRequest::class),
|
||||
)
|
||||
)]
|
||||
public function getBookingDetails(
|
||||
BookingRepository $repoBooking,
|
||||
#[MapRequestPayload()] BookingDetailsRequest $detailsRequest
|
||||
): JsonResponse {
|
||||
|
||||
if (\is_null($detailsRequest)) {
|
||||
throw new \Exception('Invalid Payload', 400);
|
||||
}
|
||||
|
||||
$refNumber = $payload["refNumber"];
|
||||
$customerEmail = $payload["email"];
|
||||
|
||||
$bookingList = $repoBooking->findBy(["refNumber" => $refNumber]);
|
||||
$bookingList = $repoBooking->findBy(["refNumber" => $detailsRequest->refNumber]);
|
||||
if (\is_null($bookingList) || \count($bookingList) == 0) {
|
||||
throw new HttpException(404, 'Invalid Booking');
|
||||
}
|
||||
|
||||
$customerBooking = $bookingList[0];
|
||||
if ($customerBooking->getBookingCustomer()->getEmail() != $customerEmail) {
|
||||
if ($customerBooking->getBookingCustomer()->getEmail() != $detailsRequest->email) {
|
||||
throw new HttpException(404, 'Invalid Booking');
|
||||
}
|
||||
|
||||
return $this->json($customerBooking);
|
||||
}
|
||||
|
||||
#[Route('/api/booking/create', name: 'app_booking_create')]
|
||||
public function newBooking(Request $request, BookingRepository $repoBooking, EntityManagerInterface $entityManager,
|
||||
RoomCategoryRepository $repoCat, RoomAvailabilityRepository $repoAvailability,
|
||||
PricesService $priceSrv): JsonResponse
|
||||
{
|
||||
$payload = $request->toArray();
|
||||
if (\is_null($payload)) {
|
||||
throw new \Exception('Invalid Payload', 400);
|
||||
/**
|
||||
* Create a new Booking.
|
||||
*/
|
||||
#[Route('/api/booking/create', name: 'app_booking_create', methods: ["POST"], format: "json")]
|
||||
#[OA\Tag(name: "Booking")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns booking details',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: BookingCreateResponse::class)
|
||||
)
|
||||
)]
|
||||
#[OA\RequestBody(
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: BookingCreateRequest::class),
|
||||
)
|
||||
)]
|
||||
public function newBooking(
|
||||
Request $request,
|
||||
EntityManagerInterface $entityManager,
|
||||
RoomCategoryRepository $repoCat,
|
||||
RoomAvailabilityRepository $repoAvailability,
|
||||
PricesService $priceSrv,
|
||||
#[MapRequestPayload()] BookingCreateRequest $createRequest
|
||||
): JsonResponse {
|
||||
if (\is_null($createRequest)) {
|
||||
throw new HttpException('Invalid Payload', 400);
|
||||
}
|
||||
|
||||
|
||||
$booking = new Booking();
|
||||
try {
|
||||
$reqArrivalDate = $payload["arrivalDate"];
|
||||
$reqDepartureDate = $payload["departureDate"];
|
||||
|
||||
$arrivalDate = new \DateTime($reqArrivalDate);
|
||||
$departureDate = new \DateTime($reqDepartureDate);
|
||||
|
||||
if ($arrivalDate >= $departureDate) {
|
||||
if ($createRequest->arrivalDate >= $createRequest->departureDate) {
|
||||
throw new HttpException(400, "Arrival cant be before departure");
|
||||
}
|
||||
|
||||
@@ -71,9 +108,11 @@ class BookingController extends AbstractController
|
||||
|
||||
// Create booking from request data.
|
||||
$booking->setBookingTime($currentTime);
|
||||
$booking->setArrivalDate($arrivalDate);
|
||||
$booking->setDepartureDate($departureDate);
|
||||
$booking->setArrivalDate($createRequest->arrivalDate);
|
||||
$booking->setDepartureDate($createRequest->departureDate);
|
||||
$booking->setBookingCustomer($createRequest->customerDetails);
|
||||
|
||||
//TODOME: Improve refNumber generation.
|
||||
$highest_id = $entityManager->createQueryBuilder()
|
||||
->select('MAX(e.id)')
|
||||
->from('App\Entity\Booking', 'e')
|
||||
@@ -84,37 +123,25 @@ class BookingController extends AbstractController
|
||||
|
||||
$entityManager->persist($booking);
|
||||
|
||||
// Create booking customer.
|
||||
$reqCustomer = $payload["customerDetails"];
|
||||
$bookingCustomer = new BookingCustomer();
|
||||
$bookingCustomer->setName($reqCustomer["name"]);
|
||||
$bookingCustomer->setSurname($reqCustomer["surname"]);
|
||||
$bookingCustomer->setEmail($reqCustomer["email"]);
|
||||
$bookingCustomer->setPhoneNumber($reqCustomer["phoneNumber"]);
|
||||
$bookingCustomer->setBooking($booking);
|
||||
|
||||
$entityManager->persist($bookingCustomer);
|
||||
|
||||
$reqRoomList = $payload["rooms"];
|
||||
if (\count($reqRoomList) == 0) {
|
||||
if (\count($createRequest->rooms) == 0) {
|
||||
throw new HttpException(400, "Se debe indicar al menos una habitación");
|
||||
}
|
||||
|
||||
// Create each room.
|
||||
foreach ($reqRoomList as $roomItem) {
|
||||
foreach ($createRequest->rooms as $roomItem) {
|
||||
$room = new BookingRoom();
|
||||
$room->setBooking($booking);
|
||||
|
||||
//Get Room category.
|
||||
$roomCategory = $repoCat->find($roomItem["roomCategory"]);
|
||||
$roomCategory = $repoCat->find($roomItem->roomCategory);
|
||||
if ($roomCategory == null) {
|
||||
throw new HttpException(400, "La RoomCategory no es válida.");
|
||||
}
|
||||
|
||||
//Check room availability.
|
||||
$amountAvailable = $repoAvailability->getAvailabilityForCategoryInPeriod($roomCategory, $arrivalDate, $departureDate);
|
||||
$selectedAmount = $roomItem['amount'];
|
||||
$selectedGuestAmount = $roomItem["guestNumber"];
|
||||
$amountAvailable = $repoAvailability->getAvailabilityForCategoryInPeriod($roomCategory, $createRequest->arrivalDate, $createRequest->departureDate);
|
||||
$selectedAmount = $roomItem->amount;
|
||||
$selectedGuestAmount = $roomItem->guestNumber;
|
||||
|
||||
if ($amountAvailable == null || $selectedAmount > $amountAvailable) {
|
||||
throw new HttpException(400, "No se pueden reservar más habitaciones de las disponibles.");
|
||||
@@ -125,7 +152,7 @@ class BookingController extends AbstractController
|
||||
$room->setAmount($selectedAmount);
|
||||
|
||||
//Get Price for period.
|
||||
$priceList = $priceSrv->getFinalPricesForSearch($roomCategory, $arrivalDate, $departureDate);
|
||||
$priceList = $priceSrv->getFinalPricesForSearch($roomCategory, $createRequest->arrivalDate, $createRequest->departureDate);
|
||||
$priceFound = false;
|
||||
foreach ($priceList as $key => $value) {
|
||||
if ($key == $selectedGuestAmount) {
|
||||
@@ -136,19 +163,20 @@ class BookingController extends AbstractController
|
||||
}
|
||||
|
||||
if (!$priceFound) {
|
||||
throw new HttpException(500,
|
||||
"No se puedo obtener el precio para la categoría: " . $roommCategory->getId() . " , guests: " . $selecctedGuestAmount);
|
||||
throw new HttpException(
|
||||
500,
|
||||
"No se puedo obtener el precio para la categoría: " . $roomCategory->getId() . " , guests: " . $selectedGuestAmount
|
||||
);
|
||||
}
|
||||
|
||||
$entityManager->persist($room);
|
||||
|
||||
//If booking is nice, let's update current availability.
|
||||
$repoAvailability->updateAvailabilityForRoomCategoryOnPeriod($roomCategory, $arrivalDate, $departureDate, $selectedAmount, true); //Update using "diff" mode.
|
||||
$repoAvailability->updateAvailabilityForRoomCategoryOnPeriod($roomCategory, $createRequest->arrivalDate, $createRequest->departureDate, $selectedAmount, true); //Update using "diff" mode.
|
||||
}
|
||||
|
||||
$entityManager->commit();
|
||||
$entityManager->flush();
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$entityManager->rollback();
|
||||
throw $th;
|
||||
|
||||
@@ -2,14 +2,35 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\ConfigVariable;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use App\Repository\ConfigVariableRepository;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class ConfigVariableController extends AbstractController
|
||||
{
|
||||
#[Route('/api/config', name: 'app_config_variable')]
|
||||
/**
|
||||
* Get All config variables.
|
||||
*/
|
||||
#[Route('/api/config', name: 'app_config_allVariable', methods: ["GET"])]
|
||||
#[OA\Tag(name: "Config")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns all public config variables.',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(
|
||||
property: "results",
|
||||
type: "array",
|
||||
items: new OA\Items(ref: new Model(type: ConfigVariable::class))
|
||||
)
|
||||
]
|
||||
)
|
||||
)]
|
||||
public function getAllVariables(ConfigVariableRepository $repo): Response
|
||||
{
|
||||
$varList = $repo->findAllVariables();
|
||||
@@ -17,7 +38,22 @@ class ConfigVariableController extends AbstractController
|
||||
return $this->json(['results' => $varList]);
|
||||
}
|
||||
|
||||
#[Route('/api/config/section', name: 'app_config_sections')]
|
||||
#[Route('/api/config/section', name: 'app_config_sections', methods: ["GET"])]
|
||||
#[OA\Tag(name: "Config")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns all public config sections.',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(
|
||||
property: "results",
|
||||
type: "array",
|
||||
items: new OA\Items(type: "string")
|
||||
)
|
||||
]
|
||||
)
|
||||
)]
|
||||
public function getSections(ConfigVariableRepository $repo): Response
|
||||
{
|
||||
$sectionList = $repo->getAllSections();
|
||||
@@ -30,7 +66,28 @@ class ConfigVariableController extends AbstractController
|
||||
return $this->json(['results' => $returnList]);
|
||||
}
|
||||
|
||||
#[Route('/api/config/section/{section}', name: 'app_config_variableBySection')]
|
||||
#[Route('/api/config/section/{section}', name: 'app_config_variableBySection', methods: ["GET"])]
|
||||
#[OA\Tag(name: "Config")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns all public config variables for given section.',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(
|
||||
property: "results",
|
||||
type: "array",
|
||||
items: new OA\Items(ref: new Model(type: ConfigVariable::class))
|
||||
)
|
||||
]
|
||||
)
|
||||
)]
|
||||
#[OA\Parameter(
|
||||
name: 'section',
|
||||
in: 'path',
|
||||
description: 'Config section.',
|
||||
schema: new OA\Schema(type: 'string')
|
||||
)]
|
||||
public function getVariablesBySection(ConfigVariableRepository $repo, string $section): Response
|
||||
{
|
||||
if(\is_null($section) || $section == '') {
|
||||
@@ -42,7 +99,22 @@ class ConfigVariableController extends AbstractController
|
||||
return $this->json(['results' => $varList]);
|
||||
}
|
||||
|
||||
#[Route('/api/config/var/{key}', name: 'app_config_variable')]
|
||||
#[Route('/api/config/var/{key}', name: 'app_config_variable', methods: ["GET"])]
|
||||
#[OA\Tag(name: "Config")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Get config variable by key.',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: ConfigVariable::class),
|
||||
)
|
||||
)]
|
||||
#[OA\Parameter(
|
||||
name: 'key',
|
||||
in: 'path',
|
||||
description: 'Variable key.',
|
||||
schema: new OA\Schema(type: 'string')
|
||||
)]
|
||||
public function getByKey(ConfigVariableRepository $repo, string $key): Response
|
||||
{
|
||||
$var = $repo->findVariableByKey($key);
|
||||
|
||||
@@ -6,18 +6,37 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Repository\RoomCategoryRepository;
|
||||
use App\Entity\RoomCategory;
|
||||
use App\Entity\RoomCategoryDetails;
|
||||
use App\Entity\RoomCategoryPhoto;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use OpenApi\Annotations\Property;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Serializer\Context\Normalizer\ObjectNormalizerContextBuilder;
|
||||
use OpenApi\Attributes as OA;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class RoomCategoryController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/api/room/category', name: 'app_room_AllCategories')]
|
||||
/**
|
||||
* Get All room categories.
|
||||
*/
|
||||
#[Route('/api/room/category', name: 'app_room_AllCategories', methods: ["GET"])]
|
||||
#[OA\Tag(name: "Rooms")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns all room categories',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(
|
||||
property: "results",
|
||||
type: "array",
|
||||
items: new OA\Items(ref: new Model(type: RoomCategory::class))
|
||||
)
|
||||
]
|
||||
)
|
||||
)]
|
||||
public function getAll(RoomCategoryRepository $catRepo): Response
|
||||
{
|
||||
$catList = $catRepo->findAll();
|
||||
@@ -25,7 +44,24 @@ class RoomCategoryController extends AbstractController
|
||||
return $this->json(["results" => $catList]);
|
||||
}
|
||||
|
||||
#[Route('/api/room/category/{id}', name: 'app_room_category')]
|
||||
/**
|
||||
* Get a room category by ID.
|
||||
*/
|
||||
#[Route('/api/room/category/{id}', name: 'app_room_category', methods: ["GET"])]
|
||||
#[OA\Tag(name: "Rooms")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Returns a room category',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: RoomCategory::class),
|
||||
)
|
||||
)]
|
||||
#[OA\Parameter(
|
||||
name: 'id',
|
||||
in: 'path',
|
||||
description: 'RoomCategory ID',
|
||||
)]
|
||||
public function getById(RoomCategory $category): Response
|
||||
{
|
||||
return $this->json($category);
|
||||
|
||||
@@ -5,72 +5,132 @@ namespace App\Controller;
|
||||
use App\Repository\FareTableRepository;
|
||||
use App\Repository\RoomAvailabilityRepository;
|
||||
use App\Repository\RoomCategoryRepository;
|
||||
use App\Request\SearchAvailabilityPeriodRequest;
|
||||
use App\Response\SearchAvailabilityResponse;
|
||||
use App\Request\SearchFareCategoryRequest;
|
||||
use App\Response\SearchFareCategoryResponse;
|
||||
use App\Service\PricesService;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use OpenApi\Attributes as OA;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class SearchRoomsController extends AbstractController
|
||||
{
|
||||
#[Route('/api/search/availability', name: 'app_search_availability')]
|
||||
public function getAvailabilityForPeriod(Request $request, RoomAvailabilityRepository $repoAvailability): Response
|
||||
{
|
||||
$payload = $request->toArray();
|
||||
if (\is_null($payload)) {
|
||||
throw new \Exception('Invalid Payload', 400);
|
||||
/**
|
||||
* Get availability for all rooms on period.
|
||||
* For each room, the minimal availability will be returned.
|
||||
*/
|
||||
#[Route('/api/search/availability', name: 'app_search_availability', methods: ["POST"], format: "json")]
|
||||
#[OA\Tag(name: "Searchs")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Each room available',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(
|
||||
property: "results",
|
||||
type: "array",
|
||||
items: new OA\Items(ref: new Model(type: SearchAvailabilityResponse::class))
|
||||
)
|
||||
]
|
||||
)
|
||||
)]
|
||||
#[OA\RequestBody(
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: SearchAvailabilityPeriodRequest::class),
|
||||
)
|
||||
)]
|
||||
public function getAvailabilityForPeriod(
|
||||
Request $request,
|
||||
RoomAvailabilityRepository $repoAvailability,
|
||||
#[MapRequestPayload()] SearchAvailabilityPeriodRequest $searchRequest
|
||||
): Response {
|
||||
if (\is_null($searchRequest)) {
|
||||
throw new HttpException('Invalid Payload', 400);
|
||||
}
|
||||
$filter = $payload["filter"];
|
||||
|
||||
$startDate = new \DateTime($filter["startDate"]);
|
||||
$endDate = new \DateTime($filter["endDate"]);
|
||||
|
||||
$rs = $repoAvailability->getAvailabilityForPeriod($startDate, $endDate);
|
||||
if ($searchRequest->startDate >= $searchRequest->endDate) {
|
||||
throw new HttpException(400, "startDate cant be before endDate");
|
||||
}
|
||||
$rs = $repoAvailability->getAvailabilityForPeriod($searchRequest->startDate, $searchRequest->endDate);
|
||||
|
||||
return $this->json(["results" => $rs]);
|
||||
}
|
||||
|
||||
#[Route('/api/search/availabilityDetails', name: 'app_search_availabilityDetails')]
|
||||
public function getAvailabilityForPeriodDetails(Request $request, RoomAvailabilityRepository $repoAvailability): Response
|
||||
{
|
||||
$payload = $request->toArray();
|
||||
if (\is_null($payload)) {
|
||||
/**
|
||||
* Get Availability for all rooms on each day of a period.
|
||||
* (Not used on Front-end APP)
|
||||
*/
|
||||
#[Route('/api/search/availabilityDetails', name: 'app_search_availabilityDetails', methods: ["POST"], format: "json")]
|
||||
#[OA\Tag(name: "Searchs")]
|
||||
public function getAvailabilityForPeriodDetails(
|
||||
Request $request,
|
||||
RoomAvailabilityRepository $repoAvailability,
|
||||
#[MapRequestPayload()] SearchAvailabilityPeriodRequest $searchRequest
|
||||
): Response {
|
||||
if (\is_null($searchRequest)) {
|
||||
throw new \Exception('Invalid Payload', 400);
|
||||
}
|
||||
$filter = $payload["filter"];
|
||||
|
||||
$startDate = new \DateTime($filter["startDate"]);
|
||||
$endDate = new \DateTime($filter["endDate"]);
|
||||
$rs = $repoAvailability->getAvailabilityForPeriodDetails($searchRequest->startDate, $searchRequest->endDate);
|
||||
|
||||
$rs = $repoAvailability->getAvailabilityForPeriodDetails($startDate, $endDate);
|
||||
|
||||
return $this->json($rs);
|
||||
return $this->json(["results" => $rs]);
|
||||
}
|
||||
|
||||
#[Route('/api/search/fares', name: 'app_search_faresForCategory')]
|
||||
public function getFaresForCategoryOnPeriod(Request $request, RoomCategoryRepository $repoCat, PricesService $priceService): Response
|
||||
{
|
||||
$payload = $request->toArray();
|
||||
if (\is_null($payload)) {
|
||||
/**
|
||||
* Get room category price for given period.
|
||||
* Returns price for a room category.
|
||||
* This price is the total for all the selected days by guest number.
|
||||
*/
|
||||
#[Route('/api/search/fares', name: 'app_search_faresForCategory', methods: ["POST"], format: "json")]
|
||||
#[OA\Tag(name: "Searchs")]
|
||||
#[OA\Response(
|
||||
response: 200,
|
||||
description: 'Room price by guest number',
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(
|
||||
property: "results",
|
||||
type: "array",
|
||||
items: new OA\Items(ref: new Model(type: SearchFareCategoryResponse::class))
|
||||
)
|
||||
]
|
||||
)
|
||||
)]
|
||||
#[OA\RequestBody(
|
||||
content: new OA\JsonContent(
|
||||
type: 'object',
|
||||
ref: new Model(type: SearchFareCategoryRequest::class),
|
||||
)
|
||||
)]
|
||||
public function getFaresForCategoryOnPeriod(
|
||||
Request $request,
|
||||
RoomCategoryRepository $repoCat,
|
||||
PricesService $priceService,
|
||||
#[MapRequestPayload()] SearchFareCategoryRequest $searchRequest
|
||||
): Response {
|
||||
if (\is_null($searchRequest)) {
|
||||
throw new \Exception('Invalid Payload', 400);
|
||||
}
|
||||
$filter = $payload["filter"];
|
||||
|
||||
$catId = $filter["roomCategory"];
|
||||
$roomCategory = $repoCat->find($catId);
|
||||
$roomCategory = $repoCat->find($searchRequest->roomCategory);
|
||||
if ($roomCategory === null) {
|
||||
throw new \Exception('Invalid Category', 400);
|
||||
}
|
||||
|
||||
$startDate = new \DateTime($filter["startDate"]);
|
||||
$endDate = new \DateTime($filter["endDate"]);
|
||||
|
||||
$daysDiff = $startDate->diff($endDate)->days;
|
||||
if (!$daysDiff || $startDate > $endDate) {
|
||||
if ($searchRequest->startDate >= $searchRequest->endDate) {
|
||||
throw new \Exception('Invalid time interval', 400);
|
||||
}
|
||||
|
||||
$fareList = $priceService->getFinalPricesForSearch($roomCategory, $startDate, $endDate);
|
||||
$fareList = $priceService->getFinalPricesForSearch($roomCategory, $searchRequest->startDate, $searchRequest->endDate);
|
||||
$rs = [];
|
||||
foreach ($fareList as $key => $value) {
|
||||
$rs[] = ["guestNumber" => $key, "price" => $value];
|
||||
@@ -79,7 +139,7 @@ class SearchRoomsController extends AbstractController
|
||||
return $this->json(["results" => $rs]);
|
||||
}
|
||||
|
||||
#[Route('/search/debug', name: 'app_search_faresDebug')]
|
||||
#[Route('/debug/search', name: 'app_search_faresDebug')]
|
||||
public function faresDebug(Request $request, PricesService $priceService, FareTableRepository $repoFareTable, RoomCategoryRepository $repoCat): Response
|
||||
{
|
||||
$fareTable[] = $repoFareTable->find(1);
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\ConfigVariable;
|
||||
use App\Enum\ConfigSectionType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -37,9 +38,10 @@ class SecurityController extends AbstractController
|
||||
#[Route(path: '/setup', name: 'app_security_addAdmin')]
|
||||
public function addAdmin(UserPasswordHasherInterface $passwordHasher, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$setupStatus = $entityManager->find(ConfigVariable::class, "SETUP_STATUS");
|
||||
$configRepo = $entityManager->getRepository(ConfigVariable::class);
|
||||
$setupStatus = $configRepo->findBy(["key" => "SETUP_STATUS"]);
|
||||
|
||||
if($setupStatus == null || $setupStatus == 1) {
|
||||
if($setupStatus != null && $setupStatus[0] != null && $setupStatus[0]->getValue() != 1) {
|
||||
return new Response("Setup was already done");
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ class SecurityController extends AbstractController
|
||||
$var_setup = new ConfigVariable();
|
||||
$var_setup->setKey("SETUP_STATUS");
|
||||
$var_setup->setValue("1");
|
||||
$var_setup->setSection("SYSTEM");
|
||||
$var_setup->setSection(ConfigSectionType::Internal);
|
||||
$entityManager->persist($var_setup);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BedTypeRepository;
|
||||
use Symfony\Component\Serializer\Annotation\Ignore;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BedTypeRepository::class)]
|
||||
class BedType
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $iconUrl = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIconUrl(): ?string
|
||||
{
|
||||
return $this->iconUrl;
|
||||
}
|
||||
|
||||
public function setIconUrl(?string $iconUrl): static
|
||||
{
|
||||
$this->iconUrl = $iconUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(): string {
|
||||
return $this->getName();
|
||||
}
|
||||
}
|
||||
+20
-18
@@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Ignore;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BookingRepository::class)]
|
||||
class Booking
|
||||
@@ -14,29 +15,30 @@ class Booking
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Ignore]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $ArrivalDate = null;
|
||||
#[ORM\Column(length: 20)]
|
||||
private ?string $refNumber = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $DepartureDate = null;
|
||||
private ?\DateTimeInterface $arrivalDate = null;
|
||||
|
||||
#[ORM\Column(type : Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $departureDate = null;
|
||||
|
||||
#[ORM\Column(type : Types::DATETIMETZ_MUTABLE)]
|
||||
private ?\DateTimeInterface $BookingTime = null;
|
||||
private ?\DateTimeInterface $bookingTime = null;
|
||||
|
||||
#[ORM\OneToOne(mappedBy : 'Booking', cascade: ['persist', 'remove'])]
|
||||
#[ORM\OneToOne(mappedBy: 'booking', cascade: ['persist', 'remove'])]
|
||||
private ?BookingCustomer $bookingCustomer = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, BookingRoom>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: BookingRoom::class, mappedBy: 'Booking', orphanRemoval: true, cascade: ['persist'])]
|
||||
#[ORM\OneToMany(targetEntity: BookingRoom::class, mappedBy: 'booking', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $bookingRooms;
|
||||
|
||||
#[ORM\Column(length: 20)]
|
||||
private ?string $refNumber = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bookingRooms = new ArrayCollection();
|
||||
@@ -49,36 +51,36 @@ class Booking
|
||||
|
||||
public function getArrivalDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->ArrivalDate;
|
||||
return $this->arrivalDate;
|
||||
}
|
||||
|
||||
public function setArrivalDate(\DateTimeInterface $ArrivalDate): static
|
||||
public function setArrivalDate(\DateTimeInterface $arrivalDate): static
|
||||
{
|
||||
$this->ArrivalDate = $ArrivalDate;
|
||||
$this->arrivalDate = $arrivalDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDepartureDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->DepartureDate;
|
||||
return $this->departureDate;
|
||||
}
|
||||
|
||||
public function setDepartureDate(\DateTimeInterface $DepartureDate): static
|
||||
public function setDepartureDate(\DateTimeInterface $departureDate): static
|
||||
{
|
||||
$this->DepartureDate = $DepartureDate;
|
||||
$this->departureDate = $departureDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBookingTime(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->BookingTime;
|
||||
return $this->bookingTime;
|
||||
}
|
||||
|
||||
public function setBookingTime(\DateTimeInterface $BookingTime): static
|
||||
public function setBookingTime(\DateTimeInterface $bookingTime): static
|
||||
{
|
||||
$this->BookingTime = $BookingTime;
|
||||
$this->bookingTime = $bookingTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -12,88 +12,87 @@ class BookingCustomer
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Ignore]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\OneToOne(inversedBy: 'bookingCustomer', cascade: ['persist', 'remove'])]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
#[Ignore]
|
||||
private ?Booking $Booking = null;
|
||||
private ?Booking $booking = null;
|
||||
|
||||
#[ORM\Column(length: 64)]
|
||||
private ?string $Name = null;
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $Surname = null;
|
||||
private ?string $surname = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $Email = null;
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $PhoneNumber = null;
|
||||
private ?string $phoneNumber = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function getBooking(): ?Booking
|
||||
{
|
||||
return $this->Booking;
|
||||
return $this->booking;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function setBooking(Booking $Booking): static
|
||||
public function setBooking(Booking $booking): static
|
||||
{
|
||||
$this->Booking = $Booking;
|
||||
$this->booking = $booking;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->Name;
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $Name): static
|
||||
public function setName(string $name): static
|
||||
{
|
||||
$this->Name = $Name;
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSurname(): ?string
|
||||
{
|
||||
return $this->Surname;
|
||||
return $this->surname;
|
||||
}
|
||||
|
||||
public function setSurname(string $Surname): static
|
||||
public function setSurname(string $surname): static
|
||||
{
|
||||
$this->Surname = $Surname;
|
||||
$this->surname = $surname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->Email;
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(string $Email): static
|
||||
public function setEmail(string $email): static
|
||||
{
|
||||
$this->Email = $Email;
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPhoneNumber(): ?string
|
||||
{
|
||||
return $this->PhoneNumber;
|
||||
return $this->phoneNumber;
|
||||
}
|
||||
|
||||
public function setPhoneNumber(string $PhoneNumber): static
|
||||
public function setPhoneNumber(string $phoneNumber): static
|
||||
{
|
||||
$this->PhoneNumber = $PhoneNumber;
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
+21
-24
@@ -12,56 +12,53 @@ class BookingRoom
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Ignore]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'bookingRooms')]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
#[Ignore]
|
||||
private ?Booking $Booking = null;
|
||||
private ?Booking $booking = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[Ignore]
|
||||
private ?RoomCategory $RoomCategory = null;
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $GuestNumber = null;
|
||||
private ?int $guestNumber = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $RoomPrice = null;
|
||||
private ?int $roomPrice = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $Amount = null;
|
||||
private ?int $amount = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function getBooking(): ?Booking
|
||||
{
|
||||
return $this->Booking;
|
||||
return $this->booking;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function setBooking(?Booking $Booking): static
|
||||
public function setBooking(?Booking $booking): static
|
||||
{
|
||||
$this->Booking = $Booking;
|
||||
$this->booking = $booking;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function getRoomCategory(): ?RoomCategory
|
||||
{
|
||||
return $this->RoomCategory;
|
||||
return $this->roomCategory;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function setRoomCategory(?RoomCategory $RoomCategory): static
|
||||
public function setRoomCategory(?RoomCategory $roomCategory): static
|
||||
{
|
||||
$this->RoomCategory = $RoomCategory;
|
||||
$this->roomCategory = $roomCategory;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -73,36 +70,36 @@ class BookingRoom
|
||||
|
||||
public function getGuestNumber(): ?int
|
||||
{
|
||||
return $this->GuestNumber;
|
||||
return $this->guestNumber;
|
||||
}
|
||||
|
||||
public function setGuestNumber(int $GuestNumber): static
|
||||
public function setGuestNumber(int $guestNumber): static
|
||||
{
|
||||
$this->GuestNumber = $GuestNumber;
|
||||
$this->guestNumber = $guestNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRoomPrice(): ?int
|
||||
{
|
||||
return $this->RoomPrice;
|
||||
return $this->roomPrice;
|
||||
}
|
||||
|
||||
public function setRoomPrice(int $RoomPrice): static
|
||||
public function setRoomPrice(int $roomPrice): static
|
||||
{
|
||||
$this->RoomPrice = $RoomPrice;
|
||||
$this->roomPrice = $roomPrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAmount(): ?int
|
||||
{
|
||||
return $this->Amount;
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
public function setAmount(int $Amount): static
|
||||
public function setAmount(int $amount): static
|
||||
{
|
||||
$this->Amount = $Amount;
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -3,31 +3,25 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ConfigVariableRepository;
|
||||
use App\Enum\ConfigSectionType;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ConfigVariableRepository::class)]
|
||||
class ConfigVariable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
#[ORM\GeneratedValue("NONE")]
|
||||
#[ORM\Column(length: 32, unique: true, nullable: false)]
|
||||
private string $key = "";
|
||||
|
||||
#[ORM\Column(length: 32, unique: true)]
|
||||
private ?string $key = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255, nullable: false)]
|
||||
private ?string $value = null;
|
||||
|
||||
#[ORM\Column(length: 64, nullable: true)]
|
||||
private ?string $section = null;
|
||||
#[ORM\Column(type: 'string', enumType: ConfigSectionType::class, nullable: false)]
|
||||
private ConfigSectionType $section = ConfigSectionType::General;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getKey(): ?string
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
@@ -51,15 +45,20 @@ class ConfigVariable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSection(): ?string
|
||||
public function getSection(): ConfigSectionType
|
||||
{
|
||||
return $this->section;
|
||||
}
|
||||
|
||||
public function setSection(?string $section): static
|
||||
public function setSection(ConfigSectionType $section): static
|
||||
{
|
||||
$this->section = $section;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
function __toString(): string
|
||||
{
|
||||
return $this->getKey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class FareTable
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
|
||||
private ?\DateTimeInterface $startDate = null;
|
||||
|
||||
#[ORM\Column(type : Types::DATETIME_MUTABLE, nullable: true)]
|
||||
@@ -125,10 +125,14 @@ class FareTable
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$str = $this->id;
|
||||
if (!\is_null($this->comment)) {
|
||||
return $this->comment;
|
||||
$str = $this->comment;
|
||||
}
|
||||
return $this->id;
|
||||
$str . "(" . $this->roomCategory . ")";
|
||||
if (!\is_null($this->roomCategory)) {
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +164,7 @@ class FareTable
|
||||
/**
|
||||
* Obtiene las tarifas que aplican al GuestNumber indicado.
|
||||
* @param int $guestNumber GuestNumber para búsqueda.
|
||||
* @return RoomFare[] Lista de tarifas.
|
||||
* @return Collection<RoomFare> Lista de tarifas.
|
||||
*/
|
||||
public function getRoomFaresByGuestNumber(int $guestNumber)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ class RoomAvailability
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[ORM\Column(nullable: false)]
|
||||
private ?int $numAvailable = null;
|
||||
|
||||
public function getDay(): ?\DateTimeInterface
|
||||
|
||||
+50
-50
@@ -22,12 +22,12 @@ class RoomCategory
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(length: 64, nullable: true)]
|
||||
private ?string $bedType = null;
|
||||
|
||||
#[ORM\Column]
|
||||
#[ORM\Column(nullable: false)]
|
||||
private ?int $maxGuestNum = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
||||
private ?int $orderHomePage = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, RoomCategoryPhoto>
|
||||
*/
|
||||
@@ -35,15 +35,15 @@ class RoomCategory
|
||||
private Collection $roomCategoryPhotos;
|
||||
|
||||
/**
|
||||
* @var Collection<int, RoomCategoryDetails>
|
||||
* @var Collection<int, RoomCategoryBedType>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: RoomCategoryDetails::class, mappedBy: 'roomCategory', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $roomCategoryDetails;
|
||||
#[ORM\OneToMany(targetEntity: RoomCategoryBedType::class, mappedBy: 'roomCategory', orphanRemoval: true, cascade: ['persist'])]
|
||||
private Collection $roomCategoryBedTypes;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->roomCategoryPhotos = new ArrayCollection();
|
||||
$this->roomCategoryDetails = new ArrayCollection();
|
||||
$this->roomCategoryBedTypes = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -75,18 +75,6 @@ class RoomCategory
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBedType(): ?string
|
||||
{
|
||||
return $this->bedType;
|
||||
}
|
||||
|
||||
public function setBedType(?string $bedType): static
|
||||
{
|
||||
$this->bedType = $bedType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMaxGuestNum(): ?int
|
||||
{
|
||||
return $this->maxGuestNum;
|
||||
@@ -99,6 +87,18 @@ class RoomCategory
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOrderHomePage(): ?int
|
||||
{
|
||||
return $this->orderHomePage;
|
||||
}
|
||||
|
||||
public function setOrderHomePage(?int $orderHomePage): static
|
||||
{
|
||||
$this->orderHomePage = $orderHomePage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, RoomCategoryPhoto>
|
||||
*/
|
||||
@@ -129,38 +129,38 @@ class RoomCategory
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, RoomCategoryDetails>
|
||||
*/
|
||||
public function getRoomCategoryDetails(): Collection
|
||||
{
|
||||
return $this->roomCategoryDetails;
|
||||
}
|
||||
|
||||
public function addRoomCategoryDetail(RoomCategoryDetails $roomCategoryDetail): static
|
||||
{
|
||||
if (!$this->roomCategoryDetails->contains($roomCategoryDetail)) {
|
||||
$this->roomCategoryDetails->add($roomCategoryDetail);
|
||||
$roomCategoryDetail->setRoomCategory($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeRoomCategoryDetail(RoomCategoryDetails $roomCategoryDetail): static
|
||||
{
|
||||
if ($this->roomCategoryDetails->removeElement($roomCategoryDetail)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($roomCategoryDetail->getRoomCategory() === $this) {
|
||||
$roomCategoryDetail->setRoomCategory(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, RoomCategoryBedType>
|
||||
*/
|
||||
public function getRoomCategoryBedTypes(): Collection
|
||||
{
|
||||
return $this->roomCategoryBedTypes;
|
||||
}
|
||||
|
||||
public function addRoomCategoryBedType(RoomCategoryBedType $roomCategoryBedType): static
|
||||
{
|
||||
if (!$this->roomCategoryBedTypes->contains($roomCategoryBedType)) {
|
||||
$this->roomCategoryBedTypes->add($roomCategoryBedType);
|
||||
$roomCategoryBedType->setRoomCategory($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeRoomCategoryBedType(RoomCategoryBedType $roomCategoryBedType): static
|
||||
{
|
||||
if ($this->roomCategoryBedTypes->removeElement($roomCategoryBedType)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($roomCategoryBedType->getRoomCategory() === $this) {
|
||||
$roomCategoryBedType->setRoomCategory(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\RoomCategoryBedTypeRepository;
|
||||
use Symfony\Component\Serializer\Annotation\Ignore;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: RoomCategoryBedTypeRepository::class)]
|
||||
class RoomCategoryBedType
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(inversedBy: 'roomCategoryBedTypes')]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
#[Ignore]
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[Ignore]
|
||||
private ?BedType $bedType = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $amount = null;
|
||||
|
||||
// public function __construct(RoomCategory $roomCat, BedType $bedType) {
|
||||
// $this->roomCategory = $roomCat;
|
||||
// $this->bedType = $bedType;
|
||||
// }
|
||||
|
||||
public function getAmount(): ?int
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
public function setAmount(int $amount): static
|
||||
{
|
||||
$this->amount = $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRoomCategory(): ?RoomCategory
|
||||
{
|
||||
return $this->roomCategory;
|
||||
}
|
||||
|
||||
public function setRoomCategory(?RoomCategory $roomCategory): static
|
||||
{
|
||||
$this->roomCategory = $roomCategory;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBedType(): ?BedType
|
||||
{
|
||||
return $this->bedType;
|
||||
}
|
||||
|
||||
public function setBedType(?BedType $bedType): static
|
||||
{
|
||||
$this->bedType = $bedType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBedTypeName(): string {
|
||||
return $this->getBedType()->getName();
|
||||
}
|
||||
|
||||
public function getBedTypeIcon(): string {
|
||||
return $this->getBedType()->getIconUrl();
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\RoomCategoryDetailsRepository;
|
||||
use Symfony\Component\Serializer\Annotation\Ignore;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: RoomCategoryDetailsRepository::class)]
|
||||
class RoomCategoryDetails
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $detailsSection = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $detailValue = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'roomCategoryDetails')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[Ignore]
|
||||
private ?RoomCategory $roomCategory = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDetailsSection(): ?string
|
||||
{
|
||||
return $this->detailsSection;
|
||||
}
|
||||
|
||||
public function setDetailsSection(string $detailsSection): static
|
||||
{
|
||||
$this->detailsSection = $detailsSection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDetailValue(): ?string
|
||||
{
|
||||
return $this->detailValue;
|
||||
}
|
||||
|
||||
public function setDetailValue(string $detailValue): static
|
||||
{
|
||||
$this->detailValue = $detailValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function getRoomCategory(): ?RoomCategory
|
||||
{
|
||||
return $this->roomCategory;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function setRoomCategory(?RoomCategory $roomCategory): static
|
||||
{
|
||||
$this->roomCategory = $roomCategory;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -12,16 +12,17 @@ class RoomCategoryPhoto
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Ignore]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255, nullable: false)]
|
||||
private ?string $path = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $altText = null;
|
||||
|
||||
#[ORM\Column(length: 30)]
|
||||
private ?string $kind = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $photoOrder = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'roomCategoryPhotos')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
@@ -57,25 +58,23 @@ class RoomCategoryPhoto
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getKind(): ?string
|
||||
public function getPhotoOrder(): ?int
|
||||
{
|
||||
return $this->kind;
|
||||
return $this->photoOrder;
|
||||
}
|
||||
|
||||
public function setKind(string $kind): static
|
||||
public function setPhotoOrder(?int $photoOrder): static
|
||||
{
|
||||
$this->kind = $kind;
|
||||
$this->photoOrder = $photoOrder;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function getRoomCategory(): ?RoomCategory
|
||||
{
|
||||
return $this->roomCategory;
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function setRoomCategory(?RoomCategory $roomCategory): static
|
||||
{
|
||||
$this->roomCategory = $roomCategory;
|
||||
|
||||
@@ -14,7 +14,7 @@ class RoomFare
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'roomFares')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||
private ?FareTable $fareTable = null;
|
||||
|
||||
#[ORM\Column]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enum;
|
||||
|
||||
enum ConfigSectionType: string {
|
||||
case General = 'GENERAL';
|
||||
case Internal = 'INTERNAL';
|
||||
case Company = 'COMPANY';
|
||||
case Backend = 'BACK';
|
||||
case Frontend = 'FRONT';
|
||||
case Test = 'TEST';
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\BedType;
|
||||
use App\Entity\RoomCategory;
|
||||
use App\Entity\RoomCategoryBedType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RoomCategoryBedTypeFormType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$selectRoomCategory = $options['selectRoomCategory'];
|
||||
|
||||
if($selectRoomCategory) {
|
||||
$builder->add('roomCategory', EntityType::class, [
|
||||
'class' => RoomCategory::class,
|
||||
'choice_label' => 'name'
|
||||
]);
|
||||
}
|
||||
|
||||
$builder->add('bedType', EntityType::class, [
|
||||
'class' => BedType::class,
|
||||
'choice_label' => 'name',
|
||||
]);
|
||||
$builder->add('amount', IntegerType::class);
|
||||
$builder->add('save', SubmitType::class);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => RoomCategoryBedType::class,
|
||||
'selectRoomCategory' => true,
|
||||
]);
|
||||
|
||||
$resolver->setAllowedTypes('selectRoomCategory', 'bool');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\BedType;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<BedType>
|
||||
*
|
||||
* @method BedType|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method BedType|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method BedType[] findAll()
|
||||
* @method BedType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class BedTypeRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, BedType::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return BedType[] Returns an array of BedType objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('b')
|
||||
// ->andWhere('b.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('b.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?BedType
|
||||
// {
|
||||
// return $this->createQueryBuilder('b')
|
||||
// ->andWhere('b.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\RoomCategoryBedType;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<RoomCategoryBedType>
|
||||
*
|
||||
* @method RoomCategoryBedType|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method RoomCategoryBedType|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method RoomCategoryBedType[] findAll()
|
||||
* @method RoomCategoryBedType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class RoomCategoryBedTypeRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, RoomCategoryBedType::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RoomCategoryBedType[] Returns an array of RoomCategoryBedType objects
|
||||
*/
|
||||
public function findByRoomCategory(string $categoryId): array
|
||||
{
|
||||
return $this->createQueryBuilder('r')
|
||||
->andWhere('r.roomCategory = :catId')
|
||||
->setParameter('catId', $categoryId)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
// public function findOneBySomeField($value): ?RoomCategoryBedType
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\RoomCategoryDetails;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<RoomCategoryDetails>
|
||||
*
|
||||
* @method RoomCategoryDetails|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method RoomCategoryDetails|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method RoomCategoryDetails[] findAll()
|
||||
* @method RoomCategoryDetails[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class RoomCategoryDetailsRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, RoomCategoryDetails::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return RoomCategoryDetails[] Returns an array of RoomCategoryDetails objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?RoomCategoryDetails
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use App\Entity\BookingCustomer;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class BookingCreateRequest
|
||||
{
|
||||
#[OA\Property(description: 'Booking Arrival date')]
|
||||
public \DateTime $arrivalDate;
|
||||
|
||||
#[OA\Property(description: 'Booking departure date')]
|
||||
public \DateTime $departureDate;
|
||||
|
||||
#[OA\Property(
|
||||
description: 'Booking customer details',
|
||||
)]
|
||||
public BookingCustomer $customerDetails;
|
||||
|
||||
/**
|
||||
* @var BookingCreateRoomItem[]
|
||||
*/
|
||||
#[OA\Property(
|
||||
description: 'Rooms to book',
|
||||
)]
|
||||
public array $rooms;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class BookingCreateRoomItem
|
||||
{
|
||||
#[OA\Property(description: 'Room category ID')]
|
||||
public int $roomCategory;
|
||||
|
||||
#[OA\Property(description: 'Guest number for the room')]
|
||||
public int $guestNumber;
|
||||
|
||||
#[OA\Property(description: 'Room amount')]
|
||||
public int $amount;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class BookingDetailsRequest
|
||||
{
|
||||
#[OA\Property(description: 'Booking reference number')]
|
||||
public string $refNumber;
|
||||
|
||||
#[OA\Property(maxLength: 255, description: 'Email associated to the booking')]
|
||||
public string $email;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class SearchAvailabilityPeriodRequest
|
||||
{
|
||||
#[OA\Property(description: 'Period start date')]
|
||||
public \DateTime $startDate;
|
||||
|
||||
#[OA\Property(description: 'Period end date')]
|
||||
public \DateTime $endDate;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Request;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class SearchFareCategoryRequest
|
||||
{
|
||||
#[OA\Property(description: 'Room category ID')]
|
||||
public int $roomCategory;
|
||||
|
||||
#[OA\Property(description: 'Period start date')]
|
||||
public \DateTime $startDate;
|
||||
|
||||
#[OA\Property(description: 'Period end date')]
|
||||
public \DateTime $endDate;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Response;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class BookingCreateResponse
|
||||
{
|
||||
#[OA\Property(description: 'Booking reference number')]
|
||||
public string $refNumber;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Response;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class SearchAvailabilityResponse
|
||||
{
|
||||
#[OA\Property(description: 'Room category ID')]
|
||||
public string $roomCategory;
|
||||
|
||||
#[OA\Property(description: 'Number of available rooms')]
|
||||
public int $availability;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Response;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
class SearchFareCategoryResponse
|
||||
{
|
||||
#[OA\Property(description: 'Number of guests')]
|
||||
public int $guestNumber;
|
||||
|
||||
#[OA\Property(description: 'room price')]
|
||||
public int $price;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Entity\ConfigVariable;
|
||||
use App\Repository\ConfigVariableRepository;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* Service to manage config variables.
|
||||
*/
|
||||
class ConfigVariableService
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
private ConfigVariableRepository $repoVariables
|
||||
) {}
|
||||
|
||||
public function getVariable(string $key) {
|
||||
$var = $this->repoVariables->findVariableByKey($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and init all variables.
|
||||
* To be used during Setup process.
|
||||
*/
|
||||
public function InitVariablesOnSetup(): void {
|
||||
|
||||
$entityManager = $this->repoVariables->getEntityManager();
|
||||
$entityManager->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
}
|
||||
catch (\Throwable $th) {
|
||||
$entityManager->rollback();
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
|
||||
private function AddConfigVariable(string $key, string $value, string $section): void {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\String\Slugger\SluggerInterface;
|
||||
|
||||
class FileUploaderService
|
||||
{
|
||||
public function __construct(
|
||||
private string $targetDirectory,
|
||||
private SluggerInterface $slugger,
|
||||
) {}
|
||||
|
||||
public function upload(UploadedFile $file): string
|
||||
{
|
||||
$originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
|
||||
$safeFilename = $this->slugger->slug($originalFilename);
|
||||
$fileName = $safeFilename . '-' . uniqid() . '.' . $file->guessExtension();
|
||||
|
||||
try {
|
||||
$file->move($this->getTargetDirectory(), $fileName);
|
||||
} catch (FileException $e) {
|
||||
// ... handle exception if something happens during file upload
|
||||
}
|
||||
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
public function deleteFile(string $filepath): bool
|
||||
{
|
||||
if (!$filepath || !is_file($filepath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$deleted = unlink($filepath);
|
||||
|
||||
return $deleted;
|
||||
}
|
||||
|
||||
public function getTargetDirectory(): string
|
||||
{
|
||||
return $this->targetDirectory;
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class PricesService
|
||||
|
||||
/**
|
||||
* Calcula el precio a aplicar según las condiciones de las tarifas.
|
||||
* @param RoomFare[] $roomFareList Lista con las posibles tarifas.
|
||||
* @param Collection<RoomFare> $roomFareList Lista con las posibles tarifas.
|
||||
* @param DateTimeInterface $fareCondDate Fecha utilizada para las condiciones.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,19 @@
|
||||
"ref": "b131e6cbfe1b898a508987851963fff485986285"
|
||||
}
|
||||
},
|
||||
"nelmio/api-doc-bundle": {
|
||||
"version": "4.30",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes-contrib",
|
||||
"branch": "main",
|
||||
"version": "3.0",
|
||||
"ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94"
|
||||
},
|
||||
"files": [
|
||||
"./config/packages/nelmio_api_doc.yaml",
|
||||
"./config/routes/nelmio_api_doc.yaml"
|
||||
]
|
||||
},
|
||||
"nelmio/cors-bundle": {
|
||||
"version": "2.4",
|
||||
"recipe": {
|
||||
@@ -47,6 +60,21 @@
|
||||
"./config/packages/nelmio_cors.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/asset-mapper": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.4",
|
||||
"ref": "6c28c471640cc2c6e60812ebcb961c526ef8997f"
|
||||
},
|
||||
"files": [
|
||||
"./assets/app.js",
|
||||
"./assets/styles/app.css",
|
||||
"./config/packages/asset_mapper.yaml",
|
||||
"./importmap.php"
|
||||
]
|
||||
},
|
||||
"symfony/console": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
@@ -184,5 +212,8 @@
|
||||
"./config/packages/web_profiler.yaml",
|
||||
"./config/routes/web_profiler.yaml"
|
||||
]
|
||||
},
|
||||
"twig/extra-bundle": {
|
||||
"version": "v3.13.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{# templates/admin/adminEdit.html.twig #}
|
||||
{% extends '@EasyAdmin/page/content.html.twig' %}
|
||||
|
||||
{% block content_title ElementType %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
<div>
|
||||
<h3>{{ElementName}}</h3>
|
||||
</div>
|
||||
{{ form(form) }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,28 @@
|
||||
{# templates/admin/photo_manager/index.html.twig #}
|
||||
{% extends '@EasyAdmin/page/content.html.twig' %}
|
||||
|
||||
{% block content_title 'Photo Manager' %}
|
||||
{% block main %}
|
||||
|
||||
<a class="btn btn-primary m-3" href="{{ ea_url().setRoute('admin_photos_upload') }}">
|
||||
Add new
|
||||
</a>
|
||||
|
||||
<div style="display: flex; flex-direction: row; flex-wrap: wrap; gap: 18px;">
|
||||
{% for photo in photoList %}
|
||||
<div class="card text-center" style="width: 40%;">
|
||||
<p>{{photo.filename}}</p>
|
||||
<img src="{{ asset(photo.url) }}" style="max-width: 80%;"/>
|
||||
<br>
|
||||
<a class="btn btn-outline-primary m-2">
|
||||
<i class="fas fa-clipboard"> Copy!</i>
|
||||
</a>
|
||||
<a class="btn btn-primary m-2 mt-1" href="{{ ea_url().setRoute('admin_photos_remove', { filename: photo.filename }) }}">
|
||||
Delete
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{# templates/admin/room_category_bed_type_admin/category_view.html.twig #}
|
||||
{% extends '@EasyAdmin/page/content.html.twig' %}
|
||||
|
||||
{% block content_title 'Room Availability' %}
|
||||
{% block main %}
|
||||
<div>
|
||||
<h3>{{categoryData.name}}</h3>
|
||||
</div>
|
||||
<div>
|
||||
<a href="{{ ea_url().setRoute('admin_roomCategoryBedType_category_create', { categoryId: categoryData.id }) }}">
|
||||
Add BedType
|
||||
</a>
|
||||
</div>
|
||||
<table class="datagrid">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>BedType</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for bedType in bedTypeList %}
|
||||
<tr>
|
||||
<td>{{bedType.bedType}}</td>
|
||||
<td>{{bedType.amount}}</td>
|
||||
<td>
|
||||
<a href="{{ ea_url().setRoute('admin_roomCategoryBedType_category_update', { bedTypeId: bedType.bedType.id, categoryId: bedType.roomCategory.id }) }}">
|
||||
Edit
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ ea_url().setRoute('admin_roomCategoryBedType_category_remove', { bedTypeId: bedType.bedType.id, categoryId: bedType.roomCategory.id }) }}">
|
||||
Remove
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,27 @@
|
||||
{# templates/admin/room_category_bed_type_admin/index.html.twig #}
|
||||
{% extends '@EasyAdmin/page/content.html.twig' %}
|
||||
|
||||
{% block content_title 'Category Bed Type' %}
|
||||
{% block main %}
|
||||
<table class="datagrid">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td>RoomCategory</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for category in roomCategoryList %}
|
||||
<tr>
|
||||
<td>{{category.id}}</td>
|
||||
<td>{{category.name}}</td>
|
||||
<td>
|
||||
<a href="{{ ea_url().setRoute('admin_roomCategoryBedType_category', { categoryId: category.id }) }}">
|
||||
View Details
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
@@ -1,6 +1,13 @@
|
||||
{# templates/admin/somniaDashboard.html.html.twig #}
|
||||
{% extends '@EasyAdmin/layout.html.twig' %}
|
||||
|
||||
{% block javascripts %}
|
||||
{% block importmap %}
|
||||
{{ importmap('app') }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
{# ... #}
|
||||
{% endblock main %}
|
||||
@@ -8,6 +8,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{# templates/bundles/EasyAdminBundle/layout.html.twig #}
|
||||
|
||||
{# DO THIS: the '!' symbol tells Symfony to extend from the original template #}
|
||||
{% extends '@!EasyAdmin/layout.html.twig' %}
|
||||
|
||||
{% block javascripts %}
|
||||
{% block importmap %}
|
||||
{{ importmap('app') }}
|
||||
{% endblock %}{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user