haste_health/commands/
server.rs1use clap::{Subcommand, ValueEnum};
2use haste_fhir_operation_error::OperationOutcomeError;
3use haste_jwt::claims::SubscriptionTier;
4use haste_server::server;
5
6#[derive(Clone, Debug, ValueEnum)]
7pub enum UserSubscriptionChoice {
8 Free,
9 Professional,
10 Team,
11 Unlimited,
12}
13
14impl From<UserSubscriptionChoice> for SubscriptionTier {
15 fn from(choice: UserSubscriptionChoice) -> Self {
16 match choice {
17 UserSubscriptionChoice::Free => SubscriptionTier::Free,
18 UserSubscriptionChoice::Professional => SubscriptionTier::Professional,
19 UserSubscriptionChoice::Team => SubscriptionTier::Team,
20 UserSubscriptionChoice::Unlimited => SubscriptionTier::Unlimited,
21 }
22 }
23}
24
25#[derive(Subcommand, Debug)]
26pub enum ServerCommands {
27 Start {
28 #[arg(short, long)]
29 port: Option<u16>,
30 },
31}
32
33pub async fn server(command: &ServerCommands) -> Result<(), OperationOutcomeError> {
34 match &command {
35 ServerCommands::Start { port } => server::serve(port.unwrap_or(3000)).await,
36 }
37}