diff --git a/.github/workflows/build_application.yml b/.github/workflows/build_application.yml index 078316bc..62134f73 100644 --- a/.github/workflows/build_application.yml +++ b/.github/workflows/build_application.yml @@ -10,12 +10,13 @@ on: jobs: - # Run tests (unimplemented) - # test: - # name: Run Tests - # uses: ./.github/workflows/test_application.yml + # Run tests + test: + name: Run Tests + uses: ./.github/workflows/java_tests.yml # Call the docker_build workflow to build and publish images build: name: Build & Publish Images - uses: ./.github/workflows/docker_build.yml \ No newline at end of file + uses: ./.github/workflows/docker_build.yml + needs: test \ No newline at end of file diff --git a/.github/workflows/java_tests.yml b/.github/workflows/java_tests.yml new file mode 100644 index 00000000..896fdc71 --- /dev/null +++ b/.github/workflows/java_tests.yml @@ -0,0 +1,57 @@ +# This workflow should build docker images every time code is pushed to the repository +name: Test Java Applications + +# This workflow is triggered only when called by another workflow +on: + workflow_call: + +jobs: + + test: + name: Run tests on java applications + runs-on: ubuntu-latest + + # Use a matrix strategy to run the tests for all applications + strategy: + matrix: + # Add any future services relative paths from . here + service: [user] + + steps: + + - name: Check out repository + uses: actions/checkout@v3 + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Make Gradle wrapper executable + run: chmod +x gradlew + working-directory: server/${{ matrix.service }} + + - name: Run tests + run: ./gradlew test --info + working-directory: server/${{ matrix.service }} + + # Upload the junit reports as artifacts + - name: Upload JUnit test reports + if: always() + uses: actions/upload-artifact@v4 + with: + name: junit-test-results + path: | + server/${{ matrix.service }}/build/test-results + server/${{ matrix.service }}/build/reports/tests + + # Add annotations to checks tab + - name: Report Tests + if: always() + uses: dorny/test-reporter@v2 + with: + name: ${{ matrix.service }} + path: ./server/${{ matrix.service }}/build/test-results/**/*.xml + reporter: java-junit + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update_api_spec.yml b/.github/workflows/update_api_spec.yml index fd319048..e6071e7e 100644 --- a/.github/workflows/update_api_spec.yml +++ b/.github/workflows/update_api_spec.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: push: paths: - - 'api/openapi.yaml' + - 'api/*' jobs: diff --git a/.gitignore b/.gitignore index 50afe337..32a9eb8c 100644 --- a/.gitignore +++ b/.gitignore @@ -382,7 +382,7 @@ sketch HELP.md .gradle build/ -!gradle/wrapper/gradle-wrapper.jar +!**/gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ diff --git a/README.md b/README.md index d3200d4a..f68e0631 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ![Meet@Mensa logo](resources/img/meet@mensa.png "Meet@Mensa") +[![Build & Test Meet@Mensa](https://github.com/AET-DevOps25/team-devoops/actions/workflows/build_application.yml/badge.svg)](https://github.com/AET-DevOps25/team-devoops/actions/workflows/build_application.yml) + Many students at TUM, particularly in the larger study programs, report feeling lonely and isolated despite having countless peers. One of the places where this is especially noticeable is the Mensa during lunchtime. It's common for students that don't have a strong network of friends at university to eat alone or avoid eating at the Mensa entirely to not feel socially awkward. Our tool - *Meet@Mensa* - focuses on transforming the potentially uncomfortable situation of eating alone at the Mensa into an opportunity to meet fellow students and make new friends. In order to enable this, our tool offers the following features: diff --git a/api/changelogs/changelog_v2_1_1.md b/api/changelogs/changelog_v2_1_1.md new file mode 100644 index 00000000..3b2c152c --- /dev/null +++ b/api/changelogs/changelog_v2_1_1.md @@ -0,0 +1,24 @@ +## Info +### Version +v2.1 +### Date +2025-06-27 +### Autor +James Stark +## Changelog: + +### Paths +- Add 500 responses to all endpoints +- Change 201 response to 200 for register user + +``` diff + +@@ All @@ ++ insert code 500 response +# Formally handle errors + +@@ /api/v2/user/registr POST @@ +- remove code 201 response ++ insert code 200 response + +``` diff --git a/api/openapi.yaml b/api/openapi.yaml index 7b2e059c..5fa4588d 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -3,7 +3,7 @@ x-stoplight: id: ceylawji1yc2t info: title: MeetAtMensa - version: 1.0.0 + version: 2.1.1 description: |- This OpenAPI specification defines the endpoints, schemas, and security mechanisms for the Meet@Mensa User micro-service. @@ -701,6 +701,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: get-api-v2-user-userID x-stoplight: id: p1d67jb8y16q8 @@ -724,6 +726,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + 5XX: + description: Server Error operationId: put-api-v2-user-userID x-stoplight: id: exmvsbw8301bi @@ -746,6 +750,8 @@ paths: $ref: '#/components/responses/BadRequestError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: delete-api-v2-user-userID x-stoplight: id: 407z5o4zq5tvl @@ -757,8 +763,8 @@ paths: tags: - User responses: - '201': - description: Successfully created user + '200': + description: OK content: application/json: schema: @@ -769,6 +775,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '409': description: Conflict + '500': + description: Internal Server Error operationId: post-api-v2-user-register x-stoplight: id: laufntfpxgg42 @@ -792,6 +800,8 @@ paths: $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/UnauthorizedError' + '500': + description: Internal Server Error operationId: post-api-v2-matching-request x-stoplight: id: 1x5ta8qguutzq @@ -823,6 +833,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: get-api-v2-matching-matches-userID description: 'Retrieve all matches for a user with {user-id} from the matching-service' '/api/v2/matching/requests/{user-id}': @@ -845,6 +857,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: get-api-v2-matching-requests-userID x-stoplight: id: wkc1ys6vkbv12 @@ -865,6 +879,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: delete-api-v2-matching-matches-request-id x-stoplight: id: shgx14ydoaa2f @@ -888,6 +904,8 @@ paths: $ref: '#/components/responses/NotFoundError' '406': description: MatchRequest cannot be updated since it has already been fulfilled! + '500': + description: Internal Server Error operationId: put-api-v2-matching-request-request-id x-stoplight: id: f6t3aeqcvup68 @@ -909,6 +927,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: get-api-v2-matching-rsvp-match-id-accept x-stoplight: id: am6b7xnyytanu @@ -933,6 +953,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: get-api-v2-matching-rsvp-match-id-reject description: Reject invitation to a given match x-stoplight: @@ -959,6 +981,8 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' + '500': + description: Internal Server Error operationId: get-api-v2-genai-conversation-starter requestBody: content: diff --git a/client/src/api.ts b/client/src/api.ts index b9c5b31f..8ac5989a 100644 --- a/client/src/api.ts +++ b/client/src/api.ts @@ -646,6 +646,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "put-api-v2-user-userID": { @@ -676,6 +683,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Server Error */ + "5XX": { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "delete-api-v2-user-userID": { @@ -700,6 +714,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["BadRequestError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "post-api-v2-user-register": { @@ -715,8 +736,8 @@ export interface operations { }; }; responses: { - /** @description Successfully created user */ - 201: { + /** @description OK */ + 200: { headers: { [name: string]: unknown; }; @@ -733,6 +754,13 @@ export interface operations { }; content?: never; }; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "post-api-v2-matching-request": { @@ -757,6 +785,13 @@ export interface operations { }; 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "get-api-v2-matching-matches-userID": { @@ -783,6 +818,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "get-api-v2-matching-requests-userID": { @@ -809,6 +851,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "put-api-v2-matching-request-request-id": { @@ -846,6 +895,13 @@ export interface operations { }; content?: never; }; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "delete-api-v2-matching-matches-request-id": { @@ -870,6 +926,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "get-api-v2-matching-rsvp-match-id-accept": { @@ -893,6 +956,13 @@ export interface operations { }; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "get-api-v2-matching-rsvp-match-id-reject": { @@ -916,6 +986,13 @@ export interface operations { }; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; "get-api-v2-genai-conversation-starter": { @@ -944,6 +1021,13 @@ export interface operations { 400: components["responses"]["BadRequestError"]; 401: components["responses"]["UnauthorizedError"]; 404: components["responses"]["NotFoundError"]; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; } diff --git a/docs/api.html b/docs/api.html index 9f795dda..b3cda8f2 100644 --- a/docs/api.html +++ b/docs/api.html @@ -424,7 +424,7 @@ 55.627 l 55.6165,55.627 -231.245496,231.24803 c -127.185,127.1864 -231.5279,231.248 -231.873,231.248 -0.3451,0 -104.688, -104.0616 -231.873,-231.248 z - " fill="currentColor">

