wad-lab 1.1.6 → 1.1.7

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 (93) hide show
  1. package/package.json +1 -1
  2. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/controller/CompanyController.java +88 -74
  3. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/model/Employee.java +73 -73
  4. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/service/CompanyService.java +90 -60
  5. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +429 -405
  6. package/templates/fullstack-springboot-vue/frontend/vue-axios-interceptor/src/App.vue +177 -159
  7. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +441 -427
  8. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/stores/companyStore.js +126 -96
  9. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/App.vue +84 -69
  10. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
  11. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
  12. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
  13. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/App.vue +191 -167
  14. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -98
  15. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentList.vue +92 -91
  16. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -128
  17. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeList.vue +95 -94
  18. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +90 -90
  19. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/AddEmployeeView.vue +247 -247
  20. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +296 -273
  21. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +219 -196
  22. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/HomeDashboardView.vue +263 -263
  23. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
  24. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
  25. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
  26. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
  27. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
  28. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
  29. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
  30. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
  31. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
  32. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
  33. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/App.vue +59 -59
  34. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/components/DataCard.vue +72 -53
  35. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
  36. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
  37. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/controller/CompanyController.java +88 -74
  38. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/model/Employee.java +73 -73
  39. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/service/CompanyService.java +90 -60
  40. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/controller/CourseController.java +46 -42
  41. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/service/CourseService.java +70 -60
  42. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/controller/HospitalController.java +54 -50
  43. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/service/HospitalService.java +65 -54
  44. package/templates/springboot-library-api/src/main/java/com/example/library/controller/LibraryController.java +57 -51
  45. package/templates/springboot-library-api/src/main/java/com/example/library/service/LibraryService.java +70 -60
  46. package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/controller/ItemController.java +45 -41
  47. package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/service/ItemService.java +48 -38
  48. package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
  49. package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/service/ItemService.java +48 -38
  50. package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/controller/ItemController.java +45 -41
  51. package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/service/ItemService.java +48 -38
  52. package/templates/springboot-mongo-crud/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  53. package/templates/springboot-mongo-crud/src/main/java/com/example/crud/service/ItemService.java +48 -38
  54. package/templates/vue-axios/src/App.vue +264 -243
  55. package/templates/vue-axios/src/services/ItemService.js +27 -21
  56. package/templates/vue-axios-basic/src/App.vue +24 -0
  57. package/templates/vue-axios-interceptor/src/App.vue +177 -159
  58. package/templates/vue-axios-pinia/src/App.vue +14 -0
  59. package/templates/vue-axios-pinia/src/stores/companyStore.js +126 -96
  60. package/templates/vue-axios-pinia-props/src/App.vue +84 -69
  61. package/templates/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
  62. package/templates/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
  63. package/templates/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
  64. package/templates/vue-axios-props-emits/src/App.vue +24 -0
  65. package/templates/vue-axios-props-emits/src/components/DepartmentList.vue +2 -1
  66. package/templates/vue-axios-props-emits/src/components/EmployeeList.vue +2 -1
  67. package/templates/vue-axios-router/src/views/DepartmentView.vue +23 -0
  68. package/templates/vue-axios-router/src/views/EmployeeView.vue +23 -0
  69. package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
  70. package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
  71. package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
  72. package/templates/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
  73. package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
  74. package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
  75. package/templates/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
  76. package/templates/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
  77. package/templates/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
  78. package/templates/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
  79. package/templates/vue-axios-router-props/src/components/DataCard.vue +72 -53
  80. package/templates/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
  81. package/templates/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
  82. package/templates/vue-fetch/src/App.vue +285 -259
  83. package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  84. package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
  85. package/templates/vue-router-pinia-springboot/frontend/src/services/ItemService.js +24 -21
  86. package/templates/vue-router-pinia-springboot/frontend/src/stores/itemStore.js +42 -37
  87. package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +76 -67
  88. package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
  89. package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/service/ItemService.java +45 -35
  90. package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  91. package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
  92. package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +158 -149
  93. package/templates/vue-springboot-mongo-crud/frontend/src/services/ItemService.js +24 -21
