From c9ad307095b7dbd5f29fe5f5aca1ce772df2a17e Mon Sep 17 00:00:00 2001 From: Guilherme Stark Date: Sat, 19 Jul 2025 18:05:18 +0200 Subject: [PATCH 01/15] feat: Add java support for new demo endpoint --- .../matching/client/UserClient.java | 57 ++++++++++--- .../matching/service/MatchingService.java | 65 +++++++++++++++ .../user/service/UserService.java | 81 +++++++++++++++++++ 3 files changed, 194 insertions(+), 9 deletions(-) diff --git a/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java b/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java index 59f9b20e..524f2dcb 100644 --- a/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java +++ b/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java @@ -17,9 +17,6 @@ /** * User Client uses the generated java client to handle REST requests to the User-Microservice * - * WARNING: This class is currently non-functional due to complications with Auth0 - * - * TODO: @AK - Implement Authentication * */ @Service @@ -74,9 +71,6 @@ private User convertClientUserToServerUser(org.openapitools.client.model.User cl /** * Uses the Generated client to send a REST request to user-service for a User object * - * WARNING: This currently fails due to missing authentication - * - * TODO: @AK Figure out auth0 * * @param userID userID of the user being fetched * @return serverUser server-style user object (org.openapitools.model.User) @@ -101,13 +95,58 @@ public User getUser(UUID userID) { } } + /** + * Uses the Generated client to send a REST request to user-service for a User object + * + * This method fetches users by their AuthID, and is not designed for external use + * + * @param authID userID of the user being fetched + * @return serverUser server-style user object (org.openapitools.model.User) + */ + private User getUserByAuthID(String authID) { + + // create instance of the API + UserApi apiInstance = new UserApi(this.defaultClient); + + try { + + org.openapitools.client.model.User userClient; + + // request user Object from user-service + userClient = apiInstance.getApiV2UserMeAuthId(authID); + + // convert to server-type object and return + return convertClientUserToServerUser(userClient); + + } catch (Exception e) { + throw new RestException(e.toString()); + } + } + + + /** + * Uses the Generated client to send multiple REST requests to user-service for the 3 demo-users + * + * @return serverUserCollection server-style user object (org.openapitools.model.UserCollection) + */ + public UserCollection getDemoUsers() { + + // create empty UserCollection + UserCollection users = new UserCollection(); + + // get each user individually + for (String authID : List.of("TestUser001", "TestUser002", "TestUser003")) { + users.addUsersItem(getUserByAuthID(authID)); + } + + // return userCollection + return users; + + } /** * Uses the Generated client to send multiple REST requests to user-service for multiple User objects * - * WARNING: This currently fails due to missing authentication - * - * TODO: @AK Figure out auth0 * * @param userIDs userID of the user being fetched * @return serverUserCollection server-style user object (org.openapitools.model.UserCollection) diff --git a/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java b/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java index 53217db8..244ed163 100644 --- a/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java +++ b/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java @@ -12,6 +12,7 @@ import org.openapitools.model.MatchStatus; import org.openapitools.model.RequestStatus; import org.openapitools.model.MatchCollection; +import org.openapitools.model.MatchRequestNew; import org.openapitools.model.Group; import org.openapitools.model.InviteStatus; import org.openapitools.model.Location; @@ -465,4 +466,68 @@ protected void cleanupExpired() { } + + /** + * Generate a Demo-Match with placeholder users + * + * @param groupID UUID of the group to rematch + * @param strict + * False: rematch CONFIRMED and SENT requests, expire REJECTED + * True: rematch CONFIRMED, expire SENT and REJECTED + * + */ + public Group createDemoMatch(MatchRequestNew demoRequest) { + + // get this user and demo users from UserService + User thisUser = userClient.getUser(demoRequest.getUserID()); + + // add database entries for the request + MatchRequest thisRequest = requestService.registerRequest(demoRequest); + + // get demo users from UserService + // TODO: This is a placeholder, Implement after API update. + UserCollection demoUsers = new UserCollection(); + + // Create a collection of demo requests + MatchRequestCollection demoUserRequests = new MatchRequestCollection(); + for (User demoUser : demoUsers.getUsers()) { + + // register a request identical to demoRequest but from one of the demoUsers + MatchRequest demoUserRequest = requestService.registerRequest( + new MatchRequestNew( + demoUser.getUserID(), + demoRequest.getDate(), + demoRequest.getTimeslot(), + demoRequest.getLocation(), + demoRequest.getPreferences() + ) + ); + + // add generated request to list + demoUserRequests.addRequestsItem(demoUserRequest); + + } + + // add real user to collections + demoUsers.addUsersItem(thisUser); + demoUserRequests.addRequestsItem(thisRequest); + + // Create Solution block + MatchingSolutionBlock demoSolution = new MatchingSolutionBlock( + demoUsers, + demoUserRequests, + demoRequest.getDate(), + demoRequest.getTimeslot().get(0), + demoRequest.getLocation(), + RequestStatus.MATCHED + ); + + // implement solution + Group demoGroup = implementSolution(demoSolution); + + // return group object that was just created + return demoGroup; + + } + } diff --git a/server/user/src/main/java/meet_at_mensa/user/service/UserService.java b/server/user/src/main/java/meet_at_mensa/user/service/UserService.java index b4181b0c..6b240d4f 100644 --- a/server/user/src/main/java/meet_at_mensa/user/service/UserService.java +++ b/server/user/src/main/java/meet_at_mensa/user/service/UserService.java @@ -8,6 +8,7 @@ import jakarta.validation.Valid; import org.openapitools.model.User; +import org.openapitools.model.UserCollection; import org.openapitools.model.UserNew; import org.openapitools.model.UserUpdate; @@ -17,6 +18,7 @@ import meet_at_mensa.user.exception.UserNotFoundException; import meet_at_mensa.user.model.*; +import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -305,6 +307,85 @@ private List registerInterests(UUID userID, List interests) { return getInterests(userID); } + /** + * Creates database entries for 3 "Test Users" used to showcase Meet@Mensa functionality + * + * Checks if users already exist before creating them. + * + * @return UserCollection of the Demo Users + */ + public UserCollection createDemoUsers() { + + // create empty return collection + UserCollection demoUsers = new UserCollection(); + + // If users are in database, return them + try { + + getUserByAuthID("TestUser001"); + getUserByAuthID("TestUser002"); + getUserByAuthID("TestUser003"); + + // If users are not it database, create them + } catch (UserNotFoundException e) { + + registerUser( + new UserNew( + "TestUser001", + "max.mustermann@meetatmensa.com", + "Max", + "Mustermann", + LocalDate.of(1999, 9, 6), + "male", + "msc_informatics", + 2024, + List.of("Cats", "Rock Climbing", "Magic the Gathering"), + "Just a student that loves chilling with fluffy kitties. I'm also a bit more into magic the gathering than I'd like to admint, hahaha." + ) + ); + + registerUser( + new UserNew( + "TestUser002", + "maria.musterfrau@meetatmensa.com", + "Maria", + "Musterfrau", + LocalDate.of(2000, 4, 20), + "female", + "msc_informatics", + 2025, + List.of("Dogs", "Boardgames", "Plants"), + "Heyyy there! I'm Maria and my favorite thing is taking my dog to the park or meeting friends for a good boardgame." + ) + ); + + registerUser( + new UserNew( + "TestUser003", + "daniel.musterdivers@meetatmensa.com", + "Daniel", + "Musterdivers", + LocalDate.of(2001, 8, 27), + "other", + "bsc_informatics", + 2022, + List.of("Astronomy", "Video Games", "Tabletop RPGs"), + "Daniel here, but all my friends call me Dani. I look at pictures of stars during the day, and pretend to be a wizard at night." + ) + ); + + } + + // add demo users to return object + demoUsers.addUsersItem(getUserByAuthID("TestUser001")); + demoUsers.addUsersItem(getUserByAuthID("TestUser002")); + demoUsers.addUsersItem(getUserByAuthID("TestUser003")); + + // return demo users + return demoUsers; + + } + /** * DEBUG METHOD ONLY. DO NOT USE IN PRODUCTION * From 6cf550d36d15392d8cca3fa0e6155dd92232b4cb Mon Sep 17 00:00:00 2001 From: Guilherme Stark Date: Sat, 19 Jul 2025 18:32:32 +0200 Subject: [PATCH 02/15] add debug compose for testing (also removes --- deployment/docker_debug/compose.yml | 92 +++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 deployment/docker_debug/compose.yml diff --git a/deployment/docker_debug/compose.yml b/deployment/docker_debug/compose.yml new file mode 100644 index 00000000..9911c0de --- /dev/null +++ b/deployment/docker_debug/compose.yml @@ -0,0 +1,92 @@ +# This file is used to deploy the microservices using Docker Compose. +# It defines the services, their images, build context, and ports. + +services: + meetatmensa-gateway: + build: ../../server/gateway + container_name: meetatmensa-gateway + ports: + - "8080:8080" + depends_on: + - meetatmensa-matching + - meetatmensa-user + - meetatmensa-genai + networks: + - backend + + meetatmensa-matching: + build: ../../server/matching + container_name: meetatmensa-matching + expose: + - "80" + ports: + - "8081:80" + depends_on: + - match-database + networks: + - backend + + meetatmensa-user: + build: ../../server/user + container_name: meetatmensa-user + expose: + - "80" + ports: + - "8082:80" + depends_on: + - user-database + networks: + - backend + + meetatmensa-genai: + build: ../../server/genai + container_name: meetatmensa-genai + expose: + - "80" + ports: + - "8083:80" + networks: + - backend + + meetatmensa-client: + build: + context: ../../client + container_name: meetatmensa-client + ports: + - "80:80" + environment: + - API_BASE_URL=http://localhost:8080 + + match-database: + build: ../../server/database/matchdb + container_name: meetatmensa-matchdb + # TODO: Implement password passed via secret + environment: + - MYSQL_ROOT_PASSWORD=root + volumes: + - matchdb_data:/var/lib/mysql + expose: + - "3306" + networks: + - backend + + user-database: + build: ../../server/database/userdb + container_name: meetatmensa-userdb + # TODO: Implement password passed via secret + environment: + - MYSQL_ROOT_PASSWORD=root + volumes: + - userdb_data:/var/lib/mysql + expose: + - "3306" + networks: + - backend + +networks: + backend: + driver: bridge + +volumes: + matchdb_data: + userdb_data: \ No newline at end of file From 9fcb5c1037c3d1ed1a31de0894f19e3f95089606 Mon Sep 17 00:00:00 2001 From: Guilherme Stark Date: Sat, 19 Jul 2025 18:33:17 +0200 Subject: [PATCH 03/15] fix: change client demo logic to match upcomming spec --- .../matching/client/UserClient.java | 34 +++++++++++++++---- .../matching/service/MatchingService.java | 3 +- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java b/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java index 524f2dcb..9e6c6da8 100644 --- a/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java +++ b/server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java @@ -132,15 +132,35 @@ private User getUserByAuthID(String authID) { public UserCollection getDemoUsers() { // create empty UserCollection - UserCollection users = new UserCollection(); + UserCollection demoUsers = new UserCollection(); - // get each user individually - for (String authID : List.of("TestUser001", "TestUser002", "TestUser003")) { - users.addUsersItem(getUserByAuthID(authID)); - } + // create instance of the API + UserApi apiInstance = new UserApi(this.defaultClient); - // return userCollection - return users; + try { + + org.openapitools.client.model.UserCollection userCollectionClient; + + // request user Object from user-service + // TODO: Uncomment after API update + // userCollectionClient = apiInstance.getApiV2UsersDemo(); + userCollectionClient = null; + + // Convert to server users and add to list + for (org.openapitools.client.model.User userClient : userCollectionClient.getUsers()) { + + demoUsers.addUsersItem( + convertClientUserToServerUser(userClient) + ); + + } + + // convert to server-type object and return + return demoUsers; + + } catch (Exception e) { + throw new RestException(e.toString()); + } } diff --git a/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java b/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java index 244ed163..17ce18d5 100644 --- a/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java +++ b/server/matching/src/main/java/meet_at_mensa/matching/service/MatchingService.java @@ -485,8 +485,7 @@ public Group createDemoMatch(MatchRequestNew demoRequest) { MatchRequest thisRequest = requestService.registerRequest(demoRequest); // get demo users from UserService - // TODO: This is a placeholder, Implement after API update. - UserCollection demoUsers = new UserCollection(); + UserCollection demoUsers = userClient.getDemoUsers(); // Create a collection of demo requests MatchRequestCollection demoUserRequests = new MatchRequestCollection(); From 69196fb8f9a6e7d4891c2dd2e43212c6e06cefc1 Mon Sep 17 00:00:00 2001 From: Guilherme Stark Date: Sat, 19 Jul 2025 18:34:17 +0200 Subject: [PATCH 04/15] spec: API v2.3.0 Add demo endpoint --- api/changelogs/changelog_v2_3_0 .md | 25 ++++++++++++++++ api/openapi.yaml | 46 ++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 api/changelogs/changelog_v2_3_0 .md diff --git a/api/changelogs/changelog_v2_3_0 .md b/api/changelogs/changelog_v2_3_0 .md new file mode 100644 index 00000000..7a63d770 --- /dev/null +++ b/api/changelogs/changelog_v2_3_0 .md @@ -0,0 +1,25 @@ +## Info +### Version +v2.3.0 +### Date +2025-19-07 +### Autor +James Stark +## Changelog: + +### Endpoints +- Add new POST endpoint to matching to enable demo functionality +- Add new GET endpoint to user to enable fetching pre-made demo users + + +``` diff + +@@ POST @ /api/v2/matching/demo @@ ++ Add new POST operation with a MatchRequestNew payload +# Generates a match fitting this MatchRequest with placeholder users + +@@ POST @ /api/v2/users/demo @@ ++ Add new GET operation with no payload that returns demo users +# Returns 3 pre-made demo-users + +``` \ No newline at end of file diff --git a/api/openapi.yaml b/api/openapi.yaml index 65b5fd15..c6fe312b 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -3,7 +3,7 @@ x-stoplight: id: ceylawji1yc2t info: title: MeetAtMensa - version: 2.2.2 + version: 2.3.0 description: |- This OpenAPI specification defines the endpoints, schemas, and security mechanisms for the Meet@Mensa User micro-service. @@ -1063,6 +1063,50 @@ paths: x-stoplight: id: 3fke7st84x7x9 description: Retrieve a user object based on an Auth0 sub ID + /api/v2/matching/demo: + post: + summary: Create demo request + tags: + - Matching + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Group' + '409': + description: User already has a meeting on this day! + '500': + description: Internal Server Error + operationId: post-api-v2-matching-demo + x-stoplight: + id: nz0sz8ks59ugw + description: Submit a match request which will be immediately matched with a group of demo users. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MatchRequestNew' + /api/v2/users/demo: + get: + summary: Get demo users + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UserCollection' + '500': + description: Internal Server Error + operationId: get-api-v2-users-demo + x-stoplight: + id: fq2onjttsvxxa + description: Return 3 demo-users in a UserCollection + x-internal: true tags: - name: GenAI description: Paths belonging to the GenAI microservice From b0a6c4c44bb8f9c9a6de917738ad0adf5dfd62e4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 19 Jul 2025 16:54:48 +0000 Subject: [PATCH 05/15] gen: generate code and documentation based on latest version of openapi.yaml --- api/flags/flags.yaml | 2 +- client/src/api.ts | 105 ++++++++++++++ docs/api.html | 72 ++++++++-- server/gateway/generated-client/README.md | 11 +- .../gateway/generated-client/api/openapi.yaml | 52 ++++++- server/gateway/generated-client/build.gradle | 2 +- server/gateway/generated-client/build.sbt | 2 +- .../generated-client/docs/MatchingApi.md | 70 +++++++++ server/gateway/generated-client/pom.xml | 2 +- .../org/openapitools/client/ApiCallback.java | 2 +- .../org/openapitools/client/ApiClient.java | 4 +- .../org/openapitools/client/ApiException.java | 4 +- .../org/openapitools/client/ApiResponse.java | 2 +- .../openapitools/client/Configuration.java | 6 +- .../client/GzipRequestInterceptor.java | 2 +- .../java/org/openapitools/client/JSON.java | 2 +- .../java/org/openapitools/client/Pair.java | 4 +- .../client/ProgressRequestBody.java | 2 +- .../client/ProgressResponseBody.java | 2 +- .../client/ServerConfiguration.java | 4 +- .../openapitools/client/ServerVariable.java | 4 +- .../org/openapitools/client/StringUtil.java | 4 +- .../org/openapitools/client/api/GenAiApi.java | 2 +- .../openapitools/client/api/MatchingApi.java | 133 +++++++++++++++++- .../org/openapitools/client/api/UserApi.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 4 +- .../client/auth/Authentication.java | 4 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 4 +- .../client/model/AbstractOpenApiSchema.java | 4 +- .../client/model/ConversationStarter.java | 4 +- .../model/ConversationStarterCollection.java | 4 +- .../org/openapitools/client/model/Group.java | 4 +- .../client/model/InviteStatus.java | 2 +- .../openapitools/client/model/Location.java | 2 +- .../org/openapitools/client/model/Match.java | 4 +- .../client/model/MatchCollection.java | 4 +- .../client/model/MatchPreferences.java | 4 +- .../client/model/MatchRequest.java | 4 +- .../client/model/MatchRequestCollection.java | 4 +- .../client/model/MatchRequestNew.java | 4 +- .../client/model/MatchRequestUpdate.java | 4 +- .../client/model/MatchStatus.java | 4 +- .../client/model/RequestStatus.java | 2 +- .../org/openapitools/client/model/User.java | 4 +- .../client/model/UserCollection.java | 4 +- .../openapitools/client/model/UserNew.java | 4 +- .../openapitools/client/model/UserUpdate.java | 4 +- server/gateway/generated/build.gradle | 2 +- server/gateway/generated/pom.xml | 2 +- .../java/org/openapitools/api/GenAiApi.java | 2 +- .../org/openapitools/api/MatchingApi.java | 52 ++++++- .../java/org/openapitools/api/UserApi.java | 2 +- .../model/ConversationStarter.java | 2 +- .../model/ConversationStarterCollection.java | 2 +- .../java/org/openapitools/model/Group.java | 2 +- .../org/openapitools/model/InviteStatus.java | 2 +- .../java/org/openapitools/model/Location.java | 2 +- .../java/org/openapitools/model/Match.java | 2 +- .../openapitools/model/MatchCollection.java | 2 +- .../openapitools/model/MatchPreferences.java | 2 +- .../org/openapitools/model/MatchRequest.java | 2 +- .../model/MatchRequestCollection.java | 2 +- .../openapitools/model/MatchRequestNew.java | 2 +- .../model/MatchRequestUpdate.java | 2 +- .../org/openapitools/model/MatchStatus.java | 2 +- .../org/openapitools/model/RequestStatus.java | 2 +- .../java/org/openapitools/model/User.java | 2 +- .../openapitools/model/UserCollection.java | 2 +- .../java/org/openapitools/model/UserNew.java | 2 +- .../org/openapitools/model/UserUpdate.java | 2 +- server/matching/generated-client/README.md | 11 +- .../generated-client/api/openapi.yaml | 52 ++++++- server/matching/generated-client/build.gradle | 2 +- server/matching/generated-client/build.sbt | 2 +- .../generated-client/docs/MatchingApi.md | 70 +++++++++ server/matching/generated-client/pom.xml | 2 +- .../org/openapitools/client/ApiCallback.java | 2 +- .../org/openapitools/client/ApiClient.java | 4 +- .../org/openapitools/client/ApiException.java | 4 +- .../org/openapitools/client/ApiResponse.java | 2 +- .../openapitools/client/Configuration.java | 6 +- .../client/GzipRequestInterceptor.java | 2 +- .../java/org/openapitools/client/JSON.java | 2 +- .../java/org/openapitools/client/Pair.java | 4 +- .../client/ProgressRequestBody.java | 2 +- .../client/ProgressResponseBody.java | 2 +- .../client/ServerConfiguration.java | 4 +- .../openapitools/client/ServerVariable.java | 4 +- .../org/openapitools/client/StringUtil.java | 4 +- .../org/openapitools/client/api/GenAiApi.java | 2 +- .../openapitools/client/api/MatchingApi.java | 133 +++++++++++++++++- .../org/openapitools/client/api/UserApi.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 4 +- .../client/auth/Authentication.java | 4 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 4 +- .../client/model/AbstractOpenApiSchema.java | 4 +- .../client/model/ConversationStarter.java | 4 +- .../model/ConversationStarterCollection.java | 4 +- .../org/openapitools/client/model/Group.java | 4 +- .../client/model/InviteStatus.java | 2 +- .../openapitools/client/model/Location.java | 2 +- .../org/openapitools/client/model/Match.java | 4 +- .../client/model/MatchCollection.java | 4 +- .../client/model/MatchPreferences.java | 4 +- .../client/model/MatchRequest.java | 4 +- .../client/model/MatchRequestCollection.java | 4 +- .../client/model/MatchRequestNew.java | 4 +- .../client/model/MatchRequestUpdate.java | 4 +- .../client/model/MatchStatus.java | 4 +- .../client/model/RequestStatus.java | 2 +- .../org/openapitools/client/model/User.java | 4 +- .../client/model/UserCollection.java | 4 +- .../openapitools/client/model/UserNew.java | 4 +- .../openapitools/client/model/UserUpdate.java | 4 +- server/matching/generated/build.gradle | 2 +- server/matching/generated/pom.xml | 2 +- .../java/org/openapitools/api/GenAiApi.java | 2 +- .../org/openapitools/api/MatchingApi.java | 52 ++++++- .../java/org/openapitools/api/UserApi.java | 2 +- .../model/ConversationStarter.java | 2 +- .../model/ConversationStarterCollection.java | 2 +- .../java/org/openapitools/model/Group.java | 2 +- .../org/openapitools/model/InviteStatus.java | 2 +- .../java/org/openapitools/model/Location.java | 2 +- .../java/org/openapitools/model/Match.java | 2 +- .../openapitools/model/MatchCollection.java | 2 +- .../openapitools/model/MatchPreferences.java | 2 +- .../org/openapitools/model/MatchRequest.java | 2 +- .../model/MatchRequestCollection.java | 2 +- .../openapitools/model/MatchRequestNew.java | 2 +- .../model/MatchRequestUpdate.java | 2 +- .../org/openapitools/model/MatchStatus.java | 2 +- .../org/openapitools/model/RequestStatus.java | 2 +- .../java/org/openapitools/model/User.java | 2 +- .../openapitools/model/UserCollection.java | 2 +- .../java/org/openapitools/model/UserNew.java | 2 +- .../org/openapitools/model/UserUpdate.java | 2 +- server/user/generated-client/README.md | 11 +- server/user/generated-client/api/openapi.yaml | 52 ++++++- server/user/generated-client/build.gradle | 2 +- server/user/generated-client/build.sbt | 2 +- .../user/generated-client/docs/MatchingApi.md | 70 +++++++++ server/user/generated-client/pom.xml | 2 +- .../org/openapitools/client/ApiCallback.java | 2 +- .../org/openapitools/client/ApiClient.java | 4 +- .../org/openapitools/client/ApiException.java | 4 +- .../org/openapitools/client/ApiResponse.java | 2 +- .../openapitools/client/Configuration.java | 6 +- .../client/GzipRequestInterceptor.java | 2 +- .../java/org/openapitools/client/JSON.java | 2 +- .../java/org/openapitools/client/Pair.java | 4 +- .../client/ProgressRequestBody.java | 2 +- .../client/ProgressResponseBody.java | 2 +- .../client/ServerConfiguration.java | 4 +- .../openapitools/client/ServerVariable.java | 4 +- .../org/openapitools/client/StringUtil.java | 4 +- .../org/openapitools/client/api/GenAiApi.java | 2 +- .../openapitools/client/api/MatchingApi.java | 133 +++++++++++++++++- .../org/openapitools/client/api/UserApi.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 4 +- .../client/auth/Authentication.java | 4 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 4 +- .../client/model/AbstractOpenApiSchema.java | 4 +- .../client/model/ConversationStarter.java | 4 +- .../model/ConversationStarterCollection.java | 4 +- .../org/openapitools/client/model/Group.java | 4 +- .../client/model/InviteStatus.java | 2 +- .../openapitools/client/model/Location.java | 2 +- .../org/openapitools/client/model/Match.java | 4 +- .../client/model/MatchCollection.java | 4 +- .../client/model/MatchPreferences.java | 4 +- .../client/model/MatchRequest.java | 4 +- .../client/model/MatchRequestCollection.java | 4 +- .../client/model/MatchRequestNew.java | 4 +- .../client/model/MatchRequestUpdate.java | 4 +- .../client/model/MatchStatus.java | 4 +- .../client/model/RequestStatus.java | 2 +- .../org/openapitools/client/model/User.java | 4 +- .../client/model/UserCollection.java | 4 +- .../openapitools/client/model/UserNew.java | 4 +- .../openapitools/client/model/UserUpdate.java | 4 +- server/user/generated/build.gradle | 2 +- server/user/generated/pom.xml | 2 +- .../java/org/openapitools/api/GenAiApi.java | 2 +- .../org/openapitools/api/MatchingApi.java | 52 ++++++- .../java/org/openapitools/api/UserApi.java | 2 +- .../model/ConversationStarter.java | 2 +- .../model/ConversationStarterCollection.java | 2 +- .../java/org/openapitools/model/Group.java | 2 +- .../org/openapitools/model/InviteStatus.java | 2 +- .../java/org/openapitools/model/Location.java | 2 +- .../java/org/openapitools/model/Match.java | 2 +- .../openapitools/model/MatchCollection.java | 2 +- .../openapitools/model/MatchPreferences.java | 2 +- .../org/openapitools/model/MatchRequest.java | 2 +- .../model/MatchRequestCollection.java | 2 +- .../openapitools/model/MatchRequestNew.java | 2 +- .../model/MatchRequestUpdate.java | 2 +- .../org/openapitools/model/MatchStatus.java | 2 +- .../org/openapitools/model/RequestStatus.java | 2 +- .../java/org/openapitools/model/User.java | 2 +- .../openapitools/model/UserCollection.java | 2 +- .../java/org/openapitools/model/UserNew.java | 2 +- .../org/openapitools/model/UserUpdate.java | 2 +- 207 files changed, 1369 insertions(+), 304 deletions(-) diff --git a/api/flags/flags.yaml b/api/flags/flags.yaml index f9ec9109..3e9065d5 100644 --- a/api/flags/flags.yaml +++ b/api/flags/flags.yaml @@ -3,4 +3,4 @@ # DO NOT CHANGE info: - version: 2.2.2 + version: 2.3.0 diff --git a/client/src/api.ts b/client/src/api.ts index c3cbe417..ef2df0cd 100644 --- a/client/src/api.ts +++ b/client/src/api.ts @@ -237,6 +237,46 @@ export interface paths { patch?: never; trace?: never; }; + "/api/v2/matching/demo": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create demo request + * @description Submit a match request which will be immediately matched with a group of demo users. + */ + post: operations["post-api-v2-matching-demo"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/api/v2/users/demo": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get demo users + * @description Return 3 demo-users in a UserCollection + */ + get: operations["get-api-v2-users-demo"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } export type webhooks = Record; export interface components { @@ -1110,4 +1150,69 @@ export interface operations { }; }; }; + "post-api-v2-matching-demo": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["MatchRequestNew"]; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Group"]; + }; + }; + /** @description User already has a meeting on this day! */ + 409: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + "get-api-v2-users-demo": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserCollection"]; + }; + }; + /** @description Internal Server Error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; } diff --git a/docs/api.html b/docs/api.html index cdd16af0..4ab12ab4 100644 --- a/docs/api.html +++ b/docs/api.html @@ -406,7 +406,7 @@ -

MeetAtMensa (2.2.2)

Download OpenAPI specification:

MeetAtMensa (2.3.0)

Download OpenAPI specification:

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

@@ -498,7 +498,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Conflict

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"
}

Retrieve all matches for a {user-id}

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"
}

