diff --git a/libs/shared-entity/src/dto/billing_dto.rs b/libs/shared-entity/src/dto/billing_dto.rs index 35b26ab9..74c3309f 100644 --- a/libs/shared-entity/src/dto/billing_dto.rs +++ b/libs/shared-entity/src/dto/billing_dto.rs @@ -30,6 +30,19 @@ pub enum SubscriptionPlan { AiLocal = 4, } +impl From for SubscriptionPlan { + fn from(value: i16) -> Self { + match value { + 0 => SubscriptionPlan::Free, + 1 => SubscriptionPlan::Pro, + 2 => SubscriptionPlan::Team, + 3 => SubscriptionPlan::AiMax, + 4 => SubscriptionPlan::AiLocal, + _ => SubscriptionPlan::Unknown, + } + } +} + impl AsRef for SubscriptionPlan { fn as_ref(&self) -> &str { match self {