@@ -18,7 +18,7 @@ The application uses the following database models:
18
18
- ** Employee** : Represents employees, linked to divisions and items.
19
19
- ** Item** : Represents inventory items, with attributes and status.
20
20
- ** EmployeeItem** : An associative table linking employees to items.
21
- - ** ItemAttribute ** : Represents dynamic attributes for items.
21
+ - ** EmployeeItemAttribute ** : Represents dynamic attributes for items.
22
22
- ** User** : Represents system users (managers).
23
23
- ** Log** : For logging actions performed in the system.
24
24
- ** ItemTransferHistory** : Tracks the history of item transfers between employees.
@@ -63,6 +63,10 @@ Some reusable utility functions lies here including search functions
63
63
64
64
### Database Schema in detail
65
65
66
+ Here is the revised database schema in Markdown format:
67
+
68
+ ### Database Schema in detail
69
+
66
70
#### 1. ** Employee Table**
67
71
* Now includes division ID as a foreign key and keeps track of each employee's division and details.*
68
72
@@ -72,7 +76,7 @@ Some reusable utility functions lies here including search functions
72
76
| name | String | Employee name |
73
77
| division_id | Integer | Foreign key to ` Division ` |
74
78
| item_count | Integer | Total number of assigned items |
75
- | date_joined | Date | Date employee joined the company |
79
+ | date_joined | DateTime | Date employee joined the company |
76
80
77
81
#### 2. ** Division Table**
78
82
* Includes a count of employees in each division.*
@@ -81,7 +85,6 @@ Some reusable utility functions lies here including search functions
81
85
| ------------------| ---------| --------------------------------------|
82
86
| division_id | Integer | Unique ID for each division |
83
87
| name | String | Name of the division |
84
- | employee_count | Integer | Number of employees in this division|
85
88
86
89
#### 3. ** Item Table**
87
90
* Now includes additional details for item status and history tracking.*
@@ -90,10 +93,7 @@ Some reusable utility functions lies here including search functions
90
93
| -----------------| ---------| ---------------------------------------|
91
94
| item_id | Integer | Unique ID for each item |
92
95
| name | String | Item name |
93
- | unique_key | String | Unique identifier (e.g., serial) |
94
- | is_common | Boolean | Whether the item is common or unique |
95
- | status | String | Current status (` active ` , ` retired ` , ` lost ` , etc.)|
96
- | last_assigned | Date | Date when the item was last assigned |
96
+ | last_assigned | DateTime | Date when the item was last assigned |
97
97
98
98
#### 4. ** EmployeeItem Table** (Associative Table for Many-to-Many Relationship)
99
99
* Tracks unique or shared items and keeps records of item ownership.*
@@ -103,11 +103,21 @@ Some reusable utility functions lies here including search functions
103
103
| id | Integer | Primary key |
104
104
| emp_id | String | Foreign key to ` Employee ` |
105
105
| item_id | Integer | Foreign key to ` Item ` |
106
- | is_unique | Boolean | Indicates if item is unique to this employee |
107
- | date_assigned | Date | Date when item was assigned |
106
+ | unique_key | String | Unique identifier (e.g., serial) |
107
+ | date_assigned | DateTime | Date when item was assigned |
108
108
| notes | Text | Additional notes (e.g., item conditions) |
109
109
110
- #### 5. ** User Table** (For System Manager)
110
+ #### 5. ** EmployeeItemAttribute Table**
111
+ * Tracks dynamic attributes for employee items.*
112
+
113
+ | Column | Type | Description |
114
+ | -----------------| ---------| ---------------------------------------|
115
+ | emp_attribute_id | Integer | Primary key |
116
+ | emp_item_id | Integer | Foreign key to ` EmployeeItem ` |
117
+ | name | String | Attribute name |
118
+ | value | String | Attribute value |
119
+
120
+ #### 6. ** User Table** (For System Manager)
111
121
* Manager login table.*
112
122
113
123
| Column | Type | Description |
@@ -117,7 +127,7 @@ Some reusable utility functions lies here including search functions
117
127
| password | String | Hashed login password |
118
128
| role | String | Role of the user (` manager ` ) |
119
129
120
- #### 6 . ** Log Table**
130
+ #### 7 . ** Log Table**
121
131
* Enhanced to log all user actions, including system changes, searches, and item updates.*
122
132
123
133
| Column | Type | Description |
@@ -128,7 +138,7 @@ Some reusable utility functions lies here including search functions
128
138
| timestamp | DateTime | When the action occurred |
129
139
| user_id | Integer | Foreign key to ` User ` performing the action (nullable for searches) |
130
140
131
- #### 7 . ** ItemTransferHistory Table**
141
+ #### 8 . ** ItemTransferHistory Table**
132
142
* Tracks historical transfers of items between employees.*
133
143
134
144
| Column | Type | Description |
@@ -140,12 +150,6 @@ Some reusable utility functions lies here including search functions
140
150
| transfer_date | Date | Date of transfer |
141
151
| notes | Text | Optional notes (e.g., reason for transfer)|
142
152
143
- ---
144
-
145
- ## To do
146
-
147
- - chnage the db model with new attributes values for employee record .
148
-
149
153
### Screenshots
150
154
151
155
0 commit comments