chg: [titles] add endpoints to get all titles

dev
terrtia 2024-02-15 10:13:06 +01:00
parent 4cf3d628db
commit c260455d14
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
2 changed files with 17 additions and 0 deletions

View File

@ -229,6 +229,16 @@ class AbstractDaterangeObjects(ABC):
def sanitize_content_to_search(self, content_to_search):
return content_to_search
def get_contents_ids(self):
titles = {}
for obj_id in self.get_ids():
obj = self.obj_class(obj_id)
content = obj.get_content()
if content not in titles:
titles[content] = []
titles[content].append(obj.get_id())
return titles
def search_by_content(self, content_to_search, r_pos=False, case_sensitive=True):
objs = {}
if case_sensitive:

View File

@ -131,3 +131,10 @@ def objects_title_search():
return render_template("search_title_result.html", dict_objects=dict_objects, search_result=search_result,
dict_page=dict_page,
to_search=to_search, case_sensitive=case_sensitive, type_to_search=type_to_search)
@objects_title.route("/objects/titles/download", methods=['GET'])
@login_required
@login_analyst
def objects_title_downloads():
return jsonify(Titles.Titles().get_contents_ids())