###### Are you prohibited to create a post/comment?
###### Is it asked in the register for an email and a password?
##### Enter the website as a registered user.
###### Does the project detects if the email or password are wrong?
###### Are you able to create a post/comment?
###### Does the project detects if the email or user name is already taken in the register?
##### Try creating a post as a registered user.
##### Try to register as a new user in the forum.
###### Are you able to choose a category for that post?
###### Is it possible to register?
###### Can you like or dislike a post?
##### Try to login with the user you created.
###### Can you like or dislike a comment?
###### Can you login and have all the rights of a registered user?
##### Try liking a post, then refresh the page.
###### Does the number of likes increase?
##### Try to login without any credentials.
##### Try desliking a post, then refresh the page.
###### Does the number of dislikes increase?
###### Does it show a warning message?
##### Try to like and then dislike the same post.
###### Can you confirm that it is not possible to like and dislike the same post at the same time?
###### Are sessions present in the project?
##### Try seeing all posts from one category using the search engine.
##### Try opening two different browsers and login into one of them. Refresh the other browser.
###### Are all posts displayed from that category?
###### Can you confirm that the browser non logged remains unregistered?
##### Try searching for a specific post.
##### Try opening two different browsers and login into one of them. Then create a new post or just add a comment. Refresh the other browser.
###### Does it present the expected post?
###### Does it present the changes made in the logged browser?
#### SQLite
@ -45,10 +36,6 @@
###### Does the code contain at least one SELECT query?
###### Does the code contain at least one DELETE query?
###### Is the use of the sqlite3 command missing from the code?
##### Try registering in the forum, open the database with `sqlite3 <database_name.db>` and perform a query to select all the users (Example: SELECT * FROM users;).
###### Does it present the user you created?
@ -57,57 +44,84 @@
###### Does it present the post you created?
#### Authentication
##### Try creating a comment in the forum, open the database with `sqlite3 <database_name.db>` and perform a query to select all the users (Example: SELECT * FROM comment;).
##### Try to register as a new user in the forum.
###### Does it present the comment you created?
###### Is it possible to register?
#### Docker
##### Try opening two different browsers and login into one of them. Then create a new post or just add a comment. Refresh the other browser.
###### Does the project have Dockerfiles?
###### Can you confirm that the browser non logged remains unregistered?
##### Try to run the command `"docker image build [OPTINS] PATH | URL | -"` to build the image using using the project Dockerfiles and run the command `"docker images"` to see images.
```
student$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<nameoftheimage> latest 85a65d66ca39 7 seconds ago 795MB
```
###### Does all images build as above?
##### Try to login with the user you created.
##### Try running the command `"docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]"` to start the containers using the images just created and run the command `"docker ps -a"` to see containers.
```
student$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cc8f5dcf760f <nameoftheimage> "./server" 6 seconds ago Up 6 seconds 0.0.0.0:8080->8080/tcp ascii-art-web
```
###### Is the docker containers running as above?
###### Can you login and have all the rights of a registered user?
###### Does the project present no [unused object](https://docs.docker.com/config/pruning/)?
##### Are sessions present in the project?
#### Functional
##### Try to login without any credentials.
##### Enter the forum as a non-registered user.
###### Are you prohibited to create a post?
###### Does it show a warning message?
##### Enter the forum as a non-registered user.
###### Are you prohibited to create a comment?
##### Try opening two different browsers and login into one of them. Then create a new post or just add a comment. Refresh the other browser.
##### Enter the forum as a non-registered user and try to like a comment.
###### Are you prohibited to like a post?
###### Does it present the changes made in the logged in browser?
##### Enter the forum as a non-registered user and try to dislike a comment.
###### Are you prohibited to dislike a comment?
###### Is it asked in the register for an email and a password?
##### Enter the forum as a registered user, go to a post and try to create a comment for it.
###### Were you able to create the comment?
###### Does the project detects if the email or password are wrong?
##### Enter the forum as a registered user, go to a post and try to create an empty comment for it.
###### Were you prohibited to create the comment?
###### Does the project detects if the email or user name is already taken in the register?
##### Enter the forum as a registered user and try to create a post.
###### Were you able to create a post?
#### Docker
##### Enter the forum as a registered user and try to create an empty post.
###### Were you prohibited to create the post?
###### Does the project have Dockerfiles?
##### Try creating a post as a registered user and try to choose a category for that post.
###### Were you able to choose a category for that post?
##### Try to run the command `"docker image build [OPTINS] PATH | URL | -"` to build the image using using the project Dockerfiles?
```
student$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<nameoftheimage> latest 85a65d66ca39 7 seconds ago 795MB
```
###### Run the command `"docker images"` to see images. Does all images build as above?
##### Enter the forum as a registered user and try to like or dislike a post.
###### Can you like or dislike the post?
##### Try running the command `"docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]"` to start the containers using the images just created.
```
student$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cc8f5dcf760f ascii-art-web-docker "./server" 6 seconds ago Up 6 seconds 0.0.0.0:8080->8080/tcp ascii-art-web
```
###### Run the command `"docker ps -a"` to see containers. Is the docker containers running as above?
##### Enter the forum as a registered user and try to like or dislike a comment.
###### Can you like or dislike the comment?
###### Does the project present no [unused object](https://docs.docker.com/config/pruning/)?
##### Enter the forum as a registered user, try liking and disliking a post and then refresh the page.
###### Does the number of likes/dislikes change?
##### Enter the forum as a registered user and try to like and then dislike the same post.
###### Can you confirm that it is not possible that the post is liked and disliked at the same time?
##### Enter the forum as a registered user and try seeing all of your created posts.
###### Does it present the expected posts?
##### Enter the forum as a registered user and try seeing all of your liked posts.
###### Does it present the expected posts?
##### Navigate to a post of your choice and see its comments.
###### Are all users (registered or not) able to see the number of likes and dislikes that comment has?
##### Try seeing all posts from one category using the filter.
###### Are all posts displayed from that category?
###### Did the server behaved as expected?(did not crashed)
This project consists in creating a web forum that allows :
- communication between users and the community through the creation of posts/comments.
- associate posts to categories.
- non-registered users to only see posts/comments.
- likes and dislikes in posts and comments, you must take in consideration that the number of likes and dislikes must be accounted.
- searching, inside your forum, for a specific category or post
- The search bar must have typing suggestions as you write.
- communication between users.
- associate categories to posts.
- liking and disliking posts and comments.
- filtering posts.
#### SQLite
@ -19,51 +17,54 @@ SQLite is a popular choice as embedded database software for local/client storag
To structure your database and to achieve better performance we highly advise you to take a look at the [entity relationship diagram](https://www.smartdraw.com/entity-relationship-diagram/) and build one based on your own database.
- You must use at least one SELECT, one CREATE, one INSERT and one DELETE query.
- You must use at least one SELECT, one CREATE and one INSERT.
To know more about SQLite you can check the [SQLite page](https://www.sqlite.org/index.html).
##### SQLite Usage
- You can run queries in your database with the `sqlite3` command.
- You cannot use the command as part of your project. `sqlite3` command will be used as a way to check and test your database.
- Below we have an example on how to use the `sqlite3` command, as well as some query examples:
```console
student$ sqlite3 database.db
SQLite version 3.29.0 2019-07-10 17:32:03
Enter ".help" for usage hints.
sqlite> CREATE TABLE car (id INTEGER PRIMARY KEY, brand TEXT, year INTEGER);
sqlite> INSERT INTO car (brand, year) VALUES ("Mercedes", 2010);
sqlite> INSERT INTO car (brand, year) VALUES ("Volvo", 2018);
sqlite> INSERT INTO car (brand, year) VALUES ("Nissan", 1999);
sqlite> SELECT * FROM car;
1|Mercedes|2010
2|Volvo|2018
3|Nissan|1999
sqlite> DELETE FROM car WHERE year>2000;
sqlite> SELECT * FROM car;
3|Nissan|1999
sqlite> ^C^C^Cstudent$
```
#### Authentication
In this segment the client must be able to `register` as a new user for the forum, by inputting their credentials. You also have to create a `login session` to access the forum and be able to add posts and/or comments.
In this segment the client must be able to `register` as a new user on the forum, by inputting their credentials. You also have to create a `login session` to access the forum and be able to add posts and comments.
You should use cookies to allow each user to have only one open session. Each of this sessions must contain an expiration date. It's up to you to decide what time the cookie stays "alive".
Instructions for user registration:
- Must ask for email
- When the email is taken return an error response.
- When the email is already taken return an error response.
- Must ask for username
- Must ask for password
- The password must be encrypted
- The password must be encrypted
The forum must be able to check if the email provided is present in the database and if all credentials are correct. It will check if the password is the same with the one provided and if the password is not the same return an error response.
#### Communication
In order for users to communicate between each other, they will have to be able to create posts and comments.
- Only registered users will be able to create posts and comments.
- When registered users are creating a post they can associate one or more categories to it.
- The implementation and choice of the categories is up to you.
- The posts and comments should be visible to all users (registered or not).
- Non-registered users will only be able to see posts and comments.
#### Likes and Dislikes
Only registered users will be able to like or dislike posts and comments.
The number of likes and dislikes should be visible by all users (registered or not).
#### Filter
You need to implement a filter mechanism, that will allow users to filter the displayed posts by :
- categories
- created posts
- liked posts
You can look at filtering by categories as subforums. A subforum is a section of an online forum dedicated to a specific topic.
Note that the last two are only available for registered users and must refer to the logged in user.
#### Docker
For the forum project you must use Docker. You can see all about docker basics on the [ascii-art-web-dockerize](https://public.01-edu.org/subjects/ascii-art-web/ascii-art-web-dockerize.en) subject.
@ -76,7 +77,6 @@ This project will help you learn about:
- HTTP
- Sessions and cookies
- Using and [setting up Docker](https://docs.docker.com/get-started/) :
- Services and dependencies.
- Containerizing an application.
- Compatibility/Dependency.
- Creating images.
@ -87,7 +87,6 @@ This project will help you learn about:
### Instructions
- You must use **SQLite**.
- You must use HTML files.
- You must handle website errors, HTTP status.
- You must handle all sort of technical errors.
- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en).