Skip to content

Commit

Permalink
Merge pull request #421 from fujaba/remove/backend-mongodb
Browse files Browse the repository at this point in the history
Remove MongoDB connection from Backend
  • Loading branch information
Clashsoft authored Mar 18, 2024
2 parents e12beba + bf839e1 commit a3369e3
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 221 deletions.
3 changes: 0 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ dependencies {
// https://mvnrepository.com/artifact/org.json/json
implementation group: 'org.json', name: 'json', version: '20240303'

// https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-sync
implementation group: 'org.mongodb', name: 'mongodb-driver-sync', version: '4.11.1'

// https://mvnrepository.com/artifact/com.auth0/java-jwt
implementation group: 'com.auth0', name: 'java-jwt', version: '4.4.0'

Expand Down
128 changes: 0 additions & 128 deletions backend/src/main/java/org/fulib/webapp/mongo/Mongo.java

This file was deleted.

13 changes: 2 additions & 11 deletions backend/src/main/java/org/fulib/webapp/tool/RunCodeGen.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.fulib.webapp.tool;

import org.fulib.StrUtil;
import org.fulib.webapp.mongo.Mongo;
import org.fulib.webapp.tool.model.CodeGenData;
import org.fulib.webapp.tool.model.Diagram;
import org.fulib.webapp.tool.model.Method;
Expand Down Expand Up @@ -39,16 +38,14 @@ public class RunCodeGen

// =============== Fields ===============

private final Mongo db;
private final String tempDir = System.getProperty("java.io.tmpdir") + "/fulib.org/";
private final ScheduledExecutorService deleter = Executors.newScheduledThreadPool(1);

// =============== Constructors ===============

@Inject
public RunCodeGen(Mongo db)
public RunCodeGen()
{
this.db = db;
}

// =============== Methods ===============
Expand All @@ -71,13 +68,7 @@ public String handle(Request req, Response res) throws Exception

res.type("application/json");

final String resultBody = resultObj.toString(3);

if (jsonObject.has("privacy") && "all".equals(jsonObject.get("privacy")))
{
this.db.log(req.ip(), req.userAgent(), body, resultBody);
}
return resultBody;
return resultObj.toString(3);
}

// =============== Static Methods ===============
Expand Down
75 changes: 0 additions & 75 deletions backend/src/test/java/org/fulib/webapp/mongo/CollectErrors.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.fulib.webapp.tool;

import org.fulib.StrUtil;
import org.fulib.webapp.mongo.Mongo;
import org.fulib.webapp.tool.model.Result;
import org.hamcrest.CoreMatchers;
import org.json.JSONObject;
Expand All @@ -26,8 +25,7 @@ public class RunCodeGenTest
@Test
public void handle() throws Exception
{
final Mongo db = mock(Mongo.class);
final RunCodeGen codeGen = new RunCodeGen(db);
final RunCodeGen codeGen = new RunCodeGen();

final Request request = mock(Request.class);
final String ip = "0.0.0.0";
Expand All @@ -46,7 +44,6 @@ public void handle() throws Exception
final String responseBody = codeGen.handle(request, response);

verify(response).type("application/json");
verify(db).log(ip, userAgent, requestBody, responseBody);

final JSONObject responseObj = new JSONObject(responseBody);
assertThat(responseObj.getString("output"), equalTo(""));
Expand Down

0 comments on commit a3369e3

Please sign in to comment.