161 lines
5.8 KiB
Python
161 lines
5.8 KiB
Python
import enum
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import String, Integer, Text, DateTime, Boolean, Enum, JSON
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class ProjectStatus(str, enum.Enum):
|
|
done = "done"
|
|
progress = "progress"
|
|
|
|
|
|
class AdminUser(Base):
|
|
__tablename__ = "admin_users"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
username: Mapped[str] = mapped_column(String(64), unique=True, index=True)
|
|
hashed_password: Mapped[str] = mapped_column(String(255))
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
|
|
|
|
|
class Brand(Base):
|
|
"""اطلاعات کلی برند - همیشه فقط یک رکورد (id=1) دارد."""
|
|
__tablename__ = "brand"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(255), default="")
|
|
logo: Mapped[str] = mapped_column(String(1024), default="")
|
|
hero: Mapped[str] = mapped_column(String(1024), default="")
|
|
contact_bg: Mapped[str] = mapped_column(String(1024), default="")
|
|
phone: Mapped[str] = mapped_column(String(64), default="")
|
|
phone_href: Mapped[str] = mapped_column(String(64), default="")
|
|
email: Mapped[str] = mapped_column(String(255), default="")
|
|
address: Mapped[str] = mapped_column(String(1024), default="")
|
|
|
|
|
|
class Service(Base):
|
|
__tablename__ = "services"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
title: Mapped[str] = mapped_column(String(255))
|
|
desc: Mapped[str] = mapped_column(Text)
|
|
icon: Mapped[str] = mapped_column(String(64))
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class Project(Base):
|
|
__tablename__ = "projects"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
slug: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
title: Mapped[str] = mapped_column(String(255))
|
|
location: Mapped[str] = mapped_column(String(255))
|
|
year: Mapped[str] = mapped_column(String(64))
|
|
status: Mapped[ProjectStatus] = mapped_column(Enum(ProjectStatus), default=ProjectStatus.progress)
|
|
image: Mapped[str] = mapped_column(String(1024))
|
|
gallery: Mapped[list] = mapped_column(JSON, default=list)
|
|
area: Mapped[str] = mapped_column(String(128))
|
|
floors: Mapped[str] = mapped_column(String(128))
|
|
units: Mapped[str] = mapped_column(String(128))
|
|
client: Mapped[str] = mapped_column(String(255))
|
|
summary: Mapped[str] = mapped_column(Text)
|
|
body: Mapped[list] = mapped_column(JSON, default=list)
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class Stat(Base):
|
|
__tablename__ = "stats"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
value: Mapped[int] = mapped_column(Integer)
|
|
suffix: Mapped[str] = mapped_column(String(32), default="")
|
|
label: Mapped[str] = mapped_column(String(255))
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class TimelineItem(Base):
|
|
__tablename__ = "timeline_items"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
year: Mapped[str] = mapped_column(String(64))
|
|
title: Mapped[str] = mapped_column(String(255))
|
|
desc: Mapped[str] = mapped_column(Text)
|
|
image: Mapped[str] = mapped_column(String(1024))
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class WhyUsItem(Base):
|
|
__tablename__ = "why_us_items"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
title: Mapped[str] = mapped_column(String(255))
|
|
desc: Mapped[str] = mapped_column(Text)
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class Testimonial(Base):
|
|
__tablename__ = "testimonials"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
role: Mapped[str] = mapped_column(String(255))
|
|
quote: Mapped[str] = mapped_column(Text)
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class TeamMember(Base):
|
|
__tablename__ = "team_members"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
role: Mapped[str] = mapped_column(String(255))
|
|
bio: Mapped[str] = mapped_column(Text)
|
|
photo: Mapped[str] = mapped_column(String(1024), default="")
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class Article(Base):
|
|
__tablename__ = "articles"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
slug: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
title: Mapped[str] = mapped_column(String(255))
|
|
date: Mapped[str] = mapped_column(String(64))
|
|
category: Mapped[str] = mapped_column(String(128))
|
|
image: Mapped[str] = mapped_column(String(1024))
|
|
read: Mapped[str] = mapped_column(String(32))
|
|
excerpt: Mapped[str] = mapped_column(Text)
|
|
body: Mapped[list] = mapped_column(JSON, default=list)
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class Faq(Base):
|
|
__tablename__ = "faqs"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
q: Mapped[str] = mapped_column(String(512))
|
|
a: Mapped[str] = mapped_column(Text)
|
|
order: Mapped[int] = mapped_column(Integer, default=0)
|
|
|
|
|
|
class ContactLead(Base):
|
|
__tablename__ = "contact_leads"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(255), default="")
|
|
phone: Mapped[str] = mapped_column(String(64))
|
|
note: Mapped[str] = mapped_column(Text, default="")
|
|
is_read: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
|
|
|
|
|
class NewsletterSubscriber(Base):
|
|
__tablename__ = "newsletter_subscribers"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|