backend-api #6
@@ -2,6 +2,7 @@ package enseirb.myinpulse.repository;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import enseirb.myinpulse.model.Administrator;
 | 
					import enseirb.myinpulse.model.Administrator;
 | 
				
			||||||
import enseirb.myinpulse.model.Project;
 | 
					import enseirb.myinpulse.model.Project;
 | 
				
			||||||
 | 
					import enseirb.myinpulse.model.ProjectDecisionValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.data.jpa.repository.JpaRepository;
 | 
					import org.springframework.data.jpa.repository.JpaRepository;
 | 
				
			||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
 | 
					import org.springframework.data.rest.core.annotation.RepositoryRestResource;
 | 
				
			||||||
@@ -10,5 +11,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
 | 
				
			|||||||
public interface ProjectRepository extends JpaRepository<Project, Long> {
 | 
					public interface ProjectRepository extends JpaRepository<Project, Long> {
 | 
				
			||||||
    Iterable<Project> findByProjectAdministrator(Administrator administrator);
 | 
					    Iterable<Project> findByProjectAdministrator(Administrator administrator);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Iterable<Project> findByProjectStatus(Long status);
 | 
					    Iterable<Project> findByProjectStatus(ProjectDecisionValue status);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,7 +61,9 @@ public class AdminApiService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // TODO: solve todo + test
 | 
					    // TODO: solve todo + test
 | 
				
			||||||
    public void addNewProject(Project project) {
 | 
					    public void addNewProject(Project project) {
 | 
				
			||||||
        projectService.addNewProject(project); // TODO: how can the front know the ID ?
 | 
					        projectService.addNewProject(
 | 
				
			||||||
 | 
					                project); // TODO: how can the front know the ID ? => it does not, thus needing to
 | 
				
			||||||
 | 
					        // have null in the project id field
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO
 | 
					    // TODO
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,7 +102,7 @@ public class ProjectService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Iterable<Project> getPendingProjects() {
 | 
					    public Iterable<Project> getPendingProjects() {
 | 
				
			||||||
        return this.projectRepository.findByProjectStatus((long) PENDING.ordinal());
 | 
					        return this.projectRepository.findByProjectStatus(PENDING);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void deleteProjectById(Long id) {
 | 
					    public void deleteProjectById(Long id) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user