added endpoints to see all user without any auth for testing
This commit is contained in:
parent
49e52e1826
commit
592331236e
@ -1,6 +1,8 @@
|
|||||||
package enseirb.myinpulse.controller;
|
package enseirb.myinpulse.controller;
|
||||||
|
|
||||||
|
import enseirb.myinpulse.model.Administrator;
|
||||||
import enseirb.myinpulse.model.Entrepreneur;
|
import enseirb.myinpulse.model.Entrepreneur;
|
||||||
|
import enseirb.myinpulse.service.AdminApiService;
|
||||||
import enseirb.myinpulse.service.EntrepreneurApiService;
|
import enseirb.myinpulse.service.EntrepreneurApiService;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -14,10 +16,12 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class UnauthApi {
|
public class UnauthApi {
|
||||||
|
|
||||||
private final EntrepreneurApiService entrepreneurApiService;
|
private final EntrepreneurApiService entrepreneurApiService;
|
||||||
|
private final AdminApiService adminApiService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
UnauthApi(EntrepreneurApiService entrepreneurApiService) {
|
UnauthApi(EntrepreneurApiService entrepreneurApiService, AdminApiService administratorService) {
|
||||||
this.entrepreneurApiService = entrepreneurApiService;
|
this.entrepreneurApiService = entrepreneurApiService;
|
||||||
|
this.adminApiService = administratorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unauth/finalize")
|
@GetMapping("/unauth/finalize")
|
||||||
@ -48,4 +52,19 @@ public class UnauthApi {
|
|||||||
true);
|
true);
|
||||||
entrepreneurApiService.createAccount(e);
|
entrepreneurApiService.createAccount(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These bottom endpoints are meant for testing only
|
||||||
|
* and should not py merged to main
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/unauth/getAllAdmins")
|
||||||
|
public Iterable<Administrator> getEveryAdmin() {
|
||||||
|
return this.adminApiService.getAllAdmins();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/unauth/getAllEntrepreneurs")
|
||||||
|
public Iterable<Entrepreneur> getEveryEntrepreneur() {
|
||||||
|
return this.entrepreneurApiService.getAllEntrepreneurs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,4 +206,8 @@ public class AdminApiService {
|
|||||||
public Iterable<User> getPendingUsers() {
|
public Iterable<User> getPendingUsers() {
|
||||||
return this.userService.getPendingAccounts();
|
return this.userService.getPendingAccounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterable<Administrator> getAllAdmins() {
|
||||||
|
return this.administratorService.allAdministrators();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,4 +219,8 @@ public class EntrepreneurApiService {
|
|||||||
}
|
}
|
||||||
throw new ResponseStatusException(HttpStatus.CONFLICT, "User already exists in the system");
|
throw new ResponseStatusException(HttpStatus.CONFLICT, "User already exists in the system");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterable<Entrepreneur> getAllEntrepreneurs() {
|
||||||
|
return entrepreneurService.getAllEntrepreneurs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user