Add availibility endpoint / cleanup json response
This commit is contained in:
parent
1c45a4a94b
commit
8a11a3b779
@ -122,11 +122,12 @@ A json object for the account to delete with `id`.
|
||||
```
|
||||
|
||||
##### Response
|
||||
A json object for the deleted account with `username` and `email`.
|
||||
A json object for the deleted account with status code, message, `id`, `username` and `email`.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 200,
|
||||
"message": " '`username`' account with email '`email`' has been successfully deleted."
|
||||
"data": {
|
||||
"id": 15,
|
||||
"username": "jean",
|
||||
@ -152,24 +153,23 @@ A json object for the specified account with an array of `meeting`.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 200,
|
||||
"data": [
|
||||
{
|
||||
"id": "worldwide-strategy-meeting-for-11059",
|
||||
"title": "Worldwide strategy meeting for growth",
|
||||
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
|
||||
"start_time": 2022-02-16 20:00:00,
|
||||
"timezone": "Europe/Brussels",
|
||||
"duration": 60,
|
||||
"status": 1
|
||||
},
|
||||
{
|
||||
"id": "follow-up-with-tech-team-21850",
|
||||
"title": "Follow up with tech team",
|
||||
"duration": 120,
|
||||
"status": 0
|
||||
}
|
||||
]
|
||||
"status": 200,
|
||||
"data": [{
|
||||
"id": "worldwide-strategy-meeting-for-11059",
|
||||
"title": "Worldwide strategy meeting for growth",
|
||||
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
|
||||
"start_time": "2022-02-16 20:00:00",
|
||||
"timezone": "Europe/Brussels",
|
||||
"duration": 60,
|
||||
"status": 1
|
||||
},
|
||||
{
|
||||
"id": "follow-up-with-tech-team-21850",
|
||||
"title": "Follow up with tech team",
|
||||
"duration": 120,
|
||||
"status": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@ -228,7 +228,7 @@ A json object for the meeting to update with `id`, `acount_id` and any of `title
|
||||
{
|
||||
"id": "worldwide-strategy-meeting-for-11059",
|
||||
"account_id": 5,
|
||||
"start_time": 2022-02-16 20:00:00,
|
||||
"start_time": "2022-02-16 20:00:00",
|
||||
"timezone": "Europe/Brussels",
|
||||
"status": 1
|
||||
}
|
||||
@ -244,7 +244,7 @@ A json object for the updated meeting with `id`, `title`, `description`, `start_
|
||||
"id": "worldwide-strategy-meeting-for-11059",
|
||||
"title": "Worldwide strategy meeting for growth",
|
||||
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
|
||||
"start_time": 2022-02-16 20:00:00,
|
||||
"start_time": "2022-02-16 20:00:00",
|
||||
"timezone": "Europe/Brussels",
|
||||
"duration: 90,
|
||||
"status": 1
|
||||
@ -266,15 +266,12 @@ A json object for the meeting to delete with `id` and `account_id`.
|
||||
```
|
||||
|
||||
##### Response
|
||||
A json object for the deleted meeting with `id` and `title`.
|
||||
A json object for the deleted meeting with status code and message.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 200,
|
||||
"data": {
|
||||
"id": "worldwide-strategy-meeting-for-11059",
|
||||
"title": "Worldwide strategy meeting for growth",
|
||||
}
|
||||
"message": "Meeting '`meeting_title`' has been successfully deleted."
|
||||
}
|
||||
```
|
||||
|
||||
@ -343,7 +340,7 @@ A json object for the meeting to add with **`meeting_id`** and **`possible_date`
|
||||
```
|
||||
{
|
||||
"meeting_id": "worldwide-strategy-meeting-for-11059",
|
||||
"possible_date": 2020-02-18
|
||||
"possible_date": "2020-02-18"
|
||||
}
|
||||
```
|
||||
|
||||
@ -356,7 +353,7 @@ A json object for the added meeting with `id`, `meeting_id` and `possible_date`.
|
||||
"data": {
|
||||
"id": 5,
|
||||
"meeting_id": "worldwide-strategy-meeting-for-11059",
|
||||
"possible_date": 2020-02-18
|
||||
"possible_date": "2020-02-18"
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -374,15 +371,12 @@ A json object for the possible date to delete with `id` and `account_id`.
|
||||
```
|
||||
|
||||
##### Response
|
||||
A json object for the deleted possible date with `id` and `possible_date`.
|
||||
A json object for the deleted possible date with status code and message.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 200,
|
||||
"data": {
|
||||
"id": 15,
|
||||
"possible_date": 2020-02-18
|
||||
}
|
||||
"message": "Date '`possible_date`' has been successfully removed for the '`meeting_title`'."
|
||||
}
|
||||
```
|
||||
|
||||
@ -492,16 +486,103 @@ A json object for the participant to delete with `id`.
|
||||
```
|
||||
|
||||
##### Response
|
||||
A json object for the deleted participant with `id`, `account_id` and `meeting_id`.
|
||||
A json object for the deleted participant with status code and message.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 200,
|
||||
"data": {
|
||||
"id": 15,
|
||||
"account_id": 5,
|
||||
"meeting_id": "worldwide-strategy-meeting-for-11059"
|
||||
}
|
||||
"message": "The '`participant_username`' has been successfully removed from the meeting '`meeting_title`'."
|
||||
}
|
||||
```
|
||||
|
||||
### **Availibility** | `availibility`
|
||||
| field | data type | metadata |
|
||||
| :--------------- | :-------- | :--------------------------------- |
|
||||
| id | int | primary key, auto-increment |
|
||||
| participant_id | int | foreign key, required |
|
||||
| possible_date_id | int | foreign key, required |
|
||||
| preference | boolean | `0` (ideal) or `1` (yes), required |
|
||||
| start_time | timestamp | required |
|
||||
| end_time | timestamp | required |
|
||||
| timezone | varchar | required |
|
||||
| created_at | datetime | generated by database |
|
||||
|
||||
GET / DELETE / UPDATE
|
||||
|
||||
#### Add an availibility
|
||||
**`POST /api/availibility`**
|
||||
|
||||
##### Request
|
||||
A json object with the availibility to add with **`participant_id`**, **`possible_date_id`** and an array of intervals with **`preference`**, **`start_time`**, **`end_time`** and **`timezone`**.
|
||||
|
||||
```
|
||||
{
|
||||
"participant_id": 5,
|
||||
"possible_date_id": 21,
|
||||
"intervals": [{
|
||||
"preference": 0,
|
||||
"start_time": "2021-06-25 09:00:00",
|
||||
"end_time": "2021-06-25 13:00:00",
|
||||
"timezone": "Europe/Brussels"
|
||||
},
|
||||
{
|
||||
"preference": 1,
|
||||
"start_time": "2021-06-25 15:00:00",
|
||||
"end_time": "2021-06-25 20:00:00",
|
||||
"timezone": "Europe/Brussels"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
##### Response
|
||||
A json object with the availibility to add with **`participant_id`**, **`possible_date_id`** and an array of intervals with **`id`**, **`preference`**, **`start_time`**, **`end_time`** and **`timezone`**.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 201,
|
||||
"data": {
|
||||
"participant_id": 5,
|
||||
"possible_date_id": 21,
|
||||
"intervals": [{
|
||||
"id": 45,
|
||||
"preference": 0,
|
||||
"start_time": "2021-06-25 09:00:00",
|
||||
"end_time": "2021-06-25 20:00:00",
|
||||
"timezone": "Europe/Brussels"
|
||||
},
|
||||
{
|
||||
"id": 46,
|
||||
"preference": 1,
|
||||
"start_time": "2021-06-25 09:00:00",
|
||||
"end_time": "2021-06-25 20:00:00",
|
||||
"timezone": "Europe/Brussels"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Delete availibility for a date
|
||||
**`DELETE /api/availibility/:id`**
|
||||
|
||||
##### Request
|
||||
A json object for the availibility to delete with **`participant_id`** and **`possible_date_id`**.
|
||||
|
||||
```
|
||||
{
|
||||
"participant_id": 5,
|
||||
"possible_date_id": 21
|
||||
}
|
||||
```
|
||||
|
||||
##### Response
|
||||
A json object for the deleted availibility with status code and message.
|
||||
|
||||
```
|
||||
{
|
||||
"status": 200,
|
||||
"message": "Availibility successfully deleted for `participant_username` on `possible_date`"
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user