Replace participant serial pk with composite

This commit is contained in:
rui hildt 2020-05-04 19:14:14 +02:00
parent 0202b3af88
commit f6921c0e75
1 changed files with 46 additions and 53 deletions

View File

@ -32,8 +32,8 @@ A json object for the account to register with **`username`**, **`email`**, **`p
"email": "jean@example.com",
"password": "really-strong-password",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"
"earliest_time":"09:30",
"latest_time":"22:00"
}
```
@ -47,8 +47,8 @@ A json object for the registered account with `id`, `username`, `email`, `timezo
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"
"earliest_time":"09:30",
"latest_time":"22:00"
}
```
@ -77,8 +77,8 @@ A json object for the registered account with `id`, `username`, `email`, `timezo
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"l
"earliest_time":"09:30",
"latest_time":"22:00"l
}
```
@ -107,8 +107,8 @@ A json object for the registered account with `id`, `username`, `email`, `timezo
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time": "09:30 AM",
"latest_time": "10:00 PM"
"earliest_time": "09:30",
"latest_time": "22:00"
}
```
@ -306,8 +306,8 @@ A json object for the specified meeting with an array of `participant`.
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "09:30 AM",
"latest_time": "05:00 PM",
"earliest_time": "09:30",
"latest_time": "17:00",
"quorum": 1,
"mandatory": 1,
"host": 1,
@ -318,8 +318,8 @@ A json object for the specified meeting with an array of `participant`.
"id": 28,
"account_id": 11,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "10:00 AM",
"latest_time": "09:00 PM",
"earliest_time": "10:00",
"latest_time": "21:00",
"quorum": 0,
"mandatory": 1,
"host": 0,
@ -385,20 +385,19 @@ A json object for the specified meeting with an array of `participant`.
### **Participants** | `participant`
| field | data type | metadata |
| :------------ | :-------- | :-------------------------- |
| id | int | primary key, auto-increment |
| account_id | varchar | required |
| meeting_id | varchar | required |
| earliest_time | datetime | |
| latest_time | datetime | |
| quorum | boolean | `0` (no) or `1` (yes) |
| mandatory | boolean | `0` (no) or `1` (yes) |
| host | boolean | `0` (no) or `1` (yes) |
| answered | boolean | `0` (no) or `1` (yes) |
| timezone | varchar | required |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
| field | data type | metadata |
| :------------ | :-------- | :------------------------------ |
| account_id | varchar | required, composite primary key |
| meeting_id | varchar | required, composite primary key |
| earliest_time | datetime | |
| latest_time | datetime | |
| quorum | boolean | `0` (no) or `1` (yes) |
| mandatory | boolean | `0` (no) or `1` (yes) |
| host | boolean | `0` (no) or `1` (yes) |
| answered | boolean | `0` (no) or `1` (yes) |
| timezone | varchar | required |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
#### Invite a participant
@ -428,7 +427,6 @@ A json object for the participant with `id`, `account_id`, `meeting_id`, `earlie
```
{
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "08:30",
@ -443,17 +441,16 @@ A json object for the participant with `id`, `account_id`, `meeting_id`, `earlie
#### Update a participant
**`PUT /api/participants/:id`**
**`PUT /api/participants/:account_id-:meeting_id`**
##### Request
A json object for the participant to invite with `id` and any of `id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
A json object for the participant to invite with any of `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"account_id": 5,
"earliest_time": "09:30 AM",
"latest_time": "05:00 PM",
"earliest_time": "09:30",
"latest_time": "17:00",
"quorum": 1,
"host": 1,
"answered": 1,
@ -462,36 +459,34 @@ A json object for the participant to invite with `id` and any of `id`, `earliest
##### Response `200`
A json object for the participant with `id`, `account_id`, `meeting_id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
A json object for the participant with `account_id`, `meeting_id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"data": {
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "09:30 AM",
"latest_time": "05:00 PM",
"quorum": 1,
"mandatory": 1,
"host": 1,
"answered": 1,
"timezone": "Europe/Brussels"
}
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "09:30",
"latest_time": "17:00",
"quorum": 1,
"mandatory": 1,
"host": 1,
"answered": 1,
"timezone": "Europe/Brussels"
}
```
#### Delete a participant
**`DELETE /api/participants/:id`**
**`DELETE /api/participants/:account_id-:meeting_id`**
##### Request
A json object for the participant to delete with `id`.
A json object for the participant to delete with `token`.
```
{
"id": 23
"token": "lknlkj-kjbkbj-kbjkbj-jkjh"
}
```
@ -501,11 +496,9 @@ A json object for the deleted participant with `participant_username`, `particip
```
{
"data": {
"participant_username": "Sylvia",
"participant_email": "sylvia@email.com",
"meeting_title": "Worldwide strategy meeting for growth"
}
"participant_username": "Sylvia",
"participant_email": "sylvia@email.com",
"meeting_title": "Worldwide strategy meeting for growth"
}
```