wad-lab 1.1.2 → 1.1.3

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 (145) hide show
  1. package/bin/index.js +12 -1
  2. package/package.json +1 -1
  3. package/templates/springboot-2model-1controller-api/pom.xml +42 -0
  4. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/CompanyApplication.java +11 -0
  5. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/controller/CompanyController.java +74 -0
  6. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/model/Department.java +51 -0
  7. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/model/Employee.java +73 -0
  8. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/repository/DepartmentRepository.java +12 -0
  9. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/repository/EmployeeRepository.java +12 -0
  10. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/service/CompanyService.java +60 -0
  11. package/templates/springboot-2model-1controller-api/src/main/resources/application.properties +4 -0
  12. package/templates/vue-axios-basic/index.html +12 -0
  13. package/templates/{frontend → vue-axios-basic}/package.json +6 -9
  14. package/templates/vue-axios-basic/src/App.vue +405 -0
  15. package/templates/{frontend → vue-axios-basic}/src/main.js +0 -2
  16. package/templates/vue-axios-basic/src/services/api.js +7 -0
  17. package/templates/vue-axios-basic/vite.config.js +9 -0
  18. package/templates/{frontend → vue-axios-interceptor}/index.html +2 -3
  19. package/templates/vue-axios-interceptor/package.json +20 -0
  20. package/templates/vue-axios-interceptor/src/App.vue +159 -0
  21. package/templates/vue-axios-interceptor/src/components/ToastNotification.vue +47 -0
  22. package/templates/vue-axios-interceptor/src/main.js +7 -0
  23. package/templates/vue-axios-interceptor/src/services/api.js +32 -0
  24. package/templates/vue-axios-interceptor/src/stores/toastStore.js +23 -0
  25. package/templates/vue-axios-interceptor/vite.config.js +6 -0
  26. package/templates/vue-axios-pinia/index.html +12 -0
  27. package/templates/vue-axios-pinia/package.json +20 -0
  28. package/templates/vue-axios-pinia/src/App.vue +427 -0
  29. package/templates/vue-axios-pinia/src/main.js +5 -0
  30. package/templates/vue-axios-pinia/src/services/api.js +7 -0
  31. package/templates/vue-axios-pinia/src/stores/companyStore.js +96 -0
  32. package/templates/vue-axios-pinia/vite.config.js +9 -0
  33. package/templates/vue-axios-pinia-props/index.html +12 -0
  34. package/templates/vue-axios-pinia-props/package.json +20 -0
  35. package/templates/vue-axios-pinia-props/src/App.vue +69 -0
  36. package/templates/vue-axios-pinia-props/src/components/DepartmentSection.vue +152 -0
  37. package/templates/vue-axios-pinia-props/src/components/EmployeeSection.vue +181 -0
  38. package/templates/vue-axios-pinia-props/src/main.js +5 -0
  39. package/templates/vue-axios-pinia-props/src/services/api.js +7 -0
  40. package/templates/vue-axios-pinia-props/src/stores/companyStore.js +35 -0
  41. package/templates/vue-axios-pinia-props/vite.config.js +6 -0
  42. package/templates/vue-axios-props-emits/index.html +12 -0
  43. package/templates/vue-axios-props-emits/package.json +19 -0
  44. package/templates/vue-axios-props-emits/src/App.vue +167 -0
  45. package/templates/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -0
  46. package/templates/vue-axios-props-emits/src/components/DepartmentList.vue +91 -0
  47. package/templates/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -0
  48. package/templates/vue-axios-props-emits/src/components/EmployeeList.vue +94 -0
  49. package/templates/vue-axios-props-emits/src/main.js +4 -0
  50. package/templates/vue-axios-props-emits/src/services/api.js +7 -0
  51. package/templates/vue-axios-props-emits/vite.config.js +9 -0
  52. package/templates/vue-axios-router/index.html +12 -0
  53. package/templates/vue-axios-router/package.json +20 -0
  54. package/templates/vue-axios-router/src/App.vue +90 -0
  55. package/templates/vue-axios-router/src/main.js +5 -0
  56. package/templates/vue-axios-router/src/router/index.js +19 -0
  57. package/templates/vue-axios-router/src/services/api.js +7 -0
  58. package/templates/vue-axios-router/src/views/AddEmployeeView.vue +247 -0
  59. package/templates/vue-axios-router/src/views/DepartmentView.vue +273 -0
  60. package/templates/vue-axios-router/src/views/EmployeeView.vue +196 -0
  61. package/templates/vue-axios-router/src/views/HomeDashboardView.vue +263 -0
  62. package/templates/vue-axios-router/vite.config.js +6 -0
  63. package/templates/vue-axios-router-children/index.html +12 -0
  64. package/templates/vue-axios-router-children/package.json +20 -0
  65. package/templates/vue-axios-router-children/src/App.vue +20 -0
  66. package/templates/vue-axios-router-children/src/main.js +5 -0
  67. package/templates/vue-axios-router-children/src/router/index.js +42 -0
  68. package/templates/vue-axios-router-children/src/services/api.js +7 -0
  69. package/templates/vue-axios-router-children/src/views/CompanyLayout.vue +75 -0
  70. package/templates/vue-axios-router-children/src/views/CompanyOverview.vue +109 -0
  71. package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +231 -0
  72. package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +159 -0
  73. package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +295 -0
  74. package/templates/vue-axios-router-children/vite.config.js +6 -0
  75. package/templates/vue-axios-router-pinia/index.html +12 -0
  76. package/templates/vue-axios-router-pinia/package.json +21 -0
  77. package/templates/vue-axios-router-pinia/src/App.vue +92 -0
  78. package/templates/vue-axios-router-pinia/src/main.js +9 -0
  79. package/templates/vue-axios-router-pinia/src/router/index.js +17 -0
  80. package/templates/vue-axios-router-pinia/src/services/api.js +7 -0
  81. package/templates/vue-axios-router-pinia/src/stores/companyStore.js +70 -0
  82. package/templates/vue-axios-router-pinia/src/views/DashboardView.vue +77 -0
  83. package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +209 -0
  84. package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +237 -0
  85. package/templates/vue-axios-router-pinia/vite.config.js +6 -0
  86. package/templates/vue-axios-router-pinia-props/index.html +12 -0
  87. package/templates/vue-axios-router-pinia-props/package.json +21 -0
  88. package/templates/vue-axios-router-pinia-props/src/App.vue +67 -0
  89. package/templates/vue-axios-router-pinia-props/src/components/EntityForm.vue +101 -0
  90. package/templates/vue-axios-router-pinia-props/src/components/EntityTable.vue +92 -0
  91. package/templates/vue-axios-router-pinia-props/src/components/SummaryBadge.vue +43 -0
  92. package/templates/vue-axios-router-pinia-props/src/main.js +9 -0
  93. package/templates/vue-axios-router-pinia-props/src/router/index.js +29 -0
  94. package/templates/vue-axios-router-pinia-props/src/services/api.js +29 -0
  95. package/templates/vue-axios-router-pinia-props/src/stores/companyStore.js +84 -0
  96. package/templates/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +64 -0
  97. package/templates/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +67 -0
  98. package/templates/vue-axios-router-pinia-props/src/views/OverviewView.vue +38 -0
  99. package/templates/vue-axios-router-pinia-props/vite.config.js +6 -0
  100. package/templates/vue-axios-router-props/index.html +12 -0
  101. package/templates/vue-axios-router-props/package.json +20 -0
  102. package/templates/vue-axios-router-props/src/App.vue +59 -0
  103. package/templates/vue-axios-router-props/src/components/DataCard.vue +53 -0
  104. package/templates/vue-axios-router-props/src/components/EntryForm.vue +117 -0
  105. package/templates/vue-axios-router-props/src/main.js +7 -0
  106. package/templates/vue-axios-router-props/src/router/index.js +23 -0
  107. package/templates/vue-axios-router-props/src/services/api.js +7 -0
  108. package/templates/vue-axios-router-props/src/views/DepartmentPage.vue +77 -0
  109. package/templates/vue-axios-router-props/src/views/EmployeePage.vue +116 -0
  110. package/templates/vue-axios-router-props/vite.config.js +6 -0
  111. package/templates/backend/.gitattributes +0 -2
  112. package/templates/backend/.idea/compiler.xml +0 -21
  113. package/templates/backend/.idea/encodings.xml +0 -6
  114. package/templates/backend/.idea/jarRepositories.xml +0 -20
  115. package/templates/backend/.idea/misc.xml +0 -12
  116. package/templates/backend/.idea/vcs.xml +0 -6
  117. package/templates/backend/pom.xml +0 -104
  118. package/templates/backend/src/main/java/com/example/crud/CrudApplication.java +0 -13
  119. package/templates/backend/src/main/java/com/example/crud/controller/ItemController.java +0 -42
  120. package/templates/backend/src/main/java/com/example/crud/model/Item.java +0 -20
  121. package/templates/backend/src/main/java/com/example/crud/repository/ItemRepository.java +0 -9
  122. package/templates/backend/src/main/java/com/example/crud/service/ItemService.java +0 -37
  123. package/templates/backend/src/main/resources/application.properties +0 -4
  124. package/templates/backend/src/test/java/com/example/crud/CrudApplicationTests.java +0 -13
  125. package/templates/frontend/.vscode/extensions.json +0 -3
  126. package/templates/frontend/README.md +0 -38
  127. package/templates/frontend/jsconfig.json +0 -8
  128. package/templates/frontend/public/favicon.ico +0 -0
  129. package/templates/frontend/src/App.vue +0 -50
  130. package/templates/frontend/src/assets/base.css +0 -86
  131. package/templates/frontend/src/assets/logo.svg +0 -1
  132. package/templates/frontend/src/assets/main.css +0 -35
  133. package/templates/frontend/src/components/HelloWorld.vue +0 -44
  134. package/templates/frontend/src/components/TheWelcome.vue +0 -95
  135. package/templates/frontend/src/components/WelcomeItem.vue +0 -87
  136. package/templates/frontend/src/components/icons/IconCommunity.vue +0 -7
  137. package/templates/frontend/src/components/icons/IconDocumentation.vue +0 -7
  138. package/templates/frontend/src/components/icons/IconEcosystem.vue +0 -7
  139. package/templates/frontend/src/components/icons/IconSupport.vue +0 -7
  140. package/templates/frontend/src/components/icons/IconTooling.vue +0 -19
  141. package/templates/frontend/src/services/ItemService.js +0 -21
  142. package/templates/frontend/vite.config.js +0 -18
  143. /package/templates/{backend → springboot-2model-1controller-api}/.mvn/wrapper/maven-wrapper.properties +0 -0
  144. /package/templates/{backend → springboot-2model-1controller-api}/mvnw +0 -0
  145. /package/templates/{backend → springboot-2model-1controller-api}/mvnw.cmd +0 -0
