-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
127 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule Supabase.GoTrue.Schemas.SignInAnonymously do | ||
@moduledoc """ | ||
This schema is used to validate and parse the parameters for signing in anonymously. | ||
""" | ||
|
||
use Ecto.Schema | ||
|
||
import Ecto.Changeset | ||
|
||
@type t :: %__MODULE__{ | ||
data: map | nil, | ||
captcha_token: String.t() | nil | ||
} | ||
|
||
@derive Jason.Encoder | ||
@primary_key false | ||
embedded_schema do | ||
field(:data, :map) | ||
field(:captcha_token, :string) | ||
end | ||
|
||
def to_sign_in_params(%__MODULE__{} = signin) do | ||
Map.take(signin, [:data]) | ||
end | ||
|
||
def parse(source \\ %__MODULE__{}, %{} = attrs) do | ||
source | ||
|> cast(attrs, [:data, :captcha_token]) | ||
|> apply_action(:insert) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters