基本更新

This commit is contained in:
Miyamizu-MitsuhaSang 2025-10-15 10:54:33 +08:00
parent 222a424822
commit 3b025a2eca
3 changed files with 67 additions and 1 deletions

4
.gitignore vendored
View File

@ -10,6 +10,7 @@
# Icon must end with two \r
Icon
# Thumbnails
._*
@ -318,4 +319,7 @@ poetry.toml
# LSP config files
pyrightconfig.json
# VScode setting files
.vscode/
# End of https://www.toptal.com/developers/gitignore/api/python,pycharm,macos

34
app/models/comments.py Normal file
View File

@ -0,0 +1,34 @@
from tortoise import fields
from tortoise.models import Model
class CommentFr(Model):
id = fields.IntField(pk=True)
user = fields.ForeignKeyField("models.User", related_name="comments_fr")
comment_text = fields.TextField(description="The comment text")
comment_word = fields.ForeignKeyField("models.WordlistFr", related_name="comments_fr")
created_at = fields.DatetimeField(auto_now_add=True)
updated_at = fields.DatetimeField(auto_now=True)
class Meta:
table = "comments_fr"
class CommentJp(Model):
id = fields.IntField(pk=True)
user = fields.ForeignKeyField("models.User", related_name="comments_jp")
comment_text = fields.TextField(description="The comment text")
comment_word = fields.ForeignKeyField("models.WordlistJp", related_name="comments_jp")
created_at = fields.DatetimeField(auto_now_add=True)
updated_at = fields.DatetimeField(auto_now=True)
supervised = fields.BooleanField(default=False)
class Meta:
table = "comments_jp"
class ImprovingComment(Model):
id = fields.IntField(pk=True)
user = fields.ForeignKeyField("models.User", related_name="comments_improving")
comment_text = fields.TextField(description="The comment text")
created_at = fields.DatetimeField(auto_now_add=True)
class Meta:
table = "comments_improving"

View File

@ -0,0 +1,28 @@
from typing import List, Tuple
from typing import Literal
from pydantic import BaseModel
from app.api.user.user_schemas import UserSchema
class CommentPiece(BaseModel):
user_id: UserSchema
comment_content: str
class Config:
from_attributes = True
class CommentSet(BaseModel):
comments: List[Tuple[int, str, str]]
class Config:
from_attributes = True
class CommentUpload(BaseModel):
comment_word: str
comment_content: str
lang: Literal["fr", "jp"]
class Config:
from_attributes = True