diff --git a/src/api.ml b/src/api.ml index d3db8ddb..74f40b79 100644 --- a/src/api.ml +++ b/src/api.ml @@ -733,10 +733,10 @@ end module AmlOfficerSetup = struct type t = { officer_pub: EddsaPublicKey.t; + master_sig: MasterAmlOfficerStatus.t; officer_name: string; is_active: bool; read_only: bool; - master_sig: MasterAmlOfficerStatus.t; change_date: Timestamp.t; } diff --git a/src/pg.ml b/src/pg.ml index 76c6335a..e54dcaa9 100644 --- a/src/pg.ml +++ b/src/pg.ml @@ -308,6 +308,46 @@ module Caqti_type = struct }) Caqti_type.(t6 b32 string string time amount master_sig) + let aml_officer_setup = + let master_sig = Bin_sig.MasterAmlOfficerStatus.caqti in + Caqti_type.custom + ~encode:(fun + AmlOfficerSetup. + { + officer_pub; + master_sig; + officer_name; + is_active; + read_only; + change_date; + } + -> + Ok + ( officer_pub, + master_sig, + officer_name, + is_active, + read_only, + change_date )) + ~decode:(fun + ( officer_pub, + master_sig, + officer_name, + is_active, + read_only, + change_date ) + -> + Ok + { + officer_pub; + master_sig; + officer_name; + is_active; + read_only; + change_date; + }) + Caqti_type.(t6 eddsa_pub master_sig string bool bool time) + include Caqti_request.Infix end @@ -550,24 +590,11 @@ let insert_drain_profit = let insert_aml_officer = let exchange_do_insert_aml_officer = - let master_sig = Bin_sig.MasterAmlOfficerStatus.caqti in - Caqti_type.(t6 eddsa_pub master_sig string bool bool time ->! time) + Caqti_type.(aml_officer_setup ->! time) "SELECT out_last_change FROM exchange_do_insert_aml_officer ($1, $2, $3, \ $4, $5, $6)" in - fun (module Conn : CONN) - AmlOfficerSetup. - { - officer_pub; - officer_name; - is_active; - read_only; - master_sig; - change_date; - } - -> - Conn.find exchange_do_insert_aml_officer - (officer_pub, master_sig, officer_name, is_active, read_only, change_date) + fun (module Conn : CONN) v -> Conn.find exchange_do_insert_aml_officer v let insert_partner = let insert_partner =