add: purchased accounts

This commit is contained in:
trisua 2025-07-03 21:56:21 -04:00
parent 0aa2ea362f
commit 2ec8d86edf
22 changed files with 1279 additions and 124 deletions

View file

@ -331,6 +331,10 @@ pub fn routes() -> Router {
"/auth/user/{id}/verified",
post(auth::profile::update_user_is_verified_request),
)
.route(
"/auth/user/{id}/awaiting_purchase",
post(auth::profile::update_user_awaiting_purchase_request),
)
.route(
"/auth/user/{id}/totp",
post(auth::profile::enable_totp_request),
@ -394,6 +398,10 @@ pub fn routes() -> Router {
"/auth/user/me/achievement",
post(auth::profile::self_serve_achievement_request),
)
.route(
"/auth/user/me/invite_code",
post(auth::profile::update_user_invite_code_request),
)
// apps
.route("/apps", post(apps::create_request))
.route("/apps/{id}/title", post(apps::update_title_request))
@ -643,6 +651,12 @@ pub struct RegisterProps {
pub captcha_response: String,
#[serde(default)]
pub invite_code: String,
/// If this is true, invite_code should be empty.
///
/// If invite codes are enabled, but purchase is false, the invite_code MUST
/// be checked and MUST be valid.
#[serde(default)]
pub purchase: bool,
}
#[derive(Deserialize)]
@ -750,6 +764,11 @@ pub struct UpdateUserIsVerified {
pub is_verified: bool,
}
#[derive(Deserialize)]
pub struct UpdateUserAwaitingPurchase {
pub awaiting_purchase: bool,
}
#[derive(Deserialize)]
pub struct UpdateNotificationRead {
pub read: bool,
@ -775,6 +794,11 @@ pub struct UpdateSecondaryUserRole {
pub role: SecondaryPermission,
}
#[derive(Deserialize)]
pub struct UpdateUserInviteCode {
pub invite_code: String,
}
#[derive(Deserialize)]
pub struct DeleteUser {
pub password: String,