Skip to content
Snippets Groups Projects

feat: Update routing for user-delete D7 replacement

6 files
+ 15
14
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
* Resource class containing all endpoints related to a user's EF profile (not by GH handle). Provides endpoints for user search, user
* Resource class containing all endpoints related to a user's EF profile (not by GH handle). Provides endpoints for user search, user
* profile, all user metadata, and an endpoint to initiate the user_delete_request process for a user.
* profile, all user metadata, and an endpoint to initiate the user_delete_request process for a user.
*/
*/
@Path("sandbox/account/profile")
@Path("")
@Produces({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public class AccountResource {
public class AccountResource {
private static final Logger LOGGER = LoggerFactory.getLogger(AccountResource.class);
private static final Logger LOGGER = LoggerFactory.getLogger(AccountResource.class);
@@ -79,6 +79,7 @@ public class AccountResource {
@@ -79,6 +79,7 @@ public class AccountResource {
* found.
* found.
*/
*/
@GET
@GET
 
@Path("sandbox/account/profile")
public Response searchForUser(@BeanParam ProfileAPISearchParams params) {
public Response searchForUser(@BeanParam ProfileAPISearchParams params) {
// If search params are empty, attempt to get current user
// If search params are empty, attempt to get current user
@@ -118,7 +119,7 @@ public class AccountResource {
@@ -118,7 +119,7 @@ public class AccountResource {
* @return A 200 OK Response containing the requested EfUser entity. Returns a 404 Not Found Response if the user cannot be found.
* @return A 200 OK Response containing the requested EfUser entity. Returns a 404 Not Found Response if the user cannot be found.
*/
*/
@GET
@GET
@Path("/{username}")
@Path("sandbox/account/profile/{username}")
public Response getUserProfileByUsername(@PathParam("username") String username) {
public Response getUserProfileByUsername(@PathParam("username") String username) {
Optional<EfUser> user = profileService.getFullProfileByUsername(username);
Optional<EfUser> user = profileService.getFullProfileByUsername(username);
if (user.isEmpty()) {
if (user.isEmpty()) {
@@ -150,7 +151,7 @@ public class AccountResource {
@@ -150,7 +151,7 @@ public class AccountResource {
* @return An ECA entity with the desired user's status.
* @return An ECA entity with the desired user's status.
*/
*/
@GET
@GET
@Path("/{username}/eca")
@Path("sandbox/account/profile/{username}/eca")
public Response getUserEca(@PathParam("username") String username) {
public Response getUserEca(@PathParam("username") String username) {
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
if (user.isEmpty()) {
if (user.isEmpty()) {
@@ -167,7 +168,7 @@ public class AccountResource {
@@ -167,7 +168,7 @@ public class AccountResource {
* @return A 200 OK Response containing the desired user's Gerrit review count. A 404 Not Found Response if the user cannot be found.
* @return A 200 OK Response containing the desired user's Gerrit review count. A 404 Not Found Response if the user cannot be found.
*/
*/
@GET
@GET
@Path("/{username}/gerrit")
@Path("sandbox/account/profile/{username}/gerrit")
public Response getUserGerrit(@PathParam("username") String username) {
public Response getUserGerrit(@PathParam("username") String username) {
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
// A missing UID means Accounts is having issues. We cannot continue with the DB query without it
// A missing UID means Accounts is having issues. We cannot continue with the DB query without it
@@ -191,7 +192,7 @@ public class AccountResource {
@@ -191,7 +192,7 @@ public class AccountResource {
* @return A 200 OK Response containing the desired user's mailing-list subscriptions.
* @return A 200 OK Response containing the desired user's mailing-list subscriptions.
*/
*/
@GET
@GET
@Path("/{username}/mailing-list")
@Path("sandbox/account/profile/{username}/mailing-list")
public Response getUserMailingList(@PathParam("username") String username) {
public Response getUserMailingList(@PathParam("username") String username) {
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
if (user.isEmpty()) {
if (user.isEmpty()) {
@@ -208,7 +209,7 @@ public class AccountResource {
@@ -208,7 +209,7 @@ public class AccountResource {
* @return A 200 OK Response containing the desired user's mailing-list subscriptions.
* @return A 200 OK Response containing the desired user's mailing-list subscriptions.
*/
*/
@GET
@GET
@Path("/{username}/projects")
@Path("sandbox/account/profile/{username}/projects")
public Response getUserProjects(@PathParam("username") String username) {
public Response getUserProjects(@PathParam("username") String username) {
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
if (user.isEmpty()) {
if (user.isEmpty()) {
@@ -228,7 +229,7 @@ public class AccountResource {
@@ -228,7 +229,7 @@ public class AccountResource {
* an error occurs during the persistence process.
* an error occurs during the persistence process.
*/
*/
@POST
@POST
@Path("/{username}/user_delete_request")
@Path("account/profile/{username}/user_delete_request")
public Response processUserDeleteRequest(@PathParam("username") String username) {
public Response processUserDeleteRequest(@PathParam("username") String username) {
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
Optional<EfUser> user = profileService.getSlimProfileByUsername(username);
if (user.isEmpty()) {
if (user.isEmpty()) {
Loading