Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0bb19180e1 | |||
| f76fa086de |
@@ -6,6 +6,8 @@ target/
|
|||||||
!**/src/test/**/target/
|
!**/src/test/**/target/
|
||||||
mvnw
|
mvnw
|
||||||
mvnw.cmd
|
mvnw.cmd
|
||||||
|
application-dev.properties
|
||||||
|
|
||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
.classpath
|
.classpath
|
||||||
|
|||||||
@@ -1,30 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||||
|
>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>4.1.1</version>
|
<version>4.1.1</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath /> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>myapi</groupId>
|
<groupId>myapi</groupId>
|
||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name/>
|
<name />
|
||||||
<description/>
|
<description />
|
||||||
<url/>
|
<url />
|
||||||
<licenses>
|
<licenses>
|
||||||
<license/>
|
<license />
|
||||||
</licenses>
|
</licenses>
|
||||||
<developers>
|
<developers>
|
||||||
<developer/>
|
<developer />
|
||||||
</developers>
|
</developers>
|
||||||
<scm>
|
<scm>
|
||||||
<connection/>
|
<connection />
|
||||||
<developerConnection/>
|
<developerConnection />
|
||||||
<tag/>
|
<tag />
|
||||||
<url/>
|
<url />
|
||||||
</scm>
|
</scm>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>26</java.version>
|
<java.version>26</java.version>
|
||||||
@@ -40,6 +43,22 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package myapi.api.Controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import myapi.api.Data.Repository.TaskRepository;
|
||||||
|
import myapi.api.Model.Task;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/task")
|
||||||
|
public class TaskController {
|
||||||
|
private final TaskRepository taskRepository;
|
||||||
|
|
||||||
|
public TaskController(TaskRepository repository){
|
||||||
|
this.taskRepository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<Task> getTasks(){
|
||||||
|
return this.taskRepository.findAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package myapi.api.Data.Repository;
|
||||||
|
|
||||||
|
import myapi.api.Model.Task;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface TaskRepository extends JpaRepository<Task, Integer> {}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package myapi.api.Model.Enums;
|
||||||
|
|
||||||
|
public enum Status{
|
||||||
|
EnCours,
|
||||||
|
Termine,
|
||||||
|
EnRetard
|
||||||
|
}
|
||||||
@@ -1,8 +1,77 @@
|
|||||||
package myapi.api.Model;
|
package myapi.api.Model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="task")
|
||||||
public class Task {
|
public class Task {
|
||||||
|
|
||||||
private int id_task;
|
@Id
|
||||||
private String name_task;
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private int id_task;
|
||||||
}
|
|
||||||
|
private String name_task;
|
||||||
|
private String status_task;
|
||||||
|
private Date date_task;
|
||||||
|
private Integer priority_task;
|
||||||
|
private Integer id_group;
|
||||||
|
|
||||||
|
|
||||||
|
public int getId_task() {
|
||||||
|
return id_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId_task(int id_task) {
|
||||||
|
this.id_task = id_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName_task() {
|
||||||
|
return name_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName_task(String name_task) {
|
||||||
|
this.name_task = name_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus_task() {
|
||||||
|
return status_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus_task(String status_task) {
|
||||||
|
this.status_task = status_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate_task() {
|
||||||
|
return date_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate_task(Date date_task) {
|
||||||
|
this.date_task = date_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPriority_task() {
|
||||||
|
return priority_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority_task(Integer priority_task) {
|
||||||
|
this.priority_task = priority_task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId_group() {
|
||||||
|
return id_group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId_group(Integer id_group) {
|
||||||
|
this.id_group = id_group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
return "id : " + this.id_group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
spring.application.name=api
|
spring.application.name=api
|
||||||
|
spring.profiles.active=dev
|
||||||
|
spring.jpa.show-sql=true
|
||||||
|
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||||
Reference in New Issue
Block a user