Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: projects list endpoint #70

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,19 @@ async def get_project_by_id(

async def get_projects(
db: Database,
author_id: uuid.UUID,
skip: int = 0,
limit: int = 100,
):
"""Get all projects."""
raw_sql = """
SELECT id, name, short_description, description, per_task_instructions, outline
FROM projects
WHERE author_id = :author_id
ORDER BY id DESC
ORDER BY created DESC
OFFSET :skip
LIMIT :limit;
"""
db_projects = await db.fetch_all(
raw_sql, {"author_id": author_id, "skip": skip, "limit": limit}
)
db_projects = await db.fetch_all(raw_sql, {"skip": skip, "limit": limit})

return db_projects


Expand Down
3 changes: 1 addition & 2 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ async def read_projects(
user_data: AuthUser = Depends(login_required),
):
"Return all projects"
author_id = user_data.id
projects = await project_crud.get_projects(db, author_id, skip, limit)
projects = await project_crud.get_projects(db, skip, limit)
return projects


Expand Down
Loading