wad-lab 1.2.2 → 1.2.4

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 (207) hide show
  1. package/bin/index.js +477 -627
  2. package/package.json +1 -1
  3. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +241 -429
  4. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
  5. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
  6. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemTable.vue +177 -0
  7. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +150 -441
  8. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
  9. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemStats.vue +64 -0
  10. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemTable.vue +195 -0
  11. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +41 -90
  12. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemFormModal.vue +173 -0
  13. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemTable.vue +102 -0
  14. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/NavBar.vue +57 -0
  15. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +132 -296
  16. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +126 -219
  17. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
  18. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemTable.vue +104 -0
  19. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/SideBar.vue +59 -0
  20. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
  21. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
  22. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
  23. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
  24. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/App.vue +19 -70
  25. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
  26. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
  27. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
  28. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
  29. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
  30. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
  31. package/templates/game-bingo/script.js +1 -1
  32. package/templates/game-memory-cards/script.js +2 -2
  33. package/templates/game-rock-paper-scissors/index.html +3 -3
  34. package/templates/game-rock-paper-scissors/script.js +2 -2
  35. package/templates/game-tic-tac-toe/script.js +2 -2
  36. package/templates/game-whack-a-mole/index.html +9 -9
  37. package/templates/servlet-basic/WEB-INF/ItemServlet.java +13 -0
  38. package/templates/servlet-basic/WEB-INF/classes/ItemServlet.class +0 -0
  39. package/templates/servlet-flow/WEB-INF/HelloServlet.java +34 -25
  40. package/templates/servlet-flow/WEB-INF/classes/HelloServlet.class +0 -0
  41. package/templates/servlet-jdbc/WEB-INF/JdbcItemServlet.java +13 -0
  42. package/templates/servlet-jdbc/WEB-INF/classes/JdbcItemServlet.class +0 -0
  43. package/templates/snippets/mongo-queries-cheatsheet.txt +105 -0
  44. package/templates/springboot-2model-aggregation-join/.mvn/wrapper/maven-wrapper.properties +3 -0
  45. package/templates/springboot-2model-aggregation-join/mvnw +295 -0
  46. package/templates/springboot-2model-aggregation-join/mvnw.cmd +189 -0
  47. package/templates/springboot-2model-aggregation-join/pom.xml +54 -0
  48. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/AggregationApplication.java +11 -0
  49. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/DepartmentController.java +65 -0
  50. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/EmployeeController.java +65 -0
  51. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/DepartmentStatsDTO.java +15 -0
  52. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/EmployeeJoinDTO.java +19 -0
  53. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Department.java +20 -0
  54. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Employee.java +21 -0
  55. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/DepartmentRepository.java +9 -0
  56. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/EmployeeRepository.java +9 -0
  57. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/DepartmentService.java +81 -0
  58. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/EmployeeService.java +80 -0
  59. package/templates/springboot-2model-aggregation-join/src/main/resources/application.properties +2 -0
  60. package/templates/springboot-2model-aggregation-join/src/test/java/com/example/aggregation/AggregationApplicationTests.java +13 -0
  61. package/templates/vue-2model-crud-patch/README.md +64 -0
  62. package/templates/vue-2model-crud-patch/index.html +12 -0
  63. package/templates/vue-2model-crud-patch/package-lock.json +1785 -0
  64. package/templates/vue-2model-crud-patch/package.json +21 -0
  65. package/templates/vue-2model-crud-patch/src/App.vue +63 -0
  66. package/templates/vue-2model-crud-patch/src/components/AnalyticsBoard.vue +291 -0
  67. package/templates/vue-2model-crud-patch/src/components/DepartmentFormModal.vue +138 -0
  68. package/templates/vue-2model-crud-patch/src/components/DepartmentPatchModal.vue +210 -0
  69. package/templates/vue-2model-crud-patch/src/components/DepartmentTable.vue +133 -0
  70. package/templates/vue-2model-crud-patch/src/components/EmployeeFormModal.vue +177 -0
  71. package/templates/vue-2model-crud-patch/src/components/EmployeePatchModal.vue +221 -0
  72. package/templates/vue-2model-crud-patch/src/components/EmployeeTable.vue +171 -0
  73. package/templates/vue-2model-crud-patch/src/components/NavBar.vue +156 -0
  74. package/templates/vue-2model-crud-patch/src/main.js +12 -0
  75. package/templates/vue-2model-crud-patch/src/router/index.js +33 -0
  76. package/templates/vue-2model-crud-patch/src/services/api.js +64 -0
  77. package/templates/vue-2model-crud-patch/src/stores/departmentStore.js +149 -0
  78. package/templates/vue-2model-crud-patch/src/stores/employeeStore.js +143 -0
  79. package/templates/vue-2model-crud-patch/src/style.css +415 -0
  80. package/templates/vue-2model-crud-patch/src/views/AnalyticsView.vue +59 -0
  81. package/templates/vue-2model-crud-patch/src/views/DepartmentsView.vue +135 -0
  82. package/templates/vue-2model-crud-patch/src/views/EmployeesView.vue +143 -0
  83. package/templates/vue-2model-crud-patch/vite.config.js +9 -0
  84. package/templates/vue-axios/src/App.vue +255 -264
  85. package/templates/vue-axios/src/components/ItemFormModal.vue +183 -0
  86. package/templates/vue-axios/src/components/ItemPatchModal.vue +193 -0
  87. package/templates/vue-axios/src/components/ItemTable.vue +177 -0
  88. package/templates/vue-axios-basic/src/App.vue +241 -429
  89. package/templates/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
  90. package/templates/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
  91. package/templates/vue-axios-basic/src/components/ItemTable.vue +177 -0
  92. package/templates/vue-axios-pinia/src/App.vue +150 -441
  93. package/templates/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
  94. package/templates/vue-axios-pinia/src/components/ItemStats.vue +64 -0
  95. package/templates/vue-axios-pinia/src/components/ItemTable.vue +195 -0
  96. package/templates/vue-axios-router/src/App.vue +41 -90
  97. package/templates/vue-axios-router/src/components/ItemFormModal.vue +173 -0
  98. package/templates/vue-axios-router/src/components/ItemTable.vue +102 -0
  99. package/templates/vue-axios-router/src/components/NavBar.vue +57 -0
  100. package/templates/vue-axios-router/src/views/DepartmentView.vue +132 -296
  101. package/templates/vue-axios-router/src/views/EmployeeView.vue +126 -219
  102. package/templates/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
  103. package/templates/vue-axios-router-children/src/components/ItemTable.vue +104 -0
  104. package/templates/vue-axios-router-children/src/components/SideBar.vue +59 -0
  105. package/templates/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
  106. package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
  107. package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
  108. package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
  109. package/templates/vue-axios-router-pinia/src/App.vue +19 -70
  110. package/templates/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
  111. package/templates/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
  112. package/templates/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
  113. package/templates/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
  114. package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
  115. package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
  116. package/templates/vue-banking-app/src/components/AccountOverview.vue +75 -0
  117. package/templates/vue-banking-app/src/components/TransactionForm.vue +89 -0
  118. package/templates/vue-banking-app/src/components/TransactionTable.vue +113 -0
  119. package/templates/vue-banking-app/src/stores/bankStore.js +16 -3
  120. package/templates/vue-banking-app/src/views/DashboardView.vue +23 -71
  121. package/templates/vue-banking-app/src/views/StatementView.vue +11 -158
  122. package/templates/vue-banking-app/src/views/TransactionFormView.vue +23 -121
  123. package/templates/vue-basics/src/App.vue +105 -76
  124. package/templates/vue-basics/src/components/CounterCard.vue +107 -0
  125. package/templates/vue-basics/src/components/ItemList.vue +99 -0
  126. package/templates/vue-basics/src/components/UserForm.vue +138 -0
  127. package/templates/vue-cart-router-pinia/src/components/CartSummary.vue +139 -0
  128. package/templates/vue-cart-router-pinia/src/components/CheckoutModal.vue +149 -0
  129. package/templates/vue-cart-router-pinia/src/components/ProductCard.vue +63 -0
  130. package/templates/vue-cart-router-pinia/src/stores/cartStore.js +11 -0
  131. package/templates/vue-cart-router-pinia/src/views/CartView.vue +52 -118
  132. package/templates/vue-cart-router-pinia/src/views/CheckoutView.vue +2 -5
  133. package/templates/vue-cart-router-pinia/src/views/ProductCatalogView.vue +20 -56
  134. package/templates/vue-employee-system/src/App.vue +75 -344
  135. package/templates/vue-employee-system/src/components/DepartmentFilter.vue +108 -0
  136. package/templates/vue-employee-system/src/components/EmployeeModal.vue +183 -0
  137. package/templates/vue-employee-system/src/components/EmployeeTable.vue +91 -0
  138. package/templates/vue-employee-system/src/stores/employeeStore.js +12 -0
  139. package/templates/vue-fetch/src/App.vue +261 -285
  140. package/templates/vue-fetch/src/components/FetchFormModal.vue +183 -0
  141. package/templates/vue-fetch/src/components/FetchPatchModal.vue +193 -0
  142. package/templates/vue-fetch/src/components/FetchTable.vue +177 -0
  143. package/templates/vue-food-ordering/src/components/CartSummary.vue +134 -0
  144. package/templates/vue-food-ordering/src/components/FoodMenu.vue +126 -0
  145. package/templates/vue-food-ordering/src/components/OrderModal.vue +150 -0
  146. package/templates/vue-food-ordering/src/views/MenuView.vue +11 -132
  147. package/templates/vue-food-ordering/src/views/OrderCartView.vue +31 -164
  148. package/templates/vue-game-rps/src/App.vue +29 -88
  149. package/templates/vue-game-tictactoe/src/App.vue +23 -53
  150. package/templates/vue-game-whackamole/src/App.vue +44 -63
  151. package/templates/vue-hospital-portal/src/components/AppointmentForm.vue +144 -0
  152. package/templates/vue-hospital-portal/src/components/DoctorCard.vue +73 -0
  153. package/templates/vue-hospital-portal/src/components/PatientTable.vue +123 -0
  154. package/templates/vue-hospital-portal/src/stores/hospitalStore.js +10 -1
  155. package/templates/vue-hospital-portal/src/views/OPDRegistrationView.vue +40 -416
  156. package/templates/vue-hospital-portal/src/views/PatientListView.vue +11 -301
  157. package/templates/vue-library-system/src/components/BookForm.vue +125 -0
  158. package/templates/vue-library-system/src/components/BookTable.vue +112 -0
  159. package/templates/vue-library-system/src/components/BorrowModal.vue +131 -0
  160. package/templates/vue-library-system/src/stores/libraryStore.js +26 -1
  161. package/templates/vue-library-system/src/views/BookCatalogView.vue +34 -415
  162. package/templates/vue-memory-game/src/App.vue +36 -40
  163. package/templates/vue-memory-game/src/stores/memoryStore.js +32 -37
  164. package/templates/vue-router/src/App.vue +24 -14
  165. package/templates/vue-router/src/components/AboutCard.vue +38 -0
  166. package/templates/vue-router/src/components/HomeHero.vue +75 -0
  167. package/templates/vue-router/src/components/NavBar.vue +54 -0
  168. package/templates/vue-router/src/views/ItemsLayout.vue +17 -9
  169. package/templates/vue-router/src/views/ListView.vue +106 -18
  170. package/templates/vue-router-pinia/src/App.vue +24 -14
  171. package/templates/vue-router-pinia/src/components/ItemFormModal.vue +163 -0
  172. package/templates/vue-router-pinia/src/components/ItemTable.vue +90 -0
  173. package/templates/vue-router-pinia/src/components/NavBar.vue +54 -0
  174. package/templates/vue-router-pinia/src/stores/itemStore.js +8 -1
  175. package/templates/vue-router-pinia/src/views/ListView.vue +78 -14
  176. package/templates/vue-router-pinia-springboot/frontend/src/App.vue +25 -8
  177. package/templates/vue-router-pinia-springboot/frontend/src/components/ItemFormModal.vue +183 -0
  178. package/templates/vue-router-pinia-springboot/frontend/src/components/ItemPatchModal.vue +193 -0
  179. package/templates/vue-router-pinia-springboot/frontend/src/components/ItemTable.vue +177 -0
  180. package/templates/vue-router-pinia-springboot/frontend/src/components/NavBar.vue +54 -0
  181. package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +92 -76
  182. package/templates/vue-springboot-mongo-aggregation/frontend/src/App.vue +184 -193
  183. package/templates/vue-springboot-mongo-aggregation/frontend/src/components/AnalyticsCards.vue +56 -0
  184. package/templates/vue-springboot-mongo-aggregation/frontend/src/components/CategorySummaryTable.vue +71 -0
  185. package/templates/vue-springboot-mongo-aggregation/frontend/src/components/ItemTable.vue +114 -0
  186. package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +228 -158
  187. package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemFormModal.vue +183 -0
  188. package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemPatchModal.vue +193 -0
  189. package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemTable.vue +177 -0
  190. package/templates/vue-symposium-system/src/App.vue +41 -256
  191. package/templates/vue-symposium-system/src/components/AttendeeTable.vue +100 -0
  192. package/templates/vue-symposium-system/src/components/EventCard.vue +67 -0
  193. package/templates/vue-symposium-system/src/components/RegistrationForm.vue +118 -0
  194. package/templates/vue-symposium-system/src/stores/symposiumStore.js +10 -0
  195. package/templates/vue-todo-pinia/src/App.vue +40 -138
  196. package/templates/vue-todo-pinia/src/components/TodoFilter.vue +74 -0
  197. package/templates/vue-todo-pinia/src/components/TodoInput.vue +53 -0
  198. package/templates/vue-todo-pinia/src/components/TodoList.vue +101 -0
  199. package/templates/vue-todo-pinia/src/stores/todoStore.js +6 -0
  200. package/templates/vue-todo-router/src/App.vue +5 -36
  201. package/templates/vue-todo-router/src/components/TodoForm.vue +78 -0
  202. package/templates/vue-todo-router/src/components/TodoList.vue +84 -0
  203. package/templates/vue-todo-router/src/components/TodoNavBar.vue +47 -0
  204. package/templates/vue-todo-router/src/data/todoState.js +7 -0
  205. package/templates/vue-todo-router/src/views/AddTodoView.vue +7 -66
  206. package/templates/vue-todo-router/src/views/TodoDetailView.vue +15 -1
  207. package/templates/vue-todo-router/src/views/TodoListView.vue +22 -64
