From 95b314d97e528bac493eb8ee36e38056c581a561 Mon Sep 17 00:00:00 2001 From: Zack Fu Zi Xiang Date: Tue, 9 Jul 2024 13:28:39 +0800 Subject: [PATCH] chore: support into trait for subscription plan and recurring interval --- libs/shared-entity/src/dto/billing_dto.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/shared-entity/src/dto/billing_dto.rs b/libs/shared-entity/src/dto/billing_dto.rs index fb71f465..5303b545 100644 --- a/libs/shared-entity/src/dto/billing_dto.rs +++ b/libs/shared-entity/src/dto/billing_dto.rs @@ -28,9 +28,9 @@ impl TryFrom for RecurringInterval { } } -impl Into for RecurringInterval { - fn into(self) -> i16 { - match self { +impl From for i16 { + fn from(value: RecurringInterval) -> Self { + match value { RecurringInterval::Month => 0, RecurringInterval::Year => 1, } @@ -64,9 +64,9 @@ impl TryFrom for SubscriptionPlan { } } -impl Into for SubscriptionPlan { - fn into(self) -> i16 { - match self { +impl From for i16 { + fn from(value: SubscriptionPlan) -> Self { + match value { SubscriptionPlan::Free => 0, SubscriptionPlan::Pro => 1, SubscriptionPlan::Team => 2,