create-steve-rogers 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/apps/SIMS/.env +4 -0
  2. package/apps/SIMS/README.md +138 -0
  3. package/apps/SIMS/backend/.env +4 -0
  4. package/apps/SIMS/backend/.env.example +4 -0
  5. package/apps/SIMS/backend/package-lock.json +1600 -0
  6. package/apps/SIMS/backend/package.json +22 -0
  7. package/apps/SIMS/backend/src/config/db.js +9 -0
  8. package/apps/SIMS/backend/src/controllers/authController.js +93 -0
  9. package/apps/SIMS/backend/src/controllers/simsReportController.js +94 -0
  10. package/apps/SIMS/backend/src/controllers/sparePartController.js +41 -0
  11. package/apps/SIMS/backend/src/controllers/stockInController.js +45 -0
  12. package/apps/SIMS/backend/src/controllers/stockOutController.js +123 -0
  13. package/apps/SIMS/backend/src/middleware/auth.js +8 -0
  14. package/apps/SIMS/backend/src/models/SparePart.js +17 -0
  15. package/apps/SIMS/backend/src/models/StockIn.js +16 -0
  16. package/apps/SIMS/backend/src/models/StockOut.js +18 -0
  17. package/apps/SIMS/backend/src/models/User.js +11 -0
  18. package/apps/SIMS/backend/src/routes/authRoutes.js +12 -0
  19. package/apps/SIMS/backend/src/routes/simsReportRoutes.js +8 -0
  20. package/apps/SIMS/backend/src/routes/sparePartRoutes.js +8 -0
  21. package/apps/SIMS/backend/src/routes/stockInRoutes.js +8 -0
  22. package/apps/SIMS/backend/src/routes/stockOutRoutes.js +10 -0
  23. package/apps/SIMS/backend/src/server.js +62 -0
  24. package/apps/SIMS/backend/src/utils/passwordPolicy.js +10 -0
  25. package/apps/SIMS/backend/src/utils/sparePartHelpers.js +5 -0
  26. package/apps/SIMS/frontend/dist/assets/index-3hv-vGL2.css +2 -0
  27. package/apps/SIMS/frontend/dist/assets/index-T8XT7M6y.js +19 -0
  28. package/apps/SIMS/frontend/dist/index.html +14 -0
  29. package/apps/SIMS/frontend/index.html +13 -0
  30. package/apps/SIMS/frontend/package-lock.json +3053 -0
  31. package/apps/SIMS/frontend/package.json +31 -0
  32. package/apps/SIMS/frontend/src/App.jsx +112 -0
  33. package/apps/SIMS/frontend/src/api/authApi.js +7 -0
  34. package/apps/SIMS/frontend/src/api/client.js +8 -0
  35. package/apps/SIMS/frontend/src/api/simsReportApi.js +5 -0
  36. package/apps/SIMS/frontend/src/api/sparePartsApi.js +4 -0
  37. package/apps/SIMS/frontend/src/api/stockInApi.js +4 -0
  38. package/apps/SIMS/frontend/src/api/stockOutApi.js +6 -0
  39. package/apps/SIMS/frontend/src/api/usersApi.js +3 -0
  40. package/apps/SIMS/frontend/src/components/AppLayout.jsx +60 -0
  41. package/apps/SIMS/frontend/src/index.css +737 -0
  42. package/apps/SIMS/frontend/src/main.jsx +13 -0
  43. package/apps/SIMS/frontend/src/pages/DashboardPage.jsx +179 -0
  44. package/apps/SIMS/frontend/src/pages/LoginPage.jsx +75 -0
  45. package/apps/SIMS/frontend/src/pages/RegisterPage.jsx +78 -0
  46. package/apps/SIMS/frontend/src/pages/ReportsPage.jsx +108 -0
  47. package/apps/SIMS/frontend/src/pages/ResetPasswordPage.jsx +75 -0
  48. package/apps/SIMS/frontend/src/pages/SparePartPage.jsx +128 -0
  49. package/apps/SIMS/frontend/src/pages/StockInPage.jsx +100 -0
  50. package/apps/SIMS/frontend/src/pages/StockOutPage.jsx +206 -0
  51. package/apps/SIMS/frontend/src/utils/passwordPolicy.js +8 -0
  52. package/apps/SIMS/frontend/vite.config.js +8 -0
  53. package/apps/config.js +6 -0
  54. package/package.json +1 -1
package/apps/SIMS/.env ADDED
@@ -0,0 +1,4 @@
1
+ PORT=5001
2
+ MONGO_URI=mongodb://127.0.0.1:27017/sims
3
+ SESSION_SECRET=change-sims-secret
4
+ FRONTEND_URL=http://localhost:5174
@@ -0,0 +1,138 @@
1
+ # SIMS — Stock Inventory Management System
2
+
3
+ [How this maps to the generic EPMS marking rubric (and what differs) → `EXAM_CHECKLIST_MARKING.md`](EXAM_CHECKLIST_MARKING.md)
4
+
5
+ ## ERD (Entity Relationship Diagram) — for your paper
6
+
7
+ Draw this on **plain paper** with standard symbols: **entities (rectangles)**, **relationships (diamonds or simple lines)**, **primary keys (PK)**, **foreign keys (FK)**, and **cardinalities (1, N)**.
8
+
9
+ ### 1) Entity: `User` (login / session)
10
+
11
+ | Field | Type | Key |
12
+ |----------------|---------|-----|
13
+ | `userId` | (PK) | PK |
14
+ | `username` | String | |
15
+ | `passwordHash` | String | |
16
+
17
+ - **No foreign keys.** Use this only for authentication (session). You can draw it **separate** from the stock model (no line to Spare part / stock tables), unless your assessor wants a line—usually **not required**.
18
+
19
+ ---
20
+
21
+ ### 2) Entity: `Spare_Part` (catalog + current stock)
22
+
23
+ | Field | Type | Key |
24
+ |-------------|---------|-----|
25
+ | `sparePartId` / `_id` | (id) | **PK** |
26
+ | `name` | String | |
27
+ | `category` | String | |
28
+ | `quantity` | Number | |
29
+ | `unitPrice` | Number | |
30
+ | `totalPrice`| Number | |
31
+
32
+ - One row = one part type (e.g. oil filter) with **current** quantity in stock and price fields as in the exam.
33
+
34
+ ---
35
+
36
+ ### 3) Entity: `Stock_In` (parts received into store)
37
+
38
+ | Field | Type | Key |
39
+ |------------------|--------|-----|
40
+ | `stockInId` / `_id` | (id) | **PK** |
41
+ | `sparePartId` | ref | **FK → `Spare_Part.sparePartId`** |
42
+ | `stockInQuantity`| Number | |
43
+ | `stockInDate` | Date | |
44
+
45
+ ---
46
+
47
+ ### 4) Entity: `Stock_Out` (parts taken from store)
48
+
49
+ | Field | Type | Key |
50
+ |------------------------|--------|-----|
51
+ | `stockOutId` / `_id` | (id) | **PK** |
52
+ | `sparePartId` | ref | **FK → `Spare_Part.sparePartId`** |
53
+ | `stockOutQuantity` | Number | |
54
+ | `stockOutUnitPrice` | Number | |
55
+ | `stockOutTotalPrice` | Number | |
56
+ | `stockOutDate` | Date | |
57
+
58
+ ---
59
+
60
+ ### Relationships and cardinality
61
+
62
+ | Relationship | From | To | Cardinality (typical) |
63
+ |--------------|------|-----|------------------------|
64
+ | **Supplies to stock in** | `Spare_Part` | `Stock_In` | **1 : N** (one part type, many stock-in rows over time) |
65
+ | **Supplies to stock out** | `Spare_Part` | `Stock_Out` | **1 : N** (one part type, many stock-out rows over time) |
66
+ | | `Stock_In` | `Spare_Part` | each row **N : 1** (many stock-in rows point to one part) |
67
+ | | `Stock_Out` | `Spare_Part` | each row **N : 1** (many stock-out rows point to one part) |
68
+
69
+ - **There is no direct relationship** between `Stock_In` and `Stock_Out` (no FK between them); they both only link to **`Spare_Part`**.
70
+
71
+ ### Small diagram (ASCII — for copy on paper)
72
+
73
+ ```
74
+ ┌──────────┐ 1 N ┌───────────┐
75
+ │ User │ (no FK to stock) │ Spare │
76
+ │ PK: id │ │ _Part │
77
+ └──────────┘ │ PK: id │
78
+ └─────┬─────┘
79
+ ┌──────────────────┼──────────────────┐
80
+ 1 │ N 1 │ N
81
+ ┌─────────▼──────┐ ┌───────▼──────────┐
82
+ │ Stock_In │ │ Stock_Out │
83
+ │ PK, FK→Spare │ │ PK, FK→Spare │
84
+ └────────────────┘ └────────────────┘
85
+ ```
86
+
87
+ **Summary sentence:** *One spare part can have many stock-in records and many stock-out records; each stock-in and stock-out row references exactly one spare part.*
88
+
89
+ ---
90
+
91
+ Practical exam project : full-stack app with **MongoDB**, **Express**, **React**, **Tailwind**, **session login**, **Axios**.
92
+
93
+ ## Exam rules implemented
94
+
95
+ | Requirement | How |
96
+ |-------------|-----|
97
+ | ERD: Spare_Part, Stock_In, Stock_Out (PK/FK) | On paper; backend uses `SparePart` with refs from `StockIn` / `StockOut` |
98
+ | DB name **SIMS** | `MONGO_URI` → database `sims` |
99
+ | Insert on Spare Part, Stock In, Stock Out | `POST` only (no update/delete) on spare parts and stock in |
100
+ | Update / delete / list only on **Stock Out** | `GET`, `PUT`, `DELETE` on `/api/stock-out/:id` |
101
+ | Menu: Spare Part, Stock In, Stock Out, **Reports**, **Logout** | `AppLayout.jsx` |
102
+ | Session login, **strong encrypted password** | Bcrypt; register requires 8+ chars, upper, lower, number |
103
+ | Tailwind, responsive, Axios | Vite + `@tailwindcss/vite` |
104
+ | Reports: **daily stock status** + **daily stock out** | `GET /api/reports/daily-stock-status?date=`, `GET /api/reports/daily-stockout?date=` |
105
+
106
+ ## Ports (avoids clash with EPMS on same machine)
107
+
108
+ - Backend: **5001** (configurable in `.env`)
109
+ - Frontend: **5174** (Vite)
110
+ - `FRONTEND_URL` in backend `.env` should match the Vite URL
111
+
112
+ ## Run
113
+
114
+ ```bash
115
+ cd sims/backend
116
+ cp .env.example .env
117
+ npm install
118
+ npm run dev
119
+ ```
120
+
121
+ ```bash
122
+ cd sims/frontend
123
+ npm install
124
+ npm run dev
125
+ ```
126
+
127
+ - API: [http://localhost:5001/api/health](http://localhost:5001/api/health)
128
+ - App: [http://localhost:5174](http://localhost:5174)
129
+
130
+ ## Project layout
131
+
132
+ ```
133
+ sims/
134
+ backend/ Node + Express + Mongoose
135
+ frontend/ React + Vite + Tailwind
136
+ README.md
137
+ ```
138
+
@@ -0,0 +1,4 @@
1
+ PORT=5001
2
+ MONGO_URI=mongodb://127.0.0.1:27017/sims
3
+ SESSION_SECRET=change-sims-secret
4
+ FRONTEND_URL=http://localhost:5174
@@ -0,0 +1,4 @@
1
+ PORT=5001
2
+ MONGO_URI=mongodb://127.0.0.1:27017/sims
3
+ SESSION_SECRET=change-sims-secret
4
+ FRONTEND_URL=http://localhost:5174