|
| 1 | +## backend |
| 2 | +Coded in Rust, manages database manipulation using AJAX requests from frontend. |
| 3 | + |
| 4 | +### Dependencies: |
| 5 | +* [Rouille 3.0.0](https://github.com/tomaka/rouille) |
| 6 | +* [Diesel 1.3.3](https://github.com/diesel-rs/diesel) |
| 7 | +* [dotenv 0.13.0](https://github.com/sgrif/rust-dotenv) |
| 8 | +* [serde 1.0](https://github.com/serde-rs/serde) |
| 9 | +* [serde_json 1.0](https://github.com/serde-rs/json) |
| 10 | +* [log 0.4](https://github.com/rust-lang-nursery/log) |
| 11 | +* [simplelog](https://github.com/drakulix/simplelog.rs) |
| 12 | + |
| 13 | +### API Calls |
| 14 | + |
| 15 | +`GET /users` |
| 16 | +Gets information about every user in the system. Returns a List of Users. |
| 17 | + |
| 18 | +`GET /users/{id: u64}` |
| 19 | +Gets information about the user with the given id. Returns a single User. |
| 20 | + |
| 21 | +`POST /users` |
| 22 | +Creates a new user. The body of POST should be a valid User. Returns the id of the created user. |
| 23 | + |
| 24 | +`POST /users/{id: u64}` |
| 25 | +Updates a given user. |
| 26 | + |
| 27 | +### Data Models |
| 28 | + |
| 29 | +Many of the API calls share a common set of data models, represented in JSON format. |
| 30 | + |
| 31 | +#### User |
| 32 | +| Property Name | Type | Optional | Description | |
| 33 | +|---------------|--------|----------|-------------| |
| 34 | +| id | u64 | No | The internal id of the user | |
| 35 | +| first_name | String | No | The first name of the user | |
| 36 | +| last_name | String | no | The last name of the user | |
| 37 | +| banner_id | u64 | No | The banner id of the user | |
| 38 | +| email | String | Yes | The Rowan email of the user. If the user does not have an email, this will be null of non-existent | |
| 39 | +``` |
| 40 | +{ |
| 41 | + "id": 11, |
| 42 | + "first_name": "John" |
| 43 | + "last_name": "Smith", |
| 44 | + "banner_id": 9162xxxxx, |
| 45 | + |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +#### Partial User |
| 50 | +| Property Name | Type | Optional | Description | |
| 51 | +|---------------|--------|----------|-------------| |
| 52 | +| first_name | String | Yes | The first name of the user | |
| 53 | +| last_name | String | Yes | The last name of the user | |
| 54 | +| banner_id | u64 | Yes | The banner id of the user | |
| 55 | +| email | String | Yes | The Rowan email of the user. If the user does not have an email, this will be null of non-existent | |
| 56 | +``` |
| 57 | +{ |
| 58 | + "first_name": "John" |
| 59 | + "last_name": "Smith", |
| 60 | + "banner_id": 9162xxxxx, |
| 61 | + |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +#### List of Users |
| 66 | +| Property Name | Type | Optional | Description | |
| 67 | +|---------------|---------------|----------|-----------------| |
| 68 | +| users | List of Users | No | A list of Users | |
| 69 | +``` |
| 70 | +{ |
| 71 | + "users": [ |
| 72 | + { |
| 73 | + "first_name": "John" |
| 74 | + "last_name": "Smith", |
| 75 | + "banner_id": 9162xxxxx, |
| 76 | + |
| 77 | + }, |
| 78 | + { |
| 79 | + "first_name": "Mike" |
| 80 | + "last_name": "Johnson", |
| 81 | + "banner_id": 9162xxxxx, |
| 82 | + |
| 83 | + } |
| 84 | + ] |
| 85 | +} |
| 86 | +``` |
0 commit comments