File tree Expand file tree Collapse file tree 2 files changed +28
-9
lines changed
server/matching/src/main/java/meet_at_mensa/matching Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -132,15 +132,35 @@ private User getUserByAuthID(String authID) {
132132 public UserCollection getDemoUsers () {
133133
134134 // create empty UserCollection
135- UserCollection users = new UserCollection ();
135+ UserCollection demoUsers = new UserCollection ();
136136
137- // get each user individually
138- for (String authID : List .of ("TestUser001" , "TestUser002" , "TestUser003" )) {
139- users .addUsersItem (getUserByAuthID (authID ));
140- }
137+ // create instance of the API
138+ UserApi apiInstance = new UserApi (this .defaultClient );
141139
142- // return userCollection
143- return users ;
140+ try {
141+
142+ org .openapitools .client .model .UserCollection userCollectionClient ;
143+
144+ // request user Object from user-service
145+ // TODO: Uncomment after API update
146+ // userCollectionClient = apiInstance.getApiV2UsersDemo();
147+ userCollectionClient = null ;
148+
149+ // Convert to server users and add to list
150+ for (org .openapitools .client .model .User userClient : userCollectionClient .getUsers ()) {
151+
152+ demoUsers .addUsersItem (
153+ convertClientUserToServerUser (userClient )
154+ );
155+
156+ }
157+
158+ // convert to server-type object and return
159+ return demoUsers ;
160+
161+ } catch (Exception e ) {
162+ throw new RestException (e .toString ());
163+ }
144164
145165 }
146166
Original file line number Diff line number Diff line change @@ -485,8 +485,7 @@ public Group createDemoMatch(MatchRequestNew demoRequest) {
485485 MatchRequest thisRequest = requestService .registerRequest (demoRequest );
486486
487487 // get demo users from UserService
488- // TODO: This is a placeholder, Implement after API update.
489- UserCollection demoUsers = new UserCollection ();
488+ UserCollection demoUsers = userClient .getDemoUsers ();
490489
491490 // Create a collection of demo requests
492491 MatchRequestCollection demoUserRequests = new MatchRequestCollection ();
You can’t perform that action at this time.
0 commit comments