add: apps api

This commit is contained in:
trisua 2025-06-14 14:45:52 -04:00
parent 2a99d49c8a
commit ebded00fd3
33 changed files with 698 additions and 31 deletions

View file

@ -1,3 +1,4 @@
pub mod apps;
pub mod auth;
pub mod communities;
pub mod notifications;
@ -17,6 +18,7 @@ use axum::{
};
use serde::Deserialize;
use tetratto_core::model::{
apps::AppQuota,
communities::{
CommunityContext, CommunityJoinAccess, CommunityReadAccess, CommunityWriteAccess,
PollOption, PostContext,
@ -321,6 +323,10 @@ pub fn routes() -> Router {
"/auth/user/find_by_ip/{ip}",
get(auth::profile::redirect_from_ip),
)
.route(
"/auth/user/find_by_stripe_id/{id}",
get(auth::profile::redirect_from_stripe_id),
)
.route("/auth/ip/{ip}/block", post(auth::social::ip_block_request))
.route(
"/auth/user/{id}/gpa",
@ -342,6 +348,16 @@ pub fn routes() -> Router {
"/auth/user/{id}/followers",
get(auth::social::followers_request),
)
// apps
.route("/apps", post(apps::create_request))
.route("/apps/{id}/title", post(apps::update_title_request))
.route("/apps/{id}/homepage", post(apps::update_homepage_request))
.route("/apps/{id}/redirect", post(apps::update_redirect_request))
.route(
"/apps/{id}/quota_status",
post(apps::update_quota_status_request),
)
.route("/apps/{id}", delete(apps::delete_request))
// warnings
.route("/warnings/{id}", get(auth::user_warnings::get_request))
.route("/warnings/{id}", post(auth::user_warnings::create_request))
@ -773,3 +789,30 @@ pub struct AppendAssociations {
pub struct UpdatePostIsOpen {
pub open: bool,
}
#[derive(Deserialize)]
pub struct CreateApp {
pub title: String,
pub homepage: String,
pub redirect: String,
}
#[derive(Deserialize)]
pub struct UpdateAppTitle {
pub title: String,
}
#[derive(Deserialize)]
pub struct UpdateAppHomepage {
pub homepage: String,
}
#[derive(Deserialize)]
pub struct UpdateAppRedirect {
pub redirect: String,
}
#[derive(Deserialize)]
pub struct UpdateAppQuotaStatus {
pub quota_status: AppQuota,
}