add: drawings in questions
This commit is contained in:
parent
6be729de50
commit
16843a6ab8
28 changed files with 1181 additions and 32 deletions
|
@ -15,6 +15,7 @@ use tetratto_core::model::{
|
|||
};
|
||||
use crate::{
|
||||
get_user_from_token,
|
||||
image::JsonMultipart,
|
||||
routes::{api::v1::CreateQuestion, pages::PaginatedQuery},
|
||||
State,
|
||||
};
|
||||
|
@ -23,7 +24,7 @@ pub async fn create_request(
|
|||
jar: CookieJar,
|
||||
headers: HeaderMap,
|
||||
Extension(data): Extension<State>,
|
||||
Json(req): Json<CreateQuestion>,
|
||||
JsonMultipart(drawings, req): JsonMultipart<CreateQuestion>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = get_user_from_token!(jar, data, oauth::AppScope::UserCreateQuestions);
|
||||
|
@ -70,7 +71,10 @@ pub async fn create_request(
|
|||
}
|
||||
}
|
||||
|
||||
match data.create_question(props).await {
|
||||
match data
|
||||
.create_question(props, drawings.iter().map(|x| x.to_vec()).collect())
|
||||
.await
|
||||
{
|
||||
Ok(id) => Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "Question created".to_string(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue