feat: add board functionality with articles and comments

- Implemented BoardView for creating and displaying articles with comments.
- Added NationAffairsView for managing national policies and financial settings.
- Created ScoutMessageView for editing recruitment messages.
- Introduced database migrations for board_post and board_comment tables.
This commit is contained in:
2026-01-28 14:44:15 +00:00
parent 87fe1edae1
commit bebb0de3c4
17 changed files with 2847 additions and 0 deletions
+33
View File
@@ -318,3 +318,36 @@ model InheritanceUserState {
@@map("inheritance_user_state")
}
model BoardPost {
id Int @id @default(autoincrement())
nationId Int @map("nation_id")
isSecret Boolean @default(false) @map("is_secret")
authorGeneralId Int @map("author_general_id")
authorName String @map("author_name")
title String
contentHtml String @map("content_html")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
comments BoardComment[]
@@index([nationId, isSecret, createdAt])
@@map("board_post")
}
model BoardComment {
id Int @id @default(autoincrement())
postId Int @map("post_id")
nationId Int @map("nation_id")
isSecret Boolean @default(false) @map("is_secret")
authorGeneralId Int @map("author_general_id")
authorName String @map("author_name")
contentText String @map("content_text")
createdAt DateTime @default(now()) @map("created_at")
post BoardPost @relation(fields: [postId], references: [id], onDelete: Cascade)
@@index([postId, createdAt])
@@map("board_comment")
}
@@ -0,0 +1,26 @@
CREATE TABLE "board_post" (
"id" SERIAL PRIMARY KEY,
"nation_id" INTEGER NOT NULL,
"is_secret" BOOLEAN NOT NULL DEFAULT FALSE,
"author_general_id" INTEGER NOT NULL,
"author_name" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content_html" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX "board_post_nation_secret_created_idx" ON "board_post"("nation_id", "is_secret", "created_at");
CREATE TABLE "board_comment" (
"id" SERIAL PRIMARY KEY,
"post_id" INTEGER NOT NULL REFERENCES "board_post"("id") ON DELETE CASCADE,
"nation_id" INTEGER NOT NULL,
"is_secret" BOOLEAN NOT NULL DEFAULT FALSE,
"author_general_id" INTEGER NOT NULL,
"author_name" TEXT NOT NULL,
"content_text" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX "board_comment_post_created_idx" ON "board_comment"("post_id", "created_at");