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

✨ Feat: [관리자] status별 웨이팅 팀 수 API 추가 #102

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

dudtlstm
Copy link
Contributor

@dudtlstm dudtlstm commented Oct 7, 2024

🔥 Pull requests

👷 작업한 내용

스크린샷 2024-10-07 오전 9 24 52

백엔드에서 위의 내용 보내줄 수 있도록 API 구현하였습니다.

📸 스크린샷

스크린샷 2024-10-07 오전 9 25 13

🖥️ 주요 코드 설명

종범행님이 야무지게 만들어두신 WaitingFilter를 이용해보고 싶어서 아래의 코드를 작성하였는데 .. 더 깔끔한진 모르겠네요

# 상태별 웨이팅 개수 카운트
class WaitingCountView(APIView):
    authentication_classes = [JWTAuthentication]
    permission_classes = [IsAuthenticated, IsAdminUser]
    
    def get(self, request):
        admin = self.request.admin
        booth = admin.booth

        waiting_count = WaitingFilter({'status': 'waiting'}, queryset=Waiting.objects.filter(booth=booth)).qs.count()
        calling_count = WaitingFilter({'status': 'calling'}, queryset=Waiting.objects.filter(booth=booth)).qs.count()
        arrived_count = WaitingFilter({'status': 'arrived'}, queryset=Waiting.objects.filter(booth=booth)).qs.count()
        canceled_count = WaitingFilter({'status': 'canceled'}, queryset=Waiting.objects.filter(booth=booth)).qs.count()

        return custom_response(
            data={
                "waiting": waiting_count,
                "calling": calling_count,
                "arrived": arrived_count,
                "canceled": canceled_count
            },
            message="Waiting counts fetched successfully",
            code=status.HTTP_200_OK
        )

✅ Check List

  • Merge 대상 브랜치가 올바른가?
  • 최종 코드가 에러 없이 잘 동작하는가?

@dudtlstm dudtlstm added ✨Feature 기능 개발 🐱영신작업 영신 작업 labels Oct 7, 2024
@dudtlstm dudtlstm self-assigned this Oct 7, 2024
@JongbeomLee623 JongbeomLee623 merged commit ce10b1c into LINE-NOW:main Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feature 기능 개발 🐱영신작업 영신 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants