Skip to content
This repository was archived by the owner on Jun 7, 2026. It is now read-only.

Commit de10d4f

Browse files
committed
Work on TODOs
1 parent 4aad674 commit de10d4f

28 files changed

Lines changed: 163 additions & 136 deletions

src/api/v1/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
add_library(api STATIC
2+
authors/projects.cc
3+
authors/websocket.cc
4+
5+
projects/docs.cc
6+
projects/game.cc
7+
28
auth.cc
39
base.cc
410
browse.cc
5-
docs.cc
6-
game.cc
711
error.cc
812
moderation.cc
9-
projects.cc
10-
websocket.cc
1113
system.cc
1214
)
1315

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "projects.h"
2-
#include "base.h"
3-
#include "error.h"
2+
#include "../base.h"
3+
#include "../error.h"
44

55
#include <models/UserProject.h>
66
#include <schemas/schemas.h>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ namespace api::v1 {
3434
ADD_METHOD_TO(ProjectsController::getVersions, "/api/v1/dev/projects/{1:id}/versions", drogon::Get, "AuthFilter");
3535
ADD_METHOD_TO(ProjectsController::getDeployments, "/api/v1/dev/projects/{1:id}/deployments", drogon::Get, "AuthFilter");
3636
// Deployments
37-
// TODO Deployment controller
3837
ADD_METHOD_TO(ProjectsController::getDeployment, "/api/v1/dev/deployments/{1:id}", drogon::Get, "AuthFilter");
3938
ADD_METHOD_TO(ProjectsController::deleteDeployment, "/api/v1/dev/deployments/{1:id}", drogon::Delete, "AuthFilter");
4039
// Project issues
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#include "websocket.h"
2-
#include "error.h"
3-
#include "auth.h"
2+
#include "../auth.h"
3+
#include "../error.h"
44

5-
#include <service/database/database.h>
65
#include <log/log.h>
6+
#include <service/database/database.h>
7+
#include <service/storage/storage.h>
78

89
#define WS_DEPLOYMENT "<<hello<<"
910

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <service/storage/storage.h>
43
#include <drogon/WebSocketController.h>
54

65
namespace api::v1 {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "docs.h"
2-
#include "error.h"
2+
#include "../error.h"
33

44
#include <drogon/HttpClient.h>
55
#include <models/Project.h>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <drogon/HttpController.h>
44

5-
#include "base.h"
5+
#include "../base.h"
66

77
namespace api::v1 {
88
class DocsController final : public drogon::HttpController<DocsController, false> {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace api::v1 {
2727

2828
Task<> GameController::contentItem(const HttpRequestPtr req, std::function<void(const HttpResponsePtr &)> callback,
2929
const std::string project, const std::string id) const {
30-
const auto resolved = co_await BaseProjectController::getProjectWithParams(req, project);
30+
const auto resolved = co_await BaseProjectController::getProjectWithParamsCached(req, project);
3131
requireNonVirtual(resolved);
3232

3333
const auto page = co_await resolved->readContentPage(id);
@@ -51,7 +51,7 @@ namespace api::v1 {
5151
const auto resolved = co_await BaseProjectController::getProjectWithParams(req, project);
5252
requireNonVirtual(resolved);
5353

54-
const auto recipeIds = co_await resolved->getProjectDatabase().getItemRecipes(item);
54+
const auto recipeIds = co_await resolved->getProjectDatabase().getRecipesForItem(item);
5555
nlohmann::json root(nlohmann::json::value_t::array);
5656
for (const auto &id: recipeIds) {
5757
if (const auto recipe = co_await resolved->getRecipe(id)) {
@@ -137,7 +137,7 @@ namespace api::v1 {
137137
const auto layout = co_await content::getRecipeType(resolved, unwrap(ResourceLocation::parse(type)));
138138
assertFound(layout);
139139

140-
const auto workbenches = co_await global::database->getRecipeTypeWorkbenches(recipeType->getValueOfId());
140+
const auto workbenches = co_await resolved->getProjectDatabase().getRecipeTypeWorkbenches(recipeType->getValueOfId());
141141
const auto workbenchItems = co_await resolveContentUsage(workbenches);
142142

143143
nlohmann::json root;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <drogon/HttpController.h>
44

5-
#include "base.h"
5+
#include "../base.h"
66

77
namespace api::v1 {
88
class GameController final : public drogon::HttpController<GameController, false> {

src/main.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#include "monitor.h"
44
#include "version.h"
55

6-
#include <api/v1/error.h>
7-
#include <api/v1/moderation.h>
86
#include <api/v1/auth.h>
7+
#include <api/v1/authors/projects.h>
8+
#include <api/v1/authors/websocket.h>
99
#include <api/v1/browse.h>
10-
#include <api/v1/docs.h>
11-
#include <api/v1/game.h>
12-
#include <api/v1/projects.h>
10+
#include <api/v1/error.h>
11+
#include <api/v1/moderation.h>
12+
#include <api/v1/projects/docs.h>
13+
#include <api/v1/projects/game.h>
1314
#include <api/v1/system.h>
14-
#include <api/v1/websocket.h>
1515
#include <git2.h>
1616
#include <log/log.h>
1717

@@ -25,6 +25,7 @@
2525
#include <service/system/game_data.h>
2626
#include <service/storage/ingestor/recipe/recipe_builtin.h>
2727
#include <service/project/virtual/virtual.h>
28+
#include <service/system/startup.h>
2829

2930
using namespace drogon;
3031
using namespace logging;
@@ -67,7 +68,7 @@ void globalExceptionHandler(const std::exception &e, const HttpRequestPtr &req,
6768
Task<> runStartupTaks() {
6869
global::virtualProject = co_await createVirtualProject();
6970

70-
co_await global::database->failLoadingDeployments();
71+
co_await cleanupLoadingDeployments();
7172
co_await global::gameData->setupGameData();
7273
co_await global::crowdin->getAvailableLocales();
7374
}

0 commit comments

Comments
 (0)