refactor(types): reconcile @specs with their success typings
This commit is contained in:
parent
263857ee26
commit
fd8e6ac178
17 changed files with 92 additions and 38 deletions
|
|
@ -43,6 +43,7 @@ defmodule Mv.Authorization.PermissionSets do
|
|||
pattern matches and map lookups with no database queries or external calls.
|
||||
"""
|
||||
|
||||
@type permission_set_name :: :own_data | :read_only | :normal_user | :admin
|
||||
@type scope :: :own | :linked | :all
|
||||
@type action :: :read | :create | :update | :destroy
|
||||
|
||||
|
|
@ -88,7 +89,7 @@ defmodule Mv.Authorization.PermissionSets do
|
|||
iex> PermissionSets.all_permission_sets()
|
||||
[:own_data, :read_only, :normal_user, :admin]
|
||||
"""
|
||||
@spec all_permission_sets() :: [atom()]
|
||||
@spec all_permission_sets() :: [permission_set_name(), ...]
|
||||
def all_permission_sets do
|
||||
[:own_data, :read_only, :normal_user, :admin]
|
||||
end
|
||||
|
|
@ -107,7 +108,7 @@ defmodule Mv.Authorization.PermissionSets do
|
|||
iex> PermissionSets.get_permissions(:invalid)
|
||||
** (ArgumentError) invalid permission set: :invalid. Must be one of: [:own_data, :read_only, :normal_user, :admin]
|
||||
"""
|
||||
@spec get_permissions(atom()) :: permission_set()
|
||||
@spec get_permissions(permission_set_name()) :: permission_set()
|
||||
|
||||
def get_permissions(set) when set not in [:own_data, :read_only, :normal_user, :admin] do
|
||||
raise ArgumentError,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue