Compare commits
3 commits
6b164aa983
...
29b9dd9b84
| Author | SHA1 | Date | |
|---|---|---|---|
| 29b9dd9b84 | |||
| ba20dd7792 | |||
| d38b53096c |
8 changed files with 47 additions and 11 deletions
BIN
backend/dev.db
BIN
backend/dev.db
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
[tool.pyrefly]
|
||||
|
||||
project-includes = [
|
||||
"./**/**/*.py",
|
||||
"./**/*.py",
|
||||
]
|
||||
|
|
@ -1,3 +1,17 @@
|
|||
from sqlmodel import Relationship
|
||||
from ..models.user import User
|
||||
from sqlmodel import DateTime
|
||||
from sqlmodel import Field
|
||||
from sqlmodel import UUID
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
# Comment: id, slug, content, datetime, foreign key: user
|
||||
class CommentBase(SQLModel):
|
||||
pass
|
||||
|
||||
class Comment(CommentBase, table=True):
|
||||
id: UUID | None = Field(default=None, primary_key=True)
|
||||
slug: str = Field(index=True)
|
||||
content: str = Field()
|
||||
date_time: DateTime = Field(default=DateTime())
|
||||
user_id: UUID = Field(foreign_key="user.id")
|
||||
user: User = Relationship(back_populates="comments")
|
||||
|
|
@ -3,6 +3,3 @@
|
|||
|
||||
#Reference: https://isaacfei.com/posts/simple-like-system/
|
||||
|
||||
# addReaction
|
||||
# delete Reaction
|
||||
# get Reactions by slug
|
||||
|
|
@ -1,8 +1,17 @@
|
|||
from unicodedata import name
|
||||
from sqlmodel import Field
|
||||
from sqlmodel import UUID
|
||||
from sqlmodel import Relationship
|
||||
from ..models.comment import Comment
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
# User: id, email(unique), name(unique), usercode(f.e. WLAID, unique) , subscription(bool), active=false
|
||||
class UserBase(SQLModel):
|
||||
pass
|
||||
|
||||
# CreateUser <- mail, Name
|
||||
# Login Rate Limit! -> token for everything else
|
||||
# Forgot Code <- token, email
|
||||
# Delete User <- token
|
||||
# change mail <- token, mail
|
||||
class User(UserBase):
|
||||
id: UUID | None = Field(default=None, primary_key=True)
|
||||
email: str = Field(unique=True)
|
||||
name: str = Field(unique=True)
|
||||
user_code: str = Field(unique=True) # TODO: create generation function
|
||||
subscription: bool = Field()
|
||||
comments: list[Comment] = Relationship(back_populates="user")
|
||||
4
backend/src/backend/routers/comments.py
Normal file
4
backend/src/backend/routers/comments.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
# add comment
|
||||
# delete comment
|
||||
# get comments
|
||||
5
backend/src/backend/routers/reactions.py
Normal file
5
backend/src/backend/routers/reactions.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
# addReaction
|
||||
# delete Reaction
|
||||
# get Reactions by slug
|
||||
7
backend/src/backend/routers/users.py
Normal file
7
backend/src/backend/routers/users.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# CreateUser <- mail, Name
|
||||
# Login Rate Limit! -> token for everything else
|
||||
# Forgot Code <- email (rate limit)
|
||||
# Delete User <- token
|
||||
# change mail <- token, new mail
|
||||
|
||||
# delete all deactivated users after 48h
|
||||
Loading…
Add table
Reference in a new issue