From ab606946420b6ea3112e3397d05726084fce1896 Mon Sep 17 00:00:00 2001 From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:12:45 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82,=20=D0=BD=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=D0=BB=20=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B,=20=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=BD=D0=B8=20=D0=BD=D0=B5=20=D0=BE=D1=82=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B6=D0=B0=D1=8E=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 5 +-- .../autoservice/AutoserviceApplication.java | 20 +----------- .../clients/api/ClientsController.java | 15 ++++++--- src/main/resources/templates/clients.html | 11 ------- src/main/resources/templates/error.html | 11 +++++++ src/main/resources/templates/index.html | 10 ++++++ src/main/resources/templates/page1.html | 31 +++++++++++++++++++ 7 files changed, 67 insertions(+), 36 deletions(-) delete mode 100644 src/main/resources/templates/clients.html create mode 100644 src/main/resources/templates/error.html create mode 100644 src/main/resources/templates/index.html create mode 100644 src/main/resources/templates/page1.html diff --git a/build.gradle b/build.gradle index 51565ac..c099ac0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'org.springframework.boot' version '3.2.5' + id 'org.springframework.boot' version '3.2.3' id 'io.spring.dependency-management' version '1.1.4' } @@ -28,10 +28,11 @@ repositories { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter:2.4.5' + implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' implementation 'org.modelmapper:modelmapper:3.2.0' + implementation 'org.springframework.boot:spring-boot-devtools' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.postgresql:postgresql' diff --git a/src/main/java/com/example/autoservice/AutoserviceApplication.java b/src/main/java/com/example/autoservice/AutoserviceApplication.java index 732f6dc..21087c9 100644 --- a/src/main/java/com/example/autoservice/AutoserviceApplication.java +++ b/src/main/java/com/example/autoservice/AutoserviceApplication.java @@ -1,29 +1,11 @@ package com.example.autoservice; -import java.util.Objects; - -import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import com.example.autoservice.clients.service.ClientsService; - @SpringBootApplication -public class AutoserviceApplication implements CommandLineRunner { - - private final ClientsService clientsService; - public AutoserviceApplication(ClientsService clientsService) { - this.clientsService = clientsService; - } +public class AutoserviceApplication { public static void main(String[] args) { SpringApplication.run(AutoserviceApplication.class, args); } - - @Override - public void run(String... args) throws Exception { - if (args.length > 0 && Objects.equals("--populate", args[0])) { - - } - } - } diff --git a/src/main/java/com/example/autoservice/clients/api/ClientsController.java b/src/main/java/com/example/autoservice/clients/api/ClientsController.java index c25f256..a4180ad 100644 --- a/src/main/java/com/example/autoservice/clients/api/ClientsController.java +++ b/src/main/java/com/example/autoservice/clients/api/ClientsController.java @@ -3,6 +3,7 @@ package com.example.autoservice.clients.api; import java.util.List; import org.modelmapper.ModelMapper; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.example.autoservice.core.configuration.Constants; + import com.example.autoservice.clients.service.ClientsService; import com.example.autoservice.clients.model.ClientsEntity; @@ -29,10 +31,6 @@ public class ClientsController { this.modelMapper = modelMapper; } - public String showClientsPage(){ - return "clients"; - } - private ClientsDto toDto(ClientsEntity entity) { return modelMapper.map(entity, ClientsDto.class); } @@ -40,6 +38,15 @@ public class ClientsController { private ClientsEntity toEntity(ClientsDto dto) { return modelMapper.map(dto, ClientsEntity.class); } + @GetMapping("/page1") + public String handlePage1(){ + return "page1"; + } + + @GetMapping("/error") + public String handleError() { + return "error"; + } @GetMapping public List getAll() { diff --git a/src/main/resources/templates/clients.html b/src/main/resources/templates/clients.html deleted file mode 100644 index 11742b8..0000000 --- a/src/main/resources/templates/clients.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Clients - - -

CLIENTS

- - \ No newline at end of file diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html new file mode 100644 index 0000000..dd7255e --- /dev/null +++ b/src/main/resources/templates/error.html @@ -0,0 +1,11 @@ + + + + Error + + + +

Error

+

An unexpected error occurred. Please try again later.

+ + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html new file mode 100644 index 0000000..d2e2851 --- /dev/null +++ b/src/main/resources/templates/index.html @@ -0,0 +1,10 @@ + + + + Getting Started: Serving Web Content + + + +

Get your clients here

+ + \ No newline at end of file diff --git a/src/main/resources/templates/page1.html b/src/main/resources/templates/page1.html new file mode 100644 index 0000000..b8476fd --- /dev/null +++ b/src/main/resources/templates/page1.html @@ -0,0 +1,31 @@ + + + + Getting Started: Serving Web Content + + + + + + + + + + + + + + + + + + + + + + + + +
IDFirst NameLast NameMiddle NameDate of BirthPhone Number
+ + \ No newline at end of file