Skip to content

Commit 532bffb

Browse files
fix: Critical bugfix regarding overwriting clients
1 parent d8f690c commit 532bffb

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

server/matching/src/main/java/meet_at_mensa/matching/client/GenAiClient.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package meet_at_mensa.matching.client;
22

3-
import org.openapitools.client.Configuration;
43
import org.openapitools.client.api.GenAiApi;
54
import org.springframework.stereotype.Service;
65

76
import meet_at_mensa.matching.exception.RestException;
8-
import meet_at_mensa.matching.repository.GroupRepository;
9-
import meet_at_mensa.matching.service.ConversationStarterService;
107

118
import org.openapitools.client.ApiClient;
129

@@ -15,14 +12,8 @@
1512
import org.openapitools.model.ConversationStarter;
1613
import org.openapitools.model.ConversationStarterCollection;
1714

18-
import org.openapitools.client.auth.*;
19-
2015
/**
2116
* GenAiClient uses the generated java client to handle REST requests to the GenAi-Microservice
22-
*
23-
* WARNING: This class is currently non-functional due to complications with Auth0
24-
*
25-
* TODO: @AK - Implement Authentication
2617
*
2718
*/
2819
@Service
@@ -32,8 +23,8 @@ public class GenAiClient {
3223

3324
public GenAiClient() {
3425

35-
// get default client
36-
this.defaultClient = Configuration.getDefaultApiClient();
26+
// get new client
27+
this.defaultClient = new ApiClient();
3728

3829
// set path
3930
this.defaultClient.setBasePath("http://meetatmensa-genai:80");
@@ -44,9 +35,6 @@ public GenAiClient() {
4435
/**
4536
* Uses a Generated client to a REST request to genai-service for a ConverationStarterCollection object
4637
*
47-
* WARNING: This currently fails due to missing authentication!
48-
*
49-
* TODO: @AK Figure out auth0
5038
*
5139
* @param users server-style UserCollection object of the user being fetched
5240
* @return server-style ConversationStarterCollection object (org.openapitools.model.ConversationStarterCollection)
@@ -56,6 +44,8 @@ public ConversationStarterCollection getPrompts(UserCollection users) {
5644
// create instance of the API
5745
GenAiApi apiInstance = new GenAiApi(this.defaultClient);
5846

47+
System.out.println("Users being sent:" + users.toString());
48+
5949
try {
6050

6151
// initiate object

server/matching/src/main/java/meet_at_mensa/matching/client/UserClient.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import java.util.List;
55

66
import org.openapitools.client.ApiClient;
7-
import org.openapitools.client.Configuration;
8-
import org.openapitools.client.auth.*;
97
import org.openapitools.client.api.UserApi;
108

119
import org.openapitools.model.User;
@@ -28,8 +26,8 @@ public class UserClient {
2826
// Constructor
2927
public UserClient() {
3028

31-
// get default client
32-
this.defaultClient = Configuration.getDefaultApiClient();
29+
// get new client
30+
this.defaultClient = new ApiClient();
3331

3432
// set path
3533
this.defaultClient.setBasePath("http://meetatmensa-user:80");

0 commit comments

Comments
 (0)