Changes between Initial Version and Version 1 of RelationalModel


Ignore:
Timestamp:
04/17/26 15:13:30 (2 weeks ago)
Author:
231049
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RelationalModel

    v1 v1  
     1== Relational Model: MajStore
     2
     3== Релационен дијаграм
     4
     5[[Image(RelationalModel.jpg, 1100px)]]
     6
     7
     8
     9== Ентитети
     10
     111. **Permission** – ентитет кој ги чува сите дозволи во системот. Permissions се издвоени како посебен ентитет за да се овозможи флексибилен систем за авторизација. Наместо фиксни улоги, системот дозволува комбинација од повеќе дозволи по улога.
     12- permission_id (serial, primary key)
     13- permission_name (text, not null, unique)
     14- description (text)
     15
     162. **Role** – ентитет кој ги дефинира улогите на корисниците.
     17- role_id (serial, primary key)
     18- role_name (text, not null, unique)
     19
     203. **Role_Permission** – ентитет за поврзување на улоги и дозволи (N:M)
     21- role_permission_id (serial, primary key)
     22- role_id (foreign key)
     23- permission_id (foreign key)
     24
     254. **User** – ентитет кој претставува основен кориснички профил
     26- user_id (serial, primary key)
     27- first_name (text, not null)
     28- last_name (text, not null)
     29- username (text, not null, unique)
     30- email (text, not null)
     31- password_hash (text, not null)
     32
     335. **User_Role** – ентитет за поврзување на корисници и улоги (N:M). Корисник може да има повеќе улоги (на пример: worker и admin).
     34- user_role_id (serial, primary key)
     35- role_id (foreign key)
     36- user_id (foreign key)
     37
     386. **Notification** – ентитет за известувања кон корисниците
     39- notification_id (serial, primary key)
     40- message (text, not null)
     41- is_read (bool, not null)
     42- created_at (timestamp, not null)
     43- user_id (foreign key)
     44
     457. **Location** – ентитет за локации. Издвоена како посебен ентитет за повторна употреба кај корисници, постови и работници.
     46- location_id (serial, primary key)
     47- city (text, not null)
     48- region (text, not null)
     49- address (text, not null)
     50
     518. **Worker** – ентитет кој ги претставува мајсторите
     52- worker_id (serial, primary key)
     53- bio (text)
     54- works_remote (bool, not null)
     55- location_id (foreign key)
     56- user_id (foreign key)
     57
     589. **Calendar** – Секој worker има свој календар
     59- calendar_id (serial, primary key)
     60- worker_id (foreign key)
     61
     6210. **Work_Day** – ентитет за работни денови во канлендарот, за детално дефинирање на работно време по денови
     63- work_day_id (serial, primary key)
     64- start_time (timestamp, not null)
     65- end_time (timestamp, not null)
     66- calendar_id (foreign key)
     67- day_id (foreign key)
     68
     6911. **Day** – ентитет за денови во неделата. Нормализација на деновите за избегнување неконзистентни вредности.
     70- day_id (serial, primary key)
     71- day_name (text, unique)
     72
     7312. **Calendar_Event** – ентитет за настани во календар
     74- event_id (serial, primary key)
     75- title (text, not null)
     76- description (text)
     77- start_time (timestamp, not null)
     78- end_time (timestamp, not null)
     79- calendar_id (foreign key)
     80
     8113. **Certificate** – ентитет за сертификати на работници
     82- certificate_id (serial, primary key)
     83- certificate_name (text, not null)
     84- issuer (text, not null)
     85- worker_id (foreign key)
     86
     8714. **Specialty** – ентитет за специјалности, односно струки кои ги работат мајсторите, како и категории на постовите (водоводџија, електричар...)
     88- specialty_id (serial, primary key)
     89- specialty_name (text, unique)
     90
     9115. **Worker_Specialty** – Еден worker може да има повеќе специјалности (N:M).
     92- worker_specialty_id (serial, primary key)
     93- worker_id (foreign key)
     94- specialty_id (foreign key)
     95
     9616. **Post_Status** – ентитет за статуси на постови
     97- status_id (serial, primary key)
     98- status_name (text, not null, unique)
     99
     10017. **Post** – ентитет за огласи од корисници
     101- post_id (serial, primary key)
     102- title (text, not null)
     103- description (text)
     104- created_at (timestamp)
     105- user_id (foreign key)
     106- location_id (foreign key)
     107- status_id (foreign key)
     108
     10918. **Post_Image** – ентитет за слики поврзани со пост
     110- image_id (serial, primary key)
     111- image_file (bytea, not null)
     112- post_id (int, foreign key)
     113
     11419. **Post_Specialty** – ентитет за поврзување Post и Specialty (N:M)
     115- post_specialty_id (serial, primary key)
     116- post_id (int, foreign key)
     117- specialty_id (int, foreign key)
     118
     11920. **Application_Status** – ентитет за статуси на апликации
     120- status_id (serial, primary key)
     121- status_name (text, not null, unique)
     122
     12321. **Application** – ентитет за апликации од worker-и за даден пост
     124- application_id (serial, primary key)
     125- message (text)
     126- needed_time (time)
     127- expected_price (float)
     128- created_at (timestamp, not null)
     129- worker_id (foreign key)
     130- post_id (foreign key)
     131- status_id (foreign key)
     132
     13322. **Review** – ентитет за оценки на мајстори по струка
     134- review_id (serial, primary key)
     135- grade (int, 0–5)
     136- created_at (timestamp)
     137- reviewer_id (foreign key)
     138- worker_specialty_id (foreign key)
     139
     14023. **Review_Comment** – ентитет за коментари на рецензии
     141- comment_id (serial, primary key)
     142- review_id (int, foreign key)
     143- reply (text, not null)
     144
     14524. **Payment_Method** – ентитет за начини на плаќање
     146- method_id (serial, primary key)
     147- method_name (text, not null, unique)
     148- max_amount (float, not null)
     149- tax (float, not null)
     150
     15125. **Worker_Method** – ентитет за поврзување Worker и Payment_Method, каде секој worker може да има повеќе методи за плаќање(N:M)
     152- worker_method_id (serial, primary key)
     153- worker_id (int, foreign key)
     154- method_id (int, foreign key)
     155
     15626. **Payment_Status** – ентитет за статуси на плаќања
     157- status_id (serial, primary key)
     158- status_name (text, not null, unique)
     159
     16027. **Payment** – ентитет за плаќања
     161- payment_id (serial, primary key)
     162- amount (float, not null)
     163- payment_date (timestamp, not null)
     164- worker_method_id (int, foreign key)
     165- payment_status (int, foreign key)
     166- plan_id (int, foreign key)
     167
     16828. **Premium_Plan** – ентитет за премиум пакети. Овој ентитет ги дефинира премиум плановите, како реклами, поставување на одреден мајстор прв на листа при пребарување во негоа категорија и слично. Целта е преку овие премиум планови системот да прави профит.
     169- plan_id (serial, primary key)
     170- name (text, not null, unique)
     171- price (float, not null)
     172- duration_days (int, not null)
     173- description (text, not null)
     174
     17529. **Premium_Worker** – ентитет за премиум статус на worker
     176- premium_id (serial, primary key)
     177- start_date (timestamp, not null)
     178- end_date (timestamp, not null)
     179- plan_id (int, foreign key)
     180- worker_id (int, foreign key)
     181- payment_id (int, foreign key)
     182
     183
     184== Релации
     185