diff --git a/backend/k8s/deployment.yaml b/backend/k8s/deployment.yaml index ee43da9..a7ade5a 100644 --- a/backend/k8s/deployment.yaml +++ b/backend/k8s/deployment.yaml @@ -78,7 +78,7 @@ spec: - containerPort: 5000 resources: limits: - memory: 100Mi + memory: 2Gi restartPolicy: Always automountServiceAccountToken: false diff --git a/client/cypress/e2e/scheduling.cy.js b/client/cypress/e2e/scheduling.cy.js index 4b22af3..ba8a8da 100644 --- a/client/cypress/e2e/scheduling.cy.js +++ b/client/cypress/e2e/scheduling.cy.js @@ -4,7 +4,7 @@ context('Error handling', () => { describe('Error getting user', () => { before(() => { cy.intercept('/api/v1/users/findUserByUrl?url=christian-gawron', { statusCode: 500, body: { error: "no data" } }).as('getUser') - cy.visit('/schedule/christian-gawron/sprechstunde') + cy.visit('/users/christian-gawron/sprechstunde') }) it('Should show error message', () => { @@ -26,13 +26,12 @@ context('Scheduling page', () => { describe('Visit scheduling page and schedule appointment', () => { before(() => { cy.intercept('POST', '/api/v1/**', { body: { error: 'not possible' } }).as('apiCheck') - cy.visit('/schedule/christian-gawron/sprechstunde') + cy.visit('/users/christian-gawron/sprechstunde') }) it('Check simple schedule flow', () => { cy.wait(['@getUser', '@getEvent', '@getAvailable'], { timeout: 10000 }) - cy.get('h6').should('contain', 'Christian Gawron') - cy.get('.MuiPickersDay-today').should('contain', '25') + cy.get('.MuiPickersDay-today').should('contain', '25').click() cy.contains('07:00').click() cy.get('[name=name]').type('Max Mustermann') cy.get('[name=email]').type('mustermann.max@fh-swf.de') @@ -47,13 +46,12 @@ context('Scheduling page', () => { describe('Error creating appointment', () => { before(() => { cy.intercept('POST', '/api/v1/**', { statusCode: 400, body: { error: 'not possible' } }).as('apiCheck') - cy.visit('/schedule/christian-gawron/sprechstunde') + cy.visit('/users/christian-gawron/sprechstunde') }) it('should show an error message', () => { cy.wait(['@getUser', '@getEvent', '@getAvailable'], { timeout: 10000 }) - cy.get('h6').should('contain', 'Christian Gawron') - cy.get('.MuiPickersDay-today').should('contain', '25') + cy.get('.MuiPickersDay-today').should('contain', '25').click() cy.contains('07:00').click() cy.get('[name=name]').type('Max Mustermann') cy.get('[name=email]').type('mustermann.max@fh-swf.de') diff --git a/client/package.json b/client/package.json index 7035ed9..0a6419d 100644 --- a/client/package.json +++ b/client/package.json @@ -37,7 +37,8 @@ "@types/react": "^18.2.21", "axios": "^1.5.0", "common": "workspace:*", - "date-fns": "^4.0.0", + "date-fns": "^4.1.0", + "date-fns-tz": "^3.2.0", "dayjs": "^1.11.13", "i18next": "^23.15.1", "i18next-browser-languagedetector": "^8.0.0", @@ -45,6 +46,7 @@ "js-cookie": "^3.0.5", "jsonwebtoken": "^9.0.2", "moment": "^2.30.1", + "notistack": "^3.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-i18next": "^15.0.2", diff --git a/client/src/index.tsx b/client/src/index.tsx index f5ba3b6..d5c3301 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -18,6 +18,7 @@ import Finished from "./pages/Finished"; import { isAuthenticated } from "./helpers/helpers"; import { createTheme, ThemeProvider } from "@mui/material/styles"; +import { SnackbarProvider } from 'notistack'; import "./i18n"; import { LocalizationProvider } from "@mui/x-date-pickers"; @@ -88,7 +89,8 @@ console.log("localeText: %o", deDE.components.MuiLocalizationProvider.defaultPro root.render( - + + @@ -159,7 +161,8 @@ root.render( - + + ); diff --git a/client/src/pages/Booking.tsx b/client/src/pages/Booking.tsx index ab30ffe..b50692a 100644 --- a/client/src/pages/Booking.tsx +++ b/client/src/pages/Booking.tsx @@ -35,6 +35,7 @@ import { EMPTY_EVENT, Event, Slot, IntervalSet } from "common"; import { UserDocument } from "../helpers/UserDocument"; import { useTranslation } from "react-i18next"; import { EventType } from "../components/EventType"; +import { useSnackbar } from "notistack"; const theme = createTheme({ components: { @@ -130,6 +131,7 @@ const Booking = (props: any) => { const { t, i18n } = useTranslation(); const data = useParams<{ user_url: string; url: string }>(); const navigate = useNavigate(); + const { enqueueSnackbar, closeSnackbar } = useSnackbar(); type Details = { name: string; email: string; description: string }; @@ -189,6 +191,8 @@ const Booking = (props: any) => { } }) .catch((err) => { + console.log("error getting user: %o", err); + enqueueSnackbar("Error getting user", { variant: "error", autoHideDuration: 15000, className: "error" }); return err; }); }, [data.url, data.user_url, navigate, selectedDate]); diff --git a/yarn.lock b/yarn.lock index 5d0d801..46c84c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7788,6 +7788,7 @@ __metadata: cypress: "npm:^13.15.0" cypress-ctrf-json-reporter: "npm:^0.0.11" date-fns: "npm:^4.0.0" + date-fns-tz: "npm:^3.2.0" dayjs: "npm:^1.11.13" dotenv-cli: "npm:^7.4.2" eslint: "npm:^9.11.1" @@ -7801,6 +7802,7 @@ __metadata: jsonwebtoken: "npm:^9.0.2" moment: "npm:^2.30.1" node-sass: "npm:^9.0.0" + notistack: "npm:^3.0.1" react: "npm:^18.3.1" react-dom: "npm:^18.3.1" react-i18next: "npm:^15.0.2" @@ -7866,6 +7868,13 @@ __metadata: languageName: node linkType: hard +"clsx@npm:^1.1.0": + version: 1.2.1 + resolution: "clsx@npm:1.2.1" + checksum: 10/5ded6f61f15f1fa0350e691ccec43a28b12fb8e64c8e94715f2a937bc3722d4c3ed41d6e945c971fc4dcc2a7213a43323beaf2e1c28654af63ba70c9968a8643 + languageName: node + linkType: hard + "clsx@npm:^2.1.1": version: 2.1.1 resolution: "clsx@npm:2.1.1" @@ -8554,6 +8563,15 @@ __metadata: languageName: node linkType: hard +"date-fns-tz@npm:^3.2.0": + version: 3.2.0 + resolution: "date-fns-tz@npm:3.2.0" + peerDependencies: + date-fns: ^3.0.0 || ^4.0.0 + checksum: 10/8ab4745f00b40381220f0a7a2ec16e217cb629d4018a19047264d289dd260322baa23e19b3ed63c7e553f9ad34bea9dea105391132930a3e141e9a0a53e54af2 + languageName: node + linkType: hard + "date-fns@npm:^2.30.0": version: 2.30.0 resolution: "date-fns@npm:2.30.0" @@ -11513,6 +11531,15 @@ __metadata: languageName: node linkType: hard +"goober@npm:^2.0.33": + version: 2.1.14 + resolution: "goober@npm:2.1.14" + peerDependencies: + csstype: ^3.0.10 + checksum: 10/372f18333ef64c403d29be7c1175cc9cd74cb947ec52cd42fbb1cf3f9870ac1dfec9c7671192cbf47ebc0ec17d8b05b6ef9a2b92952397d5b555a692381d5eaa + languageName: node + linkType: hard + "google-auth-library@npm:9.0.0, google-auth-library@npm:^9.0.0": version: 9.0.0 resolution: "google-auth-library@npm:9.0.0" @@ -16701,6 +16728,19 @@ __metadata: languageName: node linkType: hard +"notistack@npm:^3.0.1": + version: 3.0.1 + resolution: "notistack@npm:3.0.1" + dependencies: + clsx: "npm:^1.1.0" + goober: "npm:^2.0.33" + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + checksum: 10/be6ca9e1c2f06118fe0545eaaf91f2f260efe5b1ff3b3f6575a346d5c9f88666e7f13ef4369a56037a2c89c030c191f034f6e6b5a28be704540a23442e2d19a9 + languageName: node + linkType: hard + "now-and-later@npm:^3.0.0": version: 3.0.0 resolution: "now-and-later@npm:3.0.0"