✨ Feat: [#10] codes 앱 생성 및 초대/인증코드 모델 생성
This commit is contained in:
0
codes/__init__.py
Normal file
0
codes/__init__.py
Normal file
3
codes/admin.py
Normal file
3
codes/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
codes/apps.py
Normal file
6
codes/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CodesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'codes'
|
||||
19
codes/models.py
Normal file
19
codes/models.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from django.db import models
|
||||
|
||||
from common.models.baseModels import BaseModel
|
||||
from common.models.choiceModels import CertificateCodeUseType, InviteCodeUseType
|
||||
from common.utils.codeManger import set_expire
|
||||
|
||||
|
||||
class CertificationCode(BaseModel):
|
||||
use_type = models.CharField(choices=CertificateCodeUseType.choices, max_length=5)
|
||||
code = models.CharField(max_length=6)
|
||||
expire_at = models.DateTimeField(default=set_expire(minutes=5))
|
||||
is_used = models.BooleanField(default=False)
|
||||
identifier = models.CharField(max_length=40)
|
||||
|
||||
class InviteCode(BaseModel):
|
||||
use_type = models.CharField(choices=InviteCodeUseType.choices, max_length=5)
|
||||
code = models.CharField(max_length=10)
|
||||
expire_at = models.DateTimeField(default=set_expire(minutes=10080)) # 일주일은 10080분
|
||||
identifier = models.CharField(max_length=40)
|
||||
3
codes/tests.py
Normal file
3
codes/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
codes/views.py
Normal file
3
codes/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user