add plan details to session endpoint

This commit is contained in:
Brandon Thomas committed 2022-05-01 23:58:15 -04:00
1 parent 198f0e6493
commit aebc0ffbee
1 file changed
+22
@@ -17,6 +17,20 @@ use sqlx::error::Error::Database;
use sqlx::mysql::MySqlDatabaseError;
use std::sync::Arc;
#[derive(Serialize, Copy, Clone)]
pub enum FakeYouPlan {
Free,
Basic,
Pro,
}
#[derive(Serialize, Copy, Clone)]
pub enum StorytellerStreamPlan {
Free,
Basic,
Pro,
}
#[derive(Serialize)]
pub struct UserInfo {
pub user_token: String,
@@ -24,6 +38,10 @@ pub struct UserInfo {
pub display_name: String,
pub email_gravatar_hash: String,
// Premium plans:
pub fakeyou_plan: FakeYouPlan,
pub storyteller_stream_plan: StorytellerStreamPlan,
// Usage permissions:
pub can_use_tts: bool,
pub can_use_w2l: bool,
@@ -106,6 +124,10 @@ pub async fn session_info_handler(
display_name: session_data.display_name.to_string(),
email_gravatar_hash: session_data.email_gravatar_hash.to_string(),
// Premium plans:
fakeyou_plan: FakeYouPlan::Free,
storyteller_stream_plan: StorytellerStreamPlan::Free,
// Usage permissions:
can_use_tts: session_data.can_use_tts,
can_use_w2l: session_data.can_use_w2l,