small fix

This commit is contained in:
Swrup 2022-02-28 18:35:16 +01:00
parent 595489978d
commit cb12b4a2a8
3 changed files with 18 additions and 18 deletions

View file

@ -225,7 +225,7 @@ end
let () = let () =
let tables = let tables =
[ Q.create_post_user_table [| Q.create_post_user_table
; Q.create_thread_info_table ; Q.create_thread_info_table
; Q.create_thread_post_table ; Q.create_thread_post_table
; Q.create_post_replies_table ; Q.create_post_replies_table
@ -236,11 +236,11 @@ let () =
; Q.create_image_content_table ; Q.create_image_content_table
; Q.create_post_tags_table ; Q.create_post_tags_table
; Q.create_report_table ; Q.create_report_table
] |]
in in
if if
List.exists Result.is_error Array.exists Result.is_error
(List.map (fun query -> Db.exec query ()) tables) (Array.map (fun query -> Db.exec query ()) tables)
then Dream.error (fun log -> log "can't create table") then Dream.error (fun log -> log "can't create table")
let parse_image image = let parse_image image =

View file

@ -302,7 +302,7 @@ let feed thread_id =
let* posts = get_posts ids in let* posts = get_posts ids in
let posts = List.sort (fun a b -> compare b.date a.date) posts in let posts = List.sort (fun a b -> compare b.date a.date) posts in
let* last_update = let* last_update =
match posts with op :: _ -> Ok op.date | _ -> Error "empty thread" match posts with [] -> Error "empty thread" | op :: _l -> Ok op.date
in in
let entries fmt () = let entries fmt () =

View file

@ -80,10 +80,10 @@ module Q = struct
end end
let () = let () =
let tables = [ Q.create_user_table; Q.create_banished_table ] in let tables = [| Q.create_user_table; Q.create_banished_table |] in
if if
List.exists Result.is_error Array.exists Result.is_error
(List.map (fun query -> Db.exec query ()) tables) (Array.map (fun query -> Db.exec query ()) tables)
then Dream.error (fun log -> log "can't create table") then Dream.error (fun log -> log "can't create table")
let exist nick = Result.is_ok (Db.find Q.get_user nick) let exist nick = Result.is_ok (Db.find Q.get_user nick)