wad-lab 1.0.6 → 1.0.8

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 (49) hide show
  1. package/bin/index.js +23 -17
  2. package/package.json +1 -1
  3. package/templates/game-bingo/index.html +32 -0
  4. package/templates/game-bingo/script.js +118 -0
  5. package/templates/game-bingo/style.css +104 -0
  6. package/templates/springboot-course-registration/.mvn/wrapper/maven-wrapper.properties +3 -0
  7. package/templates/springboot-course-registration/mvnw +295 -0
  8. package/templates/springboot-course-registration/mvnw.cmd +189 -0
  9. package/templates/springboot-course-registration/pom.xml +41 -0
  10. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/CourseRegApplication.java +12 -0
  11. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/controller/CourseController.java +42 -0
  12. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/model/Course.java +99 -0
  13. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/repository/CourseRepository.java +16 -0
  14. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/service/CourseService.java +60 -0
  15. package/templates/springboot-course-registration/src/main/resources/application.properties +3 -0
  16. package/templates/springboot-course-registration/src/test/java/com/example/coursereg/CourseRegApplicationTests.java +12 -0
  17. package/templates/vue-banking-app/index.html +12 -0
  18. package/templates/vue-banking-app/package.json +20 -0
  19. package/templates/vue-banking-app/src/App.vue +80 -0
  20. package/templates/vue-banking-app/src/main.js +9 -0
  21. package/templates/vue-banking-app/src/router/index.js +17 -0
  22. package/templates/vue-banking-app/src/stores/bankStore.js +48 -0
  23. package/templates/vue-banking-app/src/views/DashboardView.vue +88 -0
  24. package/templates/vue-banking-app/src/views/StatementView.vue +171 -0
  25. package/templates/vue-banking-app/src/views/TransactionFormView.vue +144 -0
  26. package/templates/vue-banking-app/vite.config.js +6 -0
  27. package/templates/vue-employee-system/index.html +12 -0
  28. package/templates/vue-employee-system/package.json +19 -0
  29. package/templates/vue-employee-system/src/App.vue +388 -0
  30. package/templates/vue-employee-system/src/main.js +5 -0
  31. package/templates/vue-employee-system/src/stores/employeeStore.js +54 -0
  32. package/templates/vue-employee-system/vite.config.js +6 -0
  33. package/templates/vue-food-ordering/index.html +12 -0
  34. package/templates/vue-food-ordering/package.json +20 -0
  35. package/templates/vue-food-ordering/src/App.vue +109 -0
  36. package/templates/vue-food-ordering/src/main.js +6 -0
  37. package/templates/vue-food-ordering/src/router/index.js +17 -0
  38. package/templates/vue-food-ordering/src/stores/foodStore.js +65 -0
  39. package/templates/vue-food-ordering/src/views/MenuView.vue +145 -0
  40. package/templates/vue-food-ordering/src/views/OrderCartView.vue +181 -0
  41. package/templates/vue-food-ordering/src/views/OrderSuccessView.vue +93 -0
  42. package/templates/vue-food-ordering/vite.config.js +6 -0
  43. package/templates/vue-symposium-system/index.html +12 -0
  44. package/templates/vue-symposium-system/package.json +19 -0
  45. package/templates/vue-symposium-system/src/App.vue +297 -0
  46. package/templates/vue-symposium-system/src/main.js +5 -0
  47. package/templates/vue-symposium-system/src/stores/symposiumStore.js +44 -0
  48. package/templates/vue-symposium-system/vite.config.js +6 -0
  49. package/templates/servlet-flow/SERVLET_EXAM_CHEATSHEET.md +0 -389
