adaptation to my work

pull/1/head
Roxane ROSSETTO 1 year ago
parent 291fd62529
commit 8af44d145d

@ -1,3 +1,5 @@
package SAE.ApiREST.WebService.controller;
@org.springframework.stereotype.Controller @org.springframework.stereotype.Controller
@Controller @Controller

@ -1,14 +1,10 @@
package SAE.ApiREST.WebService.Controller; package SAE.ApiREST.WebService.controller;
import SAE.ApiREST.WebService.Model.Teacher; import SAE.ApiREST.WebService.service.ITeacherService;
import SAE.ApiREST.WebService.Service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@Controller @Controller
@RequestMapping("/ProfWebService") @RequestMapping("/ProfWebService")
public class TeacherController { public class TeacherController {

@ -1,4 +1,4 @@
package SAE.ApiREST.WebService.Model; package SAE.ApiREST.WebService.model;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.Id; import jakarta.persistence.Id;

@ -1,3 +1,8 @@
package SAE.ApiREST.WebService.service;
import java.util.Collection;
import java.util.List;
public interface ICollectionService{ public interface ICollectionService{
public List<Collection> getAllCollections(); public List<Collection> getAllCollections();
public Collection getCollectionById(long isbn); public Collection getCollectionById(long isbn);

@ -1,6 +1,6 @@
package SAE.ApiREST.WebService.Service; package SAE.ApiREST.WebService.service;
import SAE.ApiREST.WebService.Model.Teacher; import SAE.ApiREST.WebService.model.Teacher;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
@ -15,7 +15,7 @@ public interface ITeacherService {
public Teacher getTeacherByUsername(String username); public Teacher getTeacherByUsername(String username);
public Teacher getTeacherByMail(String mail); public Teacher getTeacherByMail(String mail);
public Teacher getTeacherByDate(LocalDate date); public Teacher getTeacherByDate(LocalDate date);
public List<Teacher> addTeacher(int id, LocalDate date, String mail, String username); public List<Teacher> addTeacher(Teacher t);
public List<Teacher> deleteTeacher(int id); public List<Teacher> deleteTeacher(int id);
} }

@ -1,13 +1,10 @@
package SAE.ApiREST.WebService.service; package SAE.ApiREST.WebService.service;
import java.sql.Date;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import SAE.ApiREST.WebService.model.Article;
@Service @Service
public class CollectionService implements ICollectionService { public class CollectionService implements ICollectionService {
private ArrayList<Collection> collections; private ArrayList<Collection> collections;

@ -1,6 +1,6 @@
package SAE.ApiREST.WebService.Service; package SAE.ApiREST.WebService.service;
import SAE.ApiREST.WebService.Model.Teacher; import SAE.ApiREST.WebService.model.Teacher;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
@ -46,9 +46,9 @@ public class TeacherServiceStub implements ITeacherService {
} }
@Override @Override
public List<Teacher> addTeacher(int id, LocalDate date, String mail, String username) { public List<Teacher> addTeacher(Teacher t) {
List<Teacher> lteach = new ArrayList<Teacher>(); List<Teacher> lteach = new ArrayList<Teacher>();
lteach.add(new Teacher(id,date,mail,username)); lteach.add(t);
return lteach; return lteach;
} }
Loading…
Cancel
Save