|
| 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 | + |
| 14 | +### API Calls |
| 15 | + |
| 16 | +`GET /users` |
| 17 | +Gets information about every user in the system. Returns a List of Users. |
| 18 | + |
| 19 | +`GET /users/{id: u64}` |
| 20 | +Gets information about the user with the given id. Returns a single User. |
| 21 | + |
| 22 | +`POST /users` |
| 23 | +Creates a new user. The body of POST should be a valid User. Returns the id of the created user. |
| 24 | + |
| 25 | +`POST /users/{id: u64}` |
| 26 | +Updates a given user. |
| 27 | + |
| 28 | +### Data Models |
| 29 | + |
| 30 | +Many of the API calls share a common set of data models, represented in JSON format. |
| 31 | + |
| 32 | +#### User |
| 33 | +| Property Name | Type | Optional | Description | |
| 34 | +|---------------|--------|----------|-------------| |
| 35 | +| id | u64 | No | The internal id of the user | |
| 36 | +| first_name | String | No | The first name of the user | |
| 37 | +| last_name | String | no | The last name of the user | |
| 38 | +| banner_id | u64 | No | The banner id of the user | |
| 39 | +| email | String | Yes | The Rowan email of the user. If the user does not have an email, this will be null of non-existent | |
| 40 | +``` |
| 41 | +{ |
| 42 | + "id": 11, |
| 43 | + "first_name": "John" |
| 44 | + "last_name": "Smith", |
| 45 | + "banner_id": 9162xxxxx, |
| 46 | + |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +#### Partial User |
| 51 | +| Property Name | Type | Optional | Description | |
| 52 | +|---------------|--------|----------|-------------| |
| 53 | +| first_name | String | Yes | The first name of the user | |
| 54 | +| last_name | String | Yes | The last name of the user | |
| 55 | +| banner_id | u64 | Yes | The banner id of the user | |
| 56 | +| email | String | Yes | The Rowan email of the user. If the user does not have an email, this will be null of non-existent | |
| 57 | +``` |
| 58 | +{ |
| 59 | + "first_name": "John" |
| 60 | + "last_name": "Smith", |
| 61 | + "banner_id": 9162xxxxx, |
| 62 | + |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +#### List of Users |
| 67 | +| Property Name | Type | Optional | Description | |
| 68 | +|---------------|---------------|----------|-----------------| |
| 69 | +| users | List of Users | No | A list of Users | |
| 70 | +``` |
| 71 | +{ |
| 72 | + "users": [ |
| 73 | + { |
| 74 | + "first_name": "John" |
| 75 | + "last_name": "Smith", |
| 76 | + "banner_id": 9162xxxxx, |
| 77 | + |
| 78 | + }, |
| 79 | + { |
| 80 | + "first_name": "Mike" |
| 81 | + "last_name": "Johnson", |
| 82 | + "banner_id": 9162xxxxx, |
| 83 | + |
| 84 | + } |
| 85 | + ] |
| 86 | +} |
| 87 | +``` |
0 commit comments