Skip to content

Commit 86d9573

Browse files
committed
docs(server): complete readme with student path
1 parent ffbc9fd commit 86d9573

File tree

1 file changed

+57
-21
lines changed

1 file changed

+57
-21
lines changed

Api/Readme.md

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,23 @@ pub struct User {
5454
}
5555
```
5656

57-
## User Endpoints
57+
## Student Model
58+
59+
The `Student` model represents a user in the system. Here's the structure of the `Student` model:
60+
61+
```rust
62+
pub struct Students {
63+
pub user_id: Option<ObjectId>, // The student id linked to user ID
64+
pub duree: i32, // The duration of the stage/internship
65+
pub niveau: String, // The graduation level
66+
pub type_contrat: String, // Type of contract
67+
pub date_debut: BsonDateTime, // Date of start
68+
pub lieu: String, // Place of stage
69+
pub recherche: bool, // Currently looking for ?
70+
}
71+
```
72+
73+
## Endpoints
5874

5975
### Create User - `POST /user`
6076

@@ -71,43 +87,51 @@ curl -X POST -H "Content-Type: application/json" -d '{
7187
}' http://127.0.0.1:8000/user
7288
```
7389

74-
curl -X POST -H "Content-Type: application/json" -d '{
75-
"duree":5,
76-
"niveau": "BAC+5",
77-
"type_contrat": "alternance",
78-
"date_debut": {
79-
"$date": {"$numberLong": "1644566400000"}
80-
},
81-
"lieu": "Paris",
82-
"recherche": true
83-
84-
}' http://127.0.0.1:8000/student
90+
> To create a student statut must be set to "student"
8591
86-
### Get All Users - `GET /users`
92+
### Get queries
8793

8894
Returns a list of all users in the system. No request body is required for this endpoint.
8995

90-
Example:
96+
Examples:
97+
98+
#### Get All Users - `GET /users`
9199

92100
```bash
93101
curl -X GET http://127.0.0.1:8000/users
94102
```
95103

96-
### Get User - `GET /user/<id>`
104+
#### Get All Students - `GET /students`
105+
106+
```bash
107+
curl -X GET http://127.0.0.1:8000/students
108+
```
109+
110+
### Get queries
97111

98112
Returns the details of a specific user. Replace `<id>` with the ID of the user you want to retrieve. No request body is required for this endpoint.
99113

100-
Example:
114+
Examples:
115+
116+
#### Get User - `GET /user/<id>`
101117

102118
```bash
103119
curl -X GET http://127.0.0.1:8000/user/<id>
104120
```
105121

106-
### Update User - `PUT /user/<id>`
122+
#### Get Student - `GET /student/<id>`
123+
124+
```bash
125+
curl -X GET http://127.0.0.1:8000/student/<id>
126+
```
127+
128+
### Update queries
107129

108130
Updates the details of a specific user. Replace `<id>` with the ID of the user you want to update. The request body should be a JSON object with the fields to update.
109131

110-
Example:
132+
Examples:
133+
134+
#### Update User - `PUT /user/<id>`
111135

112136
```bash
113137
curl -X PUT -H "Content-Type: application/json" -d '{
@@ -119,6 +143,9 @@ curl -X PUT -H "Content-Type: application/json" -d '{
119143
}' http://127.0.0.1:8000/user/<id>
120144
```
121145

146+
#### Update Student - `PUT /student/<id>`
147+
148+
```bash
122149
curl -X PUT -H "Content-Type: application/json" -d '{
123150
"duree":4,
124151
"niveau": "BAC+4",
@@ -131,18 +158,27 @@ curl -X PUT -H "Content-Type: application/json" -d '{
131158
"lieu": "Paris",
132159
"recherche": false
133160
134-
}' http://127.0.0.1:8000/student/65a17960c47012ed8f140bfe
161+
}' http://127.0.0.1:8000/student/65a2c1f81cb256b4957fee3c
162+
```
135163

136-
### Delete User - `DELETE /user/<id>`
164+
### Delete queries
137165

138166
Deletes a specific user. Replace `<id>` with the ID of the user you want to delete. No request body is required for this endpoint.
139167

140-
Example:
168+
Examples:
169+
170+
#### Delete User - `DELETE /user/<id>`
141171

142172
```bash
143173
curl -X DELETE http://127.0.0.1:8000/user/<id>
144174
```
145175

176+
#### Delete Student - `DELETE /student/<id>`
177+
178+
```bash
179+
curl -X DELETE http://127.0.0.1:8000/student/<id>
180+
```
181+
146182
### Login - `POST /login`
147183

148184
Logs in a user. The request body should be a JSON object with the following properties:

0 commit comments

Comments
 (0)