View raw

1 type routine_id = string 2 type workout_id = string 3 4 let routine_id s = s 5 let workout_id s = s 6 7 (* Fields are reached through the module type, not from here. *) 8 type record = { id : workout_id; workout : Evidence.Workout.t } 9 [@@warning "-69"] 10 11 type app_feedback_id = string 12 13 let app_feedback_id s = s 14 let app_feedback_id_to_string id = id 15 16 type app_feedback = { 17 feedback_id : app_feedback_id; 18 author : string; 19 contributions : int; 20 submitted_at : Recovery.timestamp; 21 message : string; 22 upvotes : int; 23 viewer_upvoted : bool; 24 viewer_owns : bool; 25 } 26 27 module type S = sig 28 type t 29 30 val create_trainee : 31 t -> 32 username:Trainee.username -> 33 credential:Trainee.credential -> 34 (Trainee.t, [ `Username_taken ]) result Lwt.t 35 36 val find_trainee_by_username : t -> Trainee.username -> Trainee.t option Lwt.t 37 val find_trainee : t -> Trainee.id -> Trainee.t option Lwt.t 38 39 val update_username : 40 t -> 41 Trainee.id -> 42 Trainee.username -> 43 (Trainee.t, [ `Username_taken ]) result Lwt.t 44 45 val update_credential : 46 t -> Trainee.id -> Trainee.credential -> Trainee.t option Lwt.t 47 48 val list_routines : t -> (routine_id * Prescription.Routine.t) list 49 val find_routine : t -> routine_id -> Prescription.Routine.t option 50 val active_routine : t -> Trainee.id -> routine_id option Lwt.t 51 val set_active_routine : t -> Trainee.id -> routine_id -> unit Lwt.t 52 val in_progress : t -> Trainee.id -> Evidence.Workout.t option Lwt.t 53 54 val set_in_progress : 55 t -> Trainee.id -> Evidence.Workout.t option -> unit Lwt.t 56 57 val finish_workout : t -> Trainee.id -> Evidence.Workout.t -> record Lwt.t 58 val find : t -> Trainee.id -> workout_id -> record option Lwt.t 59 val replace : t -> Trainee.id -> record -> bool Lwt.t 60 val log : t -> Trainee.id -> Evidence.Log.t Lwt.t 61 val history : t -> Trainee.id -> record list Lwt.t 62 val save_feedback : t -> Trainee.id -> Evidence.Feedback.t -> unit Lwt.t 63 val feedback : t -> Trainee.id -> Evidence.Feedback.t list Lwt.t 64 65 val save_app_feedback : 66 t -> 67 Trainee.id -> 68 submitted_at:Recovery.timestamp -> 69 message:string -> 70 app_feedback Lwt.t 71 72 val app_feedback : t -> viewer:Trainee.id -> app_feedback list Lwt.t 73 74 val upvote_app_feedback : 75 t -> voter:Trainee.id -> app_feedback_id -> bool Lwt.t 76 77 val update_app_feedback : 78 t -> author:Trainee.id -> app_feedback_id -> message:string -> bool Lwt.t 79 80 val delete_app_feedback : 81 t -> author:Trainee.id -> app_feedback_id -> bool Lwt.t 82 end 83