Skip to content

Commit

Permalink
bump api version
Browse files Browse the repository at this point in the history
  • Loading branch information
PizieDust committed Oct 24, 2024
1 parent 1c20c0b commit d95f8f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions storage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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 ()
Expand All @@ -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
Expand Down

0 comments on commit d95f8f9

Please sign in to comment.