MeetAtMensa (1.0.0)

Download OpenAPI specification:

MeetAtMensa (2.1.1)

Download OpenAPI specification:

This OpenAPI specification defines the endpoints, schemas, and security mechanisms for the Meet@Mensa User micro-service.

@@ -444,6 +444,8 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Authentication failed due to missing or invalid OAuth2 token.

Request samples

Content type
application/json
{
  • "users": {
    }
}

Response samples

Content type
application/json
{
  • "conversationsStarters": [
    ]
}

Matching

Paths belonging to the Matching microservice

Submit matching Request

The request was malformed or contained invalid parameters.

Request samples

Content type
application/json
{
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "date": "2019-08-24",
  • "timeslot": [
    ],
  • "location": "GARCHING",
  • "preferences": {
    }
}

Retrieve all matches for a {user-id}

Retrieve all matches for a user with {user-id} from the matching-service

Authorizations:
auth0
path Parameters
user-id
required
string <uuid>

Authentication failed due to missing or invalid OAuth2 token.

Response samples

Content type
application/json
{
  • "matches": {
    }
}

Retrieve all MatchRequests for a {user-id}

Retrieve all MatchRequests for a user with {user-id} from the matching-service

Authorizations:
auth0
path Parameters
user-id
required
string <uuid>

Authentication failed due to missing or invalid OAuth2 token.

