pg global_fees fix + caqti_type
This commit is contained in:
parent
5b7c243f8c
commit
e57b12f9d5
2 changed files with 80 additions and 57 deletions
|
|
@ -464,17 +464,17 @@ module Global_fees = struct
|
|||
}
|
||||
|
||||
let do_ ~db_conn v =
|
||||
let* global_fees_opt =
|
||||
let* global_fees =
|
||||
let start_date = v.GlobalFees.start_date in
|
||||
let end_date = v.GlobalFees.end_date in
|
||||
Pg.lookup_global_fee_by_time db_conn ~start_date ~end_date
|
||||
Pg.lookup_global_fees_by_time db_conn ~start_date ~end_date
|
||||
|> unwrap_err_caqti
|
||||
in
|
||||
match global_fees_opt with
|
||||
| Some _ -> Error "global-fees already setup"
|
||||
| None ->
|
||||
match global_fees with
|
||||
| [] ->
|
||||
let+ () = Pg.insert_global_fee db_conn v |> unwrap_err_caqti in
|
||||
()
|
||||
| _l -> Error "global-fees already setup"
|
||||
|
||||
let jsont = GlobalFees.jsont
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue