Goal: Make existing code cleaner, more readable, and more expressive using Scopes and Relationships
- Convert the
orderByDesc( "createdDate" )
to a scope calledlatest
. - Hide the implementation detail of
userId
when creating a Post by utilizing theposts
relationship on User. - Remove the cbsecurity check by constraining the Posts queries to the logged in user's posts using the
posts
relationship.
Goal: Add a Commenting System
- Create a migration to create a
comments
table. - Create a
Comment
entity. - Add a relationship from
Comment
toPost
and fromComment
toUser
. - Add the inverse relationship from
Post
toComment
. - Show the new comment form on the
posts.show
view when the user is logged in. - Validate and create a Comment associated with a Post. (The User must be logged in to perform this action.)
- Show all Comments underneath a Post. Comments should display their commenter's name, the time it was posted, and the body of the Comment.
Goal: Allow for editing, updating, and deleting of Posts
- Add an edit form. Ensure that only the author of a Post can view this form.
- Handle validation and updating of Posts. Ensure that only the author of a Post can edit the Post. Relocate back to the
posts.show
route. - Add a link to delete a Post on the edit page when the logged in User is the author of the Post.
- Handle deleting a Post. Ensure that only the author of a Post can delete the Post. Relocate back to the
posts.index
route.
Goal: Display a single Post
- Create a new action for
show
to load the Post with the given id in the url. - Display the post in a new
posts.show
view. Include a link back to theposts.index
page. - Link the title of each Post on the
posts.index
page to the newposts.show
route. - Handle the
EntityNotFound
exception thrown by Quick to show a 404 page.
Goal: Create a new Post from the UI
- Create a new form for creating a Post. Ensure the user must be logged in to access it.
- Handle validation and saving of a new Post. On success,
relocate
to theposts.index
page with acbmessagebox
message. - Show the author's name on the Post card.
- Create a second Post from the UI. Notice the Posts are sorting in ascending order by
id
. - Order the posts in descending order by
createdDate
.
Goal: Show all existing Posts
- Create a migration for a
posts
table. - Create a Quick entity for a
Post
. - Create a
posts
handler andindex
action to show all posts. - Show all posts on the
index
view. - Provide an empty state view in
posts.index
. - Add a link to create a new post.
- Link to the new
posts.index
route from the navbar.
Goal: Capture addition user information in the registration form.
- Add a new migration to add
firstName
andlastName
columns to the database. - Add
firstName
andlastName
attributes to theUser
entity. - Add fields to the registration form for the new fields.
- Validate that the new fields are required when submitting the form.
- Save all the registration fields to the database.
- Show the user's full name on the navbar when logged in.
- Scaffold a
quick-blog-example
app from thequick-with-auth
template - Configure Quick in your
.env
file and application to work with your database. - Run your migrations against your database.
- Start Server and ensure that registration and logging in is successful.