Add API request for meeting

This commit is contained in:
rui hildt 2020-03-25 19:42:00 +01:00
parent 8f6dab9cae
commit 60e7da542b
4 changed files with 208 additions and 65 deletions

View File

@ -6,12 +6,12 @@ ___
| field | data type | metadata | | field | data type | metadata |
| :-------------| :---------------- | :-------------------------------------------------- | | :-------------| :---------------- | :-------------------------------------------------- |
| id | unsigned integer | primary key, auto-increments, generated by database | | id | unsigned integer | primary key, auto-increments, generated by database |
| username | string | required | | username | varchar | required |
| email | string | required | | email | varchar | required |
| password | string | required | | password | varchar | required |
| timezone | string | | | timezone | varchar | |
| earliest_time | string | | | earliest_time | varchar | |
| latest_time | string | | | latest_time | varchar | |
| created_at | datetime | generated by database | | created_at | datetime | generated by database |
#### Register an account #### Register an account
@ -22,7 +22,7 @@ A json object for the user to register with **`username`**, **`email`**, **`pass
``` ```
{ {
"username": "jean, "username": "jean",
"email": "jean@example.com", "email": "jean@example.com",
"password": "really-strong-password", "password": "really-strong-password",
"timezone": "Europe/Brussels", "timezone": "Europe/Brussels",
@ -48,63 +48,6 @@ A json object for the registered user with `id`, `username`, `email`, `timezone`
} }
``` ```
#### Update an account
**`PUT /api/account/:id/profile`**
##### Request
A json object for the user to register with `id` and any of `username`, `email`, `password`, `timezone`, `earliest_time`, `latest_time`.
```
{
"id": 15,
"earliest_time":"08:30 AM",
"latest_time":"08:00 PM"
}
```
##### Response
A json object for the registered user with `id`, `username`, `email`, `timezone`, `earliest_time` and `latest_time`.
```
{
"status": 200,
"data": {
"id": 1,
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"
}
}
```
#### Delete an account
**`DELETE /api/account/:id`**
##### Request
A json object for the user to delete with `id`.
```
{
"id": 15
}
```
##### Response
A json object for the deleted user with `username` and `email`.
```
{
"status": 200,
"data": {
"id": 15,
"username": "jean",
"email": "jean@example.com"
}
}
```
#### Log in an account #### Log in an account
**`POST /api/account/login`** **`POST /api/account/login`**
@ -133,4 +76,204 @@ A json object for the registered user with `id`, `username`, `email`, `timezone`
"latest_time":"10:00 PM"l "latest_time":"10:00 PM"l
} }
} }
```
#### Update an account
**`PUT /api/account/:id/profile`**
##### Request
A json object for the user to register with `id` and any of `username`, `email`, `password`, `timezone`, `earliest_time`, `latest_time`.
```
{
"id": 15,
"earliest_time": "08:30 AM",
"latest_time": "08:00 PM"
}
```
##### Response
A json object for the registered user with `id`, `username`, `email`, `timezone`, `earliest_time` and `latest_time`.
```
{
"status": 200,
"data": {
"id": 1,
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time": "09:30 AM",
"latest_time": "10:00 PM"
}
}
```
#### Delete an account
**`DELETE /api/account/:id`**
##### Request
A json object for the user to delete with `id`.
```
{
"id": 15
}
```
##### Response
A json object for the deleted user with `username` and `email`.
```
{
"status": 200,
"data": {
"id": 15,
"username": "jean",
"email": "jean@example.com"
}
}
```
### **Meetings** | `meeting`
| field | data type | metadata |
| :---------- | :-------- | :-------------------------------------------------------------------------------- |
| id | varchar | primary key, first 30 chars of `title` with words separated by `-` + 5 random int |
| title | varchar | required |
| description | varchar | |
| start_time | datetime | |
| timezone | varchar | |
| duration | int | required |
| status | boolean | required: `0` (proposed) or `1` (confirmed) |
| password | varchar | |
| created_at | datetime | generated by database |
#### Add a meeting
**`POST /api/meeting/add`**
##### Request
A json object for the meeting to add with **`id`**, **`title`**, `description`, `start_time`, **`duration`** and `password`.
```
{
"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.",
"duration": 90,
"password": "generic-password"
}
```
##### Response
A json object for the added meeting with `id`, `title`, `description`, `start_time`, `duration`, `status` and `password`.
```
{
"status": 201,
"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.",
"duration": 90,
"status": 0
}
}
```
#### Get a list of meetings for an account
**`GET /api/meeting/account/:account_id`**
##### Request
A json object with an `account_id`.
```
{
"id": 5
}
```
##### Response
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
}
]
}
```
#### Update a meeting
**`PUT /api/meeting/:id`**
##### Request
A json object for the meeting to update with `id`, `acount_id` and any of `title`, `description`, `start_time`, `timezone`, `duration`, `status` and `password`.
```
{
"id": "worldwide-strategy-meeting-for-11059",
"account_id": 5,
"start_time": 2022-02-16 20:00:00,
"timezone": "Europe/Brussels",
"status": 1
}
```
##### Response
A json object for the updated meeting with `id`, `title`, `description`, `start_time`, `timezone`, `duration` and `status`.
```
{
"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: 90,
"status": 1
}
}
```
#### Delete a meeting
**`DELETE /api/account/:id`**
##### Request
A json object for the meeting to delete with `id` and `account_id`.
```
{
"id": "worldwide-strategy-meeting-for-11059",
"account_id": 5
}
```
##### Response
A json object for the deleted user with `username` and `email`.
```
{
"status": 200,
"data": {
"id": "worldwide-strategy-meeting-for-11059",
"title": "Worldwide strategy meeting for growth",
}
}
``` ```

