From bf0828ce99ea809962047e6752e0cb935ded7045 Mon Sep 17 00:00:00 2001 From: OGordoo Date: Mon, 2 Mar 2020 13:59:03 +0000 Subject: [PATCH 01/20] forum READMEs --- subjects/forum/forum.audit.en.md | 16 ++++++ subjects/forum/forum.en.md | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 subjects/forum/forum.audit.en.md create mode 100644 subjects/forum/forum.en.md diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md new file mode 100644 index 000000000..86a648aba --- /dev/null +++ b/subjects/forum/forum.audit.en.md @@ -0,0 +1,16 @@ +#### Functional + +###### Has the requirement for the allowed packages been respected? + +###### Does the code contain at least one CREATE query? + +###### Does the code contain at least one INSERT query? + +###### Does the code contain at least one SELECT query? + +###### Are there HTTP requests between the database and the server? + +#### General + +###### + + \ No newline at end of file diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md new file mode 100644 index 000000000..3b3245bdd --- /dev/null +++ b/subjects/forum/forum.en.md @@ -0,0 +1,89 @@ +## forum + +### Objectives + +This project consists in creating a web forum that allows communication between users through the creation of posts and comments. It also allows non-registered users to only see posts and comments. + +- Your forum should work based on services. Using services to create a project means that instead of having all of your project in one location, you actually divide it in smaller "projects". +- For example if you want to create a gym application you can split it in: login/register, workouts, stats (weight, muscle mass, etc.), and so on. + +You can learn more about services [here](https://medium.com/myntra-engineering/my-journey-with-golang-web-services-4d922a8c9897). + +#### Authentication + +In this segment you will have to create a page that allows you to `register` new users for the forum, by inputting their credentials. You also have to create a `login session` to access te forum and be able to add posts or comments. + +Instructions for user register: + +- Must ask for email +- Must ask for password +- When the user is taken return an error response. +- The password must be encrypted + +After the registrations the new users must be able to login into the forum. For that they will fill their credentials in the login page. + +This page must be able to check if the email provided is present in our 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. + +If there is an error in the login it must be handled properly: + +- If there is an error when casting, return an error response. +- If the email is not present or incorrect return an error response. +- If the password is not present or incorrect return an error response. + +#### SQLite + +In order to store the data in your forum (like users, posts, comments, etc.) you will use the database library SQLite. + +SQLite is a popular choice as embedded database software for local/client storage in application software such as web browsers. It enables you to create a database as well as controlling it by using queries. + +- To interact with the database you should use http requests between the server and the database. +- You must use at least one SELECT, one CREATE and one INSERT query. + +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 people (id INTEGER PRIMARY KEY, first_name TEXT, age INTEGER, gender TEXT); +sqlite> INSERT INTO people (first_name, age, gender) VALUES ("John", 23, "m"); +sqlite> INSERT INTO people (first_name, age, gender) VALUES ("Jade", 36, "f"); +sqlite> INSERT INTO people (first_name, age, gender) VALUES ("Kim", 49, "f"); +sqlite> SELECT * FROM people; +1|John|23|m +2|Jade|36|f +3|Kim|49|f +sqlite> DELETE FROM people WHERE gender="m"; +sqlite> SELECT * FROM people; +2|Jade|36|f +3|Kim|49|f +sqlite> ^C^C^Cstudent$ + +``` + +This project will help you learn about: + +- SQLite language. +- Manipulation of databases. +- HTTP requests. +- How to manage dependencies in Go. +- How to protect routes. + +### Instructions + +- You must use **SQLite** queries. +- You must use HTML files. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). +- It is recommend that the code should present a **test file**. + +### Allowed packages + +- All [standard go](https://golang.org/pkg/) packages are allowed. +- github.com/mattn/go-sqlite3 From 8a66776d16656d99a091db7dac491be094246ba5 Mon Sep 17 00:00:00 2001 From: lee Date: Mon, 2 Mar 2020 14:40:06 +0000 Subject: [PATCH 02/20] adding docker --- subjects/forum/forum.en.md | 51 ++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index 3b3245bdd..4f6b79134 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -9,6 +9,30 @@ This project consists in creating a web forum that allows communication between You can learn more about services [here](https://medium.com/myntra-engineering/my-journey-with-golang-web-services-4d922a8c9897). +#### 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. + +You must build a network using containers, in docker you can create your own network of containers through network drivers. Docker provides two network drivers, being `bridge` and `overlay`. + +Your objective is to use the [`bridge` network](https://docs.docker.com/engine/tutorials/networkingcontainers/) to create your own network for the services created for the forum project. Docker connected to this network by default, so docker creates a subnet and a gateway for the `bridge` network, the command `docker run` automatically adds containers to it. To inspect the network for more details you can just run `docker network inspect `. + +- You can see the default network : + +```console +student$ docker network ls +NETWORK ID NAME DRIVER SCOPE +b64130fc5aae bridge bridge local +033f3a191908 host host local +159cdc8d8083 none null local +``` + +- Each service will have to run in a container that will be associated to a docker host, a docker host must contain at least two containers/services, the containers must be connected to a bridge. + +- You must be carful, bridges are a private network, so it is restricted to a single Docker host, for instance containers can communicate within networks but not across networks. + - You may have to use [Port Mapping](https://docker-k8s-lab.readthedocs.io/en/latest/docker/port-mapping.html). + - Or attaching containers to multiple networks, that way connecting with all of the containers on all networks creating a "hub". + #### Authentication In this segment you will have to create a page that allows you to `register` new users for the forum, by inputting their credentials. You also have to create a `login session` to access te forum and be able to add posts or comments. @@ -34,17 +58,16 @@ If there is an error in the login it must be handled properly: In order to store the data in your forum (like users, posts, comments, etc.) you will use the database library SQLite. -SQLite is a popular choice as embedded database software for local/client storage in application software such as web browsers. It enables you to create a database as well as controlling it by using queries. +SQLite is a popular choice as embedded database software for local/client storage in application software such as web browsers. It enables you to create a database as well as controlling it by using queries. - To interact with the database you should use http requests between the server and the database. - You must use at least one SELECT, one CREATE and one INSERT query. 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 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: @@ -70,20 +93,34 @@ sqlite> ^C^C^Cstudent$ This project will help you learn about: +- Client utilities. +- The basics of web : + - Server + - HTML + - HTTP + - Services +- Learning what is [docker](https://docs.docker.com). +- Docker network bridge +- Using and [setting up Docker](https://docs.docker.com/get-started/) : + - Services and dependencies. + - Containerizing an application. + - Compatibility/Dependency. + - Creating images. + - Docker network. - SQLite language. -- Manipulation of databases. -- HTTP requests. + - Manipulation of databases. - How to manage dependencies in Go. -- How to protect routes. ### Instructions +- You must use **SQLite**. - You must use **SQLite** queries. - You must use HTML files. +- You must handle website errors, HTTP status. - The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). - It is recommend that the code should present a **test file**. -### Allowed packages +### Allowed packages - All [standard go](https://golang.org/pkg/) packages are allowed. - github.com/mattn/go-sqlite3 From 0e22e62b6a2ec32bf054bdaaafcb8f4523ca17b6 Mon Sep 17 00:00:00 2001 From: OGordoo Date: Mon, 2 Mar 2020 17:37:03 +0000 Subject: [PATCH 03/20] forum README done --- subjects/forum/forum.en.md | 108 +++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index 4f6b79134..c0ad040a8 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -2,57 +2,17 @@ ### Objectives -This project consists in creating a web forum that allows communication between users through the creation of posts and comments. It also allows non-registered users to only see posts and comments. +This project consists in creating a web forum that allows : -- Your forum should work based on services. Using services to create a project means that instead of having all of your project in one location, you actually divide it in smaller "projects". -- For example if you want to create a gym application you can split it in: login/register, workouts, stats (weight, muscle mass, etc.), and so on. +- communication between users and the community through the creation of posts/comments. +- non-registered users to only see posts/comments. +- registered users to like or dislike posts/comments. +- associate posts to categories. -You can learn more about services [here](https://medium.com/myntra-engineering/my-journey-with-golang-web-services-4d922a8c9897). +Your forum should work based on services. Using services to create a project means that instead of having a monolith architecture, you actually have the various components distributed across a cluster of instances. In other words, dividing the project in smaller "projects", this way it becomes easier to understand and your project will become more scalable. +- For example for a taxi like application you can divide it in : passenger management, billing, notifications, payments, trip management and driver management. -#### 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. - -You must build a network using containers, in docker you can create your own network of containers through network drivers. Docker provides two network drivers, being `bridge` and `overlay`. - -Your objective is to use the [`bridge` network](https://docs.docker.com/engine/tutorials/networkingcontainers/) to create your own network for the services created for the forum project. Docker connected to this network by default, so docker creates a subnet and a gateway for the `bridge` network, the command `docker run` automatically adds containers to it. To inspect the network for more details you can just run `docker network inspect `. - -- You can see the default network : - -```console -student$ docker network ls -NETWORK ID NAME DRIVER SCOPE -b64130fc5aae bridge bridge local -033f3a191908 host host local -159cdc8d8083 none null local -``` - -- Each service will have to run in a container that will be associated to a docker host, a docker host must contain at least two containers/services, the containers must be connected to a bridge. - -- You must be carful, bridges are a private network, so it is restricted to a single Docker host, for instance containers can communicate within networks but not across networks. - - You may have to use [Port Mapping](https://docker-k8s-lab.readthedocs.io/en/latest/docker/port-mapping.html). - - Or attaching containers to multiple networks, that way connecting with all of the containers on all networks creating a "hub". - -#### Authentication - -In this segment you will have to create a page that allows you to `register` new users for the forum, by inputting their credentials. You also have to create a `login session` to access te forum and be able to add posts or comments. - -Instructions for user register: - -- Must ask for email -- Must ask for password -- When the user is taken return an error response. -- The password must be encrypted - -After the registrations the new users must be able to login into the forum. For that they will fill their credentials in the login page. - -This page must be able to check if the email provided is present in our 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. - -If there is an error in the login it must be handled properly: - -- If there is an error when casting, return an error response. -- If the email is not present or incorrect return an error response. -- If the password is not present or incorrect return an error response. +You can learn more about this [here](https://www.nginx.com/blog/introduction-to-microservices/). #### SQLite @@ -60,8 +20,9 @@ In order to store the data in your forum (like users, posts, comments, etc.) you SQLite is a popular choice as embedded database software for local/client storage in application software such as web browsers. It enables you to create a database as well as controlling it by using queries. -- To interact with the database you should use http requests between the server and the database. -- You must use at least one SELECT, one CREATE and one INSERT query. +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. To know more about SQLite you can check the [SQLite page](https://www.sqlite.org/index.html). @@ -91,6 +52,46 @@ 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. + +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. +- Must ask for username +- Must ask for password +- 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. + +#### 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. + +You must build a network using containers. In docker you can create your own network of containers through network drivers. Docker provides two network drivers : `bridge` and `overlay`. + +- You can see the default network : + +```console +student$ docker network ls +NETWORK ID NAME DRIVER SCOPE +b64130fc5aae bridge bridge local +033f3a191908 host host local +159cdc8d8083 none null local +``` + +Your objective is to use the [`bridge` network](https://docs.docker.com/engine/tutorials/networkingcontainers/) to create your own network for the services. Docker connects to this network by default, creating a subnet and a gateway for the `bridge` network. The command `docker run` automatically adds containers to it. To inspect the network for more details you can just run `docker network inspect `. + +- Each service will have to run in a container that will be associated to a docker host, which must contain at least two containers/services and these must be connected to a bridge. + +- You must be careful, bridges are a private network, so it is restricted to a single Docker host, for instance containers can communicate within networks but not across networks. + - You may have to use [Port Mapping](https://docker-k8s-lab.readthedocs.io/en/latest/docker/port-mapping.html). + - Or attaching containers to multiple networks connecting with all containers on all networks creating a ["hub"](https://docs.docker.com/engine/tutorials/bridge3.png). + This project will help you learn about: - Client utilities. @@ -99,17 +100,17 @@ This project will help you learn about: - HTML - HTTP - Services -- Learning what is [docker](https://docs.docker.com). + - Sessions and cookies - Docker network bridge - Using and [setting up Docker](https://docs.docker.com/get-started/) : - Services and dependencies. - Containerizing an application. - Compatibility/Dependency. - Creating images. - - Docker network. - SQLite language. - Manipulation of databases. - How to manage dependencies in Go. +- The basics of encryption. ### Instructions @@ -117,6 +118,7 @@ This project will help you learn about: - You must use **SQLite** queries. - 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). - It is recommend that the code should present a **test file**. @@ -124,3 +126,5 @@ This project will help you learn about: - All [standard go](https://golang.org/pkg/) packages are allowed. - github.com/mattn/go-sqlite3 +- golang.org/x/crypto/bcrypt +- github.com/satori/go.uuid \ No newline at end of file From 062f9cce029ba8e30e67d0175a0a6e63d0aa8877 Mon Sep 17 00:00:00 2001 From: lee Date: Tue, 3 Mar 2020 11:50:14 +0000 Subject: [PATCH 04/20] corrections --- subjects/forum/forum.en.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index c0ad040a8..001d6c4d5 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -9,7 +9,8 @@ This project consists in creating a web forum that allows : - registered users to like or dislike posts/comments. - associate posts to categories. -Your forum should work based on services. Using services to create a project means that instead of having a monolith architecture, you actually have the various components distributed across a cluster of instances. In other words, dividing the project in smaller "projects", this way it becomes easier to understand and your project will become more scalable. +Your forum should work based on services. Using services to create a project means that instead of having a monolith architecture, you actually have various components distributed across a cluster of instances. In other words, dividing the project in smaller "projects", this way it becomes easier to understand and your project will become more scalable. + - For example for a taxi like application you can divide it in : passenger management, billing, notifications, payments, trip management and driver management. You can learn more about this [here](https://www.nginx.com/blog/introduction-to-microservices/). @@ -20,7 +21,7 @@ In order to store the data in your forum (like users, posts, comments, etc.) you SQLite is a popular choice as embedded database software for local/client storage in application software such as web browsers. It enables you to create a database as well as controlling it by using queries. -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. +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. @@ -127,4 +128,4 @@ This project will help you learn about: - All [standard go](https://golang.org/pkg/) packages are allowed. - github.com/mattn/go-sqlite3 - golang.org/x/crypto/bcrypt -- github.com/satori/go.uuid \ No newline at end of file +- github.com/satori/go.uuid From 5a5694f4336788fef2ebc3d05a57062e468432c3 Mon Sep 17 00:00:00 2001 From: OGordoo Date: Tue, 3 Mar 2020 11:56:12 +0000 Subject: [PATCH 05/20] audit forum and sqlite --- subjects/forum/forum.audit.en.md | 66 ++++++++++++++++++++++++++++++-- subjects/forum/forum.en.md | 29 +++++++------- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 86a648aba..4f4875c4d 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -1,6 +1,24 @@ #### Functional -###### Has the requirement for the allowed packages been respected? +##### Enter the website as a non-registered user. + +###### Are you able to see posts/comments? + +##### Enter the website as a non-registered user. + +###### Are you prohibited to create a post/comment? + +##### Enter the website as a registered user. + +###### Are you able to create a post/comment? + +##### Try creating a post as a registered user. + +###### Are you able to choose a category for that post? + +###### Is the forum composed of services? + +#### SQLite ###### Does the code contain at least one CREATE query? @@ -8,9 +26,49 @@ ###### Does the code contain at least one SELECT query? -###### Are there HTTP requests between the database and the server? +###### 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 ` and perform a query to select all the users (Example: SELECT * FROM users;). + +###### Does it present the user you created? + +##### Try creating a post in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT * FROM post;). + +###### Does it present the post you created? + + +###### Did the server behaved as expected?(did not crashed) + +###### Does the server use the right [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)? + +###### Has the website runned without crashing at anytime? + +###### Are all the pages working? (Absence of 404 page?) + +###### Does the project avoid [HTTP status 400](https://kinsta.com/knowledgebase/400-bad-request/#causes)? + +###### Does the project avoid [HTTP status 500](https://www.restapitutorial.com/httpstatuscodes.html)? + +###### Are the libraries used allowed? #### General -###### + - \ No newline at end of file +###### +Is the database a service? + +#### Basic + +###### +Does the project runs quickly and effectively? (Favoring recursive, no unnecessary data requests, etc) + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +###### +Is there a test file for this code? + +#### Social + +###### +Did you learn anything from this project? + +###### +Can it be open-sourced / be used for other sources? + +###### +Would you recommend/nominate this program as an example for the rest of the school? \ No newline at end of file diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index 001d6c4d5..d184b22e3 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -5,13 +5,12 @@ This project consists in creating a web forum that allows : - communication between users and the community through the creation of posts/comments. -- non-registered users to only see posts/comments. -- registered users to like or dislike posts/comments. - associate posts to categories. +- non-registered users to only see posts/comments. Your forum should work based on services. Using services to create a project means that instead of having a monolith architecture, you actually have various components distributed across a cluster of instances. In other words, dividing the project in smaller "projects", this way it becomes easier to understand and your project will become more scalable. -- For example for a taxi like application you can divide it in : passenger management, billing, notifications, payments, trip management and driver management. +- For example for a taxi like application you can divide it in the following services : passenger management, billing, notifications, payments, trip management and driver management. You can learn more about this [here](https://www.nginx.com/blog/introduction-to-microservices/). @@ -37,18 +36,17 @@ To know more about SQLite you can check the [SQLite page](https://www.sqlite.org student$ sqlite3 database.db SQLite version 3.29.0 2019-07-10 17:32:03 Enter ".help" for usage hints. -sqlite> CREATE TABLE people (id INTEGER PRIMARY KEY, first_name TEXT, age INTEGER, gender TEXT); -sqlite> INSERT INTO people (first_name, age, gender) VALUES ("John", 23, "m"); -sqlite> INSERT INTO people (first_name, age, gender) VALUES ("Jade", 36, "f"); -sqlite> INSERT INTO people (first_name, age, gender) VALUES ("Kim", 49, "f"); -sqlite> SELECT * FROM people; -1|John|23|m -2|Jade|36|f -3|Kim|49|f -sqlite> DELETE FROM people WHERE gender="m"; -sqlite> SELECT * FROM people; -2|Jade|36|f -3|Kim|49|f +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$ ``` @@ -116,7 +114,6 @@ This project will help you learn about: ### Instructions - You must use **SQLite**. -- You must use **SQLite** queries. - You must use HTML files. - You must handle website errors, HTTP status. - You must handle all sort of technical errors. From 32e42b39873b988d97f67b159ed567146d43747b Mon Sep 17 00:00:00 2001 From: lee Date: Tue, 3 Mar 2020 15:09:02 +0000 Subject: [PATCH 06/20] adding docker questions --- subjects/forum/forum.audit.en.md | 43 +++++++++++++++++++++++++++++++- subjects/forum/forum.en.md | 4 +-- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 4f4875c4d..acbd6224c 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -18,6 +18,8 @@ ###### Is the forum composed of services? +###### The communication between the services well stablish? Does the communication use [smart EndPoints](https://medium.com/@nathankpeck/microservice-principles-smart-endpoints-and-dumb-pipes-5691d410700f)(ex: Request-Response, Observer)? + #### SQLite ###### Does the code contain at least one CREATE query? @@ -38,6 +40,43 @@ ###### Does it present the post you created? +#### Authentication + +#### Docker + +###### Does the project have Dockerfiles? + +##### 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 + latest 85a65d66ca39 7 seconds ago 795MB +``` +###### Run the command `"docker images"` to see images. Does all images build as above? + +##### 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? + +##### Try running the comment `"docker network ls"` +``` +NETWORK ID NAME DRIVER SCOPE +24560f95a216 bridge local +24560f95a216 bridge bridge local +3f12239adb4f host host local +159cdc8d8083 none null local +``` +###### Is the network a bridge driver and does it appear in the list of networks as above? + +##### Try openning a shell to the running container, using the [command](https://docs.docker.com/engine/reference/commandline/exec/) `"docker exec [OPTIONS] CONTAINER COMMAND [ARG...]"` (ex: `"docker exec -it /bin/bash"`) and ping the other container that are connected to the same network, for [example](https://docs.docker.com/engine/tutorials/networkingcontainers/). + +###### Did it ping with success? Are the multiple services/containers communicating between each other? + +###### Does the project present no [unused object](https://docs.docker.com/config/pruning/)? ###### Did the server behaved as expected?(did not crashed) @@ -57,6 +96,8 @@ ###### +Is the database a service? +###### +Does the project present a script to build the images and containers? (using a script to simplify the build) + #### Basic ###### +Does the project runs quickly and effectively? (Favoring recursive, no unnecessary data requests, etc) @@ -71,4 +112,4 @@ ###### +Can it be open-sourced / be used for other sources? -###### +Would you recommend/nominate this program as an example for the rest of the school? \ No newline at end of file +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index d184b22e3..7ab857c5e 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -12,7 +12,7 @@ Your forum should work based on services. Using services to create a project mea - For example for a taxi like application you can divide it in the following services : passenger management, billing, notifications, payments, trip management and driver management. -You can learn more about this [here](https://www.nginx.com/blog/introduction-to-microservices/). +- Services can [communicate](https://medium.com/@nathankpeck/microservice-principles-smart-endpoints-and-dumb-pipes-5691d410700f) using : **Request-Response**, this being that one service invokes another service by making an request, usually to store or retrieve data. Or **Observer**, this is a event base communication, so one or more services are listening for an event and wen triggered they respond to the event. #### SQLite @@ -85,7 +85,7 @@ b64130fc5aae bridge bridge local Your objective is to use the [`bridge` network](https://docs.docker.com/engine/tutorials/networkingcontainers/) to create your own network for the services. Docker connects to this network by default, creating a subnet and a gateway for the `bridge` network. The command `docker run` automatically adds containers to it. To inspect the network for more details you can just run `docker network inspect `. -- Each service will have to run in a container that will be associated to a docker host, which must contain at least two containers/services and these must be connected to a bridge. +- Each service will have to run in a container that will be associated to a docker host, which must contain at least two containers/services and these must be connected to a bridge, creating a network for [example](https://docs.docker.com/engine/tutorials/bridge3.png). - You must be careful, bridges are a private network, so it is restricted to a single Docker host, for instance containers can communicate within networks but not across networks. - You may have to use [Port Mapping](https://docker-k8s-lab.readthedocs.io/en/latest/docker/port-mapping.html). From 850a9118eab95b21387bb0af96dda408f1dfd408 Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Tue, 3 Mar 2020 16:25:11 +0000 Subject: [PATCH 07/20] autentication questions --- subjects/forum/forum.audit.en.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index acbd6224c..34c8d1631 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -42,6 +42,30 @@ #### Authentication +##### Try to register as a new user in the forum. + +###### Is it possible to register? + +##### Try to login with the user you created. + +###### Can you login and have all the rights of a registered user? + +##### Try to login without any credentials. + +###### Does it show a warning message? + +##### 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 changes made in the logged in browser? + +###### Can you confirm that it is not possible to do it? + +###### Is it asked in the register for an email and a password? + +###### Does the project detects if the email or password are wrong? + +###### Does the project detects if the email or user name is already taken in the register? + #### Docker ###### Does the project have Dockerfiles? From 7470e2bf1d313c76350c55fd899365d093af8825 Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Tue, 3 Mar 2020 16:37:59 +0000 Subject: [PATCH 08/20] add autentication questions --- subjects/forum/forum.audit.en.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 34c8d1631..f5c32d1d3 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -46,10 +46,16 @@ ###### Is it possible to register? +##### 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. + +###### Can you confirm that the browser non logged remains unregistered? + ##### Try to login with the user you created. ###### Can you login and have all the rights of a registered user? +##### Are sessions present in the project? + ##### Try to login without any credentials. ###### Does it show a warning message? From 879fe6b57af4bb8332e5f7e9bf232c7cc85c3b13 Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Tue, 3 Mar 2020 16:41:08 +0000 Subject: [PATCH 09/20] rm autentication questions --- subjects/forum/forum.audit.en.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index f5c32d1d3..04c93968a 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -64,8 +64,6 @@ ###### Does it present the changes made in the logged in browser? -###### Can you confirm that it is not possible to do it? - ###### Is it asked in the register for an email and a password? ###### Does the project detects if the email or password are wrong? From 1b6cb736b5f55c4141d05399c079fcc8430e0816 Mon Sep 17 00:00:00 2001 From: OGordoo Date: Thu, 5 Mar 2020 11:00:51 +0000 Subject: [PATCH 10/20] handle instead of avoid --- subjects/ascii-art-web/ascii-art-web.audit.en.md | 4 ++-- subjects/forum/forum.audit.en.md | 4 ++-- subjects/groupie-tracker/groupie-tracker.audit.en.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/subjects/ascii-art-web/ascii-art-web.audit.en.md b/subjects/ascii-art-web/ascii-art-web.audit.en.md index afe350068..6584d8e06 100644 --- a/subjects/ascii-art-web/ascii-art-web.audit.en.md +++ b/subjects/ascii-art-web/ascii-art-web.audit.en.md @@ -71,8 +71,8 @@ o-o-o o--o o-o o o o o-o | | o o ##### Try to navigate between all the available pages in the website. ###### Are all the pages working? Does the project implement [404 status](https://www.restapitutorial.com/httpstatuscodes.html)? -###### Does the project implement HTTP status [400 bad request](https://kinsta.com/knowledgebase/400-bad-request/#causes)? -###### Does the project implement HTTP status [500 internal server error](https://www.restapitutorial.com/httpstatuscodes.html)? +###### Does the project handle [HTTP status 400 - Bad Request](https://kinsta.com/knowledgebase/400-bad-request/#causes)? +###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? ##### Try making a request to the server (clicking a button to generate the ascii-art representation on the website) ###### Is the communication between [server and client](https://www.geeksforgeeks.org/client-server-model/) well established? diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 04c93968a..0179260cd 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -114,9 +114,9 @@ NETWORK ID NAME DRIVER SCOPE ###### Are all the pages working? (Absence of 404 page?) -###### Does the project avoid [HTTP status 400](https://kinsta.com/knowledgebase/400-bad-request/#causes)? +###### Does the project handle [HTTP status 400 - Bad Requests](https://kinsta.com/knowledgebase/400-bad-request/#causes)? -###### Does the project avoid [HTTP status 500](https://www.restapitutorial.com/httpstatuscodes.html)? +###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? ###### Are the libraries used allowed? diff --git a/subjects/groupie-tracker/groupie-tracker.audit.en.md b/subjects/groupie-tracker/groupie-tracker.audit.en.md index 7ea387c21..0e1a2cc22 100644 --- a/subjects/groupie-tracker/groupie-tracker.audit.en.md +++ b/subjects/groupie-tracker/groupie-tracker.audit.en.md @@ -61,9 +61,9 @@ ###### Are all the pages working? (Absence of 404 page?) -###### Does the project avoid [HTTP status 400](https://kinsta.com/knowledgebase/400-bad-request/#causes)? +###### Does the project handle [HTTP status 400 - Bad Requests](https://kinsta.com/knowledgebase/400-bad-request/#causes)? -###### Does the project avoid [HTTP status 500](https://www.restapitutorial.com/httpstatuscodes.html)? +###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? ###### Is the communication between server and client well established? From 90a9a194f3900258276360009463564bd9fea323 Mon Sep 17 00:00:00 2001 From: lee Date: Thu, 5 Mar 2020 16:11:37 +0000 Subject: [PATCH 11/20] removing micro-services and docker networking --- subjects/forum/forum.audit.en.md | 41 ++++++++++++++++---------------- subjects/forum/forum.en.md | 33 +++---------------------- 2 files changed, 23 insertions(+), 51 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 0179260cd..a7a85c814 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -16,9 +16,26 @@ ###### Are you able to choose a category for that post? -###### Is the forum composed of services? +###### Can you like or dislike a post? -###### The communication between the services well stablish? Does the communication use [smart EndPoints](https://medium.com/@nathankpeck/microservice-principles-smart-endpoints-and-dumb-pipes-5691d410700f)(ex: Request-Response, Observer)? +###### Can you like or dislike a comment? + +##### Try liking a post, then refresh the page. +###### Does the number of likes increase? + +##### Try desliking a post, then refresh the page. +###### Does the number of dislikes increase? + +##### 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? + +##### Try seeing all posts from one category using the search engine. + +###### Are all posts displayed from that category? + +##### Try searching for a specific post. + +###### Does it present the expected post? #### SQLite @@ -90,40 +107,22 @@ cc8f5dcf760f ascii-art-web-docker "./server" 6 seconds ag ``` ###### Run the command `"docker ps -a"` to see containers. Is the docker containers running as above? -##### Try running the comment `"docker network ls"` -``` -NETWORK ID NAME DRIVER SCOPE -24560f95a216 bridge local -24560f95a216 bridge bridge local -3f12239adb4f host host local -159cdc8d8083 none null local -``` -###### Is the network a bridge driver and does it appear in the list of networks as above? - -##### Try openning a shell to the running container, using the [command](https://docs.docker.com/engine/reference/commandline/exec/) `"docker exec [OPTIONS] CONTAINER COMMAND [ARG...]"` (ex: `"docker exec -it /bin/bash"`) and ping the other container that are connected to the same network, for [example](https://docs.docker.com/engine/tutorials/networkingcontainers/). - -###### Did it ping with success? Are the multiple services/containers communicating between each other? - ###### Does the project present no [unused object](https://docs.docker.com/config/pruning/)? ###### Did the server behaved as expected?(did not crashed) ###### Does the server use the right [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)? -###### Has the website runned without crashing at anytime? - ###### Are all the pages working? (Absence of 404 page?) ###### Does the project handle [HTTP status 400 - Bad Requests](https://kinsta.com/knowledgebase/400-bad-request/#causes)? ###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? -###### Are the libraries used allowed? +###### Are the allowed packages being respected? #### General -###### +Is the database a service? - ###### +Does the project present a script to build the images and containers? (using a script to simplify the build) #### Basic diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index 7ab857c5e..b81174df5 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -7,12 +7,9 @@ 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. - -Your forum should work based on services. Using services to create a project means that instead of having a monolith architecture, you actually have various components distributed across a cluster of instances. In other words, dividing the project in smaller "projects", this way it becomes easier to understand and your project will become more scalable. - -- For example for a taxi like application you can divide it in the following services : passenger management, billing, notifications, payments, trip management and driver management. - -- Services can [communicate](https://medium.com/@nathankpeck/microservice-principles-smart-endpoints-and-dumb-pipes-5691d410700f) using : **Request-Response**, this being that one service invokes another service by making an request, usually to store or retrieve data. Or **Observer**, this is a event base communication, so one or more services are listening for an event and wen triggered they respond to the event. +- 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. #### SQLite @@ -71,36 +68,13 @@ The forum must be able to check if the email provided is present in the database 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. -You must build a network using containers. In docker you can create your own network of containers through network drivers. Docker provides two network drivers : `bridge` and `overlay`. - -- You can see the default network : - -```console -student$ docker network ls -NETWORK ID NAME DRIVER SCOPE -b64130fc5aae bridge bridge local -033f3a191908 host host local -159cdc8d8083 none null local -``` - -Your objective is to use the [`bridge` network](https://docs.docker.com/engine/tutorials/networkingcontainers/) to create your own network for the services. Docker connects to this network by default, creating a subnet and a gateway for the `bridge` network. The command `docker run` automatically adds containers to it. To inspect the network for more details you can just run `docker network inspect `. - -- Each service will have to run in a container that will be associated to a docker host, which must contain at least two containers/services and these must be connected to a bridge, creating a network for [example](https://docs.docker.com/engine/tutorials/bridge3.png). - -- You must be careful, bridges are a private network, so it is restricted to a single Docker host, for instance containers can communicate within networks but not across networks. - - You may have to use [Port Mapping](https://docker-k8s-lab.readthedocs.io/en/latest/docker/port-mapping.html). - - Or attaching containers to multiple networks connecting with all containers on all networks creating a ["hub"](https://docs.docker.com/engine/tutorials/bridge3.png). - This project will help you learn about: - Client utilities. - The basics of web : - - Server - HTML - HTTP - - Services - Sessions and cookies -- Docker network bridge - Using and [setting up Docker](https://docs.docker.com/get-started/) : - Services and dependencies. - Containerizing an application. @@ -108,7 +82,6 @@ This project will help you learn about: - Creating images. - SQLite language. - Manipulation of databases. -- How to manage dependencies in Go. - The basics of encryption. ### Instructions From f983f6506e8a4e63d32ba629b43dae8d59433cbd Mon Sep 17 00:00:00 2001 From: OGordoo Date: Fri, 6 Mar 2020 15:49:01 +0000 Subject: [PATCH 12/20] forum clarification --- subjects/forum/forum.audit.en.md | 134 +++++++++++++++++-------------- subjects/forum/forum.en.md | 73 +++++++++-------- 2 files changed, 110 insertions(+), 97 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index a7a85c814..6f11d8c37 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -1,41 +1,32 @@ -#### Functional - -##### Enter the website as a non-registered user. - -###### Are you able to see posts/comments? - -##### Enter the website as a non-registered user. +#### Authentication -###### 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 ` 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 ` 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 + 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 "./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 - 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) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index b81174df5..ac2cd99be 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -4,12 +4,10 @@ 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). From 582c4615d5e1102df910cf9884f5588151970ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sat, 7 Mar 2020 14:34:06 +0000 Subject: [PATCH 13/20] SQLite is not a language --- subjects/forum/forum.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index ac2cd99be..ce8e29c9a 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -80,7 +80,7 @@ This project will help you learn about: - Containerizing an application. - Compatibility/Dependency. - Creating images. -- SQLite language. +- SQL language. - Manipulation of databases. - The basics of encryption. From 9c0f23cd2ec8722a42105dc11f6c276e3a93715b Mon Sep 17 00:00:00 2001 From: OGordoo Date: Mon, 9 Mar 2020 09:45:25 +0000 Subject: [PATCH 14/20] sqlite language removed --- subjects/forum/forum.en.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index ac2cd99be..ce5bc818e 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -76,13 +76,14 @@ This project will help you learn about: - HTML - HTTP - Sessions and cookies -- Using and [setting up Docker](https://docs.docker.com/get-started/) : - - Containerizing an application. - - Compatibility/Dependency. - - Creating images. -- SQLite language. - - Manipulation of databases. -- The basics of encryption. +- Using and [setting up Docker](https://docs.docker.com/get-started/) + - Containerizing an application + - Compatibility/Dependency + - Creating images +- SQLite + - Manipulation of databases + - SQL +- The basics of encryption ### Instructions From 1cec85d68c3b1d0ac0222893152d9df62685d3fc Mon Sep 17 00:00:00 2001 From: OGordoo Date: Mon, 9 Mar 2020 09:50:36 +0000 Subject: [PATCH 15/20] my bad, sql language --- subjects/forum/forum.en.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index ce5bc818e..5b2e40257 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -80,9 +80,8 @@ This project will help you learn about: - Containerizing an application - Compatibility/Dependency - Creating images -- SQLite +- SQL language - Manipulation of databases - - SQL - The basics of encryption ### Instructions From a15b718e5eeaaf410c7d2d0d79def639953ce54c Mon Sep 17 00:00:00 2001 From: OGordoo Date: Tue, 17 Mar 2020 12:49:35 +0000 Subject: [PATCH 16/20] authentication correction --- subjects/forum/forum.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index 5b2e40257..ee89afc7d 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -33,7 +33,7 @@ Instructions for user registration: - 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 when stored 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. From 793d8d9a0412cb97b42066b7e633317a865d96ac Mon Sep 17 00:00:00 2001 From: LEEDASILVA <39002521+LEEDASILVA@users.noreply.github.com> Date: Tue, 17 Mar 2020 13:13:46 +0000 Subject: [PATCH 17/20] Update forum.audit.en.md --- subjects/forum/forum.audit.en.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 6f11d8c37..09301b0c0 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -24,9 +24,9 @@ ###### Can you confirm that the browser non logged remains unregistered? -##### 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. +##### Try opening two different browsers and login into one of them. Then create a new post or just add a comment. Refresh both browsers. -###### Does it present the changes made in the logged browser? +###### Does it present the comment/post on both browsers? #### SQLite From 619fd03ddca1c20c7f226cf3d73beb69258c2e88 Mon Sep 17 00:00:00 2001 From: Christopher Fremond Date: Wed, 18 Mar 2020 02:36:44 +0000 Subject: [PATCH 18/20] typos --- subjects/forum/forum.en.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index ee89afc7d..919f056e4 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -5,7 +5,7 @@ This project consists in creating a web forum that allows : - communication between users. -- associate categories to posts. +- associating categories to posts. - liking and disliking posts and comments. - filtering posts. @@ -25,7 +25,7 @@ To know more about SQLite you can check the [SQLite page](https://www.sqlite.org 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". +You should use cookies to allow each user to have only one opened session. Each of this sessions must contain an expiration date. It is up to you to decide how long the cookie stays "alive". Instructions for user registration: @@ -35,7 +35,7 @@ Instructions for user registration: - Must ask for password - The password must be encrypted when stored -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. +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, it will return an error response. #### Communication @@ -49,7 +49,7 @@ In order for users to communicate between each other, they will have to be able #### Likes and Dislikes -Only registered users will be able to like or dislike posts and comments. +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). @@ -90,7 +90,7 @@ This project will help you learn about: - 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). -- It is recommend that the code should present a **test file**. +- It is recommended that the code should present a **test file**. ### Allowed packages From af31d80bd32ed4b8e31b3edb8a8e8f9e063fafe3 Mon Sep 17 00:00:00 2001 From: Christopher Fremond Date: Wed, 18 Mar 2020 02:39:37 +0000 Subject: [PATCH 19/20] clarification --- subjects/forum/forum.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md index 919f056e4..7abdc829d 100644 --- a/subjects/forum/forum.en.md +++ b/subjects/forum/forum.en.md @@ -17,7 +17,7 @@ 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 and one INSERT. +- You must use at least one SELECT, one CREATE and one INSERT queries. To know more about SQLite you can check the [SQLite page](https://www.sqlite.org/index.html). From 33bcfecc017908674e4ff4e033b7cb11dd1905d1 Mon Sep 17 00:00:00 2001 From: Christopher Fremond Date: Wed, 18 Mar 2020 02:42:49 +0000 Subject: [PATCH 20/20] typos of audit fixed --- subjects/forum/forum.audit.en.md | 37 +++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md index 09301b0c0..fb88882dd 100644 --- a/subjects/forum/forum.audit.en.md +++ b/subjects/forum/forum.audit.en.md @@ -1,10 +1,10 @@ #### Authentication -###### Is it asked in the register for an email and a password? +###### Are an email and a password asked for in the resgistration? -###### Does the project detects if the email or password are wrong? +###### Does the project detect if the email or password are wrong? -###### Does the project detects if the email or user name is already taken in the register? +###### Does the project detect if the email or user name is already taken in the registration? ##### Try to register as a new user in the forum. @@ -36,15 +36,15 @@ ###### Does the code contain at least one SELECT query? -##### Try registering in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT * FROM users;). +##### Try registering in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT \* FROM users;). ###### Does it present the user you created? -##### Try creating a post in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT * FROM post;). +##### Try creating a post in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT \* FROM post;). ###### Does it present the post you created? -##### Try creating a comment in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT * FROM comment;). +##### Try creating a comment in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT \* FROM comment;). ###### Does it present the comment you created? @@ -52,20 +52,24 @@ ###### Does the project have Dockerfiles? -##### 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. +##### 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 latest 85a65d66ca39 7 seconds ago 795MB ``` + ###### Does all images build as above? ##### 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 "./server" 6 seconds ago Up 6 seconds 0.0.0.0:8080->8080/tcp ascii-art-web ``` + ###### Is the docker containers running as above? ###### Does the project present no [unused object](https://docs.docker.com/config/pruning/)? @@ -73,54 +77,71 @@ cc8f5dcf760f "./server" 6 seconds ag #### Functional ##### Enter the forum as a non-registered user. + ###### Are you prohibited to create a post? ##### Enter the forum as a non-registered user. + ###### Are you prohibited to create a comment? ##### Enter the forum as a non-registered user and try to like a comment. + ###### Are you prohibited to like a post? ##### Enter the forum as a non-registered user and try to dislike a comment. + ###### Are you prohibited to dislike a comment? ##### 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? ##### 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? ##### Enter the forum as a registered user and try to create a post. + ###### Were you able to create a post? ##### Enter the forum as a registered user and try to create an empty post. + ###### Were you prohibited to create the post? ##### 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? ##### Enter the forum as a registered user and try to like or dislike a post. + ###### Can you like or dislike the post? ##### Enter the forum as a registered user and try to like or dislike a comment. + ###### Can you like or dislike the comment? ##### 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) @@ -133,7 +154,7 @@ cc8f5dcf760f "./server" 6 seconds ag ###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? -###### Are the allowed packages being respected? +###### Are only the allowed packages being used? #### General