nu
This commit is contained in:
parent
4c23ab840a
commit
e8864cc853
15 changed files with 4004 additions and 1593 deletions
|
|
@ -308,7 +308,7 @@ void RealmController::getRealmStreamKey(const HttpRequestPtr &req,
|
|||
};
|
||||
}
|
||||
|
||||
void RealmController::getRealm(const HttpRequestPtr &req,
|
||||
void RealmController::getRealm(const HttpRequestPtr &, // Remove parameter name since it's unused
|
||||
std::function<void(const HttpResponsePtr &)> &&callback,
|
||||
const std::string &realmId) {
|
||||
// Remove authentication requirement for public viewing
|
||||
|
|
@ -349,17 +349,43 @@ void RealmController::getRealm(const HttpRequestPtr &req,
|
|||
void RealmController::updateRealm(const HttpRequestPtr &req,
|
||||
std::function<void(const HttpResponsePtr &)> &&callback,
|
||||
const std::string &realmId) {
|
||||
// Since we removed display_name and description, there's nothing to update
|
||||
// We could just return success or remove this endpoint entirely
|
||||
UserInfo user = getUserFromRequest(req);
|
||||
if (user.id == 0) {
|
||||
callback(jsonError("Unauthorized", k401Unauthorized));
|
||||
return;
|
||||
}
|
||||
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
callback(jsonResp(resp));
|
||||
// Parse realm ID
|
||||
int64_t id;
|
||||
try {
|
||||
id = std::stoll(realmId);
|
||||
} catch (...) {
|
||||
callback(jsonError("Invalid realm ID", k400BadRequest));
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify the realm exists and belongs to the user
|
||||
auto dbClient = app().getDbClient();
|
||||
*dbClient << "SELECT id FROM realms WHERE id = $1 AND user_id = $2"
|
||||
<< id << user.id
|
||||
>> [callback](const Result& r) {
|
||||
if (r.empty()) {
|
||||
callback(jsonError("Realm not found or access denied", k404NotFound));
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently no fields to update since we removed display_name and description
|
||||
// This endpoint is kept for potential future updates
|
||||
// For now, just return success
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
resp["message"] = "Realm updated successfully";
|
||||
callback(jsonResp(resp));
|
||||
}
|
||||
>> [callback](const DrogonDbException& e) {
|
||||
LOG_ERROR << "Database error: " << e.base().what();
|
||||
callback(jsonError("Database error"));
|
||||
};
|
||||
}
|
||||
|
||||
void RealmController::deleteRealm(const HttpRequestPtr &req,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue