feat: Add bulletin board system
- Add BoardCategory and BoardPost models with multi-language support - Add bulletin API endpoints (CRUD, notice toggle, pin toggle) - Add board_enabled setting to control menu visibility - Create frontend board pages (list, detail, write, edit) - Create admin board management and category management pages - Update Header.tsx with conditional Board menu between Inquiry and Contact Us - Update admin settings with board_enabled toggle - Add Board menu to admin sidebar Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
59
backend/app/models/bulletin.py
Normal file
59
backend/app/models/bulletin.py
Normal file
@@ -0,0 +1,59 @@
|
||||
"""
|
||||
Bulletin Board Models - 게시판 모델
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from ..database import Base
|
||||
|
||||
|
||||
class BoardCategory(Base):
|
||||
"""게시판 카테고리"""
|
||||
__tablename__ = "board_categories"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String(100), nullable=False) # 카테고리명 (한국어)
|
||||
name_en = Column(String(100), nullable=True) # 영어
|
||||
name_mn = Column(String(100), nullable=True) # 몽골어
|
||||
name_ru = Column(String(100), nullable=True) # 러시아어
|
||||
slug = Column(String(50), unique=True, nullable=False) # URL용 슬러그
|
||||
description = Column(String(255), nullable=True)
|
||||
sort_order = Column(Integer, default=0)
|
||||
is_active = Column(Boolean, default=True)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
# Relationships
|
||||
posts = relationship("BoardPost", back_populates="category")
|
||||
|
||||
|
||||
class BoardPost(Base):
|
||||
"""게시판 글"""
|
||||
__tablename__ = "board_posts"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
title = Column(String(255), nullable=False)
|
||||
content = Column(Text, nullable=False)
|
||||
|
||||
# Category
|
||||
category_id = Column(Integer, ForeignKey("board_categories.id"), nullable=False)
|
||||
|
||||
# Author
|
||||
author_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
|
||||
# Status
|
||||
is_notice = Column(Boolean, default=False) # 공지사항 여부 (관리자만 설정 가능)
|
||||
is_pinned = Column(Boolean, default=False) # 상단 고정 여부
|
||||
is_published = Column(Boolean, default=True) # 게시 여부
|
||||
|
||||
# Stats
|
||||
view_count = Column(Integer, default=0)
|
||||
|
||||
# Timestamps
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
# Relationships
|
||||
category = relationship("BoardCategory", back_populates="posts")
|
||||
author = relationship("User", foreign_keys=[author_id])
|
||||
Reference in New Issue
Block a user