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

Deprecated된 App 제거 및 년도 컬럼 추가 #153

Merged
merged 20 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions accounts/templates/_base.html

This file was deleted.

29 changes: 0 additions & 29 deletions accounts/templates/account_mypage_payments.html

This file was deleted.

11 changes: 1 addition & 10 deletions accounts/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from django.urls import include, path

from .views import GitHubLogin, GoogleLogin, MyPage, mypage_payments

from .views import IdLogin, Logout

from .views import login_api, logout_api
from .views import GitHubLogin, GoogleLogin, IdLogin, Logout, login_api, logout_api

urlpatterns = [
path("auth/", include("dj_rest_auth.urls")),
Expand All @@ -14,13 +10,8 @@
path("accounts/signup/", IdLogin.as_view(), name="account_signup"),
path("auth/github/login/", GitHubLogin.as_view(), name="github_login"),
path("auth/google/login/", GoogleLogin.as_view(), name="google_login"),
#path("my-page/payments", MyPage.as_view())
path("my-page/payments/", mypage_payments),

# Endpoints for Seesion Based Login
path("api/login/", login_api, name="login-api"),
path("api/logout/", logout_api, name="logout-api"),
# path("api/logout/", )

path("api/mypage/", MyPage.as_view(), name="mypage-api"),
]
20 changes: 0 additions & 20 deletions accounts/view_models.py

This file was deleted.

52 changes: 4 additions & 48 deletions accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
from allauth.account.views import LoginView, LogoutView
from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import OAuth2Client
from dj_rest_auth.registration.views import SocialLoginView

from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.contrib.auth import login, logout, authenticate
from functional import seq

from rest_framework.response import Response
from rest_framework.views import APIView
from django.contrib.auth import authenticate, login, logout
from rest_framework.decorators import api_view
from rest_framework.response import Response

from accounts.logics import get_basic_auth_token
from accounts.view_models import UserTicketInfo
from ticket.models import Ticket

from allauth.account.views import LoginView, LogoutView


class IdLogin(LoginView):
Expand All @@ -41,37 +32,6 @@ class GoogleLogin(SocialLoginView):
client_class = OAuth2Client


class MyPage(APIView):
def get(self, request):
dto = {
"ticket": self.get_ticket_info(request)
# "session": None, # TODO 세션
# "sponsor": None, # TODO 후원사
# "user_info": None # TODO 사용자 정보
}

return Response(dto)

def get_ticket_info(self, request) -> list:
all_tickets = Ticket.objects.filter(
user=request.user,
is_refunded=False
)

return list(
seq(all_tickets)
.map(UserTicketInfo)
.map(lambda info: info.to_dict())
)


@login_required
def mypage_payments(request):
ticket_list = Ticket.objects.filter(user=request.user)
return render(request, 'account_mypage_payments.html',
context={'ticket_list': ticket_list})


@api_view(["POST"])
def login_api(request):
if request.user.is_authenticated:
Expand Down Expand Up @@ -99,8 +59,4 @@ def logout_api(request):
return Response({"msg": "not logged in"})

logout(request)

response_data = {
"msg": "ok"
}
return Response(response_data)
return Response({"msg": "ok"})
Empty file removed payment/__init__.py
Empty file.
16 changes: 0 additions & 16 deletions payment/admin.py

This file was deleted.

6 changes: 0 additions & 6 deletions payment/apps.py

This file was deleted.

85 changes: 0 additions & 85 deletions payment/clients.py

This file was deleted.

9 changes: 0 additions & 9 deletions payment/enum.py

This file was deleted.

57 changes: 0 additions & 57 deletions payment/logic.py

This file was deleted.

Loading
Loading