Feat: [#10] codes 앱 생성 및 초대/인증코드 모델 생성

This commit is contained in:
sm4640
2025-03-27 16:58:54 +09:00
parent 64a8763c72
commit 0f5baeb9eb
6 changed files with 34 additions and 0 deletions

0
codes/__init__.py Normal file
View File

3
codes/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
codes/apps.py Normal file
View 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
View 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
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
codes/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.