Skip to content

Commit

Permalink
Merge pull request #198 from bounswe/fatih/follow-unfollow
Browse files Browse the repository at this point in the history
Fatih/follow unfollow
  • Loading branch information
fatih260 authored May 11, 2024
2 parents d55c6ff + 4bbf6ea commit 1df25ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions backend/nba_app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
path('login/', views.log_in, name='login'),
path('feed/', views.feed, name='feed'),
path('profile_view_edit/', views.profile_view_edit, name='profile_view_edit'),
path('follow_user/', views.follow_user, name='follow_user'),
path('unfollow_user/', views.unfollow_user, name='unfollow_user'),
path('follow_user/<int:user_id>', views.follow_user, name='follow_user'),
path('unfollow_user/<int:user_id>', views.unfollow_user, name='unfollow_user'),
path('reset_password/', views.reset_password, name='reset_password'),
path('post/', views.post, name='post'),
path('search/', views.search, name='search'),
Expand Down
8 changes: 4 additions & 4 deletions backend/nba_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ def reset_password(request):



def follow_user(request):
def follow_user(request, user_id):
if request.method != 'POST':
return JsonResponse({'error': 'Only POST requests are allowed.'}, status=405)

user_id = request.POST.get('user_id')
# user_id = request.POST.get('user_id')

if request.user.user_id == user_id:
return JsonResponse({'error': 'You cannot follow yourself.'}, status=400)
Expand All @@ -236,11 +236,11 @@ def follow_user(request):



def unfollow_user(request):
def unfollow_user(request, user_id):
if request.method != 'POST':
return JsonResponse({'error': 'Only POST requests are allowed.'}, status=405)

user_id = request.POST.get('user_id')
# user_id = request.POST.get('user_id')

# Retrieve the user to unfollow
try:
Expand Down
5 changes: 3 additions & 2 deletions backend/nba_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases



DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.getenv('DB_NAME'),
'HOST': '64.226.89.39',#os.getenv('DB_HOST'),
'PORT': '3307',#os.getenv('DB_PORT'),
'HOST': os.getenv('DB_HOST'),
'PORT': os.getenv('DB_PORT'),
'USER': os.getenv('DB_USER'),
'PASSWORD': os.getenv('DB_PASSWORD'),
}
Expand Down

0 comments on commit 1df25ed

Please sign in to comment.