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.
- package/package.json +1 -1
- package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/controller/CompanyController.java +88 -74
- package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/model/Employee.java +73 -73
- package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/service/CompanyService.java +90 -60
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +429 -405
- package/templates/fullstack-springboot-vue/frontend/vue-axios-interceptor/src/App.vue +177 -159
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +441 -427
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/stores/companyStore.js +126 -96
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/App.vue +84 -69
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
- package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/App.vue +191 -167
- package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -98
- package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentList.vue +92 -91
- package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -128
- package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeList.vue +95 -94
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +90 -90
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/AddEmployeeView.vue +247 -247
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +296 -273
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +219 -196
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/HomeDashboardView.vue +263 -263
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/App.vue +59 -59
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/components/DataCard.vue +72 -53
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
- package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/controller/CompanyController.java +88 -74
- package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/model/Employee.java +73 -73
- package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/service/CompanyService.java +90 -60
- package/templates/springboot-course-registration/src/main/java/com/example/coursereg/controller/CourseController.java +46 -42
- package/templates/springboot-course-registration/src/main/java/com/example/coursereg/service/CourseService.java +70 -60
- package/templates/springboot-hospital-api/src/main/java/com/example/hospital/controller/HospitalController.java +54 -50
- package/templates/springboot-hospital-api/src/main/java/com/example/hospital/service/HospitalService.java +65 -54
- package/templates/springboot-library-api/src/main/java/com/example/library/controller/LibraryController.java +57 -51
- package/templates/springboot-library-api/src/main/java/com/example/library/service/LibraryService.java +70 -60
- package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/controller/ItemController.java +45 -41
- package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/service/ItemService.java +48 -38
- package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
- package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/service/ItemService.java +48 -38
- package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/controller/ItemController.java +45 -41
- package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/service/ItemService.java +48 -38
- package/templates/springboot-mongo-crud/src/main/java/com/example/crud/controller/ItemController.java +45 -41
- package/templates/springboot-mongo-crud/src/main/java/com/example/crud/service/ItemService.java +48 -38
- package/templates/vue-axios/src/App.vue +264 -243
- package/templates/vue-axios/src/services/ItemService.js +27 -21
- package/templates/vue-axios-basic/src/App.vue +24 -0
- package/templates/vue-axios-interceptor/src/App.vue +177 -159
- package/templates/vue-axios-pinia/src/App.vue +14 -0
- package/templates/vue-axios-pinia/src/stores/companyStore.js +126 -96
- package/templates/vue-axios-pinia-props/src/App.vue +84 -69
- package/templates/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
- package/templates/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
- package/templates/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
- package/templates/vue-axios-props-emits/src/App.vue +24 -0
- package/templates/vue-axios-props-emits/src/components/DepartmentList.vue +2 -1
- package/templates/vue-axios-props-emits/src/components/EmployeeList.vue +2 -1
- package/templates/vue-axios-router/src/views/DepartmentView.vue +23 -0
- package/templates/vue-axios-router/src/views/EmployeeView.vue +23 -0
- package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
- package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
- package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
- package/templates/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
- package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
- package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
- package/templates/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
- package/templates/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
- package/templates/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
- package/templates/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
- package/templates/vue-axios-router-props/src/components/DataCard.vue +72 -53
- package/templates/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
- package/templates/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
- package/templates/vue-fetch/src/App.vue +285 -259
- package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
- package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
- package/templates/vue-router-pinia-springboot/frontend/src/services/ItemService.js +24 -21
- package/templates/vue-router-pinia-springboot/frontend/src/stores/itemStore.js +42 -37
- package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +76 -67
- package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
- package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/service/ItemService.java +45 -35
- package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
- package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
- package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +158 -149
- package/templates/vue-springboot-mongo-crud/frontend/src/services/ItemService.js +24 -21
|
@@ -1,159 +1,177 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, reactive } from 'vue'
|
|
3
|
-
import api from './services/api'
|
|
4
|
-
import ToastNotification from './components/ToastNotification.vue'
|
|
5
|
-
|
|
6
|
-
const departments = ref([
|
|
7
|
-
{ id: 1, name: 'Engineering', location: 'Floor 3' },
|
|
8
|
-
{ id: 2, name: 'Marketing', location: 'Floor 2' }
|
|
9
|
-
])
|
|
10
|
-
|
|
11
|
-
const newDept = reactive({
|
|
12
|
-
name: '',
|
|
13
|
-
location: ''
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
async function fetchDepartments() {
|
|
17
|
-
try {
|
|
18
|
-
const res = await api.get('/departments')
|
|
19
|
-
departments.value = res.data
|
|
20
|
-
} catch (err) {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async function addDepartment() {
|
|
25
|
-
if (!newDept.name) return
|
|
26
|
-
try {
|
|
27
|
-
const res = await api.post('/departments', {
|
|
28
|
-
name: newDept.name,
|
|
29
|
-
location: newDept.location
|
|
30
|
-
})
|
|
31
|
-
departments.value.push(res.data || { id: Date.now(), name: newDept.name, location: newDept.location })
|
|
32
|
-
newDept.name = ''
|
|
33
|
-
newDept.location = ''
|
|
34
|
-
} catch (err) {
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
button
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
border-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
button
|
|
128
|
-
background-color: #
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, reactive } from 'vue'
|
|
3
|
+
import api from './services/api'
|
|
4
|
+
import ToastNotification from './components/ToastNotification.vue'
|
|
5
|
+
|
|
6
|
+
const departments = ref([
|
|
7
|
+
{ id: 1, name: 'Engineering', location: 'Floor 3' },
|
|
8
|
+
{ id: 2, name: 'Marketing', location: 'Floor 2' }
|
|
9
|
+
])
|
|
10
|
+
|
|
11
|
+
const newDept = reactive({
|
|
12
|
+
name: '',
|
|
13
|
+
location: ''
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
async function fetchDepartments() {
|
|
17
|
+
try {
|
|
18
|
+
const res = await api.get('/departments')
|
|
19
|
+
departments.value = res.data
|
|
20
|
+
} catch (err) {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function addDepartment() {
|
|
25
|
+
if (!newDept.name) return
|
|
26
|
+
try {
|
|
27
|
+
const res = await api.post('/departments', {
|
|
28
|
+
name: newDept.name,
|
|
29
|
+
location: newDept.location
|
|
30
|
+
})
|
|
31
|
+
departments.value.push(res.data || { id: Date.now(), name: newDept.name, location: newDept.location })
|
|
32
|
+
newDept.name = ''
|
|
33
|
+
newDept.location = ''
|
|
34
|
+
} catch (err) {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function testPatchEmployeeSalary() {
|
|
39
|
+
const empId = 1
|
|
40
|
+
try {
|
|
41
|
+
await api.patch(`/employees/${empId}`, { salary: 88000 })
|
|
42
|
+
} catch (err) {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function triggerError() {
|
|
47
|
+
try {
|
|
48
|
+
await api.get('/departments/invalid-id')
|
|
49
|
+
} catch (err) {
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div class="container">
|
|
56
|
+
<ToastNotification />
|
|
57
|
+
<h1>Department Management</h1>
|
|
58
|
+
|
|
59
|
+
<div class="actions">
|
|
60
|
+
<button @click="fetchDepartments">Fetch Departments (GET)</button>
|
|
61
|
+
<button class="btn-patch" @click="testPatchEmployeeSalary">Test PATCH Employee Salary</button>
|
|
62
|
+
<button class="btn-error" @click="triggerError">Trigger 404 Error (GET)</button>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<form class="form" @submit.prevent="addDepartment">
|
|
66
|
+
<input v-model="newDept.name" placeholder="Department Name" required />
|
|
67
|
+
<input v-model="newDept.location" placeholder="Location" required />
|
|
68
|
+
<button type="submit">Add Department (POST)</button>
|
|
69
|
+
</form>
|
|
70
|
+
|
|
71
|
+
<table class="table">
|
|
72
|
+
<thead>
|
|
73
|
+
<tr>
|
|
74
|
+
<th>ID</th>
|
|
75
|
+
<th>Name</th>
|
|
76
|
+
<th>Location</th>
|
|
77
|
+
</tr>
|
|
78
|
+
</thead>
|
|
79
|
+
<tbody>
|
|
80
|
+
<tr v-for="dept in departments" :key="dept.id">
|
|
81
|
+
<td>{{ dept.id }}</td>
|
|
82
|
+
<td>{{ dept.name }}</td>
|
|
83
|
+
<td>{{ dept.location }}</td>
|
|
84
|
+
</tr>
|
|
85
|
+
</tbody>
|
|
86
|
+
</table>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<style>
|
|
91
|
+
body {
|
|
92
|
+
margin: 0;
|
|
93
|
+
font-family: sans-serif;
|
|
94
|
+
background-color: #f7f9fa;
|
|
95
|
+
color: #333;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.container {
|
|
99
|
+
max-width: 800px;
|
|
100
|
+
margin: 40px auto;
|
|
101
|
+
padding: 20px;
|
|
102
|
+
background: #fff;
|
|
103
|
+
border: 1px solid #ddd;
|
|
104
|
+
border-radius: 6px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
h1 {
|
|
108
|
+
margin-top: 0;
|
|
109
|
+
font-size: 22px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.actions {
|
|
113
|
+
display: flex;
|
|
114
|
+
gap: 10px;
|
|
115
|
+
margin-bottom: 20px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
button {
|
|
119
|
+
padding: 8px 14px;
|
|
120
|
+
border: 1px solid #1976d2;
|
|
121
|
+
background-color: #1976d2;
|
|
122
|
+
color: #fff;
|
|
123
|
+
border-radius: 4px;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
button:hover {
|
|
128
|
+
background-color: #1565c0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
button.btn-patch {
|
|
132
|
+
border-color: #f57c00;
|
|
133
|
+
background-color: #f57c00;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
button.btn-patch:hover {
|
|
137
|
+
background-color: #e65100;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
button.btn-error {
|
|
141
|
+
border-color: #d32f2f;
|
|
142
|
+
background-color: #d32f2f;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
button.btn-error:hover {
|
|
146
|
+
background-color: #b71c1c;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.form {
|
|
150
|
+
display: flex;
|
|
151
|
+
gap: 10px;
|
|
152
|
+
margin-bottom: 20px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
input {
|
|
156
|
+
padding: 8px;
|
|
157
|
+
border: 1px solid #ccc;
|
|
158
|
+
border-radius: 4px;
|
|
159
|
+
flex: 1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.table {
|
|
163
|
+
width: 100%;
|
|
164
|
+
border-collapse: collapse;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.table th,
|
|
168
|
+
.table td {
|
|
169
|
+
border: 1px solid #ddd;
|
|
170
|
+
padding: 10px;
|
|
171
|
+
text-align: left;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.table th {
|
|
175
|
+
background-color: #f0f0f0;
|
|
176
|
+
}
|
|
177
|
+
</style>
|