|
|
@@ -0,0 +1,24 @@
|
|
|
+use actix_web::{HttpResponse, HttpRequest, web, post};
|
|
|
+use sqlx::PgPool;
|
|
|
+use serde::Deserialize;
|
|
|
+use crate::{
|
|
|
+ http_error::HttpError,
|
|
|
+ auth::user_auth
|
|
|
+};
|
|
|
+
|
|
|
+#[derive(Deserialize)]
|
|
|
+struct Body {
|
|
|
+ name: String,
|
|
|
+ description: String
|
|
|
+}
|
|
|
+
|
|
|
+#[post("/game/{game_id}/character")]
|
|
|
+pub async fn route(
|
|
|
+ db: web::Data<PgPool>,
|
|
|
+ game_id: web::Path<String>,
|
|
|
+ web::Json(body): web::Json<Body>,
|
|
|
+ req: HttpRequest
|
|
|
+) -> Result<HttpResponse, HttpError> {
|
|
|
+ let user = user_auth(&db, &req, true).await?;
|
|
|
+ Ok(HttpResponse::Ok().body("something"))
|
|
|
+}
|