-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from TUK-DP/develop
deploy 0.3
- Loading branch information
Showing
7 changed files
with
305 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
from django.db import models | ||
from django.http import JsonResponse | ||
from rest_framework import status | ||
|
||
|
||
class BaseModel(models.Model): | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
|
||
# deleted_at = models.DateTimeField(blank=True, null=True) | ||
|
||
class Meta: | ||
abstract = True | ||
|
||
|
||
class ApiResponse: | ||
@staticmethod | ||
def on_success(result, response_status=status.HTTP_200_OK): | ||
return JsonResponse({'isSuccess': True, 'result': result}, status=response_status) | ||
|
||
@staticmethod | ||
def on_fail(message, response_status=status.HTTP_400_BAD_REQUEST): | ||
return JsonResponse({'isSuccess': False, 'message': message}, status=response_status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Generated by Django 5.0.2 on 2024-03-06 08:50 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('diary', '0003_remove_diary_content_alter_sentences_diary_quizs_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Keywords', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('keyword', models.CharField(max_length=100)), | ||
('sentence', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='keywords', to='diary.sentences')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='Questions', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('question', models.TextField()), | ||
('keyword', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='diary.keywords')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.DeleteModel( | ||
name='Quizs', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
from django.urls import path, include | ||
from rest_framework.routers import DefaultRouter | ||
from .views import DiaryView, WriteView, GetDiarybyUserView, GetQuizView, UpdateView | ||
from django.urls import path | ||
from .views import WriteView, GetDiaryByUserView, GetQuizView, UpdateView | ||
|
||
urlpatterns = [ | ||
path('', DiaryView.as_view()), | ||
path('write', WriteView.as_view()), | ||
path('list', GetDiarybyUserView.as_view()), | ||
path('list', GetDiaryByUserView.as_view()), | ||
path('quiz', GetQuizView.as_view()), | ||
path('update', UpdateView.as_view()) | ||
] |
Oops, something went wrong.