Implement indexing into Apache Druid #1

Closed
m wants to merge 263 commits from druid into master
1 changed files with 22 additions and 0 deletions
Showing only changes of commit b72d3d67a1 - Show all commits

View File

@ -381,3 +381,25 @@ class API(object):
alias_list.append(alias_dup) alias_list.append(alias_dup)
return dumps({"aliases": alias_list}) return dumps({"aliases": alias_list})
@app.route("/aliases/", methods=["POST"])
@login_required
def aliases_update(self, request):
try:
data = loads(request.content.read())
except JSONDecodeError:
return "Invalid JSON"
for alias, fields in data.items():
if not alias.isdigit():
return dumps({"success": False, "reason": "alias not a number."})
alias = int(alias)
if alias not in main.alias.keys():
return dumps({"success": False, "reason": "alias does not exist."})
if fields:
main.alias[alias] = fields
if "emails" in fields:
if not fields["emails"]:
main.alias[alias]["emails"] = []
main.saveConf("alias")
return dumps({"success": True})