From 0904adbe51701cf2eced5cd24f9f5effad79704a Mon Sep 17 00:00:00 2001 From: Moritz Reich Date: Tue, 17 Jan 2023 14:30:00 +0000 Subject: [PATCH 1/4] added settings for prettier and auto formatting Signed-off-by: Moritz Reich --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 3 ++- .editorconfig | 10 ++++++++++ .gitignore | 3 ++- .vscode/settings.json | 4 ++++ 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .editorconfig create mode 100644 .vscode/settings.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index bec1b935..3045d887 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,4 +24,4 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # libjpeg-dev \ # [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 +RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g prettier" 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 34e603fe..a1fd451d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,7 +19,8 @@ "eamodio.gitlens", "bradlc.vscode-tailwindcss", "ms-vscode.vscode-typescript", - "ms-playwright.playwright" + "ms-playwright.playwright", + "EditorConfig.EditorConfig" ] } }, diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4a2cfd3d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +indent_style = space +indent_size = 2 + +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore index 689fb0be..bb698f65 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ pids __pycache__/ # vscode -.vscode/ web-build/ dist/ @@ -36,6 +35,8 @@ bin/ # MacOS .DS_Store + + src/deskstar-backend/DeskstarSolution.sln.DotSettings.user *.cs~ src/deskstar-backend/Deskstar/out/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1b6457c5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" +} From 3ebbd0d4698fcb7bc28bf14a13f49799ad2dc6b5 Mon Sep 17 00:00:00 2001 From: Moritz Reich Date: Tue, 17 Jan 2023 16:45:23 +0000 Subject: [PATCH 2/4] configured for eslint Signed-off-by: Moritz Reich --- .devcontainer/devcontainer.json | 1 + .vscode/settings.json | 5 ++++- .editorconfig => src/.editorconfig | 0 src/deskstar-frontend/.eslintrc.json | 6 +++++- src/deskstar-frontend/package.json | 3 +++ src/deskstar-frontend/yarn.lock | 29 ++++++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 2 deletions(-) rename .editorconfig => src/.editorconfig (100%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 297b7e0f..d16f76fa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,6 +16,7 @@ "ms-dotnettools.csharp", "ms-vsliveshare.vsliveshare", "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", "eamodio.gitlens", "bradlc.vscode-tailwindcss", "ms-vscode.vscode-typescript", diff --git a/.vscode/settings.json b/.vscode/settings.json index 1b6457c5..84469d1b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "[csharp]": { + "editor.defaultFormatter": "ms-dotnettools.csharp" + } } diff --git a/.editorconfig b/src/.editorconfig similarity index 100% rename from .editorconfig rename to src/.editorconfig diff --git a/src/deskstar-frontend/.eslintrc.json b/src/deskstar-frontend/.eslintrc.json index bffb357a..cb8e4cfe 100644 --- a/src/deskstar-frontend/.eslintrc.json +++ b/src/deskstar-frontend/.eslintrc.json @@ -1,3 +1,7 @@ { - "extends": "next/core-web-vitals" + "extends": ["prettier", "next/core-web-vitals"], + "plugins": ["prettier"], + "rules": { + "prettier/prettier": ["error"] + } } diff --git a/src/deskstar-frontend/package.json b/src/deskstar-frontend/package.json index 016f6acf..30111238 100644 --- a/src/deskstar-frontend/package.json +++ b/src/deskstar-frontend/package.json @@ -28,7 +28,10 @@ "autoprefixer": "^10.4.13", "eslint": "8.26.0", "eslint-config-next": "13.0.0", + "eslint-config-prettier": "^8.6.0", + "eslint-plugin-prettier": "^4.2.1", "postcss": "^8.4.18", + "prettier": "^2.8.3", "tailwindcss": "^3.2.1", "typescript": "^4.9.3" } diff --git a/src/deskstar-frontend/yarn.lock b/src/deskstar-frontend/yarn.lock index 64b46856..6902e4f2 100644 --- a/src/deskstar-frontend/yarn.lock +++ b/src/deskstar-frontend/yarn.lock @@ -746,6 +746,11 @@ eslint-config-next@13.0.0: eslint-plugin-react "^7.31.7" eslint-plugin-react-hooks "^4.5.0" +eslint-config-prettier@^8.6.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz#dec1d29ab728f4fa63061774e1672ac4e363d207" + integrity sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA== + eslint-import-resolver-node@^0.3.6: version "0.3.6" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" @@ -810,6 +815,13 @@ eslint-plugin-jsx-a11y@^6.5.1: minimatch "^3.1.2" semver "^6.3.0" +eslint-plugin-prettier@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" + integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-plugin-react-hooks@^4.5.0: version "4.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" @@ -943,6 +955,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-glob@^3.2.12, fast-glob@^3.2.9: version "3.2.12" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" @@ -1780,6 +1797,18 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632" + integrity sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw== + pretty-format@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-3.8.0.tgz#bfbed56d5e9a776645f4b1ff7aa1a3ac4fa3c385" From b20eb12d8831f901cd7cc313ff491d10f66476c5 Mon Sep 17 00:00:00 2001 From: Moritz Reich Date: Tue, 17 Jan 2023 20:02:40 +0000 Subject: [PATCH 3/4] prettier and lint fix Signed-off-by: Moritz Reich --- src/{ReadMe.md => README.md.rename} | 3 + .../Deskstar/Properties/launchSettings.json | 4 +- src/deskstar-backend/Deskstar/README.md | 16 +- .../Deskstar/appsettings.json | 2 +- .../Teststar.Tests/{REAME.md => README.md} | 8 +- .../.github/workflows/playwright.yml | 36 +- src/deskstar-frontend/auth.d.ts | 2 +- src/deskstar-frontend/bookings.js | 242 ++--- .../components/AddResourceModal.tsx | 980 ++++++++++-------- .../components/BookingsTable.tsx | 11 +- .../components/UpdateBookingModal.tsx | 3 +- .../resources/BuildingResourceTable.tsx | 17 +- .../resources/DeskResourceTable.tsx | 14 +- .../resources/DeskTypeResourceTable.tsx | 17 +- .../resources/FloorResourceTable.tsx | 14 +- .../resources/RoomResourceTable.tsx | 14 +- src/deskstar-frontend/deskTypes.js | 18 +- src/deskstar-frontend/desks.js | 146 +-- .../lib/api/BookingService.ts | 14 +- .../lib/api/ResourceService.ts | 57 +- src/deskstar-frontend/lib/api/constants.ts | 2 +- src/deskstar-frontend/next.config.js | 6 +- .../pages/resources/index.tsx | 143 +-- src/deskstar-frontend/postcss.config.js | 2 +- src/deskstar-frontend/rooms.js | 30 +- src/deskstar-frontend/tailwind.config.js | 10 +- src/deskstar-frontend/types/desk.ts | 4 +- src/deskstar-frontend/types/desktypes.ts | 6 +- src/deskstar-frontend/types/floor.ts | 2 +- .../types/models/CreateBuildingDto.ts | 6 +- .../types/models/CreateDeskDto.ts | 8 +- .../types/models/CreateDeskTypeDto.ts | 2 +- .../types/models/CreateFloorDto.ts | 6 +- .../types/models/CreateRoomDto.ts | 6 +- src/deskstar-frontend/types/room.ts | 12 +- src/deskstar-frontend/types/users.ts | 18 +- 36 files changed, 1017 insertions(+), 864 deletions(-) rename src/{ReadMe.md => README.md.rename} (99%) rename src/deskstar-backend/Teststar.Tests/{REAME.md => README.md} (97%) diff --git a/src/ReadMe.md b/src/README.md.rename similarity index 99% rename from src/ReadMe.md rename to src/README.md.rename index 4866ff07..3de4f12d 100644 --- a/src/ReadMe.md +++ b/src/README.md.rename @@ -3,6 +3,7 @@ ## Local production run 1. Copy the `.env.template` file to `.env.local`: + ```bash cp .env.template .env.local ``` @@ -18,9 +19,11 @@ cp .env.template .env.local 4. The frontend should now be reachable on `http://localhost:3000`. After that you should be able to register, login and use the software. 5. OPTIONAL: If you want to fill the database with our dummy-data you can use the following command: + ```bash docker exec -i deskstar_postgres psql -U postgres deskstar < ./deskstar-db/dummy-data.sql ``` + The dummy data already contain some companies you can use and also some test users. You can find the login data at the bottom of this README. ## Local Dev Setup diff --git a/src/deskstar-backend/Deskstar/Properties/launchSettings.json b/src/deskstar-backend/Deskstar/Properties/launchSettings.json index 5823d00e..1367fdeb 100644 --- a/src/deskstar-backend/Deskstar/Properties/launchSettings.json +++ b/src/deskstar-backend/Deskstar/Properties/launchSettings.json @@ -24,7 +24,7 @@ "EMAIL__HOST": "smtp.strato.de", "EMAIL__PORT": "587", "EMAIL__PSW": "123456", - "EMAIL__ADDRESS":"noreply@deskstar.de" + "EMAIL__ADDRESS": "noreply@deskstar.de" } }, "IIS Express": { @@ -40,7 +40,7 @@ "EMAIL__HOST": "smtp.strato.de", "EMAIL__PORT": "587", "EMAIL__PSW": "123456", - "EMAIL__ADDRESS":"noreply@deskstar.de" + "EMAIL__ADDRESS": "noreply@deskstar.de" } } } diff --git a/src/deskstar-backend/Deskstar/README.md b/src/deskstar-backend/Deskstar/README.md index 7b06b490..51191158 100644 --- a/src/deskstar-backend/Deskstar/README.md +++ b/src/deskstar-backend/Deskstar/README.md @@ -6,25 +6,25 @@ 2. Compile and Run: -``` bash +```bash dotnet restore ``` -``` bash +```bash dotnet publish -c Dev -o out ``` Choose one of the two environments (Development, Production). Also you need to configure the database connection. Take a look at the run.sh file for information on that. -``` bash +```bash dotnet bin\Dev\net6.0\Deskstar.dll --environment [Development|Production] #cmd dotnet bin/Dev/net6.0/Deskstar.dll --environment [Development|Production] #bash ``` Generate models and data access context from postgres database tables. -``` bash +```bash dotnet tool install --global dotnet-ef dotnet ef dbcontext scaffold "Host=localhost;Database=deskstar;Username=postgres;Password=root" Npgsql.EntityFrameworkCore.PostgreSQL -o Models ``` @@ -34,18 +34,20 @@ dotnet ef dbcontext scaffold "Host=localhost;Database=deskstar;Username=postgres If you want to run the project with docker, you'll have to have docker installed and run the following commands from inside the project folder. -``` bash +```bash docker build -t deskstar-image -f Dockerfile . ``` Use this command to start the dockerfile configured for the test environment. To target another DB, simply alter the corresponding ENV variables. Running for Production can be done by altering the ASPNETCORE_ENVIRONMENT ENV variable. -``` bash + +```bash docker run -it -e DB__HOST=localhost -e DB__DATABASE=deskstar -e DB__USERNAME=postgres -e DB__PASSWORD=root -e ASPNETCORE_ENVIRONMENT=Development --rm -p 5000:5000 --name deskstar-backend deskstar-image ``` ## Convert Runtime Entities to DTOs with AutoMapper + To map the runtime entities we use to DTOs we serve through the REST-API, we use AutoMapper to avoid writing additional boilerplate code. An example for using AutoMapper is implemented for the User (AutomapperConfiguration.cs UserProfileDto.cs, UserController.cs). @@ -67,4 +69,4 @@ Internal representation / interface of all the attributes for a specific feature ### Models -External representation / interface of a specific business logic call e.g. CreateUserRequest \ No newline at end of file +External representation / interface of a specific business logic call e.g. CreateUserRequest diff --git a/src/deskstar-backend/Deskstar/appsettings.json b/src/deskstar-backend/Deskstar/appsettings.json index f66c6de2..e3d9d017 100644 --- a/src/deskstar-backend/Deskstar/appsettings.json +++ b/src/deskstar-backend/Deskstar/appsettings.json @@ -11,4 +11,4 @@ } }, "AllowedHosts": "*" -} \ No newline at end of file +} diff --git a/src/deskstar-backend/Teststar.Tests/REAME.md b/src/deskstar-backend/Teststar.Tests/README.md similarity index 97% rename from src/deskstar-backend/Teststar.Tests/REAME.md rename to src/deskstar-backend/Teststar.Tests/README.md index 6f3cd01c..587198bd 100644 --- a/src/deskstar-backend/Teststar.Tests/REAME.md +++ b/src/deskstar-backend/Teststar.Tests/README.md @@ -7,7 +7,9 @@ dotnet test This repo contains only unit tests for business logic of usecase classes # test structure -All tests for a usecase and its dependant test data is saved in a file called + +All tests for a usecase and its dependant test data is saved in a file called + ``` Tests.cs @@ -27,9 +29,11 @@ public void _When_Should(){ ``` changes of existing setup functions MUST only be commited if all existing tests still work. + # test coverage show test coverage + ``` rm -rf ../Deskstar/Migrations && rm -rf ../Deskstar/Controllers dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage @@ -37,4 +41,4 @@ dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --logg cp coverage/*/coverage.cobertura.xml coverage/coverage.cobertura.xml pycobertura show coverage/coverage.cobertura.xml -``` \ No newline at end of file +``` diff --git a/src/deskstar-frontend/.github/workflows/playwright.yml b/src/deskstar-frontend/.github/workflows/playwright.yml index c2fa2b3e..aa189ae4 100644 --- a/src/deskstar-frontend/.github/workflows/playwright.yml +++ b/src/deskstar-frontend/.github/workflows/playwright.yml @@ -1,27 +1,27 @@ name: Playwright Tests on: push: - branches: [ main, master ] + branches: [main, master] pull_request: - branches: [ main, master ] + branches: [main, master] jobs: test: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Install dependencies - run: yarn - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: yarn playwright test - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install dependencies + run: yarn + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Run Playwright tests + run: yarn playwright test + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/src/deskstar-frontend/auth.d.ts b/src/deskstar-frontend/auth.d.ts index a4d13872..bf36b374 100644 --- a/src/deskstar-frontend/auth.d.ts +++ b/src/deskstar-frontend/auth.d.ts @@ -12,4 +12,4 @@ declare module "next-auth" { interface Session { user: User; } -} \ No newline at end of file +} diff --git a/src/deskstar-frontend/bookings.js b/src/deskstar-frontend/bookings.js index fbfcd244..57d22f15 100644 --- a/src/deskstar-frontend/bookings.js +++ b/src/deskstar-frontend/bookings.js @@ -1,122 +1,122 @@ export const bookings = [ - { - bookingId: "1", - userId: "1", - deskName: "A", - room: "Office A", - floor: "EG", - building: "Headquarter", - location: "Example street 123, 12345 Berlin", - timestamp: "2022-10-08T12:00:00Z", - startTime: "2022-10-09T12:00:00Z", - endTime: "2022-10-09T16:00:00Z" - }, - { - bookingId: "2", - userId: "1", - deskName: "B", - room: "Office A", - floor: "EG", - building: "Headquarter", - location: "Example street 123, 12345 Berlin", - timestamp: "2022-10-09T16:01:00Z", - startTime: "2022-10-10T12:00:00Z", - endTime: "2022-10-10T16:00:00Z" - }, - { - bookingId: "3", - userId: "1", - deskName: "A", - room: "Office B", - floor: "EG", - building: "Headquarter", - location: "Example street 123, 12345 Berlin", - timestamp: "2022-10-10T16:01:00Z", - startTime: "2022-10-11T12:00:00Z", - endTime: "2022-10-11T16:00:00Z" - }, - { - bookingId: "4", - userId: "1", - deskName: "A", - room: "Office B", - floor: "EG", - building: "Headquarter", - location: "Example street 123, 12345 Berlin", - timestamp: "2022-10-12T12:00:00Z", - startTime: "2022-10-12T19:00:00Z", - endTime: "2022-10-12T23:00:00Z" - }, - { - bookingId: "5", - userId: "1", - deskName: "A", - room: "Room 192.22", - floor: "12", - building: "Innovation Center", - location: "Sesamstreet 42, 85757 Karlsfeld", - timestamp: "2022-10-12T23:10:00Z", - startTime: "2022-10-13T12:00:00Z", - endTime: "2022-10-13T16:00:00Z" - }, - { - bookingId: "6", - userId: "1", - deskName: "B", - room: "Room 192.22", - floor: "12", - building: "Innovation Center", - location: "Sesamstreet 42, 85757 Karlsfeld", - timestamp: "2022-10-14T08:00:00Z", - startTime: "2022-10-19T14:00:00Z", - endTime: "2022-10-19T18:00:00Z" - }, - { - bookingId: "7", - userId: "1", - deskName: "X", - room: "Room 192.23", - floor: "12", - building: "Innovation Center", - location: "Sesamstreet 42, 85757 Karlsfeld", - timestamp: "2022-10-23T08:00:00Z", - startTime: "2022-10-23T09:00:00Z", - endTime: "2022-10-23T16:00:00Z" - }, - { - bookingId: "8", - userId: "1", - deskName: "A", - room: "Room 103.12", - floor: "13", - building: "Innovation Center", - location: "Sesamstreet 42, 85757 Karlsfeld", - timestamp: "2022-10-13T23:10:00Z", - startTime: "2022-10-14T12:00:00Z", - endTime: "2022-10-14T16:00:00Z" - }, - { - bookingId: "9", - userId: "1", - deskName: "V", - room: "Room 192.12", - floor: "12", - building: "Headquarter", - location: "Example street 123, 12345 Berlin", - timestamp: "2022-10-14T23:10:00Z", - startTime: "2022-10-15T12:00:00Z", - endTime: "2022-10-15T16:00:00Z" - }, - { - bookingId: "10", - userId: "1", - deskName: "A", - room: "Room 192.11", - floor: "12", - building: "Headquarter", - location: "Example street 123, 12345 Berlin", - timestamp: "2022-10-14T23:10:00Z", - startTime: "2022-10-16T12:00:00Z", - endTime: "2022-10-16T16:00:00Z" - }, -]; \ No newline at end of file + { + bookingId: "1", + userId: "1", + deskName: "A", + room: "Office A", + floor: "EG", + building: "Headquarter", + location: "Example street 123, 12345 Berlin", + timestamp: "2022-10-08T12:00:00Z", + startTime: "2022-10-09T12:00:00Z", + endTime: "2022-10-09T16:00:00Z", + }, + { + bookingId: "2", + userId: "1", + deskName: "B", + room: "Office A", + floor: "EG", + building: "Headquarter", + location: "Example street 123, 12345 Berlin", + timestamp: "2022-10-09T16:01:00Z", + startTime: "2022-10-10T12:00:00Z", + endTime: "2022-10-10T16:00:00Z", + }, + { + bookingId: "3", + userId: "1", + deskName: "A", + room: "Office B", + floor: "EG", + building: "Headquarter", + location: "Example street 123, 12345 Berlin", + timestamp: "2022-10-10T16:01:00Z", + startTime: "2022-10-11T12:00:00Z", + endTime: "2022-10-11T16:00:00Z", + }, + { + bookingId: "4", + userId: "1", + deskName: "A", + room: "Office B", + floor: "EG", + building: "Headquarter", + location: "Example street 123, 12345 Berlin", + timestamp: "2022-10-12T12:00:00Z", + startTime: "2022-10-12T19:00:00Z", + endTime: "2022-10-12T23:00:00Z", + }, + { + bookingId: "5", + userId: "1", + deskName: "A", + room: "Room 192.22", + floor: "12", + building: "Innovation Center", + location: "Sesamstreet 42, 85757 Karlsfeld", + timestamp: "2022-10-12T23:10:00Z", + startTime: "2022-10-13T12:00:00Z", + endTime: "2022-10-13T16:00:00Z", + }, + { + bookingId: "6", + userId: "1", + deskName: "B", + room: "Room 192.22", + floor: "12", + building: "Innovation Center", + location: "Sesamstreet 42, 85757 Karlsfeld", + timestamp: "2022-10-14T08:00:00Z", + startTime: "2022-10-19T14:00:00Z", + endTime: "2022-10-19T18:00:00Z", + }, + { + bookingId: "7", + userId: "1", + deskName: "X", + room: "Room 192.23", + floor: "12", + building: "Innovation Center", + location: "Sesamstreet 42, 85757 Karlsfeld", + timestamp: "2022-10-23T08:00:00Z", + startTime: "2022-10-23T09:00:00Z", + endTime: "2022-10-23T16:00:00Z", + }, + { + bookingId: "8", + userId: "1", + deskName: "A", + room: "Room 103.12", + floor: "13", + building: "Innovation Center", + location: "Sesamstreet 42, 85757 Karlsfeld", + timestamp: "2022-10-13T23:10:00Z", + startTime: "2022-10-14T12:00:00Z", + endTime: "2022-10-14T16:00:00Z", + }, + { + bookingId: "9", + userId: "1", + deskName: "V", + room: "Room 192.12", + floor: "12", + building: "Headquarter", + location: "Example street 123, 12345 Berlin", + timestamp: "2022-10-14T23:10:00Z", + startTime: "2022-10-15T12:00:00Z", + endTime: "2022-10-15T16:00:00Z", + }, + { + bookingId: "10", + userId: "1", + deskName: "A", + room: "Room 192.11", + floor: "12", + building: "Headquarter", + location: "Example street 123, 12345 Berlin", + timestamp: "2022-10-14T23:10:00Z", + startTime: "2022-10-16T12:00:00Z", + endTime: "2022-10-16T16:00:00Z", + }, +]; diff --git a/src/deskstar-frontend/components/AddResourceModal.tsx b/src/deskstar-frontend/components/AddResourceModal.tsx index a080b353..ff0199dd 100644 --- a/src/deskstar-frontend/components/AddResourceModal.tsx +++ b/src/deskstar-frontend/components/AddResourceModal.tsx @@ -1,6 +1,15 @@ import { useSession } from "next-auth/react"; import { useState } from "react"; -import { createBuilding, createDesk, createDeskType, createFloor, createRoom, getDeskTypes, getFloors, getRooms } from "../lib/api/ResourceService"; +import { + createBuilding, + createDesk, + createDeskType, + createFloor, + createRoom, + getDeskTypes, + getFloors, + getRooms, +} from "../lib/api/ResourceService"; import { IBuilding } from "../types/building"; import { IDeskType } from "../types/desktypes"; import { IFloor } from "../types/floor"; @@ -10,462 +19,569 @@ import { toast } from "react-toastify"; import FilterListbox from "./FilterListbox"; import Input from "./forms/Input"; -const AddResourceModal = ({ buildings: origBuildings, deskTypes: origDeskTypes, }: { buildings: IBuilding[]; deskTypes: IDeskType[] }) => { - let { data: session } = useSession(); - - const resourceTypes: string[] = ["Building", "Floor", "Room", "Desk", "DeskType"]; - const [selectedResourceType, setSelectedResourceType] = useState("Desk"); - const [isLoading, setIsLoading] = useState(false); - - const [buildingName, setBuildingName] = useState(""); - const [locationName, setLocationName] = useState(""); - const [floorName, setFloorName] = useState(""); - const [roomName, setRoomName] = useState(""); - const [deskName, setDeskName] = useState(""); - const [deskTypeName, setDeskTypeName] = useState(""); - - const [deskType, setDeskType] = useState(); - const [room, setRoom] = useState(); - const [floor, setFloor] = useState(); - const [building, setBuilding] = useState(); - const [location, setLocation] = useState(); - const uniqueLocation = (ogBuildings: IBuilding[]) => { - const t = new Map(); - ogBuildings.forEach((element) => t.set(element.location, { locationName: element.location })); - return Array.from(t.values()) +const AddResourceModal = ({ + buildings: origBuildings, + deskTypes: origDeskTypes, +}: { + buildings: IBuilding[]; + deskTypes: IDeskType[]; +}) => { + let { data: session } = useSession(); + + const resourceTypes: string[] = [ + "Building", + "Floor", + "Room", + "Desk", + "DeskType", + ]; + const [selectedResourceType, setSelectedResourceType] = useState("Desk"); + const [isLoading, setIsLoading] = useState(false); + + const [buildingName, setBuildingName] = useState(""); + const [locationName, setLocationName] = useState(""); + const [floorName, setFloorName] = useState(""); + const [roomName, setRoomName] = useState(""); + const [deskName, setDeskName] = useState(""); + const [deskTypeName, setDeskTypeName] = useState(""); + + const [deskType, setDeskType] = useState(); + const [room, setRoom] = useState(); + const [floor, setFloor] = useState(); + const [building, setBuilding] = useState(); + const [location, setLocation] = useState(); + const uniqueLocation = (ogBuildings: IBuilding[]) => { + const t = new Map(); + ogBuildings.forEach((element) => + t.set(element.location, { locationName: element.location }) + ); + return Array.from(t.values()); + }; + const [locations, setLocations] = useState( + uniqueLocation(origBuildings) + ); + + const [buildings, setBuildings] = useState([]); + const [floors, setFloors] = useState([]); + const [rooms, setRooms] = useState([]); + const [deskTypes, setDeskTypes] = useState(origDeskTypes); + + async function onSelectedLocationChange( + selectedLocation: ILocation | null | undefined + ) { + if (!selectedLocation) { + return; } - const [locations, setLocations] = useState(uniqueLocation(origBuildings)); - - const [buildings, setBuildings] = useState([]); - const [floors, setFloors] = useState([]); - const [rooms, setRooms] = useState([]); - const [deskTypes, setDeskTypes] = useState(origDeskTypes); - - async function onSelectedLocationChange(selectedLocation: ILocation | null | undefined) { - if (!selectedLocation) { - return; - } - - setLocation(selectedLocation); - let filteredBuildings = origBuildings.filter((building) => - selectedLocation.locationName === building.location - ); - - setBuildings(filteredBuildings); - setBuilding(null); - setFloor(null); - setRoom(null); - } - - async function onSelectedBuildingChange(selectedBuilding: IBuilding | null | undefined) { - if (!selectedBuilding) { - return; - } - setBuilding(selectedBuilding); - if (!session) { - return []; - } - const resFloors = await getFloors(session, selectedBuilding.buildingId); - setFloors(resFloors); + setLocation(selectedLocation); + let filteredBuildings = origBuildings.filter( + (building) => selectedLocation.locationName === building.location + ); + + setBuildings(filteredBuildings); + setBuilding(null); + setFloor(null); + setRoom(null); + } + + async function onSelectedBuildingChange( + selectedBuilding: IBuilding | null | undefined + ) { + if (!selectedBuilding) { + return; + } - setFloor(null); - setRoom(null); + setBuilding(selectedBuilding); + if (!session) { + return []; + } + const resFloors = await getFloors(session, selectedBuilding.buildingId); + setFloors(resFloors); + + setFloor(null); + setRoom(null); + } + + async function onSelectedFloorChange( + selectedFloor: IFloor | null | undefined + ) { + if (!selectedFloor) { + return; } - async function onSelectedFloorChange(selectedFloor: IFloor | null | undefined) { - if (!selectedFloor) { - return; - } + setFloor(selectedFloor); + if (!session) { + return []; + } - setFloor(selectedFloor); - if (!session) { - return []; - } + const resRooms = await getRooms(session, selectedFloor.floorId); + setRooms(resRooms); + setRoom(null); + } - const resRooms = await getRooms(session, selectedFloor.floorId); - setRooms(resRooms); - setRoom(null); + async function onSelectedDeskTypeChange( + onSelectedDeskType: IDeskType | null | undefined + ) { + if (!onSelectedDeskType) { + return; } - - async function onSelectedDeskTypeChange(onSelectedDeskType: IDeskType | null | undefined) { - if (!onSelectedDeskType) { - return; - } - setDeskType(onSelectedDeskType); + setDeskType(onSelectedDeskType); + } + + async function addBuilding() { + if (!session) return; + if (!buildingName) { + toast.warn("please enter a building name"); + return; } - - async function addBuilding() { - if (!session) - return; - if (!buildingName) { - toast.warn("please enter a building name"); - return; - } - if ((!locationName || (locationName === "")) && !location) { - toast.warn("please choose or enter a location"); - return; - } - - setIsLoading(true); - let res = await createBuilding(session, { buildingName: buildingName, location: location ? location.locationName : locationName }); - if (res.message.toLowerCase().includes("success")) { - origBuildings.push(res.data as IBuilding); - setBuildings([...buildings, res.data as IBuilding]); - const tmp = new Map(); - [...locations, { locationName: (res.data as IBuilding).location }].forEach((element) => tmp.set(element.locationName, { locationName: element.locationName })); - setLocations(Array.from(tmp.values())); - toast.success(res.message); - } else { - toast.error(res.message); - } - - setIsLoading(false); + if ((!locationName || locationName === "") && !location) { + toast.warn("please choose or enter a location"); + return; } - async function addFloor() { - if (!session) - return; - if (!floorName) { - toast.warn("please enter a floor name"); - return; - } - if (!location) { - toast.warn("please choose a location"); - return; - } - if (!building) { - toast.warn("please choose a building"); - return; - } - - setIsLoading(true); - let res = await createFloor(session, { buildingId: building.buildingId, floorName: floorName }); - - if (res.message.toLowerCase().includes("success")) { - setFloors([...floors, res.data as IFloor]) - toast.success(res.message); - } else { - toast.error(res.message); - } - setIsLoading(false); + setIsLoading(true); + let res = await createBuilding(session, { + buildingName: buildingName, + location: location ? location.locationName : locationName, + }); + if (res.message.toLowerCase().includes("success")) { + origBuildings.push(res.data as IBuilding); + setBuildings([...buildings, res.data as IBuilding]); + const tmp = new Map(); + [ + ...locations, + { locationName: (res.data as IBuilding).location }, + ].forEach((element) => + tmp.set(element.locationName, { locationName: element.locationName }) + ); + setLocations(Array.from(tmp.values())); + toast.success(res.message); + } else { + toast.error(res.message); } - async function addRoom() { - if (!session) - return; - if (!roomName) { - toast.warn("please enter a room name"); - return; - } - if (!location) { - toast.warn("please choose a location"); - return; - } - if (!building) { - toast.warn("please choose a building"); - return; - } - if (!floor) { - toast.warn("please choose a floor"); - return; - } - - setIsLoading(true); - let res = await createRoom(session, { floorId: floor.floorId, roomName: roomName }); - if (res.message.toLowerCase().includes("success")) { - setRooms([...rooms, res.data as IRoom]) - toast.success(res.message); - } else { - toast.error(res.message); - } - setIsLoading(false); + setIsLoading(false); + } + + async function addFloor() { + if (!session) return; + if (!floorName) { + toast.warn("please enter a floor name"); + return; + } + if (!location) { + toast.warn("please choose a location"); + return; + } + if (!building) { + toast.warn("please choose a building"); + return; } - async function addDeskType() { - if (!session) - return; - if (!deskTypeName) { - toast.warn("please enter a desk type name"); - return; - } - - setIsLoading(true); - let res = await createDeskType(session, { deskTypeName: deskTypeName }); - - if (res.message.toLowerCase().includes("success")) { - setDeskTypes([...deskTypes, res.data as IDeskType]) - toast.success(res.message); - } else { - toast.error(res.message); - } - setIsLoading(false); + setIsLoading(true); + let res = await createFloor(session, { + buildingId: building.buildingId, + floorName: floorName, + }); + + if (res.message.toLowerCase().includes("success")) { + setFloors([...floors, res.data as IFloor]); + toast.success(res.message); + } else { + toast.error(res.message); + } + setIsLoading(false); + } + + async function addRoom() { + if (!session) return; + if (!roomName) { + toast.warn("please enter a room name"); + return; + } + if (!location) { + toast.warn("please choose a location"); + return; + } + if (!building) { + toast.warn("please choose a building"); + return; + } + if (!floor) { + toast.warn("please choose a floor"); + return; } - async function addDesk() { - if (!session) - return; - if (deskName === "") { - toast.warn("please enter a desk name"); - return; - } - if (!deskType) { - toast.warn("please choose a desk type"); - return; - } - if (!location) { - toast.warn("please choose a location"); - return; - } - if (!building) { - toast.warn("please choose a building"); - return; - } - if (!floor) { - toast.warn("please choose a floor"); - return; - } - if (!room) { - toast.warn("please choose a room"); - return; - } - - setIsLoading(true); - let res = await createDesk(session, { deskName: deskName, deskTypeId: deskType.deskTypeId, roomId: room?.roomId }); - if (res.message.toLowerCase().includes("success")) { - toast.success(res.message); - } else { - toast.error(res.message); - } - setIsLoading(false); + setIsLoading(true); + let res = await createRoom(session, { + floorId: floor.floorId, + roomName: roomName, + }); + if (res.message.toLowerCase().includes("success")) { + setRooms([...rooms, res.data as IRoom]); + toast.success(res.message); + } else { + toast.error(res.message); + } + setIsLoading(false); + } + + async function addDeskType() { + if (!session) return; + if (!deskTypeName) { + toast.warn("please enter a desk type name"); + return; } - return <> -
-
- - x - -

