From d95f8f921961e00542d6d4651aec8a42615493b0 Mon Sep 17 00:00:00 2001 From: PizieDust Date: Fri, 25 Oct 2024 00:26:37 +0200 Subject: [PATCH] bump api version --- storage.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage.ml b/storage.ml index 43db5b4..adad719 100644 --- a/storage.ml +++ b/storage.ml @@ -2,12 +2,13 @@ open Utils.Json type t = { users : User_model.user list; configuration : Configuration.t } -let current_version = 4 +let current_version = 5 (* version history: 1 was initial (fields until email_verification_uuid) 2 added active 3 added super_user (but did not serialise it) 4 properly serialised super_user + 5 cookie has two new fiels last_access and user_agent *) let t_to_json t = @@ -26,6 +27,7 @@ let t_of_json json = | Some (`Int v), Some (`List users), Some configuration -> let* () = if v = current_version then Ok () + else if v = 4 then Ok () else if v = 3 then Ok () else if v = 2 then Ok () else if v = 1 then Ok () @@ -42,7 +44,9 @@ let t_of_json json = let* user = if v = 1 then User_model.user_v1_of_json js else if v = 2 || v = 3 then User_model.user_v2_of_json js - else User_model.user_of_json js + else if v = 4 then + User_model.(user_of_json cookie_v1_of_json) js + else User_model.(user_of_json cookie_v1_of_json) js in Ok (user :: acc)) (Ok []) users