-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/th-15-add-login-api' into main
- Loading branch information
Showing
13 changed files
with
319 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 +1,25 @@ | ||
"""config URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/3.2/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.conf import settings | ||
from django.contrib import admin | ||
from django.urls import path | ||
from django.urls import include, path | ||
from drf_yasg import openapi | ||
from drf_yasg.utils import swagger_auto_schema | ||
from drf_yasg.views import get_schema_view | ||
from rest_framework import permissions | ||
from rest_framework.decorators import api_view | ||
from rest_framework.response import Response | ||
|
||
schema_view = get_schema_view( | ||
openapi.Info( | ||
title="Ctrl-f BE", | ||
title="CTRL-f API Doc", | ||
default_version="v1", | ||
description="Ctrl-f BE API Doc", | ||
terms_of_service="", | ||
contact=openapi.Contact(name="test", email="[email protected]"), | ||
license=openapi.License(name="Ctrl-f BE License"), | ||
description="CTRL-f API Doc", | ||
terms_of_service="https://www.google.com/policies/terms/", | ||
contact=openapi.Contact(email="[email protected]"), | ||
license=openapi.License(name="BSD License"), | ||
), | ||
public=True, | ||
permission_classes=(permissions.AllowAny,), | ||
) | ||
|
||
|
||
@swagger_auto_schema(method="get") | ||
@api_view(["GET"]) | ||
def helloworld(request): | ||
return Response({"hello": "world"}) | ||
|
||
|
||
urlpatterns = [path("admin/", admin.site.urls)] | ||
|
||
if settings.DEBUG: | ||
urlpatterns += [ | ||
path("swagger/", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"), | ||
path("helloworld", helloworld), | ||
] | ||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("swagger/", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"), | ||
path("api/auth/", include("ctrlf_auth.urls")), | ||
] |
Empty file.
Empty file.
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CtrlfAuthConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "ctrlf_auth" |
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,26 @@ | ||
# Generated by Django 3.2.5 on 2021-07-11 09:54 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="CtrlfUser", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("password", models.CharField(max_length=128, verbose_name="password")), | ||
("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")), | ||
("email", models.EmailField(max_length=255, unique=True, verbose_name="email address")), | ||
("is_active", models.BooleanField(default=True)), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
Empty file.
Oops, something went wrong.