Skip to content

Commit bfb8f4f

Browse files
committed
Updated account hook endpoint to match export-exmple-screener endpoint
1 parent 8d61cd6 commit bfb8f4f

2 files changed

Lines changed: 26 additions & 15 deletions

File tree

builder-api/src/main/java/org/acme/controller/AccountResource.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class AccountResource {
3232
@POST
3333
@Consumes(MediaType.APPLICATION_JSON)
3434
@Produces(MediaType.APPLICATION_JSON)
35-
@Path("/account-hooks")
35+
@Path("/account/hooks")
3636
public Response accountHooks(@Context SecurityIdentity identity,
3737
AccountHookRequest request) {
3838

@@ -76,27 +76,38 @@ public Response exportExampleScreener(@Context SecurityIdentity identity) {
7676

7777
if (userId == null) {
7878
return Response.status(Response.Status.UNAUTHORIZED)
79-
.entity(new ApiError(true, "Unauthorized.")).build();
79+
.entity(new ApiError(true, "Unauthorized.")).build();
8080
}
8181

8282
if (LaunchMode.current() != LaunchMode.DEVELOPMENT) {
8383
return Response.status(Response.Status.NOT_FOUND).build();
8484
}
8585

8686
try {
87-
ExampleScreenerExportService.ExportSummary summary = exampleScreenerExportService.exportForUser(userId);
88-
return Response.ok(Map.of(
89-
"success", true,
90-
"outputPath", summary.outputPath(),
91-
"screenerCount", summary.screenerCount(),
92-
"firestoreDocuments", summary.firestoreDocuments(),
93-
"storageFiles", summary.storageFiles()
94-
)).build();
87+
ExampleScreenerExportService.ExportSummary summary = exampleScreenerExportService
88+
.exportForUser(userId);
89+
return Response.ok(
90+
Map.of(
91+
"success",
92+
true,
93+
"outputPath",
94+
summary.outputPath(),
95+
"screenerCount",
96+
summary.screenerCount(),
97+
"firestoreDocuments",
98+
summary.firestoreDocuments(),
99+
"storageFiles",
100+
summary.storageFiles()))
101+
.build();
95102
} catch (Exception e) {
96-
Log.error("Failed to export example screener seed data for user " + userId, e);
97-
return Response.serverError()
98-
.entity(new ApiError(true, "Failed to export example screener seed data."))
99-
.build();
103+
Log.error(
104+
"Failed to export example screener seed data for user "
105+
+ userId,
106+
e);
107+
return Response.serverError().entity(
108+
new ApiError(true,
109+
"Failed to export example screener seed data."))
110+
.build();
100111
}
101112
}
102113
}

builder-frontend/src/api/account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { authPost } from "@/api/auth";
55
const apiUrl = env.apiUrl;
66

77
export const runAccountHooks = async () => {
8-
const accountHookUrl = new URL(`${apiUrl}/account-hooks`);
8+
const accountHookUrl = new URL(`${apiUrl}/account/hooks`);
99

1010
const hooksToCall = ["add example screener"];
1111

0 commit comments

Comments
 (0)