Remove timezone fields, update time fields, add dbml file

- Most timezones fields weren't useful as time is stored only in UTC
- Dates and preferences are stored in string instead of a date object
This commit is contained in:
rui hildt 2020-08-26 13:14:52 +02:00
parent b8aaae17c5
commit 3d73a857ff
2 changed files with 95 additions and 42 deletions

View File

@ -13,12 +13,12 @@
| field | data type | metadata |
| :------------ | :--------------- | :-------------------------- |
| id | unsigned integer | primary key, auto-increment |
| username | varchar | required |
| email | varchar | required, unique |
| password | varchar | required |
| timezone | varchar | |
| earliest_time | varchar | |
| latest_time | varchar | |
| username | string | required |
| email | string | required, unique |
| password | string | required |
| timezone | string | |
| earliest_time | string | |
| latest_time | string | |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
@ -196,13 +196,12 @@ A json object for the specified account with an array of `meeting`.
| field | data type | metadata |
| :---------- | :-------- | :------------------------------------------ |
| id | uuid | primary key, auto-generated |
| title | varchar | required |
| description | varchar | |
| title | string | required |
| description | string | |
| start_time | datetime | |
| timezone | varchar | required |
| duration | int | required |
| status | boolean | required: `0` (proposed) or `1` (confirmed) |
| password | varchar | |
| password | string | |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
@ -212,14 +211,13 @@ A json object for the specified account with an array of `meeting`.
##### Request
A json object for the meeting to add with **`title`**, `description`, `start_time`, **`duration`** and `password`.
A json object for the meeting to add with **`title`**, `description`, `start_time`, **`duration`**, **status** and `password`.
```
{
"title": "Worldwide strategy meeting for growth",
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
"start_time": "10:00",
"timezone": "Europe/Brussels",
"duration": 90,
"status": 0,
"password": "simple-meeting-password"
@ -236,7 +234,6 @@ A json object for the added meeting with `id`, `title`, `description`, `start_ti
"title": "Worldwide strategy meeting for growth",
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
"start_time": "10:00",
"timezone": "Europe/Brussels",
"duration": 90,
"status": 0,
"password" "simple-meeting-password"
@ -254,7 +251,6 @@ A json object for the meeting to update with any of `title`, `description`, `sta
```
{
"start_time": "2022-02-16 20:00:00",
"timezone": "Europe/Brussels",
"status": 1
}
```
@ -269,7 +265,6 @@ A json object for the updated meeting with `id`, `title`, `description`, `start_
"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
}
@ -409,9 +404,8 @@ A json object for the specified meeting with `meeting_id` and an array of `avail
"account_id": 1,
"possible_date_id": 1,
"preference": false,
"start_time": "09:00:00",
"end_time": "22:00:00",
"timezone": "Europe/Brussels"
"start_time": "09:00",
"end_time": "22:00",
},
{
"id": 2,
@ -421,7 +415,6 @@ A json object for the specified meeting with `meeting_id` and an array of `avail
"preference": false,
"start_time": "10:00:00",
"end_time": "20:00:00",
"timezone": "America/New_York"
},
{
"id": 3,
@ -431,7 +424,6 @@ A json object for the specified meeting with `meeting_id` and an array of `avail
"preference": false,
"start_time": "10:00:00",
"end_time": "14:00:00",
"timezone": "Europe/Brussels"
}
]
@ -441,15 +433,12 @@ A json object for the specified meeting with `meeting_id` and an array of `avail
| field | data type | metadata |
| :------------ | :-------- | :------------------------------------------- |
| account_id | varchar | required, foreign key, composite primary key |
| meeting_id | varchar | required, foreign key, composite primary key |
| earliest_time | datetime | |
| latest_time | datetime | |
| account_id | string | required, foreign key, composite primary key |
| meeting_id | string | required, foreign key, composite primary key |
| 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 |
| host | boolean | required, `0` (no) or `1` (yes) |
| answered | boolean | required, `0` (no) or `1` (yes) |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
@ -459,32 +448,27 @@ A json object for the specified meeting with `meeting_id` and an array of `avail
##### Request
A json object for the participant to add with **`account_id`**, **`meeting_id`**, **`earliest_time`**, **`latest_time`**, **`quorum`**, **`mandatory`**, **`host`**, **`answered`** and **`timezone`**.
A json object for the participant to add with **`account_id`**, **`meeting_id`**, **`quorum`**, **`mandatory`**, **`host`** and **`answered`**.
```
{
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "08:30",
"latest_time": "20:00",
"quorum": 0,
"mandatory": 1,
"host": 0,
"answered": 0,
"timezone": "Europe/Brussels"
}
```
##### Response `201`
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 `id`, `account_id`, `meeting_id`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "08:30",
"latest_time": "20:00",
"quorum": 0,
"mandatory": 1,
"host": 0,
@ -499,12 +483,10 @@ A json object for the participant with `id`, `account_id`, `meeting_id`, `earlie
##### Request
A json object for the participant to invite with any of `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
A json object for the participant to invite with any of `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"earliest_time": "09:30",
"latest_time": "17:00",
"quorum": 1,
"host": 1,
"answered": 1,
@ -513,14 +495,12 @@ A json object for the participant to invite with any of `earliest_time`, `latest
##### Response `200`
A json object for the participant with `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`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"earliest_time": "09:30",
"latest_time": "17:00",
"quorum": 1,
"mandatory": 1,
"host": 1,
@ -558,7 +538,7 @@ A json object for the deleted participant with `message`.
| field | data type | metadata |
| :------------ | :-------- | :-------------------------- |
| id | int | primary key, auto-increment |
| meeting_id | varchar | foreign key, required |
| meeting_id | string | foreign key, required |
| possible_date | string | required |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
@ -625,7 +605,7 @@ A json object for the deleted possible date with `message`.
| preference | boolean | `0` (ideal) or `1` (yes), required |
| start_time | timestamp | required |
| end_time | timestamp | required |
| timezone | varchar | required |
| timezone | string | required |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |

73
database.dbml Normal file
View File

@ -0,0 +1,73 @@
// DBML source code of the database
// Use https://dbdiagram.io to visualize it
Project meeting_planner {
database_type: 'PostgreSQL'
}
Table account as A {
id int [pk, unique, increment] // auto-increment, uuid
username string
email string
password string
timezone string
earliest_time string
latest_time string
created_at datetime [default: `now()`]
updated_at datetime [default: `now()`]
}
Table meeting as M {
id uuid [pk, unique]
title string
description string
start_time time
duration int
status status
password string
created_at datetime [default: `now()`]
updated_at datetime [default: `now()`]
}
Table participant as P {
account_id int [ref: > A.id]
meeting_id uuid [ref: > M.id]
quorum boolean
mandatory boolean
host boolean
answered boolean
created_at datetime [default: `now()`]
updated_at datetime [default: `now()`]
indexes {
(account_id, meeting_id) [pk] // composite primary key
}
}
Table possible_date as D {
id int [pk, increment, unique]
meeting_id string [ref: > M.id]
possible_date string
created_at datetime [default: `now()`]
}
Table availability {
id int [pk, increment, unique]
account_id participant_id [ref: > P.account_id]
meeting_id participant_id [ref: > P.meeting_id]
possible_date_id int [ref: > D.id]
preference availability_preference
start_time time
end_time time
created_at datetime [default: `now()`]
}
Enum status {
0_proposed
1_confirmed
}
Enum availability_preference {
0_yes
1_ideal
}