3 Commits
Author SHA1 Message Date
Daniel-Garmig bfcd04c701 Added OpenAPI docs using nelmioAPIDocBundle.
CI / Docker Lint (push) Successful in 21s
2024-09-20 21:29:23 +02:00
Daniel-Garmig 0cf6f231a3 PhotoManagement moved to Admin. 2024-09-19 18:28:53 +02:00
Daniel-Garmig 77f8d9f87a RoomCategory - Added order field for front-end home page. 2024-09-16 20:20:59 +02:00
25 changed files with 708 additions and 54 deletions
+7 -4
View File
@@ -84,11 +84,14 @@ RUN set -eux; \
# copy sources # copy sources
COPY --link . ./ COPY --link . ./
RUN rm -Rf frankenphp/
RUN rm -Rf .gitea/
RUN rm -Rf .vscode/
RUN rm -Rf public/images
# Remove development data.
RUN rm -Rf frankenphp/ \
rm -Rf .gitea/ \
rm -Rf .vscode/ \
rm -Rf public/images
# Setup application.
RUN set -eux; \ RUN set -eux; \
mkdir -p var/cache var/log; \ mkdir -p var/cache var/log; \
composer dump-autoload --classmap-authoritative --no-dev; \ composer dump-autoload --classmap-authoritative --no-dev; \
+1
View File
@@ -14,6 +14,7 @@
"doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.1", "doctrine/orm": "^3.1",
"easycorp/easyadmin-bundle": "^4.10", "easycorp/easyadmin-bundle": "^4.10",
"nelmio/api-doc-bundle": "^4.30",
"nelmio/cors-bundle": "^2.4", "nelmio/cors-bundle": "^2.4",
"phpdocumentor/reflection-docblock": "^5.4", "phpdocumentor/reflection-docblock": "^5.4",
"phpstan/phpdoc-parser": "^1.28", "phpstan/phpdoc-parser": "^1.28",
Generated
+204 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7bf0ee6f0a2aa748adae16901e21b29b", "content-hash": "20c33276e1944c7bb2e51459e4f90463",
"packages": [ "packages": [
{ {
"name": "composer/semver", "name": "composer/semver",
@@ -1401,6 +1401,128 @@
], ],
"time": "2024-04-19T18:13:15+00:00" "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", "name": "nelmio/cors-bundle",
"version": "2.4.0", "version": "2.4.0",
@@ -6730,6 +6852,87 @@
"source": "https://github.com/webmozarts/assert/tree/1.11.0" "source": "https://github.com/webmozarts/assert/tree/1.11.0"
}, },
"time": "2022-06-03T18:03:27+00:00" "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": [ "packages-dev": [
+1
View File
@@ -11,4 +11,5 @@ return [
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true], EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
]; ];
+9
View File
@@ -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
+10
View File
@@ -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 }
+41 -28
View File
@@ -1,6 +1,6 @@
<mxfile host="Electron" modified="2024-09-09T12:12:35.921Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.4.13 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="I1ybqZjP5GItnb-jHmxS" version="24.4.13" type="device"> <mxfile host="Electron" modified="2024-09-16T17:53:22.842Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.4.13 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="54XxVyyd6AhgkSw3GEFX" version="24.4.13" type="device">
<diagram id="R2lEEEUBdFMjLlhIrx00" name="Page-1"> <diagram id="R2lEEEUBdFMjLlhIrx00" name="Page-1">
<mxGraphModel dx="2666" dy="2248" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0" extFonts="Permanent Marker^https://fonts.googleapis.com/css?family=Permanent+Marker"> <mxGraphModel dx="1318" dy="2052" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0" extFonts="Permanent Marker^https://fonts.googleapis.com/css?family=Permanent+Marker">
<root> <root>
<mxCell id="0" /> <mxCell id="0" />
<mxCell id="1" parent="0" /> <mxCell id="1" parent="0" />
@@ -31,7 +31,7 @@
<mxGeometry x="10" y="30" width="330" height="160" as="geometry" /> <mxGeometry x="10" y="30" width="330" height="160" as="geometry" />
</mxCell> </mxCell>
<mxCell id="LWdVl6OarZhAk6RPOBHK-5" value="RoomCategory" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" parent="LWdVl6OarZhAk6RPOBHK-3" vertex="1"> <mxCell id="LWdVl6OarZhAk6RPOBHK-5" value="RoomCategory" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" parent="LWdVl6OarZhAk6RPOBHK-3" vertex="1">
<mxGeometry x="115" y="300" width="180" height="150" as="geometry" /> <mxGeometry x="115" y="300" width="180" height="180" as="geometry" />
</mxCell> </mxCell>
<mxCell id="LWdVl6OarZhAk6RPOBHK-6" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="LWdVl6OarZhAk6RPOBHK-5" vertex="1"> <mxCell id="LWdVl6OarZhAk6RPOBHK-6" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="LWdVl6OarZhAk6RPOBHK-5" vertex="1">
<mxGeometry y="30" width="180" height="30" as="geometry" /> <mxGeometry y="30" width="180" height="30" as="geometry" />
@@ -85,6 +85,19 @@
<mxRectangle width="150" height="30" as="alternateBounds" /> <mxRectangle width="150" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="1i8AjDvIXov1pVgopvXG-1" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="LWdVl6OarZhAk6RPOBHK-5">
<mxGeometry y="150" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="1i8AjDvIXov1pVgopvXG-2" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="1i8AjDvIXov1pVgopvXG-1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="1i8AjDvIXov1pVgopvXG-3" value="orderHomePage" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="1i8AjDvIXov1pVgopvXG-1">
<mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="LWdVl6OarZhAk6RPOBHK-47" value="RoomCategoryPhoto" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;whiteSpace=wrap;" parent="LWdVl6OarZhAk6RPOBHK-3" vertex="1"> <mxCell id="LWdVl6OarZhAk6RPOBHK-47" value="RoomCategoryPhoto" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;whiteSpace=wrap;" parent="LWdVl6OarZhAk6RPOBHK-3" vertex="1">
<mxGeometry x="530" y="300" width="180" height="180" as="geometry" /> <mxGeometry x="530" y="300" width="180" height="180" as="geometry" />
</mxCell> </mxCell>
@@ -164,55 +177,55 @@
<mxPoint x="-13" y="-1" as="offset" /> <mxPoint x="-13" y="-1" as="offset" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-11" value="RoomCategoryBedType" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" vertex="1" parent="LWdVl6OarZhAk6RPOBHK-3"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-11" value="RoomCategoryBedType" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" parent="LWdVl6OarZhAk6RPOBHK-3" vertex="1">
<mxGeometry x="490" y="70" width="210" height="120" as="geometry" /> <mxGeometry x="490" y="70" width="210" height="120" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-21" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-11"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-21" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="ZFZbn5R1wq40-V8rWeq3-11" vertex="1">
<mxGeometry y="30" width="210" height="30" as="geometry" /> <mxGeometry y="30" width="210" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-22" value="PK, FK1 *" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-21"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-22" value="PK, FK1 *" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-21" vertex="1">
<mxGeometry width="70" height="30" as="geometry"> <mxGeometry width="70" height="30" as="geometry">
<mxRectangle width="70" height="30" as="alternateBounds" /> <mxRectangle width="70" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-23" value="bedType" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-21"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-23" value="bedType" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-21" vertex="1">
<mxGeometry x="70" width="140" height="30" as="geometry"> <mxGeometry x="70" width="140" height="30" as="geometry">
<mxRectangle width="140" height="30" as="alternateBounds" /> <mxRectangle width="140" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-12" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-11"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-12" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="ZFZbn5R1wq40-V8rWeq3-11" vertex="1">
<mxGeometry y="60" width="210" height="30" as="geometry" /> <mxGeometry y="60" width="210" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-13" value="PK, FK2 *" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-12"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-13" value="PK, FK2 *" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-12" vertex="1">
<mxGeometry width="70" height="30" as="geometry"> <mxGeometry width="70" height="30" as="geometry">
<mxRectangle width="70" height="30" as="alternateBounds" /> <mxRectangle width="70" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-14" value="roomCategory" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-12"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-14" value="roomCategory" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-12" vertex="1">
<mxGeometry x="70" width="140" height="30" as="geometry"> <mxGeometry x="70" width="140" height="30" as="geometry">
<mxRectangle width="140" height="30" as="alternateBounds" /> <mxRectangle width="140" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-15" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-11"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-15" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="ZFZbn5R1wq40-V8rWeq3-11" vertex="1">
<mxGeometry y="90" width="210" height="30" as="geometry" /> <mxGeometry y="90" width="210" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-16" value="*" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-15"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-16" value="*" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-15" vertex="1">
<mxGeometry width="70" height="30" as="geometry"> <mxGeometry width="70" height="30" as="geometry">
<mxRectangle width="70" height="30" as="alternateBounds" /> <mxRectangle width="70" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-17" value="amount" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-15"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-17" value="amount" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-15" vertex="1">
<mxGeometry x="70" width="140" height="30" as="geometry"> <mxGeometry x="70" width="140" height="30" as="geometry">
<mxRectangle width="140" height="30" as="alternateBounds" /> <mxRectangle width="140" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-24" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="LWdVl6OarZhAk6RPOBHK-3" source="ZFZbn5R1wq40-V8rWeq3-12" target="LWdVl6OarZhAk6RPOBHK-6"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-24" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="LWdVl6OarZhAk6RPOBHK-3" source="ZFZbn5R1wq40-V8rWeq3-12" target="LWdVl6OarZhAk6RPOBHK-6" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="330" y="260" as="sourcePoint" /> <mxPoint x="330" y="260" as="sourcePoint" />
<mxPoint x="450" y="140" as="targetPoint" /> <mxPoint x="450" y="140" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-25" value="&lt;font style=&quot;font-size: 17px;&quot;&gt;N:1&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="ZFZbn5R1wq40-V8rWeq3-24"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-25" value="&lt;font style=&quot;font-size: 17px;&quot;&gt;N:1&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="ZFZbn5R1wq40-V8rWeq3-24" vertex="1" connectable="0">
<mxGeometry x="0.0788" y="-1" relative="1" as="geometry"> <mxGeometry x="0.0788" y="-1" relative="1" as="geometry">
<mxPoint as="offset" /> <mxPoint as="offset" />
</mxGeometry> </mxGeometry>
@@ -956,58 +969,58 @@
<mxPoint x="1" y="24" as="offset" /> <mxPoint x="1" y="24" as="offset" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZFZbn5R1wq40-V8rWeq3-21" target="ZFZbn5R1wq40-V8rWeq3-2"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="ZFZbn5R1wq40-V8rWeq3-21" target="ZFZbn5R1wq40-V8rWeq3-2" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="720" y="205" as="sourcePoint" /> <mxPoint x="720" y="205" as="sourcePoint" />
<mxPoint x="525" y="405" as="targetPoint" /> <mxPoint x="525" y="405" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-27" value="&lt;font style=&quot;font-size: 17px;&quot;&gt;N:1&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="ZFZbn5R1wq40-V8rWeq3-26"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-27" value="&lt;font style=&quot;font-size: 17px;&quot;&gt;N:1&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="ZFZbn5R1wq40-V8rWeq3-26" vertex="1" connectable="0">
<mxGeometry x="0.0788" y="-1" relative="1" as="geometry"> <mxGeometry x="0.0788" y="-1" relative="1" as="geometry">
<mxPoint as="offset" /> <mxPoint as="offset" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-28" value="Category Config" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-28" value="Category Config" style="swimlane;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="170" y="-300" width="880" height="300" as="geometry" /> <mxGeometry x="170" y="-300" width="880" height="300" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-1" value="BedType" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-28"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-1" value="BedType" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-28" vertex="1">
<mxGeometry x="70" y="90" width="180" height="120" as="geometry" /> <mxGeometry x="70" y="90" width="180" height="120" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-2" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-1"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-2" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="ZFZbn5R1wq40-V8rWeq3-1" vertex="1">
<mxGeometry y="30" width="180" height="30" as="geometry" /> <mxGeometry y="30" width="180" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-3" value="PK" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-2"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-3" value="PK" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-2" vertex="1">
<mxGeometry width="30" height="30" as="geometry"> <mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" /> <mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-4" value="ID" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-2"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-4" value="ID" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-2" vertex="1">
<mxGeometry x="30" width="150" height="30" as="geometry"> <mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds" /> <mxRectangle width="150" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-5" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-1"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-5" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="ZFZbn5R1wq40-V8rWeq3-1" vertex="1">
<mxGeometry y="60" width="180" height="30" as="geometry" /> <mxGeometry y="60" width="180" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-6" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-5"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-6" value="" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-5" vertex="1">
<mxGeometry width="30" height="30" as="geometry"> <mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" /> <mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-7" value="description" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-5"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-7" value="description" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-5" vertex="1">
<mxGeometry x="30" width="150" height="30" as="geometry"> <mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds" /> <mxRectangle width="150" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-8" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-1"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-8" value="" style="shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="ZFZbn5R1wq40-V8rWeq3-1" vertex="1">
<mxGeometry y="90" width="180" height="30" as="geometry" /> <mxGeometry y="90" width="180" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-9" value="*" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-8"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-9" value="*" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;editable=1;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-8" vertex="1">
<mxGeometry width="30" height="30" as="geometry"> <mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" /> <mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="ZFZbn5R1wq40-V8rWeq3-10" value="iconUrl" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" vertex="1" parent="ZFZbn5R1wq40-V8rWeq3-8"> <mxCell id="ZFZbn5R1wq40-V8rWeq3-10" value="iconUrl" style="shape=partialRectangle;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden;whiteSpace=wrap;html=1;" parent="ZFZbn5R1wq40-V8rWeq3-8" vertex="1">
<mxGeometry x="30" width="150" height="30" as="geometry"> <mxGeometry x="30" width="150" height="30" as="geometry">
<mxRectangle width="150" height="30" as="alternateBounds" /> <mxRectangle width="150" height="30" as="alternateBounds" />
</mxGeometry> </mxGeometry>
+32
View File
@@ -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');
}
}
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Controller; namespace App\Controller\Admin;
use App\Service\FileUploaderService; use App\Service\FileUploaderService;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
@@ -62,7 +62,7 @@ class RoomAvailabilityAdminController extends AbstractController
//TODOME: Aquí deberíamos llevar a una página de error o algo. //TODOME: Aquí deberíamos llevar a una página de error o algo.
$url = $this->adminUrlGenerator->setRoute('admin_roomAvailability_category', [ $url = $this->adminUrlGenerator->setRoute('admin_roomAvailability_category', [
'categoryId' => $item->getId(), 'categoryId' => $categoryId,
])->generateUrl(); ])->generateUrl();
return $this->redirect($url); return $this->redirect($url);
} }
@@ -33,6 +33,7 @@ class RoomCategoryCrudController extends AbstractCrudController
yield TextField::new('name'); yield TextField::new('name');
yield TextField::new('description'); yield TextField::new('description');
yield IntegerField::new('maxGuestNum'); yield IntegerField::new('maxGuestNum');
yield IntegerField::new('orderHomePage');
yield CollectionField::new('roomCategoryPhotos')->useEntryCrudForm(); yield CollectionField::new('roomCategoryPhotos')->useEntryCrudForm();
} }
} }
+48 -5
View File
@@ -8,17 +8,40 @@ use App\Entity\BookingRoom;
use App\Repository\BookingRepository; use App\Repository\BookingRepository;
use App\Repository\RoomCategoryRepository; use App\Repository\RoomCategoryRepository;
use App\Repository\RoomAvailabilityRepository; use App\Repository\RoomAvailabilityRepository;
use App\Request\BookingCreateRequest;
use App\Request\BookingDetailsRequest;
use App\Response\BookingCreateResponse;
use App\Service\PricesService; use App\Service\PricesService;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use OpenApi\Attributes as OA;
class BookingController extends AbstractController class BookingController extends AbstractController
{ {
#[Route('/api/booking/details', name: 'app_booking_details')] /**
* Get booking details
*/
#[Route('/api/booking/details', name: 'app_booking_details', methods: ["POST"])]
#[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(Request $request, BookingRepository $repoBooking): JsonResponse public function getBookingDetails(Request $request, BookingRepository $repoBooking): JsonResponse
{ {
$payload = $request->toArray(); $payload = $request->toArray();
@@ -42,14 +65,32 @@ class BookingController extends AbstractController
return $this->json($customerBooking); return $this->json($customerBooking);
} }
#[Route('/api/booking/create', name: 'app_booking_create')] /**
* Create a new Booking.
*/
#[Route('/api/booking/create', name: 'app_booking_create', methods: ["POST"])]
#[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, BookingRepository $repoBooking, EntityManagerInterface $entityManager, public function newBooking(Request $request, BookingRepository $repoBooking, EntityManagerInterface $entityManager,
RoomCategoryRepository $repoCat, RoomAvailabilityRepository $repoAvailability, RoomCategoryRepository $repoCat, RoomAvailabilityRepository $repoAvailability,
PricesService $priceSrv): JsonResponse PricesService $priceSrv): JsonResponse
{ {
$payload = $request->toArray(); $payload = $request->toArray();
if (\is_null($payload)) { if (\is_null($payload)) {
throw new \Exception('Invalid Payload', 400); throw new HttpException('Invalid Payload', 400);
} }
@@ -136,8 +177,10 @@ class BookingController extends AbstractController
} }
if(!$priceFound) { if(!$priceFound) {
throw new HttpException(500, throw new HttpException(
"No se puedo obtener el precio para la categoría: " . $roommCategory->getId() . " , guests: " . $selecctedGuestAmount); 500,
"No se puedo obtener el precio para la categoría: " . $roomCategory->getId() . " , guests: " . $selectedGuestAmount
);
} }
$entityManager->persist($room); $entityManager->persist($room);
+76 -4
View File
@@ -2,14 +2,35 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\ConfigVariable;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use App\Repository\ConfigVariableRepository; use App\Repository\ConfigVariableRepository;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA;
class ConfigVariableController extends AbstractController 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 public function getAllVariables(ConfigVariableRepository $repo): Response
{ {
$varList = $repo->findAllVariables(); $varList = $repo->findAllVariables();
@@ -17,7 +38,22 @@ class ConfigVariableController extends AbstractController
return $this->json(['results' => $varList]); 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 public function getSections(ConfigVariableRepository $repo): Response
{ {
$sectionList = $repo->getAllSections(); $sectionList = $repo->getAllSections();
@@ -30,7 +66,28 @@ class ConfigVariableController extends AbstractController
return $this->json(['results' => $returnList]); 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 public function getVariablesBySection(ConfigVariableRepository $repo, string $section): Response
{ {
if(\is_null($section) || $section == '') { if(\is_null($section) || $section == '') {
@@ -42,7 +99,22 @@ class ConfigVariableController extends AbstractController
return $this->json(['results' => $varList]); 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 public function getByKey(ConfigVariableRepository $repo, string $key): Response
{ {
$var = $repo->findVariableByKey($key); $var = $repo->findVariableByKey($key);
+41 -4
View File
@@ -7,16 +7,36 @@ use Doctrine\ORM\EntityManagerInterface;
use App\Repository\RoomCategoryRepository; use App\Repository\RoomCategoryRepository;
use App\Entity\RoomCategory; use App\Entity\RoomCategory;
use App\Entity\RoomCategoryPhoto; use App\Entity\RoomCategoryPhoto;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations\Property;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Serializer\SerializerInterface; use OpenApi\Attributes as OA;
use Symfony\Component\Serializer\Context\Normalizer\ObjectNormalizerContextBuilder; use Symfony\Component\HttpKernel\Exception\HttpException;
class RoomCategoryController extends AbstractController 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 public function getAll(RoomCategoryRepository $catRepo): Response
{ {
$catList = $catRepo->findAll(); $catList = $catRepo->findAll();
@@ -24,7 +44,24 @@ class RoomCategoryController extends AbstractController
return $this->json(["results" => $catList]); 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 public function getById(RoomCategory $category): Response
{ {
return $this->json($category); return $this->json($category);
+78 -6
View File
@@ -5,15 +5,51 @@ namespace App\Controller;
use App\Repository\FareTableRepository; use App\Repository\FareTableRepository;
use App\Repository\RoomAvailabilityRepository; use App\Repository\RoomAvailabilityRepository;
use App\Repository\RoomCategoryRepository; 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 App\Service\PricesService;
use Nelmio\ApiDocBundle\Annotation\Model;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use OpenApi\Attributes as OA;
class SearchRoomsController extends AbstractController class SearchRoomsController extends AbstractController
{ {
#[Route('/api/search/availability', name: 'app_search_availability')] /**
* 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"])]
#[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',
properties: [
new OA\Property(
property: "filter",
ref: new Model(type: SearchAvailabilityPeriodRequest::class),
),
],
)
)]
public function getAvailabilityForPeriod(Request $request, RoomAvailabilityRepository $repoAvailability): Response public function getAvailabilityForPeriod(Request $request, RoomAvailabilityRepository $repoAvailability): Response
{ {
$payload = $request->toArray(); $payload = $request->toArray();
@@ -30,7 +66,12 @@ class SearchRoomsController extends AbstractController
return $this->json(["results" => $rs]); return $this->json(["results" => $rs]);
} }
#[Route('/api/search/availabilityDetails', name: 'app_search_availabilityDetails')] /**
* 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"])]
#[OA\Tag(name: "Searchs")]
public function getAvailabilityForPeriodDetails(Request $request, RoomAvailabilityRepository $repoAvailability): Response public function getAvailabilityForPeriodDetails(Request $request, RoomAvailabilityRepository $repoAvailability): Response
{ {
$payload = $request->toArray(); $payload = $request->toArray();
@@ -44,10 +85,41 @@ class SearchRoomsController extends AbstractController
$rs = $repoAvailability->getAvailabilityForPeriodDetails($startDate, $endDate); $rs = $repoAvailability->getAvailabilityForPeriodDetails($startDate, $endDate);
return $this->json($rs); return $this->json(["results" => $rs]);
} }
#[Route('/api/search/fares', name: 'app_search_faresForCategory')] /**
* 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"])]
#[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',
properties: [
new OA\Property(
property: "filter",
ref: new Model(type: SearchFareCategoryRequest::class),
),
],
)
)]
public function getFaresForCategoryOnPeriod(Request $request, RoomCategoryRepository $repoCat, PricesService $priceService): Response public function getFaresForCategoryOnPeriod(Request $request, RoomCategoryRepository $repoCat, PricesService $priceService): Response
{ {
$payload = $request->toArray(); $payload = $request->toArray();
@@ -73,13 +145,13 @@ class SearchRoomsController extends AbstractController
$fareList = $priceService->getFinalPricesForSearch($roomCategory, $startDate, $endDate); $fareList = $priceService->getFinalPricesForSearch($roomCategory, $startDate, $endDate);
$rs = []; $rs = [];
foreach ($fareList as $key => $value) { foreach ($fareList as $key => $value) {
$rs[] = [ "guestNumber" => $key, "price" => $value]; $rs[] = ["guestNumber" => $key, "price" => $value];
} }
return $this->json(["results" => $rs]); 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 public function faresDebug(Request $request, PricesService $priceService, FareTableRepository $repoFareTable, RoomCategoryRepository $repoCat): Response
{ {
$fareTable[] = $repoFareTable->find(1); $fareTable[] = $repoFareTable->find(1);
+15
View File
@@ -25,6 +25,9 @@ class RoomCategory
#[ORM\Column(nullable: false)] #[ORM\Column(nullable: false)]
private ?int $maxGuestNum = null; private ?int $maxGuestNum = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $orderHomePage = null;
/** /**
* @var Collection<int, RoomCategoryPhoto> * @var Collection<int, RoomCategoryPhoto>
*/ */
@@ -84,6 +87,18 @@ class RoomCategory
return $this; return $this;
} }
public function getOrderHomePage(): ?int
{
return $this->orderHomePage;
}
public function setOrderHomePage(?int $orderHomePage): static
{
$this->orderHomePage = $orderHomePage;
return $this;
}
/** /**
* @return Collection<int, RoomCategoryPhoto> * @return Collection<int, RoomCategoryPhoto>
*/ */
+28
View File
@@ -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 array<BookingCreateRoomItem>
*/
#[OA\Property(
description: 'Rooms to book',
)]
public array $rooms;
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Request;
use OpenApi\Attributes as OA;
class BookingCreateRoomItem
{
#[OA\Property(description: 'Room category ID')]
public string $roomCategory;
#[OA\Property(description: 'Guest number for the room')]
public int $guestNumber;
#[OA\Property(description: 'Room amount')]
public int $amount;
}
+14
View File
@@ -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;
}
+17
View File
@@ -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;
}
+11
View File
@@ -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;
}
+13
View File
@@ -35,6 +35,19 @@
"ref": "b131e6cbfe1b898a508987851963fff485986285" "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": { "nelmio/cors-bundle": {
"version": "2.4", "version": "2.4",
"recipe": { "recipe": {