@@ -1,69 +1,84 @@
1
- <script setup>
2
- import { onMounted } from 'vue'
3
- import { useCompanyStore } from './stores/companyStore'
4
- import DepartmentSection from './components/DepartmentSection.vue'
5
- import EmployeeSection from './components/EmployeeSection.vue'
6
-
7
- const store = useCompanyStore()
8
-
9
- onMounted(() => {
10
- store.fetchDepartments()
11
- store.fetchEmployees()
12
- })
13
-
14
- function handleCreateDepartment(department) {
15
- store.createDepartment(department)
16
- }
17
-
18
- function handleDeleteDepartment(id) {
19
- store.deleteDepartment(id)
20
- }
21
-
22
- function handleCreateEmployee(employee) {
23
- store.createEmployee(employee)
24
- }
25
-
26
- function handleDeleteEmployee(id) {
27
- store.deleteEmployee(id)
28
- }
29
- </script>
30
-
31
- <template>
32
- <main class="app-container">
33
- <header class="app-header">
34
- <h1>Company Management System</h1>
35
- </header>
36
- <DepartmentSection
37
- :departments="store.departments"
38
- @create="handleCreateDepartment"
39
- @delete="handleDeleteDepartment"
40
- />
41
- <EmployeeSection
42
- :employees="store.employees"
43
- :departments="store.departments"
44
- @create="handleCreateEmployee"
45
- @delete="handleDeleteEmployee"
46
- />
47
- </main>
48
- </template>
49
-
50
- <style scoped>
51
- .app-container {
52
- max-width: 960px;
53
- margin: 0 auto;
54
- padding: 24px 16px;
55
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
56
- color: #333;
57
- }
58
-
59
- .app-header {
60
- margin-bottom: 24px;
61
- border-bottom: 2px solid #eee;
62
- padding-bottom: 12px;
63
- }
64
-
65
- .app-header h1 {
66
- margin: 0;
67
- font-size: 24px;
68
- }
69
- </style>
1
+ <script setup>
2
+ import { onMounted } from 'vue'
3
+ import { useCompanyStore } from './stores/companyStore'
4
+ import DepartmentSection from './components/DepartmentSection.vue'
5
+ import EmployeeSection from './components/EmployeeSection.vue'
6
+
7
+ const companyStore = useCompanyStore()
8
+ const store = companyStore
9
+
10
+ onMounted(() => {
11
+ store.fetchDepartments()
12
+ store.fetchEmployees()
13
+ })
14
+
15
+ function handleCreateDepartment(department) {
16
+ store.createDepartment(department)
17
+ }
18
+
19
+ function handleDeleteDepartment(id) {
20
+ store.deleteDepartment(id)
21
+ }
22
+
23
+ async function handlePatchDept(id, code) {
24
+ const newCode = prompt('New code:', code)
25
+ if (!newCode || newCode === code) return
26
+ await companyStore.patchDepartment(id, { code: newCode })
27
+ }
28
+
29
+ function handleCreateEmployee(employee) {
30
+ store.createEmployee(employee)
31
+ }
32
+
33
+ function handleDeleteEmployee(id) {
34
+ store.deleteEmployee(id)
35
+ }
36
+
37
+ async function handlePatchEmp(id, salary) {
38
+ const newSalary = prompt('New salary:', salary)
39
+ if (!newSalary || Number(newSalary) === Number(salary)) return
40
+ await companyStore.patchEmployee(id, { salary: Number(newSalary) })
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <main class="app-container">
46
+ <header class="app-header">
47
+ <h1>Company Management System</h1>
48
+ </header>
49
+ <DepartmentSection
50
+ :departments="store.departments"
51
+ @create="handleCreateDepartment"
52
+ @delete="handleDeleteDepartment"
53
+ @patch="handlePatchDept"
54
+ />
55
+ <EmployeeSection
56
+ :employees="store.employees"
57
+ :departments="store.departments"
58
+ @create="handleCreateEmployee"
59
+ @delete="handleDeleteEmployee"
60
+ @patch="handlePatchEmp"
61
+ />
62
+ </main>
63
+ </template>
64
+
65
+ <style scoped>
66
+ .app-container {
67
+ max-width: 960px;
68
+ margin: 0 auto;
69
+ padding: 24px 16px;
70
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
71
+ color: #333;
72
+ }
73
+
74
+ .app-header {
75
+ margin-bottom: 24px;
76
+ border-bottom: 2px solid #eee;
77
+ padding-bottom: 12px;
78
+ }
79
+
80
+ .app-header h1 {
81
+ margin: 0;
82
+ font-size: 24px;
83
+ }
84
+ </style>
@@ -1,152 +1,164 @@
1
- <script setup>
2
- import { ref } from 'vue'
3
-
4
- const props = defineProps(['departments'])
5
- const emit = defineEmits(['create', 'delete'])
6
-
7
- const name = ref('')
8
- const code = ref('')
9
-
10
- function handleSubmit() {
11
- if (!name.value || !code.value) return
12
- emit('create', {
13
- name: name.value.trim(),
14
- code: code.value.trim()
15
- })
16
- name.value = ''
17
- code.value = ''
18
- }
19
-
20
- function handleDelete(id) {
21
- emit('delete', id)
22
- }
23
- </script>
24
-
25
- <template>
26
- <section class="section">
27
- <h2>Departments</h2>
28
- <form class="form" @submit.prevent="handleSubmit">
29
- <div class="form-group">
30
- <label for="dept-name">Department Name</label>
31
- <input id="dept-name" v-model="name" type="text" placeholder="e.g. Engineering" required>
32
- </div>
33
- <div class="form-group">
34
- <label for="dept-code">Department Code</label>
35
- <input id="dept-code" v-model="code" type="text" placeholder="e.g. ENG" required>
36
- </div>
37
- <button type="submit" class="btn btn-primary">Add Department</button>
38
- </form>
39
-
40
- <div class="table-container">
41
- <p v-if="!departments || departments.length === 0" class="empty">No departments available.</p>
42
- <table v-else class="data-table">
43
- <thead>
44
- <tr>
45
- <th>ID</th>
46
- <th>Name</th>
47
- <th>Code</th>
48
- <th>Actions</th>
49
- </tr>
50
- </thead>
51
- <tbody>
52
- <tr v-for="dept in departments" :key="dept.id">
53
- <td>{{ dept.id }}</td>
54
- <td>{{ dept.name }}</td>
55
- <td>{{ dept.code }}</td>
56
- <td>
57
- <button class="btn btn-danger" @click="handleDelete(dept.id)">Delete</button>
58
- </td>
59
- </tr>
60
- </tbody>
61
- </table>
62
- </div>
63
- </section>
64
- </template>
65
-
66
- <style scoped>
67
- .section {
68
- border: 1px solid #ccc;
69
- border-radius: 4px;
70
- padding: 16px;
71
- margin-bottom: 24px;
72
- }
73
-
74
- .form {
75
- display: flex;
76
- flex-wrap: wrap;
77
- gap: 12px;
78
- align-items: flex-end;
79
- margin-bottom: 16px;
80
- }
81
-
82
- .form-group {
83
- display: flex;
84
- flex-direction: column;
85
- gap: 4px;
86
- }
87
-
88
- .form-group label {
89
- font-size: 14px;
90
- font-weight: 600;
91
- }
92
-
93
- .form-group input {
94
- padding: 6px 10px;
95
- border: 1px solid #ccc;
96
- border-radius: 4px;
97
- font-size: 14px;
98
- }
99
-
100
- .btn {
101
- padding: 6px 14px;
102
- border: 1px solid transparent;
103
- border-radius: 4px;
104
- cursor: pointer;
105
- font-size: 14px;
106
- }
107
-
108
- .btn-primary {
109
- background-color: #007bff;
110
- color: white;
111
- border-color: #007bff;
112
- }
113
-
114
- .btn-primary:hover {
115
- background-color: #0069d9;
116
- }
117
-
118
- .btn-danger {
119
- background-color: #dc3545;
120
- color: white;
121
- border-color: #dc3545;
122
- }
123
-
124
- .btn-danger:hover {
125
- background-color: #c82333;
126
- }
127
-
128
- .table-container {
129
- overflow-x: auto;
130
- }
131
-
132
- .data-table {
133
- width: 100%;
134
- border-collapse: collapse;
135
- }
136
-
137
- .data-table th,
138
- .data-table td {
139
- border: 1px solid #ddd;
140
- padding: 8px 12px;
141
- text-align: left;
142
- }
143
-
144
- .data-table th {
145
- background-color: #f2f2f2;
146
- }
147
-
148
- .empty {
149
- color: #666;
150
- font-style: italic;
151
- }
152
- </style>
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+
4
+ const props = defineProps(['departments'])
5
+ const emit = defineEmits(['create', 'delete', 'patch'])
6
+
7
+ const name = ref('')
8
+ const code = ref('')
9
+
10
+ function handleSubmit() {
11
+ if (!name.value || !code.value) return
12
+ emit('create', {
13
+ name: name.value.trim(),
14
+ code: code.value.trim()
15
+ })
16
+ name.value = ''
17
+ code.value = ''
18
+ }
19
+
20
+ function handleDelete(id) {
21
+ emit('delete', id)
22
+ }
23
+ </script>
24
+
25
+ <template>
26
+ <section class="section">
27
+ <h2>Departments</h2>
28
+ <form class="form" @submit.prevent="handleSubmit">
29
+ <div class="form-group">
30
+ <label for="dept-name">Department Name</label>
31
+ <input id="dept-name" v-model="name" type="text" placeholder="e.g. Engineering" required>
32
+ </div>
33
+ <div class="form-group">
34
+ <label for="dept-code">Department Code</label>
35
+ <input id="dept-code" v-model="code" type="text" placeholder="e.g. ENG" required>
36
+ </div>
37
+ <button type="submit" class="btn btn-primary">Add Department</button>
38
+ </form>
39
+
40
+ <div class="table-container">
41
+ <p v-if="!departments || departments.length === 0" class="empty">No departments available.</p>
42
+ <table v-else class="data-table">
43
+ <thead>
44
+ <tr>
45
+ <th>ID</th>
46
+ <th>Name</th>
47
+ <th>Code</th>
48
+ <th>Actions</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+ <tr v-for="dept in departments" :key="dept.id">
53
+ <td>{{ dept.id }}</td>
54
+ <td>{{ dept.name }}</td>
55
+ <td>{{ dept.code }}</td>
56
+ <td>
57
+ <button class="btn btn-patch" @click="$emit('patch', dept.id, dept.code)">Patch</button>
58
+ <button class="btn btn-danger" @click="handleDelete(dept.id)">Delete</button>
59
+ </td>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+ </div>
64
+ </section>
65
+ </template>
66
+
67
+ <style scoped>
68
+ .section {
69
+ border: 1px solid #ccc;
70
+ border-radius: 4px;
71
+ padding: 16px;
72
+ margin-bottom: 24px;
73
+ }
74
+
75
+ .form {
76
+ display: flex;
77
+ flex-wrap: wrap;
78
+ gap: 12px;
79
+ align-items: flex-end;
80
+ margin-bottom: 16px;
81
+ }
82
+
83
+ .form-group {
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 4px;
87
+ }
88
+
89
+ .form-group label {
90
+ font-size: 14px;
91
+ font-weight: 600;
92
+ }
93
+
94
+ .form-group input {
95
+ padding: 6px 10px;
96
+ border: 1px solid #ccc;
97
+ border-radius: 4px;
98
+ font-size: 14px;
99
+ }
100
+
101
+ .btn {
102
+ padding: 6px 14px;
103
+ border: 1px solid transparent;
104
+ border-radius: 4px;
105
+ cursor: pointer;
106
+ font-size: 14px;
107
+ }
108
+
109
+ .btn-primary {
110
+ background-color: #007bff;
111
+ color: white;
112
+ border-color: #007bff;
113
+ }
114
+
115
+ .btn-primary:hover {
116
+ background-color: #0069d9;
117
+ }
118
+
119
+ .btn-danger {
120
+ background-color: #dc3545;
121
+ color: white;
122
+ border-color: #dc3545;
123
+ }
124
+
125
+ .btn-danger:hover {
126
+ background-color: #c82333;
127
+ }
128
+
129
+ .btn-patch {
130
+ background-color: #17a2b8;
131
+ color: white;
132
+ border-color: #17a2b8;
133
+ margin-right: 6px;
134
+ }
135
+
136
+ .btn-patch:hover {
137
+ background-color: #138496;
138
+ }
139
+
140
+ .table-container {
141
+ overflow-x: auto;
142
+ }
143
+
144
+ .data-table {
145
+ width: 100%;
146
+ border-collapse: collapse;
147
+ }
148
+
149
+ .data-table th,
150
+ .data-table td {
151
+ border: 1px solid #ddd;
152
+ padding: 8px 12px;
153
+ text-align: left;
154
+ }
155
+
156
+ .data-table th {
157
+ background-color: #f2f2f2;
158
+ }
159
+
160
+ .empty {
161
+ color: #666;
162
+ font-style: italic;
163
+ }
164
+ </style>