Commit e693a3ad authored by roxane.carraux's avatar roxane.carraux
Browse files

add helpcontroller and help repository TODO:fix probleme with allHelpRequest route

parent 48904646
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -32,10 +32,6 @@ public class HelpRequest {
	@ManyToOne
	private Poulain poulain;

	// dateS
	// matière
	// commentaire

	public HelpRequest() {

	}
@@ -61,5 +57,4 @@ public class HelpRequest {
	public void setId(Integer id) {
		this.id = id;
	}

}
+25 −0
Original line number Diff line number Diff line
package com.example.demo;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import com.example.demo.HelpRequestRepository;


@Controller
public class HelpRequestController {
	@Autowired 
	HelpRequestRepository helpRequestRepository;
	
    @Autowired 
    
    @GetMapping("/allHelpRequest")
	public String getAll(Map<String, Object> model) {
		model.put("helpRequests", helpRequestRepository.findAll());
		return "allHelpRequest";
	}

}
+7 −0
Original line number Diff line number Diff line
package com.example.demo;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.HelpRequest;

public interface HelpRequestRepository extends JpaRepository <HelpRequest, Long>  {

}
+0 −5
Original line number Diff line number Diff line
@@ -5,13 +5,8 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import java.util.Set;

import javax.persistence.CascadeType;

@Entity
@Table(name = "mentor")
public class Mentor {
+0 −2
Original line number Diff line number Diff line
@@ -9,8 +9,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;

import com.example.demo.*;


@Controller
public class MentorController {
Loading