Add frontend project structure with React/TypeScript setup
This commit is contained in:
1 parent
c7abb73c66
commit
6914a6855c
58 files changed
+9056
-236
No files matched your search
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
Article model for Newzy application.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, String, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from db.session import Base
|
||||
|
||||
|
||||
class Article(Base):
|
||||
"""Represents a news article."""
|
||||
|
||||
__tablename__ = "articles"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
|
||||
title: Mapped[str] = mapped_column(String(200), unique=True, nullable=False)
|
||||
content: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
author_id: Mapped[int] = mapped_column(ForeignKey("authors.id"), nullable=False)
|
||||
category_id: Mapped[int] = mapped_column(ForeignKey("categories.id"), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
published: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
# Relationships
|
||||
author: Mapped["Author"] = relationship("Author", back_populates="articles")
|
||||
category: Mapped["Category"] = relationship("Category", back_populates="articles")
|
||||
Reference in new issue
Block a user