summaryrefslogtreecommitdiff
path: root/lib/serializer.ml
blob: 35464acbeabdf1dbd15145b01ed5784923415390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
let transaction (t : Operation.transaction) =
  let transaction_type =
    match t.transaction_type with
    | `Credit -> "c"
    | `Debit -> "d"
  in
  `Assoc
    [ "valor", `Int t.value
    ; "tipo", `String transaction_type
    ; "descricao", `String t.description
    ; ( "realizada_em"
      , `String
          (Format.asprintf "%a" (Ptime.pp_rfc3339 ~tz_offset_s:(-10800) ()) t.created_at)
      )
    ]
;;