Response samples

Content type
application/json
{
  • "requests": [
    ]
}

Delete MatchRequest with {request-id}

Delete MatchRequest with ID {request-id} from the system

Authorizations:
auth0
path Parameters
request-id
required
string <uuid>

Authentication failed due to missing or invalid OAuth2 token.

Update MatchRequest with {request-id}

Update all information in the MatchRequest with ID {request-id}

Authorizations:
auth0
path Parameters
request-id
required
string <uuid>

The requested resource was not found.

Request samples

Content type
application/json
{
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "date": "2019-08-24",
  • "timeslot": [
    ],
  • "location": "GARCHING",
  • "preferences": {
    }
}

Response samples

Content type
application/json
{
  • "requestID": "e4619679-f5d9-4eff-9f79-bbded6130bb1",
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "date": "2019-08-24",
  • "timeslot": [
    ],
  • "location": "GARCHING",
  • "preferences": {
    },
  • "status": "PENDING"
}

Accept invitation to a given match

Accept invitation to a given match

Authorizations:
auth0
path Parameters
match-id
required
string <uuid>

Authentication failed due to missing or invalid OAuth2 token.

Reject invitation to a given match

Reject invitation to a given match

Authorizations:
auth0
path Parameters
match-id
required
string <uuid>

Authentication failed due to missing or invalid OAuth2 token.

User

Paths belonging to the User microservice

Retrieve User with {user-id}

Authentication failed due to missing or invalid OAuth2 token.

Response samples

Content type
application/json
{
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}

Update User with {user-id}

Update all information about user with ID {user-id} from user-service

Authorizations:
auth0
path Parameters
user-id
required
string <uuid>

Authentication failed due to missing or invalid OAuth2 token.

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}

Response samples

Content type
application/json
{
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}

Delete User with {user-id}

Remove all information about user with ID {user-id} from user-service

Authorizations:
auth0
path Parameters
user-id
required
string <uuid>

The request was malformed or contained invalid parameters.

Register new User

Register a new user and respond with it's {user-id}

Authorizations:
auth0
Request Body schema: application/json
email
required
string <email>

Array of a User's interests

bio
required
string

Short introduction text written by the user

-

Responses

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}

Response samples

Content type
application/json
{
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}
+

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}

Response samples

Content type
application/json
{
  • "userID": "2c3821b8-1cdb-4b77-bcd8-a1da701e46aa",
  • "email": "user@example.com",
  • "firstname": "Max",
  • "lastname": "Mustermann",
  • "birthday": "2019-08-24",
  • "gender": "other",
  • "degree": "msc_informatics",
  • "degreeStart": 2024,
  • "interests": [
    ],
  • "bio": "string"
}