Files
Sheep-Service/dock/Sheep-Service.dbml
T
rozenrod 04f39da611 Змінено директорії
Додано скрипти CRON
Поліпшено механізм запису стендів та їх редагування
2025-10-27 00:11:18 +02:00

227 lines
12 KiB
Plaintext

// Use DBML to define your database structure
// Docs: https://dbml.dbdiagram.io/docs
Table sheeps [note: 'Таблиця вісників'] {
id integer [primary key]
group_id integer [note: 'ID групи']
name text [note: 'Імʼя вісника']
icon text [note: 'Піктограмка вісника']
uuid text [note: 'Код доступа']
uuid_manager text [note: 'Код доступа']
mode integer [default: 0,note: 'Тип користувача чи адміністратора']
mode_title text [default: 'Користувач', note: 'Назва типу користувача чи адміністратора']
}
Table possibilities [note: 'Таблиця можливостей користувачів'] {
id integer [primary key]
sheep_id integer [note: 'ID вісника']
can_add_sheeps integer [default: 0, note: 'Доступ до додавання вісників']
can_view_sheeps integer [default: 0, note: 'Доступ до перегляду списку вісників']
can_add_territory integer [default: 0, note: 'Доступ до створення територій']
can_view_territory integer [default: 0, note: 'Доступ до перегляду особистих та групових територій']
can_manager_territory integer [default: 0, note: 'Доступ до призначання територій']
can_add_stand integer [default: 0, note: 'Доступ до створення стендів']
can_view_stand integer [default: 0, note: 'Доступ до перегляду графіку стендів']
can_manager_stand integer [default: 0, note: 'Доступ до редагування графіку стендів']
can_add_schedule integer [default: 0, note: 'Доступ до створення графіку зібрань']
can_view_schedule integer [default: 0, note: 'Доступ до перегляду графіку зібрань']
}
Table groups [note: 'Таблиця теократичних груп'] {
id integer [primary key]
group_number integer [note: 'Номер групи']
share_hash text [note: 'Код доступа для посилання спільного доступу до групових території']
}
Table subscription [note: 'Таблиця токенів вісників для повідомлень'] {
id integer [primary key]
sheep_id integer [note: 'ID вісника']
endpoint text [note: 'endpoint пристрою']
keys text [note: 'keys пристрою']
device_name text [note: 'Назва пристрою']
device_model text [note: 'Модель пристрою']
created_at timestamp [note: 'Дата створення']
}
Table badges [note: 'Таблиця кількісті непрочитаних повідомлень'] {
id integer [primary key]
sheep_id integer [note: 'ID вісника']
quantity integer [note: 'Кількість непрочитаних повідомлень']
}
Table house [note: 'Таблиця багатоповерхових будинків'] {
id integer [primary key]
title text [note: 'Вулиця будинку']
number text [note: 'Номер будинку']
points text [default: '[]', note: 'Масив точок будинку OSM']
points_number text [default: '[]', note: 'Масив точок будинку OSM']
geo text [default: '[]', note: 'Точка будинку на мапі']
zoom integer [default: 18, note: 'Zoom на мапі']
osm_id text [default: '[]', note: 'Список ID будинків в БД OSM']
settlement text [note: 'Місто роздашування']
description text [note: 'Коментар до будинку']
created_at timestamp [note: 'Дата створення будинку']
updated_at timestamp [note: 'Дата зміни будинку']
}
Table entrance [note: 'Таблиця підїздів багатоповерхових будинків'] {
id integer [primary key]
house_id integer [note: 'ID багатоповерхового будинку']
entrance_number integer [note: 'Номер підїзду']
title text [note: 'Назва підїзду']
description text [note: 'Коментар до підїзду']
created_at timestamp [note: 'Дата створення підїзду']
updated_at timestamp [note: 'Дата зміни підїзду']
}
Table entrance_history [note: 'Таблиця історії вісників які опрацьовували багатоповерхові будинки'] {
id integer [primary key]
entrance_id integer [note: 'ID підїзду']
name text [note: 'Хто опрацовував (імʼя)']
date_start timestamp [note: 'Початок опрацювання']
date_end timestamp [note: 'Кінець опрацювання']
group_id integer [note: 'Група яка опрацювувала']
sheep_id integer [note: 'ID вісника що зробив зміни']
working integer [default: 0, note: 'Статус опрацювання']
}
Table apartments [note: 'Таблиця квартир'] {
id integer [primary key]
entrance_id integer [note: 'ID підїзду']
apartment_number integer [note: 'Номер квартири']
title text [note: 'Назва квартири']
floors_number integer [note: 'Номер поверху']
status integer [note: 'Статус квартири']
description text [note: 'Коментар до квартири']
sheep_id integer [note: 'ID вісника що зробив зміни']
updated_at timestamp [note: 'Дата зміни історії квартири']
}
Table apartments_history [note: 'Таблиця історії опрацьовування квартир'] {
id integer [primary key]
sheep_id integer [note: 'ID вісника що зробив зміни']
apartments_id integer [note: 'ID квартири']
status integer [note: 'Статус квартири']
description text [note: 'Коментар до квартири']
created_at timestamp [note: 'Дата зміни історії квартири']
}
Table homestead [note: 'Таблиця житлових районів'] {
id integer [primary key]
title text [note: 'Житловий район']
number text [note: 'Номер житловогу району']
points text [default: '[]', note: 'Масив точок житловогу району OSM']
geo text [default: '[]', note: 'Точка житловогу району на мапі']
zoom integer [default: 18, note: 'Zoom на мапі']
osm_id text [default: '[]', note: 'Список ID житловоих районів в БД OSM']
settlement text [note: 'Місто роздашування']
description text [note: 'Коментар до житловогу району']
created_at timestamp [note: 'Дата створення житловогу району']
updated_at timestamp [note: 'Дата зміни житловогу району']
}
Table homestead_history [note: 'Таблиця історії вісників які опрацьовували житлові райони'] {
id integer [primary key]
homestead_id integer [note: 'ID житлового район']
name text [note: 'Хто опрацовував (імʼя)']
date_start timestamp [note: 'Початок опрацювання']
date_end timestamp [note: 'Кінець опрацювання']
group_id integer [note: 'Група яка опрацювувала']
sheep_id integer [note: 'ID вісника що зробив зміни']
working integer [default: 0, note: 'Статус опрацювання']
}
Table building [note: 'Таблиця приватних будинків'] {
id integer [primary key]
homestead_id integer [note: 'ID житлового район']
geo text [default: '[]', note: 'Точка будинку на мапі']
title text [note: 'Назва будинку']
status integer [note: 'Статус будинку']
description text [note: 'Коментар до будинку']
sheep_id integer [note: 'ID вісника що зробив зміни']
updated_at timestamp [note: 'Дата зміни історії будинку']
}
Table building_history [note: 'Таблиця історії опрацьовування приватних будинків'] {
id integer [primary key]
sheep_id integer [note: 'ID вісника що зробив зміни']
building_id integer [note: 'ID приватного будинку']
status integer [note: 'Статус будинку']
description text [note: 'Коментар до будинку']
created_at timestamp [note: 'Дата зміни історії будинку']
}
Table meetings_schedule [note: 'Таблиця розкладу зібрань'] {
id integer [primary key]
date timestamp [note: 'Дата зібрання']
type integer [note: 'Тип зібрання']
name text [note: 'Імʼя вісника що має завдання']
sheep_id integer [note: 'ID вісника що має завдання']
title text [note: 'Номер пісні або назва промови']
number text [note: 'Номер пункту графіка']
}
Table stand_list [note: 'Таблиця місць розташування стенду та його налаштування'] {
id integer [primary key]
title text [note: 'Назва місця розташування стенду']
geo text [default: '[]', note: 'Точка встановлення стенду на мапі']
hour_start integer [default: 9, note: 'Година початку служіння']
hour_end integer [default: 18, note: 'Година закінчення служіння']
quantity_sheep integer [default: 2, note: 'Кількість вісників, що можуть стояти одночасно']
week_days text [default: '[0, 1, 2, 3, 4, 5, 6]', note: 'Дні тижня, на яких стоїть стенд']
processing_time real [default: 1, note: 'Час тривалості зміни вісників']
status bool [default: false, note: 'Активація чи деактивація стенду']
updated_at timestamp [note: 'Дата зміни запису']
created_at timestamp [note: 'Дата створення запису']
}
Table stand_schedule [note: 'Таблиця записів служіння зі стендом'] {
id integer [primary key]
stand_id integer [note: 'ID стенду']
date timestamp [note: 'Дата служіння зі стендом']
sheep_id integer [note: 'ID вісника']
hour integer [note: 'Година запису']
number_sheep text [note: 'Номер вісника, що одночасно стоїть']
updated_at timestamp [note: 'Дата зміни запису']
created_at timestamp [note: 'Дата створення запису']
}
Table stand_schedule_history [note: 'Таблиця записів служіння зі стендом'] {
id integer [primary key]
stand_schedule_id integer [note: 'ID стенду']
sheep_id integer [note: 'ID вісника']
created_at timestamp [note: 'Дата створення запису']
}
Ref: sheeps.id - possibilities.sheep_id // one-to-one
Ref: sheeps.id < apartments_history.sheep_id // one-to-many
Ref: sheeps.id < apartments.sheep_id // one-to-many
Ref: sheeps.id < building_history.sheep_id // one-to-many
Ref: sheeps.id < building.sheep_id // one-to-many
Ref: sheeps.id < subscription.sheep_id // one-to-many
Ref: sheeps.id < badges.sheep_id // one-to-many
Ref: sheeps.id < homestead_history.sheep_id // one-to-many
Ref: sheeps.id < entrance_history.sheep_id // one-to-many
Ref: sheeps.id < meetings_schedule.sheep_id // one-to-many
Ref: sheeps.id < stand_schedule.sheep_id // one-to-many
Ref: sheeps.id < stand_schedule_history.sheep_id // one-to-many
Ref: groups.group_number < sheeps.group_id // one-to-many
Ref: groups.group_number < entrance_history.group_id // one-to-many
Ref: groups.group_number < homestead_history.group_id // one-to-many
Ref: house.id < entrance.house_id // one-to-many
Ref: homestead.id < homestead_history.homestead_id // one-to-many
Ref: homestead.id < building.homestead_id // one-to-many
Ref: entrance.id < entrance_history.entrance_id // one-to-many
Ref: entrance.id < apartments.entrance_id // one-to-many
Ref: apartments.id < apartments_history.apartments_id // one-to-many
Ref: building.id < building_history.building_id // one-to-many
Ref: stand_list.id < stand_schedule.stand_id // one-to-many
Ref: stand_schedule.id < stand_schedule_history.stand_schedule_id // one-to-many