Skip to content

4 blog website setup#14

Merged
MicRaj merged 9 commits into
mainfrom
4-blog-website-setup
Aug 30, 2025
Merged

4 blog website setup#14
MicRaj merged 9 commits into
mainfrom
4-blog-website-setup

Conversation

@MicRaj

@MicRaj MicRaj commented Aug 9, 2025

Copy link
Copy Markdown
Owner

No description provided.

@MicRaj MicRaj linked an issue Aug 9, 2025 that may be closed by this pull request
@MicRaj MicRaj requested a review from Copilot August 9, 2025 21:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a blog website setup by replacing a simple yes/no answer system with a full blog post management system. The changes include creating new blog post models, API endpoints for CRUD operations, and frontend components for creating and displaying blog posts.

  • Replaces YesNo model with BlogPost model supporting titles, content, slugs, and cover images
  • Adds comprehensive blog post API endpoints (create, read, update, delete)
  • Refactors frontend to use separate PostEditor and PostList components

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/routes/+page.svelte Updates main page to use new PostEditor and PostList components
frontend/src/lib/components/TinyEditor.svelte Removes form submission logic and styling, keeping only the editor functionality
frontend/src/lib/components/PostList.svelte New component for fetching and displaying blog posts from the API
frontend/src/lib/components/PostEditor.svelte New component containing the post creation form with title, cover image, and content fields
backend/app/models/yesno.py Removes the YesNo model (deleted file)
backend/app/models/blog_post.py Adds new BlogPost model with associated Pydantic schemas
backend/app/main.py Simplifies CORS configuration to allow all origins
backend/app/api/data.py Replaces YesNo endpoints with comprehensive blog post CRUD operations

from pydantic import BaseModel


from typing import Optional

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate import statement. The typing.Optional import on line 8 is redundant as it's already imported on line 4.

Suggested change
from typing import Optional

Copilot uses AI. Check for mistakes.

from typing import Optional
from sqlmodel import SQLModel, Field
from pydantic import BaseModel

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate import statement. The pydantic.BaseModel import on line 10 is redundant as it's already imported on line 5.

Suggested change
from pydantic import BaseModel

Copilot uses AI. Check for mistakes.
from typing import Optional
from sqlmodel import SQLModel, Field
from pydantic import BaseModel
import time

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate import statement. The time import on line 11 is redundant as it's already imported on line 3.

Suggested change
import time

Copilot uses AI. Check for mistakes.
Comment thread backend/app/api/data.py
answer = answer.decode("utf-8")
db.add(YesNo(timestamp=datetime.datetime.now(), answer=answer))

def sanitise_html(html: str) -> str:

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sanitise_html function returns the input unchanged, providing no HTML sanitization. This creates a security risk as unsanitized HTML content could lead to XSS vulnerabilities when rendered in the frontend.

Copilot uses AI. Check for mistakes.
Comment thread backend/app/api/data.py
if updated_post.cover_image is not None:
db_post.cover_image = updated_post.cover_image

# db_post.timestamp = int(time.time())

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed rather than left in the codebase to maintain code cleanliness.

Suggested change
# db_post.timestamp = int(time.time())

Copilot uses AI. Check for mistakes.
{:else}
{#each posts as post}
<article>
<h1>{post.id}</h1>

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using <h1> tag to display the post ID is semantically incorrect. The post ID should use a less prominent heading tag or span element, as <h1> should represent the main heading of the page or section.

Suggested change
<h1>{post.id}</h1>
<span>{post.id}</span>

Copilot uses AI. Check for mistakes.
@MicRaj MicRaj merged commit 4ebe463 into main Aug 30, 2025
2 checks passed
@MicRaj MicRaj deleted the 4-blog-website-setup branch August 30, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blog website scaffolding

2 participants