Add Resources

- -
Resource Type
- -
- {resourceTypes.map((type: string) => ( - - ))} -
- - { - selectedResourceType === "Building" && <> - { setBuildingName(e.target.value) }} value={buildingName} placeholder="Building Name" /> - { setLocationName(e.target.value); setLocation(null); }} value={locationName} placeholder="New Location" /> - -
Existing Location
- { onSelectedLocationChange(o); setLocationName("") }} - getName={(location) => - location ? location.locationName : "select location" - } - /> - - addBuilding()}> - Confirm - - - } - { - selectedResourceType === "Floor" && <> - { setFloorName(e.target.value) }} value={floorName} placeholder="Floor Name" /> - -
Location
- onSelectedLocationChange(o)} - getName={(location) => - location ? location.locationName : "select location" - } - /> - - {location && <> -
Building
- onSelectedBuildingChange(o)} - getName={(building) => - building ? building.buildingName : "select building" - } - /> - - } - addFloor()}> - Confirm - - - } - { - selectedResourceType === "Room" && <> - { setRoomName(e.target.value) }} value={roomName} placeholder="Room Name" /> - -
Location
- onSelectedLocationChange(o)} - getName={(location) => - location ? location.locationName : "select location" - } - /> - - {location && <> -
Building
- onSelectedBuildingChange(o)} - getName={(building) => - building ? building.buildingName : "select building" - } - /> - } - - {building && <> -
Floor
- onSelectedFloorChange(o)} - getName={(floor) => - floor ? floor.floorName : "select floor" - } - /> - - } - addRoom()}> - Confirm - - - } + setIsLoading(true); + let res = await createDeskType(session, { deskTypeName: deskTypeName }); + if (res.message.toLowerCase().includes("success")) { + setDeskTypes([...deskTypes, res.data as IDeskType]); + toast.success(res.message); + } else { + toast.error(res.message); + } + setIsLoading(false); + } + + async function addDesk() { + if (!session) return; + if (deskName === "") { + toast.warn("please enter a desk name"); + return; + } + if (!deskType) { + toast.warn("please choose a desk type"); + return; + } + if (!location) { + toast.warn("please choose a location"); + return; + } + if (!building) { + toast.warn("please choose a building"); + return; + } + if (!floor) { + toast.warn("please choose a floor"); + return; + } + if (!room) { + toast.warn("please choose a room"); + return; + } - {selectedResourceType === "Desk" && <> - { setDeskName(e.target.value) }} value={deskName} placeholder="Desk Name" /> - <> -
Desk Type
- onSelectedDeskTypeChange(o)} - getName={(deskType) => - deskType ? deskType.deskTypeName : "No type selected" - } - /> - - -
Location
- onSelectedLocationChange(o)} - getName={(location) => - location ? location.locationName : "select location" - } - /> - - {location && <> -
Building
- onSelectedBuildingChange(o)} - getName={(building) => - building ? building.buildingName : "select building" - } - /> - } - - {building && <> -
Floor
- onSelectedFloorChange(o)} - getName={(floor) => - floor ? floor.floorName : "select floor" - } - /> - } - - {floor && <> -
Room
- setRoom(o)} - getName={(room) => - room ? room.roomName : "select room" - } - /> - } - addDesk()}> - Confirm - - } - - { - selectedResourceType === "DeskType" && <> - { setDeskTypeName(e.target.value) }} value={deskTypeName} placeholder="Desk Type Name" /> - addDeskType()}> - Confirm - - + setIsLoading(true); + let res = await createDesk(session, { + deskName: deskName, + deskTypeId: deskType.deskTypeId, + roomId: room?.roomId, + }); + if (res.message.toLowerCase().includes("success")) { + toast.success(res.message); + } else { + toast.error(res.message); + } + setIsLoading(false); + } + + return ( + <> +
+
+ + x + +

Add Resources

+ +
Resource Type
+ +
+ {resourceTypes.map((type: string) => ( + + ))} +
+ + {selectedResourceType === "Building" && ( + <> + { + setBuildingName(e.target.value); + }} + value={buildingName} + placeholder="Building Name" + /> + { + setLocationName(e.target.value); + setLocation(null); + }} + value={locationName} + placeholder="New Location" + /> + +
Existing Location
+ { + onSelectedLocationChange(o); + setLocationName(""); + }} + getName={(location) => + location ? location.locationName : "select location" } - { - isLoading && -
- -
+ /> + + addBuilding()} + > + Confirm + + + )} + {selectedResourceType === "Floor" && ( + <> + { + setFloorName(e.target.value); + }} + value={floorName} + placeholder="Floor Name" + /> + +
Location
+ onSelectedLocationChange(o)} + getName={(location) => + location ? location.locationName : "select location" } - { - !isLoading && -
+ /> + + {location && ( + <> +
Building
+ onSelectedBuildingChange(o)} + getName={(building) => + building ? building.buildingName : "select building" + } + /> + + )} + addFloor()} + > + Confirm + + + )} + {selectedResourceType === "Room" && ( + <> + { + setRoomName(e.target.value); + }} + value={roomName} + placeholder="Room Name" + /> + +
Location
+ onSelectedLocationChange(o)} + getName={(location) => + location ? location.locationName : "select location" } + /> + + {location && ( + <> +
Building
+ onSelectedBuildingChange(o)} + getName={(building) => + building ? building.buildingName : "select building" + } + /> + + )} + + {building && ( + <> +
Floor
+ onSelectedFloorChange(o)} + getName={(floor) => + floor ? floor.floorName : "select floor" + } + /> + + )} + addRoom()} + > + Confirm + + + )} + + {selectedResourceType === "Desk" && ( + <> + { + setDeskName(e.target.value); + }} + value={deskName} + placeholder="Desk Name" + /> + <> +
Desk Type
+ onSelectedDeskTypeChange(o)} + getName={(deskType) => + deskType ? deskType.deskTypeName : "No type selected" + } + /> + + +
Location
+ onSelectedLocationChange(o)} + getName={(location) => + location ? location.locationName : "select location" + } + /> + + {location && ( + <> +
Building
+ onSelectedBuildingChange(o)} + getName={(building) => + building ? building.buildingName : "select building" + } + /> + + )} + + {building && ( + <> +
Floor
+ onSelectedFloorChange(o)} + getName={(floor) => + floor ? floor.floorName : "select floor" + } + /> + + )} + + {floor && ( + <> +
Room
+ setRoom(o)} + getName={(room) => (room ? room.roomName : "select room")} + /> + + )} + addDesk()} + > + Confirm + + + )} + + {selectedResourceType === "DeskType" && ( + <> + { + setDeskTypeName(e.target.value); + }} + value={deskTypeName} + placeholder="Desk Type Name" + /> + addDeskType()} + > + Confirm + + + )} + {isLoading && ( +
+
+ )} + {!isLoading &&
}
- ; - -} +
+ + ); +}; export default AddResourceModal; - diff --git a/src/deskstar-frontend/components/BookingsTable.tsx b/src/deskstar-frontend/components/BookingsTable.tsx index b7ee8e62..2a084cc1 100644 --- a/src/deskstar-frontend/components/BookingsTable.tsx +++ b/src/deskstar-frontend/components/BookingsTable.tsx @@ -73,10 +73,17 @@ const BookingTableEntry = ({ {endTime} {onEdit && ( -
- {selectedResourceOption !== "Desk types" && ( <> )} - ) - } + )} {selectedResourceOption !== "Desk types" && ( <>
- ) - } + )} {selectedResourceOption === "Desk types" && ( <> {origDeskTypes.length > 0 && ( @@ -252,47 +268,52 @@ const ResourceOverview = ({ /> )} - ) - } - {selectedResourceOption === "Desks" && (<> - {desks.length > 0 && ( - - )} - )} - {selectedResourceOption === "Rooms" && (<> - {rooms.length > 0 && ( - - )} - )} - {selectedResourceOption === "Floors" && (<> - {floors.length > 0 && ( - - )} - )} - - - {selectedResourceOption === "Buildings" && (<> - {buildings.length > 0 && ( - - )} - )} + )} + {selectedResourceOption === "Desks" && ( + <> + {desks.length > 0 && ( + + )} + + )} + {selectedResourceOption === "Rooms" && ( + <> + {rooms.length > 0 && ( + + )} + + )} + {selectedResourceOption === "Floors" && ( + <> + {floors.length > 0 && ( + + )} + + )} + {selectedResourceOption === "Buildings" && ( + <> + {buildings.length > 0 && ( + + )} + + )} {buildings.length == 0 && (
diff --git a/src/deskstar-frontend/postcss.config.js b/src/deskstar-frontend/postcss.config.js index 33ad091d..12a703d9 100644 --- a/src/deskstar-frontend/postcss.config.js +++ b/src/deskstar-frontend/postcss.config.js @@ -3,4 +3,4 @@ module.exports = { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/src/deskstar-frontend/rooms.js b/src/deskstar-frontend/rooms.js index 404ed720..f4958710 100644 --- a/src/deskstar-frontend/rooms.js +++ b/src/deskstar-frontend/rooms.js @@ -1,16 +1,16 @@ export const rooms = [ - { - roomId: "1", - roomName: "100.1", - building: "Headquarter", - floor: "EG", - location: "Example street 123, 12345 Berlin" - }, - { - roomId: "2", - roomName: "R 20.245", - building: "Innovation Center", - floor: "EG", - location: "Sesamstreet 42, 85757 Karlsfeld", - } -] \ No newline at end of file + { + roomId: "1", + roomName: "100.1", + building: "Headquarter", + floor: "EG", + location: "Example street 123, 12345 Berlin", + }, + { + roomId: "2", + roomName: "R 20.245", + building: "Innovation Center", + floor: "EG", + location: "Sesamstreet 42, 85757 Karlsfeld", + }, +]; diff --git a/src/deskstar-frontend/tailwind.config.js b/src/deskstar-frontend/tailwind.config.js index 2d8392c6..a1e28d13 100644 --- a/src/deskstar-frontend/tailwind.config.js +++ b/src/deskstar-frontend/tailwind.config.js @@ -3,17 +3,17 @@ module.exports = { content: [ "./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", - "./app/**/*.{js,ts,jsx,tsx}" + "./app/**/*.{js,ts,jsx,tsx}", ], theme: { extend: { colors: { "deskstar-green": { dark: "#5FC36D", - light: "#9ee0b0" - } - } + light: "#9ee0b0", + }, + }, }, }, plugins: [require("daisyui")], -} +}; diff --git a/src/deskstar-frontend/types/desk.ts b/src/deskstar-frontend/types/desk.ts index 4fde1b7a..9039ecac 100644 --- a/src/deskstar-frontend/types/desk.ts +++ b/src/deskstar-frontend/types/desk.ts @@ -7,7 +7,7 @@ export interface IDesk { floorId: string; floorName: string; buildingId: string; - buildingName: string; + buildingName: string; location: string; bookings: IDeskBooking[]; } @@ -17,4 +17,4 @@ export interface IDeskBooking { userId: string; endTime: string; startTime: string; -} \ No newline at end of file +} diff --git a/src/deskstar-frontend/types/desktypes.ts b/src/deskstar-frontend/types/desktypes.ts index cfc57c85..de921371 100644 --- a/src/deskstar-frontend/types/desktypes.ts +++ b/src/deskstar-frontend/types/desktypes.ts @@ -1,4 +1,4 @@ export interface IDeskType { - deskTypeId: string; - deskTypeName: string -}; \ No newline at end of file + deskTypeId: string; + deskTypeName: string; +} diff --git a/src/deskstar-frontend/types/floor.ts b/src/deskstar-frontend/types/floor.ts index 30215beb..5cb15caf 100644 --- a/src/deskstar-frontend/types/floor.ts +++ b/src/deskstar-frontend/types/floor.ts @@ -2,5 +2,5 @@ export interface IFloor { floorId: string; floorName: string; buildingName: string; - location:string; + location: string; } diff --git a/src/deskstar-frontend/types/models/CreateBuildingDto.ts b/src/deskstar-frontend/types/models/CreateBuildingDto.ts index c248be8a..a017d10d 100644 --- a/src/deskstar-frontend/types/models/CreateBuildingDto.ts +++ b/src/deskstar-frontend/types/models/CreateBuildingDto.ts @@ -1,4 +1,4 @@ export type CreateBuildingDto = { - buildingName: string; - location: string; -}; \ No newline at end of file + buildingName: string; + location: string; +}; diff --git a/src/deskstar-frontend/types/models/CreateDeskDto.ts b/src/deskstar-frontend/types/models/CreateDeskDto.ts index e122257b..539dd46b 100644 --- a/src/deskstar-frontend/types/models/CreateDeskDto.ts +++ b/src/deskstar-frontend/types/models/CreateDeskDto.ts @@ -1,5 +1,5 @@ export type CreateDeskDto = { - roomId: string; - deskName: string; - deskTypeId: string; -}; \ No newline at end of file + roomId: string; + deskName: string; + deskTypeId: string; +}; diff --git a/src/deskstar-frontend/types/models/CreateDeskTypeDto.ts b/src/deskstar-frontend/types/models/CreateDeskTypeDto.ts index 4e4cfda8..5d91c8fe 100644 --- a/src/deskstar-frontend/types/models/CreateDeskTypeDto.ts +++ b/src/deskstar-frontend/types/models/CreateDeskTypeDto.ts @@ -1,3 +1,3 @@ export type CreateDeskTypeDto = { deskTypeName: string; -}; \ No newline at end of file +}; diff --git a/src/deskstar-frontend/types/models/CreateFloorDto.ts b/src/deskstar-frontend/types/models/CreateFloorDto.ts index 7698767f..996001ba 100644 --- a/src/deskstar-frontend/types/models/CreateFloorDto.ts +++ b/src/deskstar-frontend/types/models/CreateFloorDto.ts @@ -1,4 +1,4 @@ export type CreateFloorDto = { - buildingId: string; - floorName: string; - }; \ No newline at end of file + buildingId: string; + floorName: string; +}; diff --git a/src/deskstar-frontend/types/models/CreateRoomDto.ts b/src/deskstar-frontend/types/models/CreateRoomDto.ts index 9ee9cd7b..2af28627 100644 --- a/src/deskstar-frontend/types/models/CreateRoomDto.ts +++ b/src/deskstar-frontend/types/models/CreateRoomDto.ts @@ -1,4 +1,4 @@ export type CreateRoomDto = { - floorId: string; - roomName: string; -}; \ No newline at end of file + floorId: string; + roomName: string; +}; diff --git a/src/deskstar-frontend/types/room.ts b/src/deskstar-frontend/types/room.ts index f083f387..ab92f6ac 100644 --- a/src/deskstar-frontend/types/room.ts +++ b/src/deskstar-frontend/types/room.ts @@ -1,7 +1,7 @@ export interface IRoom { - roomId: string; - roomName: string, - building: string, - floor: string, - location: string - }; \ No newline at end of file + roomId: string; + roomName: string; + building: string; + floor: string; + location: string; +} diff --git a/src/deskstar-frontend/types/users.ts b/src/deskstar-frontend/types/users.ts index 625bfbb9..e0fa1682 100644 --- a/src/deskstar-frontend/types/users.ts +++ b/src/deskstar-frontend/types/users.ts @@ -1,10 +1,10 @@ export interface IUser { - userId: string; - firstName: string; - lastName: string; - email: string; - company: string; - isAdmin: boolean; - isApproved: boolean; - selected?: boolean; -} \ No newline at end of file + userId: string; + firstName: string; + lastName: string; + email: string; + company: string; + isAdmin: boolean; + isApproved: boolean; + selected?: boolean; +} From ea16b26e966643add6867c51997bcd4c2df0bf9a Mon Sep 17 00:00:00 2001 From: Moritz Reich Date: Tue, 17 Jan 2023 20:03:06 +0000 Subject: [PATCH 4/4] renamed README Signed-off-by: Moritz Reich --- src/{README.md.rename => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{README.md.rename => README.md} (100%) diff --git a/src/README.md.rename b/src/README.md similarity index 100% rename from src/README.md.rename rename to src/README.md