Repository navigation
Feat/super admin approval - #15
Conversation
| router = APIRouter(prefix="/notifications", tags=["staff-notifications"]) | ||
|
|
||
|
|
||
| def _to_response(notification: StaffNotification) -> StaffNotificationSchema: |
There was a problem hiding this comment.
this logique must be in schema
| ) | ||
|
|
||
|
|
||
| @router.post("/{notification_id}/read", response_model=StaffNotificationSchema) |
There was a problem hiding this comment.
must accept batch notfication read
| router = APIRouter(prefix="/uploads", tags=["staff-uploads"]) | ||
|
|
||
|
|
||
| def _to_response(upload_request: UploadRequestDetails) -> UploadRequestSchema: |
There was a problem hiding this comment.
also must be in schema folder in the dto
| current_staff_user: StaffUser = Depends(get_current_staff_user), | ||
| container: Container = Depends(get_container), | ||
| ) -> UploadRequestSchema: | ||
| upload_request = await container.upload_requests_service.create_request( |
There was a problem hiding this comment.
validate the format and size for the pic
| approved_by=admin_staff_user, | ||
| ) | ||
| return _to_response(upload_request) | ||
|
|
There was a problem hiding this comment.
those three are the same endpoint with one filter approaved and rejected and pending
| async def require_admin_staff( | ||
| current_staff_user: Annotated[StaffUser, Depends(get_current_staff_user)], | ||
| ) -> StaffUser: | ||
| if _role_value(current_staff_user.role) != "admin": |
There was a problem hiding this comment.
here the role must be multi lead not admin
|
|
||
| class CreateUploadRequestPhotoRequest(BaseModel): | ||
| drive_file_id: str | ||
| staging_storage_key: str |
There was a problem hiding this comment.
this logique is wrong how frontend will kno the storage key
There was a problem hiding this comment.
This implementation relies heavily on getattr and uses Sequence[object] for photos, which removes type safety and makes the code harder to reason about.
Because the function accepts object, it must defensively access fields like drive_file_id, staging_storage_key, taken_at, etc. using getattr. This suggests the input type is not well-defined. A clearer approach would be to define a dedicated input model (e.g., UploadPhotoInput using a dataclass or Pydantic model) and type the parameter as Sequence[UploadPhotoInput]. That would remove the need for repeated getattr calls and make the contract of the function explicit.
| for staged_photo in staged_photos: | ||
| created_photo = await self.photo_querier.create_photo( | ||
| event_id=upload_request.event_id, | ||
| uploaded_by=None, |
There was a problem hiding this comment.
ur forcing here none
|
i addressed the review feedback:
|
okeyy 9owa fix merge issues brk |
51c3bb7 to
5b993d2
Compare
Summary
This PR adds the staff upload approval workflow using the current staff/admin model.
What was added
upload_request_photosphotostable on approvalTechnical changes
staff_notificationstable and queriesupload_request_photosstaging table and queriesupload_requestswithphoto_countandrejection_reasonEndpoints
POST /stuff/uploads/requestGET /stuff/uploads/my-requestsGET /stuff/uploads/pendingPOST /stuff/uploads/{request_id}/approvePOST /stuff/uploads/{request_id}/rejectGET /stuff/notificationsPOST /stuff/notifications/{notification_id}/read