feat: implement submission of reports

This commit is contained in:
Harsh Shandilya 2022-09-16 15:12:23 +05:30
parent 1eb112527b
commit 828084a0dd
3 changed files with 13 additions and 9 deletions

1
Cargo.lock generated
View File

@ -926,6 +926,7 @@ dependencies = [
"rocket_codegen",
"rocket_http",
"serde",
"serde_json",
"state",
"tempfile",
"time",

View File

@ -8,9 +8,7 @@ publish = false
include = ["src/**/*", "LICENSE-*", "README.md"]
description = "Web app and backend service to ingest Kotlin Build Reports"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.65"
rocket = "0.5.0-rc.2"
serde = "1.0.144"
rocket = { version = "0.5.0-rc.2", features = ["json"] }
serde = { version = "1.0.144", features = ["derive"] }

View File

@ -1,15 +1,20 @@
#[macro_use] extern crate rocket;
#[macro_use]
extern crate rocket;
mod metric;
mod metric_conv;
mod metric_name;
mod model;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
use crate::model::CompileStatisticsData;
use rocket::serde::json::Json;
#[post("/", data = "<data>", format = "json")]
fn submit_report(data: Json<CompileStatisticsData>) -> String {
let data = data.into_inner();
data.build_uuid.to_owned()
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![index])
rocket::build().mount("/", routes![submit_report])
}