Add report photo upload
This commit is contained in:
@@ -372,5 +372,20 @@ Json::Value ReportService::addFeedback(const auth::UserContext &user,
|
||||
body.get("comment", "").asString());
|
||||
return success();
|
||||
}
|
||||
} // namespace visione::services
|
||||
|
||||
Json::Value ReportService::addPhoto(const auth::UserContext &user,
|
||||
long long reportId,
|
||||
const std::string &url)
|
||||
{
|
||||
if (!canAccessReport(user, reportId) || url.empty())
|
||||
{
|
||||
return failure("forbidden");
|
||||
}
|
||||
|
||||
drogon::app().getDbClient()->execSqlSync(
|
||||
"INSERT INTO report_photos (report_id, url) VALUES (?, ?)",
|
||||
reportId,
|
||||
url);
|
||||
return success();
|
||||
}
|
||||
} // namespace visione::services
|
||||
|
||||
@@ -30,6 +30,8 @@ class ReportService
|
||||
Json::Value addFeedback(const auth::UserContext &user,
|
||||
long long reportId,
|
||||
const Json::Value &body);
|
||||
Json::Value addPhoto(const auth::UserContext &user,
|
||||
long long reportId,
|
||||
const std::string &url);
|
||||
};
|
||||
} // namespace visione::services
|
||||
|
||||
|
||||
Reference in New Issue
Block a user