# domain/answer/schemas.py
import datetime
from pydantic import BaseModel, field_validator
# ๐ฅ ์
๋ ฅ: ์ฌ์ฉ์๊ฐ ๋ต๋ณ์ ํ์ดํํด์ ์๋ฒ๋ก ๋ณด๋ผ ๋ ๊ฒ์ฆํ๋ ํ
class Create(BaseModel):
content: str
# ์ฌ๊ธฐ์ @field_validator ์ ์ฉ
@field_validator("content")
def not_empty(cls, v):
if not v or not v.strip():
raise ValueError("๋น ๊ฐ์ ํ์ฉ๋์ง ์์ต๋๋ค.")
# ๊ด๋ก์ ์์ธ ๋ฉ์์ง๋ ์์ด๋ก ์์ฑํ๋ ๊ฒ์ด ์ผ๋ฐ์ ์
๋๋ค.
# raise ValueError('Content cannot be empty.')
return v
# ๐ค ์ถ๋ ฅ: DB์์ ๊บผ๋ด์ง ๋ต๋ณ์ ๊ธฐ๋ณธ ํํ (์ง๋ฌธ ์์ธ์กฐํ ์ ๋ฆฌ์คํธ์ ๋ด๊ธธ ๋ถํ)
class Answer(BaseModel):
id: int
content: str
created_at: datetime.datetime
๋ณธ ๊ณต๊ฐ์ ์ธ๊ณต์ง๋ฅ(AI)์ด ๋์ถํ ๋ฐฉ๋ํ ์ง์์ ์ผ๋ชฉ์์ฐํ๊ฒ ํ๋ ์ด์
ํ์ฌ ๊ธฐ๋กํ๋ ๋ธ๋ก๊ทธ์
๋๋ค. ๊ธฐ์ ์ ํ๊ณ๋ก ์ธํด ๋ชจ๋ ์ ๋ณด์ ์๋ฒฝํ ์ ํ์ฑ์ ๋ณด์ฅํ๊ธฐ๋ ์ด๋ ค์ฐ๋ฏ๋ก, ์ต์ข
์ ์ธ ํ๋จ๊ณผ ์ฑ
์์ ๋
์ ๋ณธ์ธ์๊ฒ ์์์ ์ ์คํ ์๋ดํด ๋๋ฆฝ๋๋ค.
2026๋ 7์ 21์ผ ํ์์ผ
app/domain/answer/schemas.py
database.py
import os from contextlib import contextmanager # contextmanager ์ํฌํธ from typing import Generator from dotenv...
-
bool atob(const char * string) { if (!strcmp(string, "true")) return true; return false; }
-
/// CXXXView.cpp void CXXXView::OnInitialUpdate() { CView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the ...
-
WxWidgets: http://www.wxwidgets.org/downloads/ MinGW: http://sourceforge.net/projects/mingw/files/ * Microsoft Windows Environment Var...