Retrieve all matches for a {user-id}

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

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

UUID associated with a given user

@@ -512,7 +512,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

The requested resource was not found.

Response samples

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

Retrieve all MatchRequests for a {user-id}

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:
jwt-bearer
path Parameters
user-id
required
string <uuid>

UUID associated with a given user

@@ -526,7 +526,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

The requested resource was not found.

Response samples

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

Delete MatchRequest with {request-id}

Response samples

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

Delete MatchRequest with {request-id}

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

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

UUID associated with a given match request

@@ -594,7 +594,7 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

MatchRequest cannot be updated since it has already been fulfilled!

Request samples

Content type
application/json
{
  • "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

Request samples

Content type
application/json
{
  • "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:
jwt-bearer
path Parameters
match-id
required
string <uuid>

UUID associated with a given match

@@ -618,7 +618,55 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

The requested resource was not found.

User

Create demo request

Submit a match request which will be immediately matched with a group of demo users.

+
Authorizations:
jwt-bearer
Request Body schema: application/json
userID
required
string <uuid> (userID)

The unique ID of a single student in the Meet@Mensa system.

+
date
required
string <date>

The date a user would like meet@mensa to find them a match

+
timeslot
required
Array of integers (timeslot) [ items [ 1 .. 16 ] ]
location
required
any (location)
Enum: "GARCHING" "ARCISSTR"

Enumerator representing a mensa at which a meet can happen

+ + + + + + + + + + + + + + + +
ValueDescription
GARCHINGThe Mensa at the TUM Garching Campus
ARCISSTRThe Mensa at the TUM Innenstadt Campus (Arcisstr. 21)
+
required
object (MatchPreferences)

Object Representing a set of user preferences

+

Responses

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
{
  • "groupID": "ec414289-a6cd-4a76-a6d7-c7f42c7f1517",
  • "date": "2019-08-24",
  • "time": 1,
  • "location": "GARCHING",
  • "userStatus": [
    ],
  • "conversationStarters": {
    }
}

User

Paths belonging to the User microservice

Retrieve User with {user-id}

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

@@ -724,9 +772,15 @@ " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Forbidden

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"
}
+

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"
}

Get demo users

Return 3 demo-users in a UserCollection

+
Authorizations:
jwt-bearer

Responses

Response samples

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