@@ -0,0 +1,189 @@
1
+ <# : batch portion
2
+ @REM ----------------------------------------------------------------------------
3
+ @REM Licensed to the Apache Software Foundation (ASF) under one
4
+ @REM or more contributor license agreements. See the NOTICE file
5
+ @REM distributed with this work for additional information
6
+ @REM regarding copyright ownership. The ASF licenses this file
7
+ @REM to you under the Apache License, Version 2.0 (the
8
+ @REM "License"); you may not use this file except in compliance
9
+ @REM with the License. You may obtain a copy of the License at
10
+ @REM
11
+ @REM http://www.apache.org/licenses/LICENSE-2.0
12
+ @REM
13
+ @REM Unless required by applicable law or agreed to in writing,
14
+ @REM software distributed under the License is distributed on an
15
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ @REM KIND, either express or implied. See the License for the
17
+ @REM specific language governing permissions and limitations
18
+ @REM under the License.
19
+ @REM ----------------------------------------------------------------------------
20
+
21
+ @REM ----------------------------------------------------------------------------
22
+ @REM Apache Maven Wrapper startup batch script, version 3.3.4
23
+ @REM
24
+ @REM Optional ENV vars
25
+ @REM MVNW_REPOURL - repo url base for downloading maven distribution
26
+ @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27
+ @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28
+ @REM ----------------------------------------------------------------------------
29
+
30
+ @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31
+ @SET __MVNW_CMD__=
32
+ @SET __MVNW_ERROR__=
33
+ @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34
+ @SET PSModulePath=
35
+ @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36
+ IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37
+ )
38
+ @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39
+ @SET __MVNW_PSMODULEP_SAVE=
40
+ @SET __MVNW_ARG0_NAME__=
41
+ @SET MVNW_USERNAME=
42
+ @SET MVNW_PASSWORD=
43
+ @IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
44
+ @echo Cannot start maven from wrapper >&2 && exit /b 1
45
+ @GOTO :EOF
46
+ : end batch / begin powershell #>
47
+
48
+ $ErrorActionPreference = "Stop"
49
+ if ($env:MVNW_VERBOSE -eq "true") {
50
+ $VerbosePreference = "Continue"
51
+ }
52
+
53
+ # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54
+ $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55
+ if (!$distributionUrl) {
56
+ Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57
+ }
58
+
59
+ switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60
+ "maven-mvnd-*" {
61
+ $USE_MVND = $true
62
+ $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63
+ $MVN_CMD = "mvnd.cmd"
64
+ break
65
+ }
66
+ default {
67
+ $USE_MVND = $false
68
+ $MVN_CMD = $script -replace '^mvnw','mvn'
69
+ break
70
+ }
71
+ }
72
+
73
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
74
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
75
+ if ($env:MVNW_REPOURL) {
76
+ $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77
+ $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
78
+ }
79
+ $distributionUrlName = $distributionUrl -replace '^.*/',''
80
+ $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81
+
82
+ $MAVEN_M2_PATH = "$HOME/.m2"
83
+ if ($env:MAVEN_USER_HOME) {
84
+ $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
85
+ }
86
+
87
+ if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
88
+ New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
89
+ }
90
+
91
+ $MAVEN_WRAPPER_DISTS = $null
92
+ if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
93
+ $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
94
+ } else {
95
+ $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
96
+ }
97
+
98
+ $MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
99
+ $MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
100
+ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
101
+
102
+ if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
103
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
104
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
105
+ exit $?
106
+ }
107
+
108
+ if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
109
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
110
+ }
111
+
112
+ # prepare tmp dir
113
+ $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
114
+ $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
115
+ $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
116
+ trap {
117
+ if ($TMP_DOWNLOAD_DIR.Exists) {
118
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
119
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
120
+ }
121
+ }
122
+
123
+ New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
124
+
125
+ # Download and Install Apache Maven
126
+ Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
127
+ Write-Verbose "Downloading from: $distributionUrl"
128
+ Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
129
+
130
+ $webclient = New-Object System.Net.WebClient
131
+ if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
132
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
133
+ }
134
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
135
+ $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
136
+
137
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
138
+ $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
139
+ if ($distributionSha256Sum) {
140
+ if ($USE_MVND) {
141
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
142
+ }
143
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
144
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
145
+ Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
146
+ }
147
+ }
148
+
149
+ # unzip and move
150
+ Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
151
+
152
+ # Find the actual extracted directory name (handles snapshots where filename != directory name)
153
+ $actualDistributionDir = ""
154
+
155
+ # First try the expected directory name (for regular distributions)
156
+ $expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
157
+ $expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
158
+ if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
159
+ $actualDistributionDir = $distributionUrlNameMain
160
+ }
161
+
162
+ # If not found, search for any directory with the Maven executable (for snapshots)
163
+ if (!$actualDistributionDir) {
164
+ Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
165
+ $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
166
+ if (Test-Path -Path $testPath -PathType Leaf) {
167
+ $actualDistributionDir = $_.Name
168
+ }
169
+ }
170
+ }
171
+
172
+ if (!$actualDistributionDir) {
173
+ Write-Error "Could not find Maven distribution directory in extracted archive"
174
+ }
175
+
176
+ Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
177
+ Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
178
+ try {
179
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
180
+ } catch {
181
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
182
+ Write-Error "fail to move MAVEN_HOME"
183
+ }
184
+ } finally {
185
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
186
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
187
+ }
188
+
189
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
@@ -0,0 +1,41 @@
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>3.3.4</version>
9
+ <relativePath/>
10
+ </parent>
11
+ <groupId>com.example</groupId>
12
+ <artifactId>springboot-course-registration</artifactId>
13
+ <version>0.0.1-SNAPSHOT</version>
14
+ <name>springboot-course-registration</name>
15
+ <properties>
16
+ <java.version>17</java.version>
17
+ </properties>
18
+ <dependencies>
19
+ <dependency>
20
+ <groupId>org.springframework.boot</groupId>
21
+ <artifactId>spring-boot-starter-web</artifactId>
22
+ </dependency>
23
+ <dependency>
24
+ <groupId>org.springframework.boot</groupId>
25
+ <artifactId>spring-boot-starter-data-mongodb</artifactId>
26
+ </dependency>
27
+ <dependency>
28
+ <groupId>org.springframework.boot</groupId>
29
+ <artifactId>spring-boot-starter-test</artifactId>
30
+ <scope>test</scope>
31
+ </dependency>
32
+ </dependencies>
33
+ <build>
34
+ <plugins>
35
+ <plugin>
36
+ <groupId>org.springframework.boot</groupId>
37
+ <artifactId>spring-boot-maven-plugin</artifactId>
38
+ </plugin>
39
+ </plugins>
40
+ </build>
41
+ </project>
@@ -0,0 +1,12 @@
1
+ package com.example.coursereg;
2
+
3
+ import org.springframework.boot.SpringApplication;
4
+ import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+
6
+ @SpringBootApplication
7
+ public class CourseRegApplication {
8
+
9
+ public static void main(String[] args) {
10
+ SpringApplication.run(CourseRegApplication.class, args);
11
+ }
12
+ }
@@ -0,0 +1,42 @@
1
+ package com.example.coursereg.controller;
2
+
3
+ import com.example.coursereg.model.Course;
4
+ import com.example.coursereg.service.CourseService;
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/courses")
12
+ @CrossOrigin(origins = "*")
13
+ public class CourseController {
14
+
15
+ @Autowired
16
+ private CourseService courseService;
17
+
18
+ @GetMapping
19
+ public List<Course> getAllCourses() {
20
+ return courseService.getAllCourses();
21
+ }
22
+
23
+ @GetMapping("/{id}")
24
+ public Course getCourseById(@PathVariable String id) {
25
+ return courseService.getCourseById(id);
26
+ }
27
+
28
+ @PostMapping
29
+ public Course createCourse(@RequestBody Course course) {
30
+ return courseService.createCourse(course);
31
+ }
32
+
33
+ @DeleteMapping("/{id}")
34
+ public void deleteCourse(@PathVariable String id) {
35
+ courseService.deleteCourse(id);
36
+ }
37
+
38
+ @PostMapping("/{id}/register")
39
+ public Course registerStudent(@PathVariable String id, @RequestParam String studentName) {
40
+ return courseService.registerStudent(id, studentName);
41
+ }
42
+ }
@@ -0,0 +1,99 @@
1
+ package com.example.coursereg.model;
2
+
3
+ import org.springframework.data.annotation.Id;
4
+ import org.springframework.data.mongodb.core.mapping.Document;
5
+
6
+ import java.util.ArrayList;
7
+ import java.util.List;
8
+
9
+ @Document(collection = "courses")
10
+ public class Course {
11
+
12
+ @Id
13
+ private String id;
14
+ private String courseCode;
15
+ private String title;
16
+ private int credits;
17
+ private String department;
18
+ private int capacity;
19
+ private List<String> enrolledStudents;
20
+
21
+ public Course() {
22
+ this.enrolledStudents = new ArrayList<>();
23
+ }
24
+
25
+ public Course(String courseCode, String title, int credits, String department, int capacity) {
26
+ this.courseCode = courseCode;
27
+ this.title = title;
28
+ this.credits = credits;
29
+ this.department = department;
30
+ this.capacity = capacity;
31
+ this.enrolledStudents = new ArrayList<>();
32
+ }
33
+
34
+ public Course(String id, String courseCode, String title, int credits, String department, int capacity, List<String> enrolledStudents) {
35
+ this.id = id;
36
+ this.courseCode = courseCode;
37
+ this.title = title;
38
+ this.credits = credits;
39
+ this.department = department;
40
+ this.capacity = capacity;
41
+ this.enrolledStudents = enrolledStudents != null ? enrolledStudents : new ArrayList<>();
42
+ }
43
+
44
+ public String getId() {
45
+ return id;
46
+ }
47
+
48
+ public void setId(String id) {
49
+ this.id = id;
50
+ }
51
+
52
+ public String getCourseCode() {
53
+ return courseCode;
54
+ }
55
+
56
+ public void setCourseCode(String courseCode) {
57
+ this.courseCode = courseCode;
58
+ }
59
+
60
+ public String getTitle() {
61
+ return title;
62
+ }
63
+
64
+ public void setTitle(String title) {
65
+ this.title = title;
66
+ }
67
+
68
+ public int getCredits() {
69
+ return credits;
70
+ }
71
+
72
+ public void setCredits(int credits) {
73
+ this.credits = credits;
74
+ }
75
+
76
+ public String getDepartment() {
77
+ return department;
78
+ }
79
+
80
+ public void setDepartment(String department) {
81
+ this.department = department;
82
+ }
83
+
84
+ public int getCapacity() {
85
+ return capacity;
86
+ }
87
+
88
+ public void setCapacity(int capacity) {
89
+ this.capacity = capacity;
90
+ }
91
+
92
+ public List<String> getEnrolledStudents() {
93
+ return enrolledStudents;
94
+ }
95
+
96
+ public void setEnrolledStudents(List<String> enrolledStudents) {
97
+ this.enrolledStudents = enrolledStudents;
98
+ }
99
+ }
@@ -0,0 +1,16 @@
1
+ package com.example.coursereg.repository;
2
+
3
+ import com.example.coursereg.model.Course;
4
+ import org.springframework.data.mongodb.repository.MongoRepository;
5
+ import org.springframework.stereotype.Repository;
6
+
7
+ import java.util.List;
8
+ import java.util.Optional;
9
+
10
+ @Repository
11
+ public interface CourseRepository extends MongoRepository<Course, String> {
12
+
13
+ Optional<Course> findByCourseCode(String courseCode);
14
+
15
+ List<Course> findByDepartment(String department);
16
+ }
@@ -0,0 +1,60 @@
1
+ package com.example.coursereg.service;
2
+
3
+ import com.example.coursereg.model.Course;
4
+ import com.example.coursereg.repository.CourseRepository;
5
+ import org.springframework.beans.factory.annotation.Autowired;
6
+ import org.springframework.stereotype.Service;
7
+
8
+ import java.util.ArrayList;
9
+ import java.util.List;
10
+
11
+ @Service
12
+ public class CourseService {
13
+
14
+ @Autowired
15
+ private CourseRepository courseRepository;
16
+
17
+ public List<Course> getAllCourses() {
18
+ return courseRepository.findAll();
19
+ }
20
+
21
+ public Course getCourseById(String id) {
22
+ return courseRepository.findById(id).orElse(null);
23
+ }
24
+
25
+ public Course createCourse(Course course) {
26
+ if (course.getId() != null && course.getId().trim().isEmpty()) {
27
+ course.setId(null);
28
+ }
29
+ if (course.getEnrolledStudents() == null) {
30
+ course.setEnrolledStudents(new ArrayList<>());
31
+ }
32
+ return courseRepository.save(course);
33
+ }
34
+
35
+ public void deleteCourse(String id) {
36
+ courseRepository.deleteById(id);
37
+ }
38
+
39
+ public Course registerStudent(String courseId, String studentName) {
40
+ Course course = courseRepository.findById(courseId).orElse(null);
41
+ if (course != null) {
42
+ if (course.getEnrolledStudents() == null) {
43
+ course.setEnrolledStudents(new ArrayList<>());
44
+ }
45
+ if (course.getEnrolledStudents().size() < course.getCapacity()) {
46
+ course.getEnrolledStudents().add(studentName);
47
+ return courseRepository.save(course);
48
+ }
49
+ }
50
+ return null;
51
+ }
52
+
53
+ public Course getCourseByCourseCode(String courseCode) {
54
+ return courseRepository.findByCourseCode(courseCode).orElse(null);
55
+ }
56
+
57
+ public List<Course> getCoursesByDepartment(String department) {
58
+ return courseRepository.findByDepartment(department);
59
+ }
60
+ }
@@ -0,0 +1,3 @@
1
+ spring.data.mongodb.uri=mongodb://localhost:27017/course_reg_db
2
+ spring.data.mongodb.database=course_reg_db
3
+ server.port=8080
@@ -0,0 +1,12 @@
1
+ package com.example.coursereg;
2
+
3
+ import org.junit.jupiter.api.Test;
4
+ import org.springframework.boot.test.context.SpringBootTest;
5
+
6
+ @SpringBootTest
7
+ class CourseRegApplicationTests {
8
+
9
+ @Test
10
+ void contextLoads() {
11
+ }
12
+ }
@@ -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>Vue Banking Application</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.js"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "vue-banking-app",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "pinia": "^4.1.0",
13
+ "vue": "^3.5.44",
14
+ "vue-router": "^5.4.0"
15
+ },
16
+ "devDependencies": {
17
+ "@vitejs/plugin-vue": "^6.0.10",
18
+ "vite": "^8.3.4"
19
+ }
20
+ }
@@ -0,0 +1,80 @@
1
+ <script setup>
2
+ </script>
3
+
4
+ <template>
5
+ <div class="app-layout">
6
+ <header class="app-header">
7
+ <h1 class="portal-title">Vue Banking Portal</h1>
8
+ <nav class="nav-links">
9
+ <router-link to="/">Dashboard</router-link>
10
+ <router-link to="/transaction">New Transaction</router-link>
11
+ <router-link to="/statement">Statement</router-link>
12
+ </nav>
13
+ </header>
14
+
15
+ <main class="content-container">
16
+ <router-view />
17
+ </main>
18
+ </div>
19
+ </template>
20
+
21
+ <style>
22
+ * {
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ body {
27
+ margin: 0;
28
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
29
+ color: #333;
30
+ background-color: #f5f6f8;
31
+ }
32
+ </style>
33
+
34
+ <style scoped>
35
+ .app-layout {
36
+ min-height: 100vh;
37
+ display: flex;
38
+ flex-direction: column;
39
+ }
40
+
41
+ .app-header {
42
+ background-color: #2c3e50;
43
+ color: white;
44
+ padding: 15px 25px;
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: center;
48
+ }
49
+
50
+ .portal-title {
51
+ margin: 0;
52
+ font-size: 20px;
53
+ }
54
+
55
+ .nav-links {
56
+ display: flex;
57
+ gap: 15px;
58
+ }
59
+
60
+ .nav-links a {
61
+ color: #ecf0f1;
62
+ text-decoration: none;
63
+ font-weight: 500;
64
+ padding: 6px 12px;
65
+ border-radius: 4px;
66
+ transition: background-color 0.2s;
67
+ }
68
+
69
+ .nav-links a:hover,
70
+ .nav-links a.router-link-active {
71
+ background-color: #34495e;
72
+ }
73
+
74
+ .content-container {
75
+ max-width: 650px;
76
+ width: 100%;
77
+ margin: 30px auto;
78
+ padding: 0 15px;
79
+ }
80
+ </style>
@@ -0,0 +1,9 @@
1
+ import { createApp } from 'vue'
2
+ import { createPinia } from 'pinia'
3
+ import App from './App.vue'
4
+ import router from './router'
5
+
6
+ const app = createApp(App)
7
+ app.use(createPinia())
8
+ app.use(router)
9
+ app.mount('#app')
@@ -0,0 +1,17 @@
1
+ import { createRouter, createWebHistory } from 'vue-router'
2
+ import DashboardView from '../views/DashboardView.vue'
3
+ import TransactionFormView from '../views/TransactionFormView.vue'
4
+ import StatementView from '../views/StatementView.vue'
5
+
6
+ const routes = [
7
+ { path: '/', name: 'Dashboard', component: DashboardView },
8
+ { path: '/transaction', name: 'Transaction', component: TransactionFormView },
9
+ { path: '/statement', name: 'Statement', component: StatementView }
10
+ ]
11
+
12
+ const router = createRouter({
13
+ history: createWebHistory(),
14
+ routes
15
+ })
16
+
17
+ export default router
@@ -0,0 +1,48 @@
1
+ import { defineStore } from 'pinia'
2
+
3
+ export const useBankStore = defineStore('bank', {
4
+ state: () => ({
5
+ accountNumber: 'ACC-892144',
6
+ accountHolder: 'John Doe',
7
+ accountType: 'Savings Account',
8
+ balance: 5000,
9
+ transactions: [
10
+ { id: 1, type: 'DEPOSIT', amount: 5000, balanceAfter: 5000, date: new Date().toLocaleDateString() }
11
+ ]
12
+ }),
13
+ getters: {
14
+ transactionCount: (state) => state.transactions.length
15
+ },
16
+ actions: {
17
+ deposit(amount) {
18
+ const val = parseFloat(amount)
19
+ if (isNaN(val) || val <= 0) return { success: false, message: 'Invalid deposit amount' }
20
+
21
+ this.balance += val
22
+ this.transactions.unshift({
23
+ id: Date.now(),
24
+ type: 'DEPOSIT',
25
+ amount: val,
26
+ balanceAfter: this.balance,
27
+ date: new Date().toLocaleDateString()
28
+ })
29
+ return { success: true, message: 'Deposit successful!' }
30
+ },
31
+
32
+ withdraw(amount) {
33
+ const val = parseFloat(amount)
34
+ if (isNaN(val) || val <= 0) return { success: false, message: 'Invalid withdrawal amount' }
35
+ if (val > this.balance) return { success: false, message: 'Insufficient balance!' }
36
+
37
+ this.balance -= val
38
+ this.transactions.unshift({
39
+ id: Date.now(),
40
+ type: 'WITHDRAWAL',
41
+ amount: val,
42
+ balanceAfter: this.balance,
43
+ date: new Date().toLocaleDateString()
44
+ })
45
+ return { success: true, message: 'Withdrawal successful!' }
46
+ }
47
+ }
48
+ })