Skip to content

Commit

Permalink
required login
Browse files Browse the repository at this point in the history
  • Loading branch information
jazwu committed Apr 14, 2024
1 parent ea6f02b commit 35130ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions chat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .models import ChatSession


@login_required
@login_required(login_url="/")
def get_chat_session(request, receiver_id):
sender = request.user
receiver = get_object_or_404(User, id=receiver_id)
Expand Down Expand Up @@ -76,7 +76,7 @@ def chat_view(request):
return render(request, "chat/no_chat.html")


@login_required
@login_required(login_url="/")
def select_user_view(request):
hospitals = Hospital.objects.all()
return render(request, "chat/select_user.html", {"hospitals": hospitals})
2 changes: 1 addition & 1 deletion healthScore/hospital_admin_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .models import HealthRecord, Hospital, HospitalStaff, Appointment, User


@login_required
@login_required(login_url="/")
def get_admin_health_history_details(request):
if request.method == "GET" and request.user.is_staff:
id = request.user.id
Expand Down
2 changes: 1 addition & 1 deletion healthScore/user_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)


@login_required
@login_required(login_url="/")
def get_health_history_details(request):
if request.method == "GET":
userID = request.user
Expand Down
6 changes: 3 additions & 3 deletions healthScore/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,20 +1145,20 @@ def update_hospital_status(request, hospital_id):
return JsonResponse({"error": "Invalid status provided."}, status=400)


@login_required
@login_required(login_url="/")
def get_patients(request):
patients = list(User.objects.filter(is_patient=True).values())
return JsonResponse({"patients": patients})


@login_required
@login_required(login_url="/")
def get_doctor_details(request, doctor_id):
doctor = HospitalStaff.objects.filter(id=doctor_id).first()
user_detail = list(User.objects.filter(id=doctor.userID).values())
return JsonResponse({"user": user_detail})


@login_required
@login_required(login_url="/")
def get_patient_details(request, patient_id):
patient_detail = list(User.objects.filter(id=patient_id).values())
return JsonResponse({"user": patient_detail})

0 comments on commit 35130ab

Please sign in to comment.