Skip to content

Commit

Permalink
chg: [titles] add endpoints to get all titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Feb 15, 2024
1 parent 4cf3d62 commit c260455
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/lib/objects/abstract_daterange_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ def search_by_id(self, name_to_search, r_pos=False, case_sensitive=True):
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:
Expand Down
7 changes: 7 additions & 0 deletions var/www/blueprints/objects_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit c260455

Please sign in to comment.