mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-04 12:04:20 +08:00
Update canceled status (#2929)
This commit is contained in:
parent
545bcbf0c8
commit
af5f0de050
3 changed files with 24 additions and 12 deletions
|
@ -844,7 +844,7 @@ defmodule Livebook.Hubs.TeamClient do
|
|||
)
|
||||
end
|
||||
|
||||
# TODO: Remove when Billign is public
|
||||
# TODO: Remove when Billing is public
|
||||
defp put_billing_status(hub, nil) do
|
||||
put_in(
|
||||
hub.billing_status,
|
||||
|
@ -852,20 +852,35 @@ defmodule Livebook.Hubs.TeamClient do
|
|||
)
|
||||
end
|
||||
|
||||
defp put_billing_status({:trialing, %LivebookProto.BillingStatusTrialing{} = type}) do
|
||||
%{type: :trialing, trial_ends_at: DateTime.from_unix!(type.trial_ends_at)}
|
||||
defp put_billing_status(
|
||||
{:trialing,
|
||||
%LivebookProto.BillingStatusTrialing{
|
||||
trial_ends_at: %DateTime{} = trial_ends_at
|
||||
}}
|
||||
) do
|
||||
%{type: :trialing, trial_ends_at: DateTime.from_unix!(trial_ends_at)}
|
||||
end
|
||||
|
||||
defp put_billing_status({:trial_ended, %LivebookProto.BillingStatusTrialEnded{} = type}) do
|
||||
%{type: :trial_ended, trial_ends_at: DateTime.from_unix!(type.trial_ends_at)}
|
||||
defp put_billing_status(
|
||||
{:trial_ended,
|
||||
%LivebookProto.BillingStatusTrialEnded{
|
||||
trial_ends_at: %DateTime{} = trial_ends_at
|
||||
}}
|
||||
) do
|
||||
%{type: :trial_ended, trial_ends_at: DateTime.from_unix!(trial_ends_at)}
|
||||
end
|
||||
|
||||
defp put_billing_status({:canceling, %LivebookProto.BillingStatusCanceling{} = type}) do
|
||||
%{type: :canceling, cancel_at: DateTime.from_unix!(type.cancel_at)}
|
||||
defp put_billing_status(
|
||||
{:canceling,
|
||||
%LivebookProto.BillingStatusCanceling{
|
||||
cancel_at: %DateTime{} = cancel_at
|
||||
}}
|
||||
) do
|
||||
%{type: :canceling, cancel_at: DateTime.from_unix!(cancel_at)}
|
||||
end
|
||||
|
||||
defp put_billing_status({:canceled, %LivebookProto.BillingStatusCanceled{} = type}) do
|
||||
%{type: :canceled, cancel_at: DateTime.from_unix!(type.cancel_at)}
|
||||
defp put_billing_status({:canceled, %LivebookProto.BillingStatusCanceled{}}) do
|
||||
%{type: :canceled}
|
||||
end
|
||||
|
||||
defp put_billing_status(_other) do
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
defmodule LivebookProto.BillingStatusCanceled do
|
||||
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
|
||||
|
||||
field :cancel_at, 1, type: :int64, json_name: "cancelAt"
|
||||
end
|
||||
|
|
|
@ -244,5 +244,4 @@ message BillingStatusCanceling {
|
|||
}
|
||||
|
||||
message BillingStatusCanceled {
|
||||
int64 cancel_at = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue