diff options
author | Mateus Cruz <mateuscolvr@gmail.com> | 2024-02-06 01:47:46 -0300 |
---|---|---|
committer | Mateus Cruz <mateuscolvr@gmail.com> | 2024-02-06 01:47:46 -0300 |
commit | 7c92898c8f0adb4a6014ce5f434a7d862a0cdc57 (patch) | |
tree | 0694f18ef7b8b97b025aabbf3c77a464acc2f4e0 /lib/operation.ml | |
parent | aae0f0595061ad32960541c532930be0e5af51f2 (diff) |
add transaction value constraint
Diffstat (limited to 'lib/operation.ml')
-rw-r--r-- | lib/operation.ml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/operation.ml b/lib/operation.ml index bce6ac2..54962fd 100644 --- a/lib/operation.ml +++ b/lib/operation.ml @@ -47,7 +47,7 @@ let decoder : transaction_op Utils.Decoder.decoder = <|> literal "d" *> return (fun p -> `Debit p) in (fun value transaction_type description -> transaction_type { value; description }) - <$> ("valor" <: int) + <$> ("valor" <: (int >>= fun x -> if x >= 0 then return x else fail)) <*> ("tipo" <: transaction_type_decoder) <*> ("descricao" <: (string |