+21
-13
docs/routes/user.md
+21
-13
docs/routes/user.md
···
1
-
## `/user`
2
-
3
-
### `/user/login`
1
+
## /user
4
2
5
-
Method: POST
3
+
### POST /user/login
6
4
7
5
#### Request
8
6
···
15
13
16
14
#### Response
17
15
18
-
`200 OK`
16
+
`set-cookie: SESSION=SFM1MTI.eyJ1c2VyX2lkIjoiMDE5YjZiMjgtZDc0YS03ZjBiLTg3N;`
19
17
20
18
```json
21
19
{
22
-
"id": "3aedc1d9-79cc-45fe-a294-938351b9f83d",
23
-
"role": "bombeiro"
20
+
"access_level": "developer"
24
21
}
25
22
```
26
23
27
-
### `/user/password`
28
-
29
-
Method: Put
24
+
### PUT /user/password
30
25
31
26
#### Request
32
27
···
40
35
41
36
#### Response
42
37
43
-
`200 OK`
38
+
```txt
39
+
Senha atualizada com sucesso!
40
+
```
44
41
45
-
```plaintext
46
-
Senha atualizada com sucesso!
42
+
### GET /user/profile
43
+
44
+
#### Response
45
+
46
+
```json
47
+
{
48
+
"id": "b2c3d4e5-f6g7-8901-bcde-f23456789012",
49
+
"full_name": "Maria Oliveira Costa",
50
+
"registration": "000000",
51
+
"user_role": "Desenvolvedor",
52
+
"email": "maria.oliveira@empresa.com.br",
53
+
"phone": "+55 (81) 9 8888-8888"
54
+
}
47
55
```
+5
-1
src/app/domain/user/login.gleam
+5
-1
src/app/domain/user/login.gleam
···
40
40
///
41
41
/// The actual Cookie is **encrypted**.
42
42
///
43
-
/// TODO:
43
+
/// ```json
44
+
/// {
45
+
/// "access_level": "developer"
46
+
/// }
47
+
/// ```
44
48
pub fn handle_request(request req: wisp.Request, ctx ctx: Context) {
45
49
use <- wisp.require_method(req, http.Post)
46
50
use body <- wisp.require_json(req)