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

git add getPropositionByMentor

parent 6a546111
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -21,6 +21,12 @@ public class HelpPropositionController {
		return "allHelpProposition";
	}

	@GetMapping("/allOpenProposition")
	public String getOpen(Map<String, Object> model) {
		model.put("helpPropositions", helpPropositionRepository.fi());
		return "allHelpProposition";
	}

	@GetMapping("/formHelpProposition")
	public String helpPropositionForm(Model model) {
		model.addAttribute("helpProposition", new HelpProposition());
@@ -38,4 +44,15 @@ public class HelpPropositionController {
		return "formHelpProposition";
	}

	
	@GetMapping("/allPropositionByMentor")
	public String getallPropositionByMentor(Map<String, Object> model) {

		//TODO : recup le mentor loggé
		Mentor mentor = new Mentor();
		mentor.setId(1);
		model.put("helpPropositions", helpPropositionRepository.findByMentor(mentor));
		return "allHelpProposition";
	}

}
+5 −1
Original line number Diff line number Diff line
package com.example.demo;

import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

import com.example.demo.HelpProposition;

public interface HelpPropositionRepository extends JpaRepository <HelpProposition, Long>  {

    List<HelpProposition> findByMentor(Mentor mentor);
}
+5 −0
Original line number Diff line number Diff line
package com.example.demo;

import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

import com.example.demo.HelpRequest;

public interface HelpRequestRepository extends JpaRepository <HelpRequest, Long>  {
    List<HelpRequest> findByPoulain(Poulain poulain);

}
+2 −2
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@
		<h1>Form HelpProposition</h1>
		<form action="#" th:action="@{/insertHelpProposition}" th:object="${helpProposition}" method="post">
			<p>HelpProposition matiere: <input type="text" th:field="*{matiere}" /></p>
			<p>HelpProposition date begin: <input type="datetime-local" th:field="*{{dateBegin}}" /></p>
			<p>HelpProposition date end: <input type="datetime-local" th:field="*{{dateEnd}}" /></p>
			<p>HelpProposition date begin: <input type="datetime-local" th:field="*{dateBegin}" /></p>
			<p>HelpProposition date end: <input type="datetime-local" th:field="*{dateEnd}" /></p>
			<p>HelpProposition comment: <input type="text" th:field="*{comment}" /></p>
			<p>HelpProposition Mentor : TODO recup id Mentor</p>
			<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>