From 390d6f437d02fd4c42f5e2738bfa8e1846d1fbff Mon Sep 17 00:00:00 2001 From: "Henrique V. Ehrenfried" <hvehrenfried@inf.ufpr.br> Date: Mon, 4 Jun 2018 11:11:00 -0300 Subject: [PATCH] Start to create README. --- README.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 866baed..31d4f1d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,74 @@ # My Application -The project is generated by [LoopBack](http://loopback.io). \ No newline at end of file +The project is generated by [LoopBack](http://loopback.io). + +## Setup + +1) You should create a PostgreSQL database, and change de SMPPIR_CheckIn2 connection in the file `server/datasources.json` + +2) Temporarily change the first acls rule from `common/end_user.json` from `DENY` to `ALLOW` + +3) Create the admin user following the example + + +```bash +curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ + "name": "Administrador Supimpa", \ + "email": "abc%40admin.com", \ + "permission": "admin", \ + "registration": "NMBR#123456789", \ + "username": "admin", \ + "password": "admin" \ + }' 'http://localhost:3000/api/end_users' + +``` + +4) Now that you created an admin, we can reverse what we made in the 2nd step. To do so, it is needed that you change the first acls rule from the file `common/end_user.json` from `DENY` to `ALLOW` + +5) Now, access you API URL under the route `/explorer` + +6) Log in using the route `POST /end_users_login` and the information that you used to create the admin + +Example: + +```json +{ + "email": "abc@admin.com", + "password": "admin" +} +``` +The result will be something similar to: +```json +{ + "result": { + "id": "2AMlMt9SaMGtjqvi1mjxOWx5Leq8vZgIUOA2vBwTORFAhbmIhgVwRpSICRB7xARE", + "ttl": 1209600, + "created": "2018-06-04T13:14:02.316Z", + "userId": 1 + } +} +``` + + +7) Copy the id resulted of this query and set the Acces token in the top of the page + +8) Now create an user's account using the route `POST /end_user` and: + +```json +{ + "name": "Usuário Incial", + "email": "user@user.com", + "permission": "user", + "registration": "USR#123", + "username": "user", + "password": "user" +} +``` + +9) Create a category type using the route `POST /categories` and: + +```json +{ + "category_name": "Categoria teste", + "category_description": "Categoria usada para testar funcionalidades" +} \ No newline at end of file -- GitLab