refac: get feedback ids

This commit is contained in:
Timothy Jaeryang Baek
2026-01-09 03:06:24 +04:00
parent ffbd6ec7f2
commit b2a1f71d92
2 changed files with 22 additions and 2 deletions
+21
View File
@@ -250,6 +250,27 @@ class FeedbackTable:
.all()
]
def get_all_feedback_ids(
self, db: Optional[Session] = None
) -> list[FeedbackIdResponse]:
with get_db_context(db) as db:
return [
FeedbackIdResponse(
id=row.id,
user_id=row.user_id,
created_at=row.created_at,
updated_at=row.updated_at,
)
for row in db.query(
Feedback.id,
Feedback.user_id,
Feedback.created_at,
Feedback.updated_at,
)
.order_by(Feedback.updated_at.desc())
.all()
]
def get_feedbacks_by_type(
self, type: str, db: Optional[Session] = None
) -> list[FeedbackModel]:
+1 -2
View File
@@ -73,8 +73,7 @@ async def get_all_feedbacks(
async def get_all_feedback_ids(
user=Depends(get_admin_user), db: Session = Depends(get_session)
):
feedbacks = Feedbacks.get_all_feedbacks(db=db)
return feedbacks
return Feedbacks.get_all_feedback_ids(db=db)
@router.delete("/feedbacks/all")