초기 커밋
This commit is contained in:
24
app/models/mongodb/notification.py
Normal file
24
app/models/mongodb/notification.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from beanie import Document
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class Notification(Document):
|
||||
user_id: int
|
||||
title: str
|
||||
message: str
|
||||
notification_type: str = "info"
|
||||
is_read: bool = False
|
||||
read_at: datetime | None = None
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
|
||||
class Settings:
|
||||
name = "notifications"
|
||||
indexes = [
|
||||
"user_id",
|
||||
[("user_id", 1), ("is_read", 1)],
|
||||
[("created_at", -1)],
|
||||
]
|
||||
Reference in New Issue
Block a user