diff --git a/TaskAPI/pom.xml b/TaskAPI/pom.xml deleted file mode 100644 index 529934e..0000000 --- a/TaskAPI/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - org.example - TaskAPI - 1.0-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-parent - 3.2.5 - - - - 20 - 20 - UTF-8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - org.postgresql - postgresql - runtime - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.springframework.data - spring-data-jpa - 3.2.5 - - - - \ No newline at end of file diff --git a/TaskAPI/src/main/java/org/example/TaskAPI.java b/TaskAPI/src/main/java/org/example/TaskAPI.java deleted file mode 100644 index 3a5b75d..0000000 --- a/TaskAPI/src/main/java/org/example/TaskAPI.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.example; - -import jakarta.persistence.*; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.web.bind.annotation.*; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import java.util.Optional; - -@SpringBootApplication -@RestController -public class TaskAPI { - - @Autowired - private TaskRepository taskRepository; - - @Entity - public static class Task { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - private String title; - private String description; - - public Task(String title, String description) { - this.title = title; - this.description = description; - } - - public Task() { - } - - public Long getId() { - return id; - } - - public String getTitle() { - return title; - } - - public String getDescription() { - return description; - } - - public void setTitle(String title) { - this.title = title; - } - - public void setDescription(String description) { - this.description = description; - } - } - - // Получение задания по id - @GetMapping("/tasks/{taskId}") - public Task getTask(@PathVariable Long taskId) { - return taskRepository.findById(taskId).orElse(null); - } - - // Получение всех заданий - @GetMapping("/tasks") - public List getTasks() { - return taskRepository.findAll(); - } - - // Добавление нового задания - @PostMapping("/tasks") - public Task createTask(@RequestBody Task newTask) { - return taskRepository.save(newTask); - } - - // Удаление задания по id - @DeleteMapping("/tasks/{taskId}") - public String deleteTaskById(@PathVariable Long taskId) { - Optional taskToDelete = taskRepository.findById(taskId); - - if (taskToDelete.isPresent()) { - Task task = taskToDelete.get(); - taskRepository.deleteById(taskId); - return "Удалена задача с id: " + task.getId() + " и названием: " + task.getTitle(); - } else { - return "Задача с id " + taskId + " не найдена."; - } - } - - public static void main(String[] args) { - SpringApplication.run(TaskAPI.class, args); - } -} \ No newline at end of file diff --git a/TaskAPI/src/main/java/org/example/TaskRepository.java b/TaskAPI/src/main/java/org/example/TaskRepository.java deleted file mode 100644 index 61b6716..0000000 --- a/TaskAPI/src/main/java/org/example/TaskRepository.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.example; - -import org.springframework.data.jpa.repository.JpaRepository; - -public interface TaskRepository extends JpaRepository { -} \ No newline at end of file diff --git a/TaskAPI/src/main/resources/application.properties b/TaskAPI/src/main/resources/application.properties deleted file mode 100644 index c743646..0000000 --- a/TaskAPI/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/Tasks -spring.datasource.username=Wanster -spring.datasource.password=6254 -spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect -spring.jpa.hibernate.ddl-auto=update \ No newline at end of file diff --git a/TaskAPI/target/classes/application.properties b/TaskAPI/target/classes/application.properties deleted file mode 100644 index c743646..0000000 --- a/TaskAPI/target/classes/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/Tasks -spring.datasource.username=Wanster -spring.datasource.password=6254 -spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect -spring.jpa.hibernate.ddl-auto=update \ No newline at end of file diff --git a/TaskAPI/target/classes/org/example/TaskAPI$Task.class b/TaskAPI/target/classes/org/example/TaskAPI$Task.class deleted file mode 100644 index 4892f99..0000000 Binary files a/TaskAPI/target/classes/org/example/TaskAPI$Task.class and /dev/null differ diff --git a/TaskAPI/target/classes/org/example/TaskAPI.class b/TaskAPI/target/classes/org/example/TaskAPI.class deleted file mode 100644 index 4ad0b41..0000000 Binary files a/TaskAPI/target/classes/org/example/TaskAPI.class and /dev/null differ diff --git a/TaskAPI/target/classes/org/example/TaskRepository.class b/TaskAPI/target/classes/org/example/TaskRepository.class deleted file mode 100644 index a092d10..0000000 Binary files a/TaskAPI/target/classes/org/example/TaskRepository.class and /dev/null differ