mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
chg: [titles] add endpoints to get all titles
This commit is contained in:
parent
4cf3d628db
commit
c260455d14
2 changed files with 17 additions and 0 deletions
|
@ -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:
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
Loading…
Reference in a new issue