add auth to create project endpoint

This commit is contained in:
2024-11-10 10:58:39 +01:00
parent 41ad5ab612
commit 4d0c071103
2 changed files with 7 additions and 4 deletions

View File

@@ -55,8 +55,15 @@ pub async fn render_project_detail_from_name(
}
pub async fn render_create_project(
auth: auth::JWT,
ViewEngine(v): ViewEngine<TeraView>,
State(ctx): State<AppContext>,
) -> Result<impl IntoResponse> {
match users::Model::find_by_pid(&ctx.db, &auth.claims.pid).await {
Ok(_) => {}
Err(_) => return unauthorized("Unauthorized"),
}
views::projects::create_project(v).await
}