add: extended app storage limits
This commit is contained in:
parent
c757ddb77a
commit
9aed5de097
12 changed files with 143 additions and 20 deletions
|
@ -15,7 +15,7 @@ use tetratto_core::model::{
|
|||
ApiReturn, Error,
|
||||
};
|
||||
use tetratto_shared::{hash::random_id, unix_epoch_timestamp};
|
||||
use super::CreateApp;
|
||||
use super::{CreateApp, UpdateAppStorageCapacity};
|
||||
|
||||
pub async fn create_request(
|
||||
jar: CookieJar,
|
||||
|
@ -138,6 +138,35 @@ pub async fn update_quota_status_request(
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn update_storage_capacity_request(
|
||||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
Path(id): Path<usize>,
|
||||
Json(req): Json<UpdateAppStorageCapacity>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data) {
|
||||
Some(ua) => ua,
|
||||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
if !user.permissions.check(FinePermission::MANAGE_APPS) {
|
||||
return Json(Error::NotAllowed.into());
|
||||
}
|
||||
|
||||
match data
|
||||
.update_app_storage_capacity(id, req.storage_capacity)
|
||||
.await
|
||||
{
|
||||
Ok(_) => Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "App updated".to_string(),
|
||||
payload: (),
|
||||
}),
|
||||
Err(e) => Json(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_scopes_request(
|
||||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue