diff --git a/backend/app/Http/Actions/Orders/EditOrderAction.php b/backend/app/Http/Actions/Orders/EditOrderAction.php index 9153255c8f..ba919daf00 100644 --- a/backend/app/Http/Actions/Orders/EditOrderAction.php +++ b/backend/app/Http/Actions/Orders/EditOrderAction.php @@ -24,8 +24,9 @@ public function __invoke(EditOrderRequest $request, int $eventId, int $orderId): $order = $this->handler->handle(new EditOrderDTO( id: $orderId, - first_name: $request->validated('first_name'), - last_name: $request->validated('last_name'), + eventId: $eventId, + firstName: $request->validated('first_name'), + lastName: $request->validated('last_name'), email: $request->validated('email'), notes: $request->validated('notes'), )); diff --git a/backend/app/Services/Application/Handlers/Order/DTO/EditOrderDTO.php b/backend/app/Services/Application/Handlers/Order/DTO/EditOrderDTO.php index d9a25aa639..e53b980aa9 100644 --- a/backend/app/Services/Application/Handlers/Order/DTO/EditOrderDTO.php +++ b/backend/app/Services/Application/Handlers/Order/DTO/EditOrderDTO.php @@ -7,10 +7,11 @@ class EditOrderDTO extends BaseDTO { public function __construct( - public int $id, - public string $first_name, - public string $last_name, - public string $email, + public int $id, + public int $eventId, + public string $firstName, + public string $lastName, + public string $email, public ?string $notes, ) { diff --git a/backend/app/Services/Application/Handlers/Order/EditOrderHandler.php b/backend/app/Services/Application/Handlers/Order/EditOrderHandler.php index 4507006656..9279ba0139 100644 --- a/backend/app/Services/Application/Handlers/Order/EditOrderHandler.php +++ b/backend/app/Services/Application/Handlers/Order/EditOrderHandler.php @@ -28,8 +28,9 @@ public function handle(EditOrderDTO $dto): OrderDomainObject return $this->editOrderService->editOrder( id: $dto->id, - first_name: $dto->first_name, - last_name: $dto->last_name, + eventId: $dto->eventId, + firstName: $dto->firstName, + lastName: $dto->lastName, email: $dto->email, notes: $dto->notes ); diff --git a/backend/app/Services/Domain/Order/EditOrderService.php b/backend/app/Services/Domain/Order/EditOrderService.php index 186b73dba7..81af767d62 100644 --- a/backend/app/Services/Domain/Order/EditOrderService.php +++ b/backend/app/Services/Domain/Order/EditOrderService.php @@ -25,22 +25,24 @@ public function __construct( */ public function editOrder( int $id, - ?string $first_name, - ?string $last_name, + int $eventId, + ?string $firstName, + ?string $lastName, ?string $email, ?string $notes ): OrderDomainObject { - return $this->databaseManager->transaction(function () use ($id, $first_name, $last_name, $email, $notes) { + return $this->databaseManager->transaction(function () use ($id, $firstName, $lastName, $email, $notes, $eventId) { $this->orderRepository->updateWhere( attributes: array_filter([ - 'first_name' => $first_name, - 'last_name' => $last_name, + 'first_name' => $firstName, + 'last_name' => $lastName, 'email' => $email, 'notes' => $notes, ]), where: [ - 'id' => $id + 'id' => $id, + 'event_id' => $eventId, ] ); @@ -51,7 +53,10 @@ public function editOrder( ), ); - return $this->orderRepository->findById($id); + return $this->orderRepository->findFirstWhere([ + 'id' => $id, + 'event_id' => $eventId, + ]); }); } } diff --git a/docker/development/README.md b/docker/development/README.md index e69de29bb2..ba575b2505 100644 --- a/docker/development/README.md +++ b/docker/development/README.md @@ -0,0 +1,122 @@ +# Hi.Events local development with Docker + +This guide walks you through setting up Hi.Events using Docker, including requirements, setup steps, configuration, +and environment variables. + +## Requirements + +1. **Docker** – Required for containerized development. [Install Docker](https://docs.docker.com/get-docker/) +2. **Git** – Needed to clone the repository. [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) + +> **Note:** This guide assumes a macOS or Linux environment by default. See the **Windows setup instructions** below if you're on Windows. + +--- + +## Setup instructions (macOS / Linux) + +### 1. Clone the repository + +```bash +git clone git@github.com:HiEventsDev/Hi.Events.git +``` + +### 2. Start the development environment + +Navigate to the Docker development directory and run the startup script: + +```bash +cd Hi.Events/docker/development +./start-dev.sh +``` + +Once running, access the app at: + +- **Frontend**: [https://localhost:8443](https://localhost:8443) + +--- + +## Setup instructions (Windows) + +Windows users should follow the steps below to manually run the setup commands instead of using the `start-dev.sh` script. + +### 1. Clone the repository + +Using Git Bash or Windows Terminal: + +```bash +git clone git@github.com:HiEventsDev/Hi.Events.git +cd Hi.Events/docker/development +``` + +### 2. Generate SSL certificates + +You can use `openssl` to generate self-signed certificates: + +```bash +mkdir -p certs +openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certs/localhost.pem.key -out certs/localhost.pem -subj "/CN=localhost" +``` + +Then, update your `docker/development/nginx/nginx.conf` to use `.pem` files: + +```nginx +ssl_certificate /etc/nginx/certs/localhost.pem; +ssl_certificate_key /etc/nginx/certs/localhost.pem.key; +``` + +> If you're using `.crt`/`.key`, update accordingly. + +### 3. Start Docker services + +```bash +docker-compose -f docker-compose.dev.yml up -d +``` + +### 4. Install backend dependencies + +```bash +docker-compose -f docker-compose.dev.yml exec -T backend composer install --ignore-platform-reqs --no-interaction --optimize-autoloader --prefer-dist +``` + +### 5. Wait for the database + +Keep checking logs until you see "ready to accept connections": + +```bash +docker-compose -f docker-compose.dev.yml logs pgsql +``` + +### 6. Create environment files (if missing) + +```bash +docker-compose -f docker-compose.dev.yml exec backend cp .env.example .env +docker-compose -f docker-compose.dev.yml exec frontend cp .env.example .env +``` + +### 7. Laravel setup + +```bash +docker-compose -f docker-compose.dev.yml exec backend php artisan key:generate +docker-compose -f docker-compose.dev.yml exec backend php artisan migrate +docker-compose -f docker-compose.dev.yml exec backend chmod -R 775 /var/www/html/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer +docker-compose -f docker-compose.dev.yml exec backend php artisan storage:link +``` + +### 8. Open the app + +```bash +start https://localhost:8443/auth/register +``` + +--- + +## Additional configuration + +Hi.Events uses environment variables for configuration. You’ll find `.env` files in: + +- `frontend/.env` +- `backend/.env` + +You can modify these to customize your setup. + +For a full list of environment variables, see the [Environment Variables Documentation](https://hi.events/docs/getting-started/deploying#environment-variables).