Skip to content

Commit

Permalink
Merge pull request #288 from 2023-Winter-Bootcamp-Team-N/develop
Browse files Browse the repository at this point in the history
deploy
  • Loading branch information
wndjs803 committed Jan 30, 2024
2 parents 1ac7e26 + 5914127 commit 51707f1
Show file tree
Hide file tree
Showing 85 changed files with 1,788 additions and 2,034 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,4 @@ jobs:

- name: Install packages
working-directory: frontend
run: npm ci

- name: Prettier
working-directory: frontend
run: npm run format

- name: ESLint
working-directory: frontend
run: npm run lint
run: npm install
2 changes: 1 addition & 1 deletion backend/account/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


urlpatterns = [
path('signin', MembersAPIView.as_view()),
path('signup', MembersAPIView.as_view()),
path('login', LoginAPIView.as_view()),
]

4 changes: 2 additions & 2 deletions backend/chart/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def get(self, request):
return Response({'error': '유저가 존재하지 않습니다.'}, status=status.HTTP_400_BAD_REQUEST)

# 유저의 각 구독 채널 정보 가져오기
user_subscribes = Summary.objects.filter(user_id=user_id).values('youtube_channel').distinct()
user_subscribes = Summary.objects.filter(user_id=user_id, deleted_at__isnull=True).values('youtube_channel').distinct()

channels = []
for subscribe in user_subscribes:
channel_name = subscribe['youtube_channel']
summary_count = Summary.objects.filter(user_id=user_id, youtube_channel=channel_name).count()
summary_count = Summary.objects.filter(user_id=user_id, youtube_channel=channel_name, deleted_at__isnull=True).count()

channels.append({
'youtube_channel': channel_name,
Expand Down
26 changes: 26 additions & 0 deletions backend/logs/test.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
[23/Jan/2024 01:08:03] WARNING [django.request:241] Bad Request: /api/account/signin
[23/Jan/2024 01:08:03] WARNING [django.channels.server:178] HTTP POST /api/account/signin 400 [0.26, 192.168.65.1:55323]
[23/Jan/2024 01:24:17] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 01:24:17] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EA%B5%90%EC%9C%A1 404 [0.03, 192.168.65.1:57937]
[23/Jan/2024 01:24:52] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 01:24:52] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%97%B0%EC%98%88 404 [0.03, 192.168.65.1:58013]
[23/Jan/2024 01:24:54] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 01:24:54] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%97%AC%ED%96%89 404 [0.02, 192.168.65.1:58013]
[23/Jan/2024 01:24:56] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 01:24:56] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%8A%A4%ED%8F%AC%EC%B8%A0 404 [0.01, 192.168.65.1:58013]
[23/Jan/2024 01:24:57] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 01:24:57] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%82%AC%ED%9A%8C 404 [0.02, 192.168.65.1:58013]
[23/Jan/2024 01:25:10] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 01:25:10] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%82%AC%ED%9A%8C 404 [0.03, 192.168.65.1:58013]
[23/Jan/2024 02:23:05] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:23:05] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EA%B5%90%EC%9C%A1 404 [0.04, 192.168.65.1:17264]
[23/Jan/2024 02:23:09] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:23:09] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%97%B0%EC%98%88 404 [0.03, 192.168.65.1:17277]
[23/Jan/2024 02:23:22] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:23:22] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%82%AC%ED%9A%8C 404 [0.03, 192.168.65.1:17319]
[23/Jan/2024 02:58:29] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:58:29] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EA%B5%90%EC%9C%A1 404 [0.03, 192.168.65.1:22608]
[23/Jan/2024 02:58:30] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:58:30] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%97%B0%EC%98%88 404 [0.03, 192.168.65.1:22608]
[23/Jan/2024 02:58:46] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:58:46] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%8A%A4%ED%8F%AC%EC%B8%A0 404 [0.03, 192.168.65.1:22645]
[23/Jan/2024 02:58:58] WARNING [django.request:241] Not Found: /api/search/category
[23/Jan/2024 02:58:58] WARNING [django.channels.server:176] HTTP GET /api/search/category?user_id=1&category=%EC%8A%A4%ED%8F%AC%EC%B8%A0 404 [0.03, 192.168.65.1:22685]
2 changes: 2 additions & 0 deletions backend/nTeamProject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware',
]
ROOT_URLCONF = 'nTeamProject.urls'
TEMPLATES = [
Expand Down
2 changes: 1 addition & 1 deletion backend/nTeamProject/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
path('api/v1/subscribe/', include("subscribe.urls")),
path('api/v1/chart/', include("chart.urls")),
path('api/v1/search/', include("search.urls")),
path('', include("django_prometheus.urls"), name='metrics'),
path('', include("django_prometheus.urls")),
]

urlpatterns += [
Expand Down
2 changes: 1 addition & 1 deletion backend/summary/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.1 on 2024-01-15 17:27
# Generated by Django 5.0.1 on 2024-01-23 21:54

import django.db.models.deletion
from django.db import migrations, models
Expand Down
20 changes: 17 additions & 3 deletions backend/summary/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
)

from drf_yasg.utils import swagger_auto_schema
import re

class SummaryAPIView(APIView):
@swagger_auto_schema(operation_summary="요약본 저장", request_body=SummarySaveCompositeSerializer, responses={"201":MessageResponseSerializer})
Expand All @@ -26,10 +27,23 @@ def post(self, request):
summary_data = request.data.get('summary')
category_list = request.data.get('category')
summary_by_times = request.data.get('summary_by_times', [])

save.delay(summary_data, category_list, summary_by_times)

return Response({"message": "요약본 저장 중"}, status=status.HTTP_201_CREATED)
user_id = summary_data.get('user_id')
youtube_url = summary_data.get('youtube_url')

video_id_match = re.search(r'(?<=v=)[^&]+', youtube_url)
if video_id_match:
video_id = video_id_match.group()
else:
return Response({"message": "유효한 YouTube URL이 아닙니다"}, status=status.HTTP_400_BAD_REQUEST)

if not Summary.objects.filter(user_id=user_id, youtube_url__contains=video_id).exists():

save.delay(summary_data, category_list, summary_by_times)
return Response({"message": "요약본 저장 중"}, status=status.HTTP_201_CREATED)

else:
return Response({"message": "이미 존재하는 요약본입니다."}, status=status.HTTP_400_BAD_REQUEST)

class SummaryDeleteAPIView(APIView):
@swagger_auto_schema(operation_summary="요약본 삭제", query_serializer=SummaryDeleteSerializer, responses = {"200":MessageResponseSerializer})
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
celery:
container_name: celery
build: ./backend
command: sh -c 'celery -A nTeamProject.celery worker --loglevel=info'
command: sh -c 'celery -A nTeamProject.celery worker -c 2 --loglevel=info'
depends_on:
- rabbit
- db
Expand Down
Loading

0 comments on commit 51707f1

Please sign in to comment.