View File

@ -1 +1 @@
<mxfile host="Electron" modified="2020-03-22T21:58:33.201Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.6.5 Chrome/80.0.3987.137 Electron/8.1.0 Safari/537.36" etag="uflC4bJSEpPzIH64YgOf" version="12.6.5" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="App flow">7V1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3LjndXQfWjYO29b5edE8G7hCwPejk89eL7ekkd+dEnUMrB+Heod0hbkOQXHa5+f3hbPjmV56N2/8A</diagram></mxfile> <mxfile host="Electron" modified="2020-03-25T18:31:26.977Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.6.5 Chrome/80.0.3987.141 Electron/8.1.1 Safari/537.36" etag="QzSuGUuUtPoOGiynkDqc" version="12.6.5" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="App flow">7V1Zd6O4Ev41eUwOEvtjNvdy052eSU8vTznYKDYTjNyAs8yvvwJLNpKwkQmbk+ScPm0EyLiWr0pVpeJIP58/fYi9xewL9lF4BDX/6Ui/OILQNHWL/JeNPK9GdMOhI9M48FdjYDNwE/yH6KBGR5eBjxLuwhTjMA0W/OAERxGapNyYF8f4kb/sDof8ty68KZIGbiZeKI/+DPx0thp1oL0Z/4iC6Yx9M7Dc1ZmxN7mfxngZ0e87gvoo/1udnntsLvpDk5nn48fCkH55pJ/HGKerT/OncxRmxGVk+/np+Wd4dW99+PxX8sf75+x/37/+OF5NNtrnlvUvjFGU1p56dHtzeQGvZ79NHURa8uPXWNOOTfbb0mdGT+QT8tJDHKczPMWRF15uRs9ymqFsWo0cba65wnhBBgEZ/Bel6TOVFW+ZYjI0S+chPUt+Rvz8K7v/xGSHv4vnLp7o5KujZ3qkSAdKrwQv4wnacZ1OpdWLpyjdQSSDilJGmYLMUTJ/QHiOyFOSC2IUemnwwAumR+V7ur5uwyTygfJpH54ZQ+KZNlCeDYtlZr8s4xi24d+wWGb2xbJdT/3ghUv6TR/JzLkxElm5YVRG9cdZkKKbhZfT5JEYXZ4pdzhKKccA+XVn09BLEkr4JI3x/dqKZVevbQ5Ynz7HIY7zL9btkaYRc7Uvxx5QnKKnnTSmZ491gzoD1DsgBsNZDTxubC1gFnJWsLOG1pYu2W9Dl3bBWqUuAatpZcpvPY1j77lwwQIHUZoUZv6WDRTkBzqC/ADXESRgN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fkgtsuHjanGSzfGE1YNoN7TEVs4nJk63m5r+PDBcfIqd5SFg6w6GPYv6dW3nn0nzghxcH3ph1L6hoNF0sVKSyXBBBwrZ01yqJLqmKYkKHvDCYRuRwQiQkF8hMCIKJF57SE/PA98NtIRtMrr4LcwGdketQJIpsawJoa3wegKwymWgVRNCyywI04vJBQQbJYUEM1cTSqCuWhlMmlldomsf5KyXRaFcSnXdJ3JWQIoIIZUGEZUUL4u6qenKo2qq+LHhIg7dMYL6dfrgsSNL4aOsrJVqoKenahpnAEpcebgnnOi430eXErcSm0/Pvn66/qjHq5ZlcTos6Z5IORCbZLCDWW3mzXhbPFHh08+mCqJJ2ORpdnn9XYtUbdCMNV8BOp8SGd7wGYAm8Xcy9WNvbTd7r++nZlRp4tpgKq+IzjQt0r8US1K79t96yaUCvldxXykTsR8ihBOwdwad2RUdZOeUkzpQFRTtOOum1Wh+8Xu42xtwh8LbWeyFeL2+b09zKiVpnrRyCe2dthboNUnNLKyzKFjeVzK0up9svX1KrTGBrmUqLm5iV27wVQzLdS6guvB1Tt+pWqtjCC/1cTZipoUS/1NFSp6UKTeWFtrcUKGtl23LLMclPV5XR7dFXccux4XRXhV1KW3lrVCPA0kCdboMosUuqFHtY9QcStnViA82yHQAcyxQzs5ao6Xt0sNo5sWm2BCGmzmMVe3FtqxAiN4ygENLNjurmkUSo7Opy30wpgWt5n5X98urUI+7r1LSMPS9rTuD266EIyWrbqAk2kC/JdfSWsAWYfB8+myZvtoKgdAPd5tgqGDXbNr5O7XjzvSXb0xVXWVdgn7piOM6uLe9Q2PKuqjmGy6uODttRHVPj48zQ4TRnX0UghzHGafFyYjRnX7CfZfsv/w8=</diagram></mxfile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB