From 66395fec15183350f9c0b0f9cefe0df2b904eb14 Mon Sep 17 00:00:00 2001 From: Vishal968 Date: Sat, 9 Sep 2023 17:58:01 -0700 Subject: [PATCH] Added endpoint to get the roles of the user --- myspace_api.py | 5 ++++- profiles.py | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/myspace_api.py b/myspace_api.py index 49fa676..259909e 100644 --- a/myspace_api.py +++ b/myspace_api.py @@ -1,6 +1,7 @@ # MANIFEST MY SPACE (PROPERTY MANAGEMENT) BACKEND PYTHON FILE # https://l0h6a9zi1e.execute-api.us-west-1.amazonaws.com/dev/ -from announcements import Announcements +from announcements import Announcements,AnnouncementsByUid +from profiles import RolesByUserid # To run program: python3 myspace_api.py # README: if conn error make sure password is set properly in RDS PASSWORD section @@ -439,6 +440,8 @@ def get(self, tenant_id): api.add_resource(ContactsBusinessContactsMaintenanceDetails, '/contactsBusinessContactsMaintenanceDetails/') api.add_resource(Announcements, '/announcements') +api.add_resource(AnnouncementsByUid, '/announcements/') +api.add_resource(RolesByUserid, '/rolesByUserId/') api.add_resource(List, '/lists') diff --git a/profiles.py b/profiles.py index e9428fa..acc935b 100644 --- a/profiles.py +++ b/profiles.py @@ -103,3 +103,11 @@ def get(self, tenant_id): # print(items) response["Profile"] = profileQuery return response + + +class RolesByUserid(Resource): + def get(self, user_id): + print('in RolesByUserid') + with connect() as db: + response = db.select('user_profiles', {"user_id": user_id}) + return response \ No newline at end of file