Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
fix: Add endpoints to receive data of profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Dec 15, 2023
1 parent aafe7e3 commit e078533
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tm_admin/tmserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def doRequest(self, request, context):

out = ""
action = protobuf_to_dict(request)
# These requests get data from the database
if action['cmd'] == Command.GET_USER:
print(f"USER {action}")
if action['id'] != 0:
Expand All @@ -104,7 +105,15 @@ def doRequest(self, request, context):
else:
out = teams.getAllUsers()
elif action['cmd'] == Command.GET_PROJECT:
log.error("PROJECTS unimplemented!")
if action['id'] != 0:
if len(action['name']) > 0:
# print(f"BY NAME {action}")
out = projectsDB.getByName(action['name'])
else:
# print(f" BY ID {action}")
out = projectsDB.getByID(action['id'])
else:
out = projectsDB.getAllUsers()
elif action['cmd'] == Command.GET_TEAM:
if action['id'] != 0:
if len(action['name']) > 0:
Expand All @@ -115,7 +124,18 @@ def doRequest(self, request, context):
out = teamsDB.getByID(action['id'])
else:
out = teams.getAllUsers()

# These requests receive a data packet for the database
elif action['cmd'] == Command.SEND_USER:
out = users.CreateTable()
log.error("SEND USER unimplemented!")
elif action['cmd'] == Command.SEND_PROJECT:
log.error("SEND PROJECT unimplemented!")
elif action['cmd'] == Command.SEND_TEAM:
log.error("SEND TEAM unimplemented!")
elif action['cmd'] == Command.SEND_ORGANIZATION:
log.error("SEND ORGANIZATION implemented!")

# Send the result
result = serialize_to_protobuf(error, tm_admin.services_pb2.tmresponse)
if type(out) == dict():
for key, value in entry.items():
Expand Down

0 comments on commit e078533

Please sign in to comment.