Changes between Initial Version and Version 1 of P1


Ignore:
Timestamp:
01/16/26 20:07:47 (27 hours ago)
Author:
211099
Comment:

Initial ER diagram implementation

Legend:

Unmodified
Added
Removed
Modified
  • P1

    v1 v1  
     1== ERModel Current version ==
     2== Diagram ==
     3[[Image()]]
     4
     5== [[Image([[Image()]])]]
     6== Data requirements ==
     7=== ENTITIES ===
     8
     9{{{BASE_ENTITY}}}
     10[[BR]]
     11Abstract superclass that provides audit fields for all entities in the system.
     12[[BR]]
     13'''[[span(style=color: #9A0000, Note:)]]'''
     14This is a mapped superclass and does not create a separate table. All attributes are inherited by child entities.
     15[[BR]]
     16'''[[span(style=color: #9A0000, Attributes:)]]'''
     17* {{{created_at}}} – timestamp, required. Automatically set when entity is created.
     18* {{{updated_at}}} – timestamp, optional. Automatically updated when entity is modified.
     19[[BR]]
     20'''[[span(style=color: #9A0000, Child entities:)]]'''
     21All entities in the system inherit from BASE_ENTITY: USER, STORY, CHAPTER, GENRE, READING_LIST, NOTIFICATION, AI_SUGGESTION, LIKE, COMMENT.
     22[[BR]]
     23----
     24
     25{{{USER}}}
     26[[BR]]
     27Represents each individual user at the platform.
     28[[BR]]
     29'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     30* {{{user_id}}} – numeric identifier (primary key).
     31[[BR]]
     32'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     33* {{{created_at}}} – timestamp, required.
     34* {{{updated_at}}} – timestamp, optional.
     35[[BR]]
     36'''[[span(style=color: #9A0000, Attributes:)]]'''
     37* {{{user_id}}} – numeric, required. Primary key.
     38* {{{username}}} – text, required, unique.
     39* {{{email}}} – text, required, unique.
     40* {{{name}}} – text, required.
     41* {{{surname}}} – text, required.
     42* {{{password}}} – hash value, required.
     43* {{{role}}} – text, required. User role in the system.
     44* {{{permission_level}}} – numeric, optional. Permission level for the user.
     45[[BR]]
     46----
     47
     48{{{ADMIN}}}
     49[[BR]]
     50Represents the admin user (full access of the system). Inherited from USER.
     51[[BR]]
     52'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     53* {{{user_id}}} – inherited primary key.
     54[[BR]]
     55'''[[span(style=color: #9A0000, Inheritance:)]]'''
     56Inherits all attributes from USER (including BASE_ENTITY attributes).
     57[[BR]]
     58----
     59
     60{{{REGULAR_USER}}}
     61[[BR]]
     62Represents regular users. Inherited from USER.
     63[[BR]]
     64'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     65* {{{user_id}}} – inherited primary key.
     66[[BR]]
     67'''[[span(style=color: #9A0000, Inheritance:)]]'''
     68Inherits all attributes from USER (including BASE_ENTITY attributes).
     69[[BR]]
     70----
     71
     72{{{WRITER}}}
     73[[BR]]
     74Represents writers. Inherited from USER.
     75[[BR]]
     76'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     77* {{{user_id}}} – inherited primary key.
     78[[BR]]
     79'''[[span(style=color: #9A0000, Inheritance:)]]'''
     80Inherits all attributes from USER (including BASE_ENTITY attributes).
     81[[BR]]
     82----
     83
     84{{{STORY}}}
     85[[BR]]
     86Represents every story that is written in the platform. '''Inherits from BASE_ENTITY.'''
     87[[BR]]
     88'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     89* {{{story_id}}} – surrogate numeric identifier (primary key).
     90[[BR]]
     91'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     92* {{{created_at}}} – timestamp, required.
     93* {{{updated_at}}} – timestamp, optional.
     94[[BR]]
     95'''[[span(style=color: #9A0000, Attributes:)]]'''
     96* {{{story_id}}} – numeric, required. Auto-generated primary key.
     97* {{{mature_content}}} – boolean, required. Indicates if story contains mature content.
     98* {{{short_description}}} – text, required. Brief description of the story.
     99* {{{content}}} – text, required. Full content of the story.
     100* {{{status}}} – text, required. Publication status (draft, published, archived).
     101* {{{image}}} – text, optional. URL or path to story cover image.
     102[[BR]]
     103----
     104
     105{{{CHAPTER}}}
     106[[BR]]
     107Represents a chapter, which is part of a story. '''Inherits from BASE_ENTITY.'''
     108[[BR]]
     109'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     110* {{{chapter_id}}} – surrogate numeric identifier (primary key).
     111[[BR]]
     112'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     113* {{{created_at}}} – timestamp, required.
     114* {{{updated_at}}} – timestamp, optional.
     115[[BR]]
     116'''[[span(style=color: #9A0000, Attributes:)]]'''
     117* {{{chapter_id}}} – numeric, required. Auto-generated primary key.
     118* {{{chapter_name}}} – text, required. Name of the chapter.
     119* {{{title}}} – text, required. Title of the chapter.
     120* {{{content}}} – text, required. Content of the chapter.
     121* {{{word_count}}} – numeric, optional. Number of words in the chapter.
     122* {{{rating}}} – numeric, optional. Rating of the chapter.
     123* {{{published_at}}} – timestamp, required. Publication date and time.
     124* {{{view_count}}} – numeric, optional. Number of views.
     125[[BR]]
     126----
     127
     128{{{GENRE}}}
     129[[BR]]
     130Represents a genre category for stories. '''Inherits from BASE_ENTITY.'''
     131[[BR]]
     132'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     133* {{{genre_id}}} – surrogate numeric identifier (primary key).
     134[[BR]]
     135'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     136* {{{created_at}}} – timestamp, required.
     137* {{{updated_at}}} – timestamp, optional.
     138[[BR]]
     139'''[[span(style=color: #9A0000, Attributes:)]]'''
     140* {{{genre_id}}} – numeric, required. Auto-generated primary key.
     141* {{{name}}} – text, required, unique. Name of the genre.
     142[[BR]]
     143----
     144
     145{{{READING_LIST}}}
     146[[BR]]
     147Represents a reading list created by users. '''Inherits from BASE_ENTITY.'''
     148[[BR]]
     149'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     150* {{{list_id}}} – surrogate numeric identifier (primary key).
     151[[BR]]
     152'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     153* {{{created_at}}} – timestamp, required.
     154* {{{updated_at}}} – timestamp, optional.
     155[[BR]]
     156'''[[span(style=color: #9A0000, Attributes:)]]'''
     157* {{{list_id}}} – numeric, required. Auto-generated primary key.
     158* {{{name}}} – text, required. Name of the reading list.
     159* {{{content}}} – text, optional. Description of the reading list.
     160* {{{is_public}}} – boolean, required. Visibility of the reading list.
     161[[BR]]
     162----
     163
     164{{{NOTIFICATION}}}
     165[[BR]]
     166Represents notifications sent to users. '''Inherits from BASE_ENTITY.'''
     167[[BR]]
     168'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     169* {{{notification_id}}} – surrogate numeric identifier (primary key).
     170[[BR]]
     171'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     172* {{{created_at}}} – timestamp, required.
     173* {{{updated_at}}} – timestamp, optional.
     174[[BR]]
     175'''[[span(style=color: #9A0000, Attributes:)]]'''
     176* {{{notification_id}}} – numeric, required. Auto-generated primary key.
     177* {{{content}}} – text, required. Content of the notification.
     178* {{{content_type}}} – text, required. Type of notification content.
     179[[BR]]
     180----
     181
     182{{{AI_SUGGESTION}}}
     183[[BR]]
     184Represents AI-generated suggestions for story improvements. '''Inherits from BASE_ENTITY.'''
     185[[BR]]
     186'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     187* {{{suggestion_id}}} – surrogate numeric identifier (primary key).
     188[[BR]]
     189'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     190* {{{created_at}}} – timestamp, required.
     191* {{{updated_at}}} – timestamp, optional.
     192[[BR]]
     193'''[[span(style=color: #9A0000, Attributes:)]]'''
     194* {{{suggestion_id}}} – numeric, required. Auto-generated primary key.
     195* {{{original_text}}} – text, required. Original text from the story.
     196* {{{suggested_text}}} – text, required. AI-suggested improvement.
     197* {{{suggestion_type}}} – text, required. Type of suggestion (grammar, style, etc.).
     198* {{{accepted}}} – boolean, required. Whether the suggestion was accepted.
     199[[BR]]
     200----
     201
     202{{{LIKE}}}
     203[[BR]]
     204Represents likes given by users to stories. '''Inherits from BASE_ENTITY.'''
     205[[BR]]
     206'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     207* Composite key: ({{{user_id}}}, {{{story_id}}}).
     208[[BR]]
     209'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     210* {{{created_at}}} – timestamp, required.
     211* {{{updated_at}}} – timestamp, optional.
     212[[BR]]
     213----
     214
     215{{{COMMENT}}}
     216[[BR]]
     217Represents comments made by users on stories. '''Inherits from BASE_ENTITY.'''
     218[[BR]]
     219'''[[span(style=color: #9A0000, Candidate keys:)]]'''
     220* {{{comment_id}}} – surrogate numeric identifier (primary key).
     221[[BR]]
     222'''[[span(style=color: #9A0000, Inherited attributes from BASE_ENTITY:)]]'''
     223* {{{created_at}}} – timestamp, required.
     224* {{{updated_at}}} – timestamp, optional.
     225[[BR]]
     226'''[[span(style=color: #9A0000, Attributes:)]]'''
     227* {{{comment_id}}} – numeric, required. Auto-generated primary key.
     228* {{{content}}} – text, required. Content of the comment.
     229[[BR]]
     230----
     231
     232=== RELATIONS ===
     233
     234{{{has_list (USER – READING_LIST)}}}
     235[[BR]]
     236Represents users having reading lists.
     237[[BR]]
     238'''[[span(style=color: #9A0000, Cardinality:)]]'''
     2391:N (One user can have many reading lists, each reading list belongs to one user)
     240[[BR]]
     241'''[[span(style=color: #9A0000, Keys:)]]'''
     242Foreign key: {{{user_id}}} in READING_LIST references USER.
     243[[BR]]
     244----
     245
     246{{{collaboration (USER – STORY)}}}
     247[[BR]]
     248Represents users collaborating on stories.
     249[[BR]]
     250'''[[span(style=color: #9A0000, Cardinality:)]]'''
     251M:N (Many users can collaborate on many stories)
     252[[BR]]
     253'''[[span(style=color: #9A0000, Keys:)]]'''
     254Composite key: ({{{user_id}}}, {{{story_id}}}).
     255[[BR]]
     256'''[[span(style=color: #9A0000, Attributes:)]]'''
     257* {{{role}}} – text, required. Role of the collaborator.
     258* {{{permission_level}}} – numeric, optional. Level of permission for collaboration.
     259[[BR]]
     260----
     261
     262{{{created_story (WRITER – STORY)}}}
     263[[BR]]
     264Represents writers creating stories.
     265[[BR]]
     266'''[[span(style=color: #9A0000, Cardinality:)]]'''
     2671:N (One writer can create many stories, each story is created by one writer)
     268[[BR]]
     269'''[[span(style=color: #9A0000, Keys:)]]'''
     270Foreign key: {{{user_id}}} in STORY references WRITER.
     271[[BR]]
     272----
     273
     274{{{has_genre (STORY – GENRE)}}}
     275[[BR]]
     276Represents stories having genres.
     277[[BR]]
     278'''[[span(style=color: #9A0000, Cardinality:)]]'''
     279M:N (Many stories can have many genres)
     280[[BR]]
     281'''[[span(style=color: #9A0000, Keys:)]]'''
     282Composite key: ({{{story_id}}}, {{{genre_id}}}).
     283[[BR]]
     284----
     285
     286{{{part_of (CHAPTER – STORY)}}}
     287[[BR]]
     288Represents chapters being part of stories.
     289[[BR]]
     290'''[[span(style=color: #9A0000, Cardinality:)]]'''
     291N:1 (Many chapters are part of one story)
     292[[BR]]
     293'''[[span(style=color: #9A0000, Keys:)]]'''
     294Foreign key: {{{story_id}}} in CHAPTER references STORY.
     295[[BR]]
     296----
     297
     298{{{is_liked (USER – LIKE – STORY)}}}
     299[[BR]]
     300Represents users liking stories.
     301[[BR]]
     302'''[[span(style=color: #9A0000, Cardinality:)]]'''
     303M:N (Many users can like many stories)
     304[[BR]]
     305'''[[span(style=color: #9A0000, Keys:)]]'''
     306Composite key: ({{{user_id}}}, {{{story_id}}}) in LIKE.
     307[[BR]]
     308----
     309
     310{{{is_commented (USER – COMMENT – STORY)}}}
     311[[BR]]
     312Represents users commenting on stories.
     313[[BR]]
     314'''[[span(style=color: #9A0000, Cardinality:)]]'''
     315M:N (Many users can comment on many stories)
     316[[BR]]
     317'''[[span(style=color: #9A0000, Keys:)]]'''
     318Foreign key: {{{user_id}}} in COMMENT references USER.
     319Foreign key: {{{story_id}}} in COMMENT references STORY.
     320[[BR]]
     321----
     322
     323{{{notify (USER – NOTIFICATION)}}}
     324[[BR]]
     325Represents users receiving notifications.
     326[[BR]]
     327'''[[span(style=color: #9A0000, Cardinality:)]]'''
     328N:1 (Many notifications can be sent to one user)
     329[[BR]]
     330'''[[span(style=color: #9A0000, Keys:)]]'''
     331Foreign key: {{{user_id}}} in NOTIFICATION references USER.
     332[[BR]]
     333----
     334
     335{{{need_approval (AI_SUGGESTION – STORY)}}}
     336[[BR]]
     337Represents AI suggestions needing approval for stories.
     338[[BR]]
     339'''[[span(style=color: #9A0000, Cardinality:)]]'''
     340N:1 (Many AI suggestions can be made for one story)
     341[[BR]]
     342'''[[span(style=color: #9A0000, Keys:)]]'''
     343Foreign key: {{{story_id}}} in AI_SUGGESTION references STORY.
     344[[BR]]
     345----