A few more messages.

master
Philippe Pittoli 2023-06-01 01:14:39 +02:00
parent 84d285c9e9
commit 0b09cefa57
1 changed files with 15 additions and 9 deletions

View File

@ -30,9 +30,6 @@ import App.IPC as IPC
Possible requests: Possible requests:
- 9 type CheckPermission = { shared_key :: Maybe String, token :: Maybe String, user :: Int | String, service :: String, resource :: String } - 9 type CheckPermission = { shared_key :: Maybe String, token :: Maybe String, user :: Int | String, service :: String, resource :: String }
- 10 type SetPermission = { shared_key :: String, user :: Int | String, service :: String, resource :: String, permission :: PermissionLevel.PermissionLevel } - 10 type SetPermission = { shared_key :: String, user :: Int | String, service :: String, resource :: String, permission :: PermissionLevel.PermissionLevel }
- 11 type PasswordRecovery = { user :: Int | String, password_renew_key :: String, new_password :: String }
- 12 type AskPasswordRecovery = { user :: Int | String, email :: Email.Email }
- 13 type SearchUser = { user :: String }
- 14 type EditProfile = { token :: String, new_profile :: Hash(String, JSON::Any) } - 14 type EditProfile = { token :: String, new_profile :: Hash(String, JSON::Any) }
- 15 type EditProfileContent = { token :: Maybe String, shared_key :: Maybe String, user :: Int | String | Nil, new_profile :: Hash(String, JSON::Any) } - 15 type EditProfileContent = { token :: Maybe String, shared_key :: Maybe String, user :: Int | String | Nil, new_profile :: Hash(String, JSON::Any) }
- 16 type EditContacts = { token :: String, email :: Maybe Email.Email, phone :: Maybe Phone.Phone } - 16 type EditContacts = { token :: String, email :: Maybe Email.Email, phone :: Maybe Phone.Phone }
@ -69,6 +66,9 @@ type GetUserByCredentials = { login :: String, password :: String }
type Register = { login :: String, password :: String, email :: Maybe Email.Email, phone :: Maybe Phone.Phone } -- profile :: Maybe Hash(String, JSON::Any) type Register = { login :: String, password :: String, email :: Maybe Email.Email, phone :: Maybe Phone.Phone } -- profile :: Maybe Hash(String, JSON::Any)
type UpdatePassword = { login :: String, old_password :: String, new_password :: String } type UpdatePassword = { login :: String, old_password :: String, new_password :: String }
type ListUsers = { token :: Maybe String, key :: Maybe String } type ListUsers = { token :: Maybe String, key :: Maybe String }
type PasswordRecovery = { user :: String, password_renew_key :: String, new_password :: String }
type AskPasswordRecovery = { user :: String, email :: Email.Email }
type SearchUser = { user :: String }
type GetContacts = { token :: String } type GetContacts = { token :: String }
-- Related JSON codecs. -- Related JSON codecs.
@ -99,6 +99,12 @@ codecUpdatePassword = CA.object "UpdatePassword" (CAR.record { login: CA.string
, new_password: CA.string }) , new_password: CA.string })
codecListUsers ∷ CA.JsonCodec ListUsers codecListUsers ∷ CA.JsonCodec ListUsers
codecListUsers = CA.object "ListUsers" (CAR.record { token: CAR.optional CA.string, key: CAR.optional CA.string }) codecListUsers = CA.object "ListUsers" (CAR.record { token: CAR.optional CA.string, key: CAR.optional CA.string })
codecPasswordRecovery ∷ CA.JsonCodec PasswordRecovery
codecPasswordRecovery = CA.object "PasswordRecovery" (CAR.record { user: CA.string, password_renew_key: CA.string, new_password: CA.string })
codecAskPasswordRecovery ∷ CA.JsonCodec AskPasswordRecovery
codecAskPasswordRecovery = CA.object "AskPasswordRecovery" (CAR.record { user: CA.string, email: Email.codec })
codecSearchUser ∷ CA.JsonCodec SearchUser
codecSearchUser = CA.object "SearchUser" (CAR.record { user: CA.string })
codecGetContacts ∷ CA.JsonCodec GetContacts codecGetContacts ∷ CA.JsonCodec GetContacts
codecGetContacts = CA.object "GetContacts" (CAR.record { token: CA.string }) codecGetContacts = CA.object "GetContacts" (CAR.record { token: CA.string })
@ -150,9 +156,9 @@ data RequestMessage
| MkListUsers ListUsers -- 8 | MkListUsers ListUsers -- 8
--| MkCheckPermission CheckPermission -- 9 --| MkCheckPermission CheckPermission -- 9
--| MkSetPermission SetPermission -- 10 --| MkSetPermission SetPermission -- 10
--| MkPasswordRecovery PasswordRecovery -- 11 | MkPasswordRecovery PasswordRecovery -- 11
--| MkAskPasswordRecovery AskPasswordRecovery -- 12 | MkAskPasswordRecovery AskPasswordRecovery -- 12
--| MkSearchUser SearchUser -- 13 | MkSearchUser SearchUser -- 13
--| MkEditProfile EditProfile -- 14 --| MkEditProfile EditProfile -- 14
--| MkEditProfileContent EditProfileContent -- 15 --| MkEditProfileContent EditProfileContent -- 15
--| MkEditContacts EditContacts -- 16 --| MkEditContacts EditContacts -- 16
@ -190,9 +196,9 @@ encode m = case m of
(MkListUsers request) -> get_tuple 8 codecListUsers request (MkListUsers request) -> get_tuple 8 codecListUsers request
-- 9 MkCheckPermission -- 9 MkCheckPermission
-- 10 MkSetPermission -- 10 MkSetPermission
-- 11 MkPasswordRecovery (MkPasswordRecovery request) -> get_tuple 11 codecPasswordRecovery request
-- 12 MkAskPasswordRecovery (MkAskPasswordRecovery request) -> get_tuple 12 codecAskPasswordRecovery request
-- 13 MkSearchUser (MkSearchUser request) -> get_tuple 13 codecSearchUser request
-- 14 MkEditProfile -- 14 MkEditProfile
-- 15 MkEditProfileContent -- 15 MkEditProfileContent
-- 16 MkEditContacts -- 16 MkEditContacts