aglinxinyuan commented on code in PR #7318:
URL: https://github.com/apache/texera/pull/7318#discussion_r3717466663
##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResource.scala:
##########
@@ -126,6 +127,13 @@ class AdminUserResource {
userDao.insert(newUser)
}
+ @GET
+ @Path("/created_datasets")
+ @Produces(Array(MediaType.APPLICATION_JSON))
+ def getCreatedDatasets(@QueryParam("user_id") user_id: Integer):
List[DatasetQuota] = {
+ getUserCreatedDatasets(user_id)
+ }
Review Comment:
Good catch — `getUserCreatedDatasets(null)` renders as `owner_uid = ?` with
a null bind, so SQL three-valued logic yields an empty list rather than a 400.
(It wouldn't match NULL owners, though — `= NULL` is never true.)
Kept the guard, with two adjustments in dd89dab151:
- Raise `BadRequestException("user_id is required")` instead of a bare
`WebApplicationException`, matching the existing admin-only guard in
`FeedbackResource.listUserFeedback`.
- Reindent it — the auto-commit landed the method at column 0, which failed
`scalafmtCheckAll` and stopped the amber job before any test ran.
Also added a spec case (`assertThrows[BadRequestException]`) so the 400 path
is covered.
Note the four sibling endpoints in this class (`created_workflows`,
`access_workflows`, `user_quota_size`, and the `deleteCollection` path param)
have the same unvalidated shape. Left them alone to keep this PR scoped to the
404, but they're worth a follow-up if we want the guard to be uniform.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]