EzyShop is a user-friendly platform that connects you to local stores, offering a seamless shopping experience. Compare prices, access exclusive deals, and enjoy hassle-free deliveries for groceries, essentials, and organic products—all in one app.
Description:
The blog functionality is not yet implemented in the application. To support blog posts, we first need to create a database schema for blogs and set up fetching data from the database. This will provide the foundation for adding blog-related features in future tasks, such as displaying blog summaries and individual blog content on the frontend.
Proposed Solution:
Define the Blog Schema:
Create a new Blog model in the schema.prisma file with fields such as:
id: Unique identifier for each blog.
title: Title of the blog post.
content: Main content of the blog.
image: URL for the blog's cover image.
authorId: Identifier linking the blog to a User.
createdAt: Timestamp of when the blog was created.
updatedAt: Timestamp of when the blog was last updated.
Establish relationships if needed (e.g., link blogs to User as author).
Run prisma db push to sync the new schema with the MongoDB database.
Create Sample Blog Data:
Add 2-3 initial blog entries to the database to facilitate testing of the fetching logic.
Set Up Data Fetching Logic:
Implement backend API endpoints to retrieve blog data.
Create endpoints such as:
GET /api/blogs: Fetch a list of blog summaries.
GET /api/blogs/:id: Fetch full details of a specific blog by id.
Ensure the data retrieval works correctly and returns the necessary fields for displaying on the frontend.
Expected Outcome:
A Blog schema is defined in the database, and blog data is stored correctly.
API endpoints for fetching blog summaries and individual blog details are functional.
Initial blog data is available in the database for testing further frontend implementation.
Additional Information:
This foundational setup will allow for a seamless transition to implementing the Blog Grid page and individual Blog Page functionality in a follow-up issue. The next step will focus on dynamically loading the blog content using this database connection.
Description
Description:
The blog functionality is not yet implemented in the application. To support blog posts, we first need to create a database schema for blogs and set up fetching data from the database. This will provide the foundation for adding blog-related features in future tasks, such as displaying blog summaries and individual blog content on the frontend.
Proposed Solution:
Define the Blog Schema:
Blog
model in theschema.prisma
file with fields such as:id
: Unique identifier for each blog.title
: Title of the blog post.content
: Main content of the blog.image
: URL for the blog's cover image.authorId
: Identifier linking the blog to aUser
.createdAt
: Timestamp of when the blog was created.updatedAt
: Timestamp of when the blog was last updated.User
asauthor
).prisma db push
to sync the new schema with the MongoDB database.Create Sample Blog Data:
Set Up Data Fetching Logic:
GET /api/blogs
: Fetch a list of blog summaries.GET /api/blogs/:id
: Fetch full details of a specific blog byid
.Expected Outcome:
Blog
schema is defined in the database, and blog data is stored correctly.Additional Information:
This foundational setup will allow for a seamless transition to implementing the Blog Grid page and individual Blog Page functionality in a follow-up issue. The next step will focus on dynamically loading the blog content using this database connection.
Screenshots
Current blog page with static details:
Checklist