From d540e25746a076a88b41f7d7e56fbaf9fad36613 Mon Sep 17 00:00:00 2001 From: Swrup Date: Tue, 11 Jan 2022 15:01:59 +0100 Subject: [PATCH] add type post, split inserting to the db and verifying stuffs --- src/babillard.ml | 306 +++++++++++++++++++++++++++++++---------------- src/permap.ml | 7 +- 2 files changed, 207 insertions(+), 106 deletions(-) diff --git a/src/babillard.ml b/src/babillard.ml index 496d3c2..7a999e4 100644 --- a/src/babillard.ml +++ b/src/babillard.ml @@ -1,5 +1,37 @@ open Db +exception Invalid_post of string + +type op = + { id : string + ; date : int + ; nick : string + ; subject : string + ; comment : string + ; image : string * string + ; tags : string list + ; longitude : float + ; latitude : float + ; replies : string list + ; citations : string list + } + +type reply = + { id : string + ; parent_id : string + ; date : int + ; nick : string + ; comment : string + ; image : (string * string) option + ; tags : string list + ; replies : string list + ; citations : string list + } + +type post = + | Op of op + | Reply of reply + module Q = struct let create_post_user_table = Caqti_request.exec Caqti_type.unit @@ -293,7 +325,7 @@ let view_post post_id = in let replies_view = {|