Add organization details to schema and update PostgreSQL health check

- Add `language`, `logoId`, and `logoUrl` columns to the `Organization` table with relevant constraints and indexes.
- Update `docker-compose.yml` to support dynamic environment variables in PostgreSQL health check.
main
Pau Costa Ferrer 2026-03-28 18:54:01 +01:00
parent 95b10a3525
commit 3a961c09ce
3 changed files with 33 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="6c8b3c54-eabb-40e5-967f-c7b594c750bc" name="Changes" comment="Integrate `svelte-i18n` for enhanced localization support&#10;&#10;- Add `svelte-i18n` as a dependency for dynamic translations.&#10;- Replace `@sveltejs/adapter-auto` with `@sveltejs/adapter-node` for better deployment compatibility.&#10;- Update `package-lock.json` to reflect new and updated dependencies." /> <list default="true" id="6c8b3c54-eabb-40e5-967f-c7b594c750bc" name="Changes" comment="Add health checks for dependent services and automate DB migrations in API Dockerfile&#10;&#10;- Configure `healthcheck` for the PostgreSQL service in `docker-compose.yml`.&#10;- Update service dependencies to use `condition: service_healthy` for PostgreSQL.&#10;- Modify API Dockerfile to run `npx prisma migrate deploy` before starting the application." />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -125,7 +125,7 @@
<updated>1774643312599</updated> <updated>1774643312599</updated>
<workItem from="1774643313611" duration="74000" /> <workItem from="1774643313611" duration="74000" />
<workItem from="1774643422240" duration="5278000" /> <workItem from="1774643422240" duration="5278000" />
<workItem from="1774706361502" duration="13566000" /> <workItem from="1774706361502" duration="13887000" />
</task> </task>
<task id="LOCAL-00001" summary="Initialize Hot Desking app with web and API services &#10;&#10;- Set up SvelteKit for the web interface with Tailwind CSS. &#10;- Build the API using NestJS with Prisma ORM for database interaction. &#10;- Add environment variable management and docker-compose for PostgreSQL and PgAdmin instances. &#10;- Create shared data models for consistent typing across services. &#10;- Establish basic routing and layouts for web and API services."> <task id="LOCAL-00001" summary="Initialize Hot Desking app with web and API services &#10;&#10;- Set up SvelteKit for the web interface with Tailwind CSS. &#10;- Build the API using NestJS with Prisma ORM for database interaction. &#10;- Add environment variable management and docker-compose for PostgreSQL and PgAdmin instances. &#10;- Create shared data models for consistent typing across services. &#10;- Establish basic routing and layouts for web and API services.">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -367,7 +367,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1774719795821</updated> <updated>1774719795821</updated>
</task> </task>
<option name="localTasksCounter" value="31" /> <task id="LOCAL-00031" summary="Exclude Prisma directory from API build configuration">
<option name="closed" value="true" />
<created>1774720057830</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1774720057830</updated>
</task>
<task id="LOCAL-00032" summary="Add health checks for dependent services and automate DB migrations in API Dockerfile&#10;&#10;- Configure `healthcheck` for the PostgreSQL service in `docker-compose.yml`.&#10;- Update service dependencies to use `condition: service_healthy` for PostgreSQL.&#10;- Modify API Dockerfile to run `npx prisma migrate deploy` before starting the application.">
<option name="closed" value="true" />
<created>1774720187941</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1774720187941</updated>
</task>
<option name="localTasksCounter" value="33" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -385,8 +401,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Add user management and registration features with invite-based onboarding&#10;&#10;- Implement `+page.svelte` for admin user management, allowing role updates, password resets, and invite link generation." />
<MESSAGE value="Add user management and registration features with invite-based onboarding&#10;&#10;- Implement `+page.svelte` for admin user management, allowing role updates, password resets, and invite link generation. Update `UsersController` and `UsersService` to support user role updates, password changes, and invite token generation.&#10;- Create DTOs (`RegisterDto`, `UpdateUserDto`) for input validation in user management endpoints.&#10;- Extend `AuthService` and `AuthController` with invite-based registration logic.&#10;- Update admin layout to include &quot;Users&quot; link for easy access to user management." />
<MESSAGE value="Add &quot;My Bookings&quot; page and enable reservation updates and cancellations&#10;&#10;- Implement `+page.svelte` for managing user reservations with real-time updates.&#10;- Add API endpoints for updating and canceling reservations with enhanced validation and authorization.&#10;- Introduce `UpdateReservationDto` for refined reservation update handling.&#10;- Update `reservations.service.ts` to handle overlapping checks, time adjustments, and admin actions.&#10;- Extend layout to include a link to the &quot;My Bookings&quot; page.&#10;- Add `date-fns` library for date formatting." /> <MESSAGE value="Add &quot;My Bookings&quot; page and enable reservation updates and cancellations&#10;&#10;- Implement `+page.svelte` for managing user reservations with real-time updates.&#10;- Add API endpoints for updating and canceling reservations with enhanced validation and authorization.&#10;- Introduce `UpdateReservationDto` for refined reservation update handling.&#10;- Update `reservations.service.ts` to handle overlapping checks, time adjustments, and admin actions.&#10;- Extend layout to include a link to the &quot;My Bookings&quot; page.&#10;- Add `date-fns` library for date formatting." />
<MESSAGE value="Add building and floor management with admin editor modal&#10;&#10;- Implement `BuildingEditorModal.svelte` for creating, editing, and deleting buildings and floors.&#10;- Add `CreateBuildingDto`, `UpdateBuildingDto`, `CreateFloorDto`, and `UpdateFloorDto` for validation.&#10;- Extend `SpacesService` and `SpacesController` with endpoints for building and floor CRUD operations.&#10;- Update Prisma schema to include building descriptions and image URLs, and floor names.&#10;- Enhance dashboard with building management functionality for admin users." /> <MESSAGE value="Add building and floor management with admin editor modal&#10;&#10;- Implement `BuildingEditorModal.svelte` for creating, editing, and deleting buildings and floors.&#10;- Add `CreateBuildingDto`, `UpdateBuildingDto`, `CreateFloorDto`, and `UpdateFloorDto` for validation.&#10;- Extend `SpacesService` and `SpacesController` with endpoints for building and floor CRUD operations.&#10;- Update Prisma schema to include building descriptions and image URLs, and floor names.&#10;- Enhance dashboard with building management functionality for admin users." />
<MESSAGE value="Enhance real-time space status updates and handling&#10;&#10;- Improve WebSocket connection reliability with updated transport options.&#10;- Introduce logic to prioritize real-time updates over initial data for live views.&#10;- Add logging for better debugging of WebSocket events and data propagation.&#10;- Update UI components (`SpaceCard`, `FloorplanViewer`) to avoid overwrites from stale data.&#10;- Refactor date handling for consistent behavior across components." /> <MESSAGE value="Enhance real-time space status updates and handling&#10;&#10;- Improve WebSocket connection reliability with updated transport options.&#10;- Introduce logic to prioritize real-time updates over initial data for live views.&#10;- Add logging for better debugging of WebSocket events and data propagation.&#10;- Update UI components (`SpaceCard`, `FloorplanViewer`) to avoid overwrites from stale data.&#10;- Refactor date handling for consistent behavior across components." />
@ -410,6 +424,8 @@
<MESSAGE value="Update reservations logic to handle non-nullable fields and type adjustments&#10;&#10;- Adjust `userId` handling in update DTO logic to allow undefined instead of null.&#10;- Cast certain fields to `any` to handle edge cases in type compatibility.&#10;- Extend Prisma imports to include `Role` for future role-based logic enhancements." /> <MESSAGE value="Update reservations logic to handle non-nullable fields and type adjustments&#10;&#10;- Adjust `userId` handling in update DTO logic to allow undefined instead of null.&#10;- Cast certain fields to `any` to handle edge cases in type compatibility.&#10;- Extend Prisma imports to include `Role` for future role-based logic enhancements." />
<MESSAGE value="Remove redundant node_modules copy in API Dockerfile" /> <MESSAGE value="Remove redundant node_modules copy in API Dockerfile" />
<MESSAGE value="Integrate `svelte-i18n` for enhanced localization support&#10;&#10;- Add `svelte-i18n` as a dependency for dynamic translations.&#10;- Replace `@sveltejs/adapter-auto` with `@sveltejs/adapter-node` for better deployment compatibility.&#10;- Update `package-lock.json` to reflect new and updated dependencies." /> <MESSAGE value="Integrate `svelte-i18n` for enhanced localization support&#10;&#10;- Add `svelte-i18n` as a dependency for dynamic translations.&#10;- Replace `@sveltejs/adapter-auto` with `@sveltejs/adapter-node` for better deployment compatibility.&#10;- Update `package-lock.json` to reflect new and updated dependencies." />
<option name="LAST_COMMIT_MESSAGE" value="Integrate `svelte-i18n` for enhanced localization support&#10;&#10;- Add `svelte-i18n` as a dependency for dynamic translations.&#10;- Replace `@sveltejs/adapter-auto` with `@sveltejs/adapter-node` for better deployment compatibility.&#10;- Update `package-lock.json` to reflect new and updated dependencies." /> <MESSAGE value="Exclude Prisma directory from API build configuration" />
<MESSAGE value="Add health checks for dependent services and automate DB migrations in API Dockerfile&#10;&#10;- Configure `healthcheck` for the PostgreSQL service in `docker-compose.yml`.&#10;- Update service dependencies to use `condition: service_healthy` for PostgreSQL.&#10;- Modify API Dockerfile to run `npx prisma migrate deploy` before starting the application." />
<option name="LAST_COMMIT_MESSAGE" value="Add health checks for dependent services and automate DB migrations in API Dockerfile&#10;&#10;- Configure `healthcheck` for the PostgreSQL service in `docker-compose.yml`.&#10;- Update service dependencies to use `condition: service_healthy` for PostgreSQL.&#10;- Modify API Dockerfile to run `npx prisma migrate deploy` before starting the application." />
</component> </component>
</project> </project>

View File

@ -0,0 +1,10 @@
-- AlterTable
ALTER TABLE "Organization" ADD COLUMN "language" TEXT NOT NULL DEFAULT 'en',
ADD COLUMN "logoId" TEXT,
ADD COLUMN "logoUrl" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "Organization_logoId_key" ON "Organization"("logoId");
-- AddForeignKey
ALTER TABLE "Organization" ADD CONSTRAINT "Organization_logoId_fkey" FOREIGN KEY ("logoId") REFERENCES "Asset"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -12,7 +12,7 @@ services:
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d hotdesking"] test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-hotdesking}"]
interval: 5s interval: 5s
timeout: 5s timeout: 5s
retries: 5 retries: 5