Skip to content

Commit f2c70c5

Browse files
committed
added missing endpoint
1 parent 07bbd0f commit f2c70c5

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

FreeTAKServer/services/http_tak_api_service/blueprints/mission_blueprint.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ def put_mission_invitation(mission_id, type, invitee):
240240
else:
241241
return '{"message": "invalid role"}', 405
242242
return '', 200
243+
except Exception as e:
244+
print(e)
245+
return {"message": str(e)}, 500
246+
247+
@page.route('/Marti/api/missions/<mission_id>/invite/', methods=["POST"])
248+
def post_mission_invitation(mission_id):
249+
"""post the invitation for a mission"""
250+
author = request.args.get("creatorUid", "unknown")
251+
invitedContacts = request.args.get("contacts", None)
252+
try:
253+
mission = HTTPTakApiCommunicationController().make_request("GetMission", "mission", {"mission_id": mission_id}, None, True).get_value("mission")
254+
if mission == None:
255+
return '{"message": "mission not found"}', 404
256+
role = json.loads(mission)["data"][0]["defaultRole"]["type"]
257+
HTTPTakApiCommunicationController().make_request("SendInvitation", "mission", {"author_uid": author, "mission_id": mission_id, "client_uid": invitedContacts, "role": role}, None, False)
258+
return '', 200
243259
except Exception as e:
244260
print(e)
245261
return {"message": str(e)}, 500

FreeTAKServer/services/https_tak_api_service/blueprints/mission_blueprint.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,22 @@ def put_mission_invitation(mission_id, type, invitee):
239239
else:
240240
return '{"message": "invalid role"}', 405
241241
return '', 200
242+
except Exception as e:
243+
print(e)
244+
return {"message": str(e)}, 500
245+
246+
@page.route('/Marti/api/missions/<mission_id>/invite/', methods=["POST"])
247+
def post_mission_invitation(mission_id):
248+
"""post the invitation for a mission"""
249+
author = request.args.get("creatorUid", "unknown")
250+
invitedContacts = request.args.get("contacts", None)
251+
try:
252+
mission = HTTPSTakApiCommunicationController().make_request("GetMission", "mission", {"mission_id": mission_id}, None, True).get_value("mission")
253+
if mission == None:
254+
return '{"message": "mission not found"}', 404
255+
role = json.loads(mission)["data"][0]["defaultRole"]["type"]
256+
HTTPSTakApiCommunicationController().make_request("SendInvitation", "mission", {"author_uid": author, "mission_id": mission_id, "client_uid": invitedContacts, "role": role}, None, False)
257+
return '', 200
242258
except Exception as e:
243259
print(e)
244260
return {"message": str(e)}, 500

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "FreeTAKServer"
3-
version = "0.2.37"
3+
version = "0.2.38"
44
description = "An open source server for the TAK family of applications."
55
authors = ["FreeTAKTeam <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)