@@ -0,0 +1,65 @@
1
+ package com.example.aggregation.controller;
2
+
3
+ import com.example.aggregation.dto.DepartmentStatsDTO;
4
+ import com.example.aggregation.model.Department;
5
+ import com.example.aggregation.service.DepartmentService;
6
+ import org.springframework.beans.factory.annotation.Autowired;
7
+ import org.springframework.http.HttpStatus;
8
+ import org.springframework.http.ResponseEntity;
9
+ import org.springframework.web.bind.annotation.*;
10
+
11
+ import java.util.List;
12
+ import java.util.Map;
13
+
14
+ @RestController
15
+ @RequestMapping("/api/departments")
16
+ @CrossOrigin("*")
17
+ public class DepartmentController {
18
+
19
+ @Autowired
20
+ private DepartmentService departmentService;
21
+
22
+ @GetMapping
23
+ public List<Department> getAll() {
24
+ return departmentService.getAll();
25
+ }
26
+
27
+ @GetMapping("/stats")
28
+ public List<DepartmentStatsDTO> getStats() {
29
+ return departmentService.getStats();
30
+ }
31
+
32
+ @GetMapping("/{id}")
33
+ public ResponseEntity<Department> getById(@PathVariable String id) {
34
+ return departmentService.getById(id)
35
+ .map(ResponseEntity::ok)
36
+ .orElse(ResponseEntity.notFound().build());
37
+ }
38
+
39
+ @PostMapping
40
+ public ResponseEntity<Department> create(@RequestBody Department department) {
41
+ return ResponseEntity.status(HttpStatus.CREATED).body(departmentService.create(department));
42
+ }
43
+
44
+ @PutMapping("/{id}")
45
+ public ResponseEntity<Department> update(@PathVariable String id, @RequestBody Department department) {
46
+ return departmentService.update(id, department)
47
+ .map(ResponseEntity::ok)
48
+ .orElse(ResponseEntity.notFound().build());
49
+ }
50
+
51
+ @PatchMapping("/{id}")
52
+ public ResponseEntity<Department> patch(@PathVariable String id, @RequestBody Map<String, Object> updates) {
53
+ return departmentService.patch(id, updates)
54
+ .map(ResponseEntity::ok)
55
+ .orElse(ResponseEntity.notFound().build());
56
+ }
57
+
58
+ @DeleteMapping("/{id}")
59
+ public ResponseEntity<Void> delete(@PathVariable String id) {
60
+ if (departmentService.delete(id)) {
61
+ return ResponseEntity.noContent().build();
62
+ }
63
+ return ResponseEntity.notFound().build();
64
+ }
65
+ }
@@ -0,0 +1,65 @@
1
+ package com.example.aggregation.controller;
2
+
3
+ import com.example.aggregation.dto.EmployeeJoinDTO;
4
+ import com.example.aggregation.model.Employee;
5
+ import com.example.aggregation.service.EmployeeService;
6
+ import org.springframework.beans.factory.annotation.Autowired;
7
+ import org.springframework.http.HttpStatus;
8
+ import org.springframework.http.ResponseEntity;
9
+ import org.springframework.web.bind.annotation.*;
10
+
11
+ import java.util.List;
12
+ import java.util.Map;
13
+
14
+ @RestController
15
+ @RequestMapping("/api/employees")
16
+ @CrossOrigin("*")
17
+ public class EmployeeController {
18
+
19
+ @Autowired
20
+ private EmployeeService employeeService;
21
+
22
+ @GetMapping
23
+ public List<Employee> getAll() {
24
+ return employeeService.getAll();
25
+ }
26
+
27
+ @GetMapping("/joined")
28
+ public List<EmployeeJoinDTO> getJoined() {
29
+ return employeeService.getJoined();
30
+ }
31
+
32
+ @GetMapping("/{id}")
33
+ public ResponseEntity<Employee> getById(@PathVariable String id) {
34
+ return employeeService.getById(id)
35
+ .map(ResponseEntity::ok)
36
+ .orElse(ResponseEntity.notFound().build());
37
+ }
38
+
39
+ @PostMapping
40
+ public ResponseEntity<Employee> create(@RequestBody Employee employee) {
41
+ return ResponseEntity.status(HttpStatus.CREATED).body(employeeService.create(employee));
42
+ }
43
+
44
+ @PutMapping("/{id}")
45
+ public ResponseEntity<Employee> update(@PathVariable String id, @RequestBody Employee employee) {
46
+ return employeeService.update(id, employee)
47
+ .map(ResponseEntity::ok)
48
+ .orElse(ResponseEntity.notFound().build());
49
+ }
50
+
51
+ @PatchMapping("/{id}")
52
+ public ResponseEntity<Employee> patch(@PathVariable String id, @RequestBody Map<String, Object> updates) {
53
+ return employeeService.patch(id, updates)
54
+ .map(ResponseEntity::ok)
55
+ .orElse(ResponseEntity.notFound().build());
56
+ }
57
+
58
+ @DeleteMapping("/{id}")
59
+ public ResponseEntity<Void> delete(@PathVariable String id) {
60
+ if (employeeService.delete(id)) {
61
+ return ResponseEntity.noContent().build();
62
+ }
63
+ return ResponseEntity.notFound().build();
64
+ }
65
+ }
@@ -0,0 +1,15 @@
1
+ package com.example.aggregation.dto;
2
+
3
+ import lombok.AllArgsConstructor;
4
+ import lombok.Data;
5
+ import lombok.NoArgsConstructor;
6
+
7
+ @Data
8
+ @NoArgsConstructor
9
+ @AllArgsConstructor
10
+ public class DepartmentStatsDTO {
11
+ private String departmentId;
12
+ private Long totalHeadcount;
13
+ private Double totalPayroll;
14
+ private Double averageSalary;
15
+ }
@@ -0,0 +1,19 @@
1
+ package com.example.aggregation.dto;
2
+
3
+ import com.example.aggregation.model.Department;
4
+ import lombok.AllArgsConstructor;
5
+ import lombok.Data;
6
+ import lombok.NoArgsConstructor;
7
+
8
+ @Data
9
+ @NoArgsConstructor
10
+ @AllArgsConstructor
11
+ public class EmployeeJoinDTO {
12
+ private String id;
13
+ private String name;
14
+ private String email;
15
+ private String role;
16
+ private Double salary;
17
+ private String departmentId;
18
+ private Department department;
19
+ }
@@ -0,0 +1,20 @@
1
+ package com.example.aggregation.model;
2
+
3
+ import lombok.AllArgsConstructor;
4
+ import lombok.Data;
5
+ import lombok.NoArgsConstructor;
6
+ import org.springframework.data.annotation.Id;
7
+ import org.springframework.data.mongodb.core.mapping.Document;
8
+
9
+ @Data
10
+ @NoArgsConstructor
11
+ @AllArgsConstructor
12
+ @Document(collection = "departments")
13
+ public class Department {
14
+ @Id
15
+ private String id;
16
+ private String name;
17
+ private String code;
18
+ private String location;
19
+ private Double budget;
20
+ }
@@ -0,0 +1,21 @@
1
+ package com.example.aggregation.model;
2
+
3
+ import lombok.AllArgsConstructor;
4
+ import lombok.Data;
5
+ import lombok.NoArgsConstructor;
6
+ import org.springframework.data.annotation.Id;
7
+ import org.springframework.data.mongodb.core.mapping.Document;
8
+
9
+ @Data
10
+ @NoArgsConstructor
11
+ @AllArgsConstructor
12
+ @Document(collection = "employees")
13
+ public class Employee {
14
+ @Id
15
+ private String id;
16
+ private String name;
17
+ private String email;
18
+ private String role;
19
+ private Double salary;
20
+ private String departmentId;
21
+ }
@@ -0,0 +1,9 @@
1
+ package com.example.aggregation.repository;
2
+
3
+ import com.example.aggregation.model.Department;
4
+ import org.springframework.data.mongodb.repository.MongoRepository;
5
+ import org.springframework.stereotype.Repository;
6
+
7
+ @Repository
8
+ public interface DepartmentRepository extends MongoRepository<Department, String> {
9
+ }
@@ -0,0 +1,9 @@
1
+ package com.example.aggregation.repository;
2
+
3
+ import com.example.aggregation.model.Employee;
4
+ import org.springframework.data.mongodb.repository.MongoRepository;
5
+ import org.springframework.stereotype.Repository;
6
+
7
+ @Repository
8
+ public interface EmployeeRepository extends MongoRepository<Employee, String> {
9
+ }
@@ -0,0 +1,81 @@
1
+ package com.example.aggregation.service;
2
+
3
+ import com.example.aggregation.dto.DepartmentStatsDTO;
4
+ import com.example.aggregation.model.Department;
5
+ import com.example.aggregation.repository.DepartmentRepository;
6
+ import org.springframework.beans.factory.annotation.Autowired;
7
+ import org.springframework.data.mongodb.core.MongoTemplate;
8
+ import org.springframework.data.mongodb.core.aggregation.Aggregation;
9
+ import org.springframework.stereotype.Service;
10
+
11
+ import java.util.List;
12
+ import java.util.Map;
13
+ import java.util.Optional;
14
+
15
+ @Service
16
+ public class DepartmentService {
17
+
18
+ @Autowired
19
+ private DepartmentRepository departmentRepository;
20
+
21
+ @Autowired
22
+ private MongoTemplate mongoTemplate;
23
+
24
+ public List<Department> getAll() {
25
+ return departmentRepository.findAll();
26
+ }
27
+
28
+ public Optional<Department> getById(String id) {
29
+ return departmentRepository.findById(id);
30
+ }
31
+
32
+ public Department create(Department department) {
33
+ return departmentRepository.save(department);
34
+ }
35
+
36
+ public Optional<Department> update(String id, Department updated) {
37
+ return departmentRepository.findById(id).map(existing -> {
38
+ updated.setId(id);
39
+ return departmentRepository.save(updated);
40
+ });
41
+ }
42
+
43
+ public Optional<Department> patch(String id, Map<String, Object> updates) {
44
+ return departmentRepository.findById(id).map(existing -> {
45
+ if (updates.containsKey("name")) {
46
+ existing.setName((String) updates.get("name"));
47
+ }
48
+ if (updates.containsKey("code")) {
49
+ existing.setCode((String) updates.get("code"));
50
+ }
51
+ if (updates.containsKey("location")) {
52
+ existing.setLocation((String) updates.get("location"));
53
+ }
54
+ if (updates.containsKey("budget")) {
55
+ Object val = updates.get("budget");
56
+ existing.setBudget(val != null ? Double.valueOf(val.toString()) : null);
57
+ }
58
+ return departmentRepository.save(existing);
59
+ });
60
+ }
61
+
62
+ public boolean delete(String id) {
63
+ if (departmentRepository.existsById(id)) {
64
+ departmentRepository.deleteById(id);
65
+ return true;
66
+ }
67
+ return false;
68
+ }
69
+
70
+ public List<DepartmentStatsDTO> getStats() {
71
+ Aggregation agg = Aggregation.newAggregation(
72
+ Aggregation.group("departmentId")
73
+ .count().as("totalHeadcount")
74
+ .sum("salary").as("totalPayroll")
75
+ .avg("salary").as("averageSalary"),
76
+ Aggregation.project("totalHeadcount", "totalPayroll", "averageSalary")
77
+ .and("_id").as("departmentId")
78
+ );
79
+ return mongoTemplate.aggregate(agg, "employees", DepartmentStatsDTO.class).getMappedResults();
80
+ }
81
+ }
@@ -0,0 +1,80 @@
1
+ package com.example.aggregation.service;
2
+
3
+ import com.example.aggregation.dto.EmployeeJoinDTO;
4
+ import com.example.aggregation.model.Employee;
5
+ import com.example.aggregation.repository.EmployeeRepository;
6
+ import org.springframework.beans.factory.annotation.Autowired;
7
+ import org.springframework.data.mongodb.core.MongoTemplate;
8
+ import org.springframework.data.mongodb.core.aggregation.Aggregation;
9
+ import org.springframework.stereotype.Service;
10
+
11
+ import java.util.List;
12
+ import java.util.Map;
13
+ import java.util.Optional;
14
+
15
+ @Service
16
+ public class EmployeeService {
17
+
18
+ @Autowired
19
+ private EmployeeRepository employeeRepository;
20
+
21
+ @Autowired
22
+ private MongoTemplate mongoTemplate;
23
+
24
+ public List<Employee> getAll() {
25
+ return employeeRepository.findAll();
26
+ }
27
+
28
+ public Optional<Employee> getById(String id) {
29
+ return employeeRepository.findById(id);
30
+ }
31
+
32
+ public Employee create(Employee employee) {
33
+ return employeeRepository.save(employee);
34
+ }
35
+
36
+ public Optional<Employee> update(String id, Employee updated) {
37
+ return employeeRepository.findById(id).map(existing -> {
38
+ updated.setId(id);
39
+ return employeeRepository.save(updated);
40
+ });
41
+ }
42
+
43
+ public Optional<Employee> patch(String id, Map<String, Object> updates) {
44
+ return employeeRepository.findById(id).map(existing -> {
45
+ if (updates.containsKey("name")) {
46
+ existing.setName((String) updates.get("name"));
47
+ }
48
+ if (updates.containsKey("email")) {
49
+ existing.setEmail((String) updates.get("email"));
50
+ }
51
+ if (updates.containsKey("role")) {
52
+ existing.setRole((String) updates.get("role"));
53
+ }
54
+ if (updates.containsKey("salary")) {
55
+ Object val = updates.get("salary");
56
+ existing.setSalary(val != null ? Double.valueOf(val.toString()) : null);
57
+ }
58
+ if (updates.containsKey("departmentId")) {
59
+ existing.setDepartmentId((String) updates.get("departmentId"));
60
+ }
61
+ return employeeRepository.save(existing);
62
+ });
63
+ }
64
+
65
+ public boolean delete(String id) {
66
+ if (employeeRepository.existsById(id)) {
67
+ employeeRepository.deleteById(id);
68
+ return true;
69
+ }
70
+ return false;
71
+ }
72
+
73
+ public List<EmployeeJoinDTO> getJoined() {
74
+ Aggregation agg = Aggregation.newAggregation(
75
+ Aggregation.lookup("departments", "departmentId", "_id", "department"),
76
+ Aggregation.unwind("department", true)
77
+ );
78
+ return mongoTemplate.aggregate(agg, "employees", EmployeeJoinDTO.class).getMappedResults();
79
+ }
80
+ }
@@ -0,0 +1,2 @@
1
+ spring.data.mongodb.uri=mongodb://localhost:27017/wad_exam
2
+ server.port=8080
@@ -0,0 +1,13 @@
1
+ package com.example.aggregation;
2
+
3
+ import org.junit.jupiter.api.Test;
4
+ import org.springframework.boot.test.context.SpringBootTest;
5
+
6
+ @SpringBootTest
7
+ class AggregationApplicationTests {
8
+
9
+ @Test
10
+ void contextLoads() {
11
+ }
12
+
13
+ }
@@ -0,0 +1,64 @@
1
+ # Vue 3 Two-Model CRUD and PATCH Frontend
2
+
3
+ Production-ready Vue 3 frontend matching the two-model Spring Boot backend (`Department` and `Employee`).
4
+
5
+ ## Architecture and Design
6
+
7
+ - **Vite + Vue 3**: Modern tooling and fast bundling
8
+ - **Component-Based Modularity**: Every feature is built using discrete child components inside `src/components/`
9
+ - **Pinia State Management**: Centralized store modules (`departmentStore.js`, `employeeStore.js`)
10
+ - **Axios API Service**: Clean client configured with base URL `http://localhost:8080/api`
11
+ - **HTTP Methods Supported**:
12
+ - `GET /api/departments` and `GET /api/employees` (Read All)
13
+ - `GET /api/departments/{id}` and `GET /api/employees/{id}` (Read Single)
14
+ - `POST /api/departments` and `POST /api/employees` (Create)
15
+ - `PUT /api/departments/{id}` and `PUT /api/employees/{id}` (Full Update)
16
+ - `PATCH /api/departments/{id}` and `PATCH /api/employees/{id}` (Partial Update)
17
+ - `DELETE /api/departments/{id}` and `DELETE /api/employees/{id}` (Remove)
18
+ - `GET /api/departments/stats` (Department $group aggregation statistics)
19
+ - `GET /api/employees/joined` (Employee and Department $lookup join data)
20
+
21
+ ## Project Structure
22
+
23
+ ```
24
+ src/
25
+ ├── components/
26
+ │ ├── NavBar.vue
27
+ │ ├── DepartmentTable.vue
28
+ │ ├── DepartmentFormModal.vue
29
+ │ ├── DepartmentPatchModal.vue
30
+ │ ├── EmployeeTable.vue
31
+ │ ├── EmployeeFormModal.vue
32
+ │ ├── EmployeePatchModal.vue
33
+ │ └── AnalyticsBoard.vue
34
+ ├── views/
35
+ │ ├── DepartmentsView.vue
36
+ │ ├── EmployeesView.vue
37
+ │ └── AnalyticsView.vue
38
+ ├── stores/
39
+ │ ├── departmentStore.js
40
+ │ └── employeeStore.js
41
+ ├── services/
42
+ │ └── api.js
43
+ ├── router/
44
+ │ └── index.js
45
+ ├── App.vue
46
+ ├── main.js
47
+ └── style.css
48
+ ```
49
+
50
+ ## Setup and Commands
51
+
52
+ ```bash
53
+ # Install dependencies
54
+ npm install
55
+
56
+ # Run dev server
57
+ npm run dev
58
+
59
+ # Build for production
60
+ npm run build
61
+
62
+ # Preview build
63
+ npm run preview
64
+ ```
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Enterprise Management System - Departments and Employees</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.js"></script>
11
+ </body>
12
+ </html>