From bc463f3498ab8a01c8a523776665e0473664a8ab Mon Sep 17 00:00:00 2001 From: Idir Lankri Date: Mon, 21 Oct 2024 10:58:43 +0200 Subject: [PATCH] Api: Lighten the request getting all portraits of a given database We only need to return the surname, the first name and the occurrence number of the person. --- src/api.ml | 20 ++++++-------------- src/assets/api.proto | 11 +---------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/api.ml b/src/api.ml index a781007..567127b 100644 --- a/src/api.ml +++ b/src/api.ml @@ -417,20 +417,12 @@ let print_img_all conf base = else Api_util.print_result conf (fl list) in - let compute_sosa = Api_util.compute_sosa conf base false in - if Api_util.p_getenvbin conf.env "full_infos" = Some "1" then - aux - (fun p img -> - let p = Api_util.pers_to_piqi_person_full conf base p compute_sosa in - Api_piqi.Full_image.({person = p; img = img;})) - (fun list -> Api_piqi_ext.gen_list_full_images @@ Api_piqi.List_full_images.({images = list}) ) - else - aux - (fun p img -> - let p = Api_util.pers_to_piqi_person_light conf base p compute_sosa in - Api_piqi.Image.({person = p; img})) - (fun list -> - Api_piqi_ext.gen_list_images @@ Api_piqi.List_images.({list_images = list})) + aux + (fun p img -> + let p = Api_util.person_to_reference_person base p in + Api_piqi.Image.({person = p; img})) + (fun list -> + Api_piqi_ext.gen_list_images @@ Api_piqi.List_images.({list_images = list})) (**/**) (* API_IMAGE_APP *) diff --git a/src/assets/api.proto b/src/assets/api.proto index 28c5e33..c40db94 100644 --- a/src/assets/api.proto +++ b/src/assets/api.proto @@ -241,12 +241,7 @@ message SearchParams { } message Image { - required Person person = 1; - required string img = 2; -} - -message FullImage { - required FullPerson person = 1; + required ReferencePerson person = 1; required string img = 2; } @@ -254,10 +249,6 @@ message ListImages { repeated Image list_images = 1; } -message ListFullImages { - repeated FullImage images = 1; -} - message PersImg { required ReferencePerson person = 1; required string img = 2;