-
Notifications
You must be signed in to change notification settings - Fork 5
feat: foro v1 #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MatiasDG539
wants to merge
7
commits into
testing
Choose a base branch
from
pcn_forum
base: testing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat: foro v1 #197
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
841867a
feat: add Post, PostCategory, PostComment, and PostLike tables with r…
MatiasDG539 66366c5
feat: scaffold forum views including category, thread detail, and new…
MatiasDG539 fd677e8
feat: add post creation logic and support for markdown text in forum
MatiasDG539 a49af6b
feat: render markdown content on individual post page
MatiasDG539 bf77cb1
feat: add post deletion logic with author-only restriction
MatiasDG539 40d02dc
refactor: change folder name for readability
MatiasDG539 38ed17a
feat: implement post editing functionality with session validation an…
MatiasDG539 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
prisma/migrations/20250721133142_add_forum_posts_categories_comments_likes/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "Post" ( | ||
| "id" TEXT NOT NULL, | ||
| "title" TEXT NOT NULL, | ||
| "content" TEXT NOT NULL, | ||
| "isPinned" BOOLEAN NOT NULL DEFAULT false, | ||
| "isLocked" BOOLEAN NOT NULL DEFAULT false, | ||
| "authorId" TEXT NOT NULL, | ||
| "categoryId" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "Post_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "PostCategory" ( | ||
| "id" TEXT NOT NULL, | ||
| "name" TEXT NOT NULL, | ||
| "description" TEXT NOT NULL, | ||
| "color" TEXT NOT NULL, | ||
| "icon" TEXT NOT NULL, | ||
| "slug" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "PostCategory_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "PostComment" ( | ||
| "id" TEXT NOT NULL, | ||
| "content" TEXT NOT NULL, | ||
| "authorId" TEXT NOT NULL, | ||
| "postId" TEXT NOT NULL, | ||
| "parentCommentId" TEXT, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "PostComment_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "PostLike" ( | ||
| "id" TEXT NOT NULL, | ||
| "userId" TEXT NOT NULL, | ||
| "postId" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "PostLike_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "PostCommentLike" ( | ||
| "id" TEXT NOT NULL, | ||
| "userId" TEXT NOT NULL, | ||
| "commentId" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "PostCommentLike_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "Post_categoryId_idx" ON "Post"("categoryId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "Post_createdAt_idx" ON "Post"("createdAt"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "Post_isPinned_idx" ON "Post"("isPinned"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "PostCategory_name_key" ON "PostCategory"("name"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "PostCategory_slug_key" ON "PostCategory"("slug"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "PostComment_postId_idx" ON "PostComment"("postId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "PostComment_authorId_idx" ON "PostComment"("authorId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "PostLike_postId_idx" ON "PostLike"("postId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "PostLike_userId_postId_key" ON "PostLike"("userId", "postId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "PostCommentLike_commentId_idx" ON "PostCommentLike"("commentId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "PostCommentLike_userId_commentId_key" ON "PostCommentLike"("userId", "commentId"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "Post" ADD CONSTRAINT "Post_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "PostCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostComment" ADD CONSTRAINT "PostComment_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostComment" ADD CONSTRAINT "PostComment_postId_fkey" FOREIGN KEY ("postId") REFERENCES "Post"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostComment" ADD CONSTRAINT "PostComment_parentCommentId_fkey" FOREIGN KEY ("parentCommentId") REFERENCES "PostComment"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostLike" ADD CONSTRAINT "PostLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostLike" ADD CONSTRAINT "PostLike_postId_fkey" FOREIGN KEY ("postId") REFERENCES "Post"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostCommentLike" ADD CONSTRAINT "PostCommentLike_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "PostCommentLike" ADD CONSTRAINT "PostCommentLike_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "PostComment"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Estos nombres podrian ser simplificados a
pinnedylocked