added endpoints to see all user without any auth for testing
Some checks failed
Format / formatting (push) Successful in 5s
Build / build (push) Successful in 45s
CI / build (push) Failing after 12s
Format / formatting (pull_request) Successful in 7s

This commit is contained in:
MAILLAL Anas 2025-05-01 17:45:49 +02:00
parent 49e52e1826
commit 592331236e
3 changed files with 28 additions and 1 deletions

View File

@ -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();
}
} }

View File

@ -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();
}
} }

View File

@ -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();
}
} }