Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67b722612c | ||
| 4e32fb8222 | |||
| f9555c515c | |||
|
|
6458a1b35c | ||
| de81b55867 | |||
| a3cd1f6b74 | |||
|
|
5eb4921c60 | ||
| c7e32c74b6 | |||
| e9850fdb2e | |||
|
|
18ff7b4dbb | ||
| e99c50d243 |
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.1.13'
|
||||
app.version: '0.1.17'
|
||||
|
||||
24
frontend/package-lock.json
generated
24
frontend/package-lock.json
generated
@@ -569,6 +569,29 @@
|
||||
"integrity": "sha512-/B8YJGPzaYq1NbsQmwgP8EZqg40NpTw4ZB3suuI0TplbxKHeK94jeaawLmVhCv+YwUnOpiWEz9U6SeThku/8JQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.2.tgz",
|
||||
"integrity": "sha512-UC+ZhH3XtczQYfOlu3lNEkdW/p4dsJ1r/bP7H8+rhao3TTTMO1ATq/4DdIi23XuGoFY+Cz0JmCbdVl0hz9jZcA==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.1",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/runtime": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.2.tgz",
|
||||
"integrity": "sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
@@ -12793,7 +12816,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
|
||||
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
"arg": "^5.0.2",
|
||||
|
||||
@@ -71,10 +71,14 @@ COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/.
|
||||
# Symfony needs a .env file to boot (variables are overridden by env_file in docker-compose)
|
||||
RUN echo "APP_ENV=prod" > /var/www/html/.env
|
||||
|
||||
# Permissions
|
||||
RUN mkdir -p /var/www/html/var /var/www/html/var/uploads \
|
||||
/var/www/maintenance/sirh /var/www/maintenance/lesstime /var/www/maintenance/inventory \
|
||||
&& chown -R www-data:www-data /var/www/html/var /var/www/maintenance
|
||||
# Permissions + directories
|
||||
RUN mkdir -p /var/www/html/var/log /var/www/html/var/uploads \
|
||||
&& chown -R www-data:www-data /var/www/html/var
|
||||
|
||||
# Allow www-data to use Docker socket
|
||||
# The socket GID varies per host; we set it at container startup via entrypoint
|
||||
# As fallback, install docker group with common GID
|
||||
RUN groupadd -g 999 docker 2>/dev/null; usermod -aG docker www-data
|
||||
|
||||
WORKDIR /var/www/html
|
||||
EXPOSE 80
|
||||
|
||||
@@ -10,6 +10,7 @@ use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Repository\EnvironmentRepository;
|
||||
use App\State\EnvironmentCreateProcessor;
|
||||
use App\State\MaintenanceToggleProcessor;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
@@ -21,9 +22,11 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
||||
new Post(
|
||||
uriTemplate: '/applications/{slug}/environments',
|
||||
uriVariables: [
|
||||
'slug' => new Link(fromClass: Application::class, fromProperty: 'environments'),
|
||||
'slug' => new Link(toProperty: 'application', fromClass: Application::class, identifiers: ['slug']),
|
||||
],
|
||||
read: false,
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
processor: EnvironmentCreateProcessor::class,
|
||||
),
|
||||
new Patch(
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
|
||||
44
src/State/EnvironmentCreateProcessor.php
Normal file
44
src/State/EnvironmentCreateProcessor.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\State;
|
||||
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\State\ProcessorInterface;
|
||||
use App\Entity\Environment;
|
||||
use App\Repository\ApplicationRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
final readonly class EnvironmentCreateProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
private ApplicationRepository $applicationRepository,
|
||||
private EntityManagerInterface $entityManager,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param Environment $data
|
||||
*/
|
||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): Environment
|
||||
{
|
||||
$slug = $uriVariables['slug']
|
||||
?? $context['request']?->attributes->get('slug')
|
||||
?? $context['request']?->attributes->get('_route_params')['slug']
|
||||
?? '';
|
||||
|
||||
$application = $this->applicationRepository->findOneBy(['slug' => $slug]);
|
||||
|
||||
if (null === $application) {
|
||||
throw new NotFoundHttpException(sprintf('Application "%s" not found.', $slug));
|
||||
}
|
||||
|
||||
$data->setApplication($application);
|
||||
|
||||
$this->entityManager->persist($data);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user