Database Structure - Keverdose/SOEN341-UC2 GitHub Wiki

Databases

images/database/dbschema.png

User

The database is set up to auto increment its own ID to make sure that every new user will have a unique system ID. Each user enters their first name, their last name, an e-mail which is verified to be unique as well as a password. Every creation of a new user is time stamped.

Posts

A post contains a unique system ID as well as an identifying user_id to identify the author of the post. It also contains the title and body of a user post submission. Every new creation is time stamped.

Comment

A comment contains a unique system ID as well as an identifying user_id to identify the athor of the comment. It also contains the associated post_id to which it pertains as well as the body of the comment itself. Every new creation is time stamped.

Creating a Post

Once logged in, it is possible to create a post by clicking on "Create a Post" from the home page. This will redirect the user to a post form page where a user can fill out the required fields in order to submit a new post to the forum. Once submitted, the system performs a creation of a new post in the database and enters the new data that was submitted.

Viewing all Posts

In order to see all open posts, the user can select "Current Posts" from the home page which will direct him/her to a page showing all of the currently open posts with comments underneath them. The system iteratively goes through every post in the database and prints the title with body of the post as well as the comments for each post in a top-down fashion.

Editing a Post

If the user wishes to edit a post that he/she had earlier posted, this is possible by first opening the post by clicking on the Post's Title. Once opened the system verifies if the current user is the author of the displayed post. If true then the user will have a button "Edit" that they can select which will direct the user to an edit page and will allow them to change the body of the post. Once the user finishes editing and wishes to submit, the user can click on the "Submit" button which will search for the correct post in the database and update the respective field. It will then automatically redirect the user to the one post viewing of the post that was just edited.

Editing a Comment

If the user wishes to edit a comment that he/she had earlier posted, this is possible by first opening the post to which the comment is associated by clicking on the Post's Title. Once opened the system verifies if the current user is the author of anything that is displayed. If true then the user will have a button "Edit" that they can select under each comment that they had made. This button directs the user to an edit page and will allow them to change the body of the comment. Once the user finishes editing and wishes to submit, the user can click on the "Submit" button which will search for the correct comment in the database and update the respective field. It will then automatically redirect the user to the one post viewing of the post to which the comment that was just edited is associated.