Add waitlist summary API

This commit is contained in:
Max Brunsfeld 2022-09-16 15:37:19 -07:00
parent f8c7c925af
commit 3dd8845bd8
3 changed files with 68 additions and 3 deletions

View file

@ -1,6 +1,6 @@
use crate::{
auth,
db::{Invite, NewUserParams, ProjectId, Signup, User, UserId},
db::{Invite, NewUserParams, ProjectId, Signup, User, UserId, WaitlistSummary},
rpc::{self, ResultExt},
AppState, Error, Result,
};
@ -46,6 +46,7 @@ pub fn routes(rpc_server: &Arc<rpc::Server>, state: Arc<AppState>) -> Router<Bod
.route("/user_activity/counts", get(get_active_user_counts))
.route("/project_metadata", get(get_project_metadata))
.route("/signups", post(create_signup))
.route("/signups_summary", get(get_waitlist_summary))
.route("/user_invites", post(create_invite_from_code))
.route("/unsent_invites", get(get_unsent_invites))
.route("/sent_invites", post(record_sent_invites))
@ -439,6 +440,12 @@ async fn create_signup(
Ok(())
}
async fn get_waitlist_summary(
Extension(app): Extension<Arc<AppState>>,
) -> Result<Json<WaitlistSummary>> {
Ok(Json(app.db.get_waitlist_summary().await?))
}
#[derive(Deserialize)]
pub struct CreateInviteFromCodeParams {
invite_code: String,