wiki:RelationalModel

Version 1 (modified by 231049, 2 weeks ago) ( diff )

--

Relational Model: MajStore

Релационен дијаграм

Ентитети

  1. Permission – ентитет кој ги чува сите дозволи во системот. Permissions се издвоени како посебен ентитет за да се овозможи флексибилен систем за авторизација. Наместо фиксни улоги, системот дозволува комбинација од повеќе дозволи по улога.
  • permission_id (serial, primary key)
  • permission_name (text, not null, unique)
  • description (text)
  1. Role – ентитет кој ги дефинира улогите на корисниците.
  • role_id (serial, primary key)
  • role_name (text, not null, unique)
  1. Role_Permission – ентитет за поврзување на улоги и дозволи (N:M)
  • role_permission_id (serial, primary key)
  • role_id (foreign key)
  • permission_id (foreign key)
  1. User – ентитет кој претставува основен кориснички профил
  • user_id (serial, primary key)
  • first_name (text, not null)
  • last_name (text, not null)
  • username (text, not null, unique)
  • email (text, not null)
  • password_hash (text, not null)
  1. User_Role – ентитет за поврзување на корисници и улоги (N:M). Корисник може да има повеќе улоги (на пример: worker и admin).
  • user_role_id (serial, primary key)
  • role_id (foreign key)
  • user_id (foreign key)
  1. Notification – ентитет за известувања кон корисниците
  • notification_id (serial, primary key)
  • message (text, not null)
  • is_read (bool, not null)
  • created_at (timestamp, not null)
  • user_id (foreign key)
  1. Location – ентитет за локации. Издвоена како посебен ентитет за повторна употреба кај корисници, постови и работници.
  • location_id (serial, primary key)
  • city (text, not null)
  • region (text, not null)
  • address (text, not null)
  1. Worker – ентитет кој ги претставува мајсторите
  • worker_id (serial, primary key)
  • bio (text)
  • works_remote (bool, not null)
  • location_id (foreign key)
  • user_id (foreign key)
  1. Calendar – Секој worker има свој календар
  • calendar_id (serial, primary key)
  • worker_id (foreign key)
  1. Work_Day – ентитет за работни денови во канлендарот, за детално дефинирање на работно време по денови
  • work_day_id (serial, primary key)
  • start_time (timestamp, not null)
  • end_time (timestamp, not null)
  • calendar_id (foreign key)
  • day_id (foreign key)
  1. Day – ентитет за денови во неделата. Нормализација на деновите за избегнување неконзистентни вредности.
  • day_id (serial, primary key)
  • day_name (text, unique)
  1. Calendar_Event – ентитет за настани во календар
  • event_id (serial, primary key)
  • title (text, not null)
  • description (text)
  • start_time (timestamp, not null)
  • end_time (timestamp, not null)
  • calendar_id (foreign key)
  1. Certificate – ентитет за сертификати на работници
  • certificate_id (serial, primary key)
  • certificate_name (text, not null)
  • issuer (text, not null)
  • worker_id (foreign key)
  1. Specialty – ентитет за специјалности, односно струки кои ги работат мајсторите, како и категории на постовите (водоводџија, електричар...)
  • specialty_id (serial, primary key)
  • specialty_name (text, unique)
  1. Worker_Specialty – Еден worker може да има повеќе специјалности (N:M).
  • worker_specialty_id (serial, primary key)
  • worker_id (foreign key)
  • specialty_id (foreign key)
  1. Post_Status – ентитет за статуси на постови
  • status_id (serial, primary key)
  • status_name (text, not null, unique)
  1. Post – ентитет за огласи од корисници
  • post_id (serial, primary key)
  • title (text, not null)
  • description (text)
  • created_at (timestamp)
  • user_id (foreign key)
  • location_id (foreign key)
  • status_id (foreign key)
  1. Post_Image – ентитет за слики поврзани со пост
  • image_id (serial, primary key)
  • image_file (bytea, not null)
  • post_id (int, foreign key)
  1. Post_Specialty – ентитет за поврзување Post и Specialty (N:M)
  • post_specialty_id (serial, primary key)
  • post_id (int, foreign key)
  • specialty_id (int, foreign key)
  1. Application_Status – ентитет за статуси на апликации
  • status_id (serial, primary key)
  • status_name (text, not null, unique)
  1. Application – ентитет за апликации од worker-и за даден пост
  • application_id (serial, primary key)
  • message (text)
  • needed_time (time)
  • expected_price (float)
  • created_at (timestamp, not null)
  • worker_id (foreign key)
  • post_id (foreign key)
  • status_id (foreign key)
  1. Review – ентитет за оценки на мајстори по струка
  • review_id (serial, primary key)
  • grade (int, 0–5)
  • created_at (timestamp)
  • reviewer_id (foreign key)
  • worker_specialty_id (foreign key)
  1. Review_Comment – ентитет за коментари на рецензии
  • comment_id (serial, primary key)
  • review_id (int, foreign key)
  • reply (text, not null)
  1. Payment_Method – ентитет за начини на плаќање
  • method_id (serial, primary key)
  • method_name (text, not null, unique)
  • max_amount (float, not null)
  • tax (float, not null)
  1. Worker_Method – ентитет за поврзување Worker и Payment_Method, каде секој worker може да има повеќе методи за плаќање(N:M)
  • worker_method_id (serial, primary key)
  • worker_id (int, foreign key)
  • method_id (int, foreign key)
  1. Payment_Status – ентитет за статуси на плаќања
  • status_id (serial, primary key)
  • status_name (text, not null, unique)
  1. Payment – ентитет за плаќања
  • payment_id (serial, primary key)
  • amount (float, not null)
  • payment_date (timestamp, not null)
  • worker_method_id (int, foreign key)
  • payment_status (int, foreign key)
  • plan_id (int, foreign key)
  1. Premium_Plan – ентитет за премиум пакети. Овој ентитет ги дефинира премиум плановите, како реклами, поставување на одреден мајстор прв на листа при пребарување во негоа категорија и слично. Целта е преку овие премиум планови системот да прави профит.
  • plan_id (serial, primary key)
  • name (text, not null, unique)
  • price (float, not null)
  • duration_days (int, not null)
  • description (text, not null)
  1. Premium_Worker – ентитет за премиум статус на worker
  • premium_id (serial, primary key)
  • start_date (timestamp, not null)
  • end_date (timestamp, not null)
  • plan_id (int, foreign key)
  • worker_id (int, foreign key)
  • payment_id (int, foreign key)

Релации

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.