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

Commit

Permalink
fix: Initialize other tables in initialize(), instead of passing them…
Browse files Browse the repository at this point in the history
… as parameters
  • Loading branch information
robsavoye committed Mar 20, 2024
1 parent 7f7ec0b commit 01add54
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
3 changes: 0 additions & 3 deletions tm_admin/organizations/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ async def initialize(self,
"""
await self.connect(inuri)
await self.getTypes("organizations")
#await self.messagesdb.connect(uri)
#await self.usersdb.connect(uri)
#await self.teamsdb.connect(uri)

async def getByID(self,
org_id: int,
Expand Down
6 changes: 2 additions & 4 deletions tm_admin/projects/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ def __init__(self):

async def initialize(self,
inuri: str,
uapi: UsersAPI,
tapi: TasksAPI,
) -> None:
"""
Connect to all tables for API endpoints that require accessing multiple tables.
Expand All @@ -91,8 +89,8 @@ async def initialize(self,
"""
await self.connect(inuri)
await self.getTypes("projects")
self.users = uapi
self.tasks = tapi
self.users = tm_admin.users.api.UsersAPI()
self.tasks = tm_admin.tasks.api.TasksAPI()

async def getByID(self,
project_id: int,
Expand Down
6 changes: 2 additions & 4 deletions tm_admin/tasks/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ def __init__(self):

async def initialize(self,
inuri: str,
papi: ProjectsAPI,
uapi: UsersAPI,
) -> None:
"""
Connect to all tables for API endpoints that require
Expand All @@ -85,8 +83,8 @@ async def initialize(self,
"""
await self.connect(inuri)
await self.getTypes("tasks")
self.projects = papi
self.users = uapi
self.projects = tm_admin.projects.api.ProjectsAPI()
self.users = tm_admin.users.api.UsersAPI()

async def getStatus(self,
task_id: int,
Expand Down
14 changes: 7 additions & 7 deletions tm_admin/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def __init__(self):

async def initialize(self,
inuri: str,
papi: ProjectsAPI,
tapi: TasksAPI,
) -> None:
"""
Connect to all tables for API endpoints that require
Expand All @@ -78,11 +76,13 @@ async def initialize(self,
"""
await self.connect(inuri)
await self.getTypes("users")
# await self.projects.initialize(inuri)
await papi.initialize(inuri, self, tapi)
await tapi.initialize(inuri, papi, self)
self.projects = papi
self.tasks = tapi

self.tasks = tm_admin.tasks.api.TasksAPI()
await self.tasks.initialize(inuri)

self.projects = tm_admin.projects.api.ProjectsAPI()
await self.projects.initialize(inuri)

# self.cursor = "DECLARE user_cursor CURSOR FOR SELECT * FROM users;"

async def getByID(self,
Expand Down

0 comments on commit 01add54

Please sign in to comment.