small fix

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

View file

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

View file

@ -302,7 +302,7 @@ let feed thread_id =
let* posts = get_posts ids in
let posts = List.sort (fun a b -> compare b.date a.date) posts in
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
let entries fmt () =

View file

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