feat(root):add mysql
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
مدل ORM برای جدول const در MySQL.
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, Text
|
||||
from core.service.mysql_orm import Base
|
||||
|
||||
|
||||
class Const(Base):
|
||||
"""مدل جدول const"""
|
||||
__tablename__ = "const"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
key = Column(String(255), nullable=False, index=True)
|
||||
title_fa = Column(String(255), nullable=True)
|
||||
value = Column(Text, nullable=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Const(id={self.id}, key='{self.key}', title_fa='{self.title_fa}')>"
|
||||
|
||||
def to_dict(self):
|
||||
"""تبدیل به dict برای JSON response"""
|
||||
return {
|
||||
"id": self.id,
|
||||
"key": self.key,
|
||||
"title_fa": self.title_fa,
|
||||
"value": self.value,
|
||||
}
|
||||
Reference in New Issue
Block a user