@@ -0,0 +1,116 @@
1
+ <script setup>
2
+ import { ref, computed, onMounted } from 'vue'
3
+ import api from '../services/api'
4
+ import EntryForm from '../components/EntryForm.vue'
5
+ import DataCard from '../components/DataCard.vue'
6
+
7
+ const employees = ref([])
8
+ const departments = ref([])
9
+
10
+ const empFields = computed(() => {
11
+ if (departments.value.length > 0) {
12
+ return [
13
+ { key: 'name', label: 'Employee Name', placeholder: 'e.g. Jane Doe' },
14
+ { key: 'email', label: 'Email Address', type: 'email', placeholder: 'e.g. jane@example.com' },
15
+ {
16
+ key: 'departmentId',
17
+ label: 'Department',
18
+ type: 'select',
19
+ placeholder: 'Select Department',
20
+ options: departments.value.map(d => ({ value: d.id, label: `${d.name} (${d.code})` }))
21
+ },
22
+ { key: 'salary', label: 'Salary', type: 'number', placeholder: 'e.g. 75000' }
23
+ ]
24
+ }
25
+ return [
26
+ { key: 'name', label: 'Employee Name', placeholder: 'e.g. Jane Doe' },
27
+ { key: 'email', label: 'Email Address', type: 'email', placeholder: 'e.g. jane@example.com' },
28
+ { key: 'departmentId', label: 'Department ID', placeholder: 'e.g. 1' },
29
+ { key: 'salary', label: 'Salary', type: 'number', placeholder: 'e.g. 75000' }
30
+ ]
31
+ })
32
+
33
+ const fetchEmployees = async () => {
34
+ try {
35
+ const res = await api.get('/employees')
36
+ employees.value = res.data
37
+ } catch (error) {
38
+ console.error(error)
39
+ }
40
+ }
41
+
42
+ const fetchDepartments = async () => {
43
+ try {
44
+ const res = await api.get('/departments')
45
+ departments.value = res.data
46
+ } catch (error) {
47
+ console.error(error)
48
+ }
49
+ }
50
+
51
+ const handleCreateEmployee = async (formData) => {
52
+ try {
53
+ const payload = {
54
+ ...formData,
55
+ salary: Number(formData.salary)
56
+ }
57
+ const res = await api.post('/employees', payload)
58
+ employees.value.push(res.data)
59
+ } catch (error) {
60
+ console.error(error)
61
+ }
62
+ }
63
+
64
+ const handleRemoveEmployee = async (id) => {
65
+ try {
66
+ await api.delete(`/employees/${id}`)
67
+ employees.value = employees.value.filter(emp => emp.id !== id)
68
+ } catch (error) {
69
+ console.error(error)
70
+ }
71
+ }
72
+
73
+ const getSubtitle = (emp) => {
74
+ const dept = departments.value.find(d => d.id === emp.departmentId)
75
+ const deptLabel = dept ? `${dept.name} (${dept.code})` : emp.departmentId
76
+ return `${emp.email} | Dept: ${deptLabel} | $${Number(emp.salary).toLocaleString()}`
77
+ }
78
+
79
+ onMounted(() => {
80
+ fetchDepartments()
81
+ fetchEmployees()
82
+ })
83
+ </script>
84
+
85
+ <template>
86
+ <div class="page-container">
87
+ <h2>Employees</h2>
88
+ <EntryForm :fields="empFields" @submit-data="handleCreateEmployee" />
89
+ <div class="card-list">
90
+ <p v-if="employees.length === 0" class="empty-state">No employees available.</p>
91
+ <DataCard
92
+ v-for="emp in employees"
93
+ :key="emp.id"
94
+ :id="emp.id"
95
+ :title="emp.name"
96
+ :subtitle="getSubtitle(emp)"
97
+ @remove="handleRemoveEmployee"
98
+ />
99
+ </div>
100
+ </div>
101
+ </template>
102
+
103
+ <style scoped>
104
+ .page-container {
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+ .empty-state {
109
+ color: #a0aec0;
110
+ font-style: italic;
111
+ }
112
+ .card-list {
113
+ display: flex;
114
+ flex-direction: column;
115
+ }
116
+ </style>
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+
4
+ export default defineConfig({
5
+ plugins: [vue()]
6
+ })
@@ -1,2 +0,0 @@
1
- /mvnw text eol=lf
2
- *.cmd text eol=crlf
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="CompilerConfiguration">
4
- <annotationProcessing>
5
- <profile name="Annotation profile for crud" enabled="true">
6
- <sourceOutputDir name="target/generated-sources/annotations" />
7
- <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
- <outputRelativeToContentRoot value="true" />
9
- <processorPath useClasspath="false">
10
- <entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.46/lombok-1.18.46.jar" />
11
- </processorPath>
12
- <module name="crud" />
13
- </profile>
14
- </annotationProcessing>
15
- </component>
16
- <component name="JavacSettings">
17
- <option name="ADDITIONAL_OPTIONS_OVERRIDE">
18
- <module name="crud" options="-parameters" />
19
- </option>
20
- </component>
21
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Encoding">
4
- <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
5
- </component>
6
- </project>
@@ -1,20 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RemoteRepositoriesConfiguration">
4
- <remote-repository>
5
- <option name="id" value="central" />
6
- <option name="name" value="Central Repository" />
7
- <option name="url" value="https://repo.maven.apache.org/maven2" />
8
- </remote-repository>
9
- <remote-repository>
10
- <option name="id" value="central" />
11
- <option name="name" value="Maven Central repository" />
12
- <option name="url" value="https://repo1.maven.org/maven2" />
13
- </remote-repository>
14
- <remote-repository>
15
- <option name="id" value="jboss.community" />
16
- <option name="name" value="JBoss Community repository" />
17
- <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
18
- </remote-repository>
19
- </component>
20
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ExternalStorageConfigurationManager" enabled="true" />
4
- <component name="MavenProjectsManager">
5
- <option name="originalFiles">
6
- <list>
7
- <option value="$PROJECT_DIR$/pom.xml" />
8
- </list>
9
- </option>
10
- </component>
11
- <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" />
12
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,104 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4
- <modelVersion>4.0.0</modelVersion>
5
- <parent>
6
- <groupId>org.springframework.boot</groupId>
7
- <artifactId>spring-boot-starter-parent</artifactId>
8
- <version>4.1.1</version>
9
- <relativePath/> <!-- lookup parent from repository -->
10
- </parent>
11
- <groupId>com.example</groupId>
12
- <artifactId>crud</artifactId>
13
- <version>0.0.1-SNAPSHOT</version>
14
- <name/>
15
- <description/>
16
- <url/>
17
- <licenses>
18
- <license/>
19
- </licenses>
20
- <developers>
21
- <developer/>
22
- </developers>
23
- <scm>
24
- <connection/>
25
- <developerConnection/>
26
- <tag/>
27
- <url/>
28
- </scm>
29
- <properties>
30
- <java.version>21</java.version>
31
- </properties>
32
- <dependencies>
33
- <dependency>
34
- <groupId>org.springframework.boot</groupId>
35
- <artifactId>spring-boot-starter-data-mongodb</artifactId>
36
- </dependency>
37
- <dependency>
38
- <groupId>org.springframework.boot</groupId>
39
- <artifactId>spring-boot-starter-webmvc</artifactId>
40
- </dependency>
41
-
42
- <dependency>
43
- <groupId>org.projectlombok</groupId>
44
- <artifactId>lombok</artifactId>
45
- <optional>true</optional>
46
- </dependency>
47
- <dependency>
48
- <groupId>org.springframework.boot</groupId>
49
- <artifactId>spring-boot-starter-data-mongodb-test</artifactId>
50
- <scope>test</scope>
51
- </dependency>
52
- <dependency>
53
- <groupId>org.springframework.boot</groupId>
54
- <artifactId>spring-boot-starter-webmvc-test</artifactId>
55
- <scope>test</scope>
56
- </dependency>
57
- </dependencies>
58
-
59
- <build>
60
- <plugins>
61
- <plugin>
62
- <groupId>org.springframework.boot</groupId>
63
- <artifactId>spring-boot-maven-plugin</artifactId>
64
- </plugin>
65
- <plugin>
66
- <groupId>org.apache.maven.plugins</groupId>
67
- <artifactId>maven-compiler-plugin</artifactId>
68
- <executions>
69
- <execution>
70
- <id>default-compile</id>
71
- <phase>compile</phase>
72
- <goals>
73
- <goal>compile</goal>
74
- </goals>
75
- <configuration>
76
- <annotationProcessorPaths>
77
- <path>
78
- <groupId>org.projectlombok</groupId>
79
- <artifactId>lombok</artifactId>
80
- </path>
81
- </annotationProcessorPaths>
82
- </configuration>
83
- </execution>
84
- <execution>
85
- <id>default-testCompile</id>
86
- <phase>test-compile</phase>
87
- <goals>
88
- <goal>testCompile</goal>
89
- </goals>
90
- <configuration>
91
- <annotationProcessorPaths>
92
- <path>
93
- <groupId>org.projectlombok</groupId>
94
- <artifactId>lombok</artifactId>
95
- </path>
96
- </annotationProcessorPaths>
97
- </configuration>
98
- </execution>
99
- </executions>
100
- </plugin>
101
- </plugins>
102
- </build>
103
-
104
- </project>
@@ -1,13 +0,0 @@
1
- package com.example.crud;
2
-
3
- import org.springframework.boot.SpringApplication;
4
- import org.springframework.boot.autoconfigure.SpringBootApplication;
5
-
6
- @SpringBootApplication
7
- public class CrudApplication {
8
-
9
- public static void main(String[] args) {
10
- SpringApplication.run(CrudApplication.class, args);
11
- }
12
-
13
- }
@@ -1,42 +0,0 @@
1
- package com.example.crud.controller;
2
-
3
- import com.example.crud.model.Item;
4
- import com.example.crud.service.ItemService;
5
- import org.springframework.beans.factory.annotation.Autowired;
6
- import org.springframework.web.bind.annotation.*;
7
-
8
- import java.util.List;
9
-
10
- @RestController
11
- @RequestMapping("/api/items")
12
- @CrossOrigin(origins = "*")
13
- public class ItemController {
14
- @Autowired
15
- private ItemService service;
16
-
17
- @GetMapping
18
- public List<Item> getAll(){
19
- return service.getAll();
20
- }
21
-
22
- @GetMapping("/{id}")
23
- public Item getOne(@PathVariable String id){
24
- return service.getOne(id);
25
- }
26
-
27
- @PostMapping
28
- public Item create(@RequestBody Item item){
29
- return service.create(item);
30
- }
31
-
32
- @PutMapping("/{id}")
33
- public Item update(@PathVariable String id,@RequestBody Item item){
34
- return service.update(id, item);
35
- }
36
-
37
- @DeleteMapping("/{id}")
38
- public String delete(@PathVariable String id){
39
- return service.delete(id);
40
- }
41
-
42
- }
@@ -1,20 +0,0 @@
1
- package com.example.crud.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 = "item")
13
-
14
- public class Item {
15
- @Id
16
- private String id;
17
- private String name;
18
- private String describtion;
19
- private double price;
20
- }
@@ -1,9 +0,0 @@
1
- package com.example.crud.repository;
2
-
3
- import com.example.crud.model.Item;
4
- import org.springframework.data.mongodb.repository.MongoRepository;
5
- import org.springframework.stereotype.Repository;
6
-
7
- @Repository
8
- public interface ItemRepository extends MongoRepository<Item,String> {
9
- }
@@ -1,37 +0,0 @@
1
- package com.example.crud.service;
2
-
3
- import com.example.crud.model.Item;
4
- import com.example.crud.repository.ItemRepository;
5
- import org.springframework.beans.factory.annotation.Autowired;
6
- import org.springframework.stereotype.Service;
7
-
8
- import java.util.List;
9
-
10
- @Service
11
- public class ItemService {
12
- @Autowired
13
- private ItemRepository repo;
14
-
15
- public List<Item> getAll(){
16
- return repo.findAll();
17
- }
18
-
19
- public Item getOne(String id){
20
- return repo.findById(id).orElse(null);
21
-
22
- }
23
-
24
- public Item create(Item item){
25
- return repo.save(item);
26
- }
27
-
28
- public Item update(String id,Item item){
29
- item.setId(id);
30
- return repo.save(item);
31
- }
32
-
33
- public String delete(String id){
34
- repo.deleteById(id);
35
- return "delete success";
36
- }
37
- }
@@ -1,4 +0,0 @@
1
- spring.application.name=crud
2
- server.port=8080
3
- spring.data.mongodb.uri=mongodb://localhost:27017/my_crud_db
4
- spring.data.mongodb.database=my_crud_db
@@ -1,13 +0,0 @@
1
- package com.example.crud;
2
-
3
- import org.junit.jupiter.api.Test;
4
- import org.springframework.boot.test.context.SpringBootTest;
5
-
6
- @SpringBootTest
7
- class CrudApplicationTests {
8
-
9
- @Test
10
- void contextLoads() {
11
- }
12
-
13
- }
@@ -1,3 +0,0 @@
1
- {
2
- "recommendations": ["Vue.volar"]
3
- }
@@ -1,38 +0,0 @@
1
- # crud-frontend
2
-
3
- This template should help get you started developing with Vue 3 in Vite.
4
-
5
- ## Recommended IDE Setup
6
-
7
- [VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8
-
9
- ## Recommended Browser Setup
10
-
11
- - Chromium-based browsers (Chrome, Edge, Brave, etc.):
12
- - [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
13
- - [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
14
- - Firefox:
15
- - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
16
- - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
17
-
18
- ## Customize configuration
19
-
20
- See [Vite Configuration Reference](https://vite.dev/config/).
21
-
22
- ## Project Setup
23
-
24
- ```sh
25
- npm install
26
- ```
27
-
28
- ### Compile and Hot-Reload for Development
29
-
30
- ```sh
31
- npm run dev
32
- ```
33
-
34
- ### Compile and Minify for Production
35
-
36
- ```sh
37
- npm run build
38
- ```
@@ -1,8 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "paths": {
4
- "@/*": ["./src/*"]
5
- }
6
- },
7
- "exclude": ["node_modules", "dist"]
8
- }
@@ -1,50 +0,0 @@
1
- <script setup>
2
- import { ref, onMounted } from 'vue';
3
- import ItemService from './services/ItemService';
4
-
5
- const items = ref([]);
6
- const name = ref('');
7
- const describtion = ref('');
8
- const price = ref(0);
9
-
10
- const load = async () => {
11
- const res = await ItemService.getAll();
12
- items.value = res.data;
13
- };
14
-
15
- const addItem = async () => {
16
- await ItemService.create({ name: name.value, describtion: describtion.value, price: price.value });
17
- name.value = '';
18
- describtion.value = '';
19
- price.value = 0;
20
- load();
21
- };
22
-
23
- const deleteItem = async (id) => {
24
- await ItemService.delete(id);
25
- load();
26
- };
27
-
28
- onMounted(load);
29
- </script>
30
-
31
- <template>
32
- <h2>Simple CRUD</h2>
33
-
34
- <form @submit.prevent="addItem">
35
- <input v-model="name" placeholder="Name" required />
36
- <input v-model="describtion" placeholder="Description" required />
37
- <input v-model="price" type="number" placeholder="Price" required />
38
- <button type="submit">Add</button>
39
- </form>
40
-
41
- <hr />
42
-
43
- <h3>Items List:</h3>
44
- <ul>
45
- <li v-for="item in items" :key="item.id">
46
- {{ item.name }} - {{ item.describtion }} - {{ item.price }}
47
- <button @click="deleteItem(item.id)">Delete</button>
48
- </li>
49
- </ul>
50
- </template>
@@ -1,86 +0,0 @@
1
- /* color palette from <https://github.com/vuejs/theme> */
2
- :root {
3
- --vt-c-white: #ffffff;
4
- --vt-c-white-soft: #f8f8f8;
5
- --vt-c-white-mute: #f2f2f2;
6
-
7
- --vt-c-black: #181818;
8
- --vt-c-black-soft: #222222;
9
- --vt-c-black-mute: #282828;
10
-
11
- --vt-c-indigo: #2c3e50;
12
-
13
- --vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
14
- --vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
15
- --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
16
- --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
17
-
18
- --vt-c-text-light-1: var(--vt-c-indigo);
19
- --vt-c-text-light-2: rgba(60, 60, 60, 0.66);
20
- --vt-c-text-dark-1: var(--vt-c-white);
21
- --vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
22
- }
23
-
24
- /* semantic color variables for this project */
25
- :root {
26
- --color-background: var(--vt-c-white);
27
- --color-background-soft: var(--vt-c-white-soft);
28
- --color-background-mute: var(--vt-c-white-mute);
29
-
30
- --color-border: var(--vt-c-divider-light-2);
31
- --color-border-hover: var(--vt-c-divider-light-1);
32
-
33
- --color-heading: var(--vt-c-text-light-1);
34
- --color-text: var(--vt-c-text-light-1);
35
-
36
- --section-gap: 160px;
37
- }
38
-
39
- @media (prefers-color-scheme: dark) {
40
- :root {
41
- --color-background: var(--vt-c-black);
42
- --color-background-soft: var(--vt-c-black-soft);
43
- --color-background-mute: var(--vt-c-black-mute);
44
-
45
- --color-border: var(--vt-c-divider-dark-2);
46
- --color-border-hover: var(--vt-c-divider-dark-1);
47
-
48
- --color-heading: var(--vt-c-text-dark-1);
49
- --color-text: var(--vt-c-text-dark-2);
50
- }
51
- }
52
-
53
- *,
54
- *::before,
55
- *::after {
56
- box-sizing: border-box;
57
- margin: 0;
58
- font-weight: normal;
59
- }
60
-
61
- body {
62
- min-height: 100vh;
63
- color: var(--color-text);
64
- background: var(--color-background);
65
- transition:
66
- color 0.5s,
67
- background-color 0.5s;
68
- line-height: 1.6;
69
- font-family:
70
- Inter,
71
- -apple-system,
72
- BlinkMacSystemFont,
73
- 'Segoe UI',
74
- Roboto,
75
- Oxygen,
76
- Ubuntu,
77
- Cantarell,
78
- 'Fira Sans',
79
- 'Droid Sans',
80
- 'Helvetica Neue',
81
- sans-serif;
82
- font-size: 15px;
83
- text-rendering: optimizeLegibility;
84
- -webkit-font-smoothing: antialiased;
85
- -moz-osx-font-smoothing: grayscale;
86
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>