Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix submissionEnvelopes/search/findByUuid endpoint #59

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jacobwindsor
Copy link
Contributor

Fix issue where findByUuid wasn't working, causing the state tracker to fail.

See Slack thread

@jacobwindsor jacobwindsor requested a review from a team February 12, 2021 16:31
@jacobwindsor jacobwindsor self-assigned this Feb 12, 2021
@jacobwindsor
Copy link
Contributor Author

The change that stopped this endpoint from working was here I think. Seems unlikely that that is what has caused the issue as was so long ago

@yusra-haider
Copy link
Contributor

This is going to cause an issue on the UI, in the submission detail view:

{"url":"http://localhost:8080/submissionEnvelopes/search/findByUuidUuid","exceptionMessage":"Resource not found!"}

because of how this core api endpoint is consumed here:
https://github.com/ebi-ait/ingest-ui/blob/9d6b208d7479eaec451fa331c40e2af49ca7a922/client/src/app/shared/services/ingest.service.ts#L96

is it possible to update the api endpoint in state tracker instead of core?

@@ -23,7 +23,7 @@
@RestResource(exported = false)
SubmissionEnvelope findByUuid(Uuid uuid);

@RestResource(rel = "findByUuid")
@RestResource(rel = "findByUuid", path = "findByUuid")
SubmissionEnvelope findByUuidUuid(@Param("uuid") UUID uuid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does Uuid appear twice in the method name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because of the non-exported findByUuid method?

Copy link
Contributor

@MightyAx MightyAx Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of a late response here but i can explain, this is due to the automated spring mongo methods interacting with our Uuid class.

SubmissionEnvelope extends AbstractEntity which contains the uuid property of type Uuid from org.humancellatlas.ingest.core.Uuid.
The Uuid class contains a single property uuid of type UUID from java.util.UUID.

So using a snippet of this example, you can see that the uuid property of the submissionEnvelope is an object containing a uuid property.
GET /submissionEnvelopes/6080a6a1dd9aab1232d308b0

{
  "submissionDate" : "2021-04-21T22:26:41.995Z",
  "updateDate" : "2021-04-22T00:07:18.005Z",
  "user" : "601c2af3ac1792031eee4261",
  "lastModifiedUser" : "anonymousUser",
  "type" : "Submission",
  "uuid" : {
    "uuid" : "9262e9bf-5ebd-44ee-b80f-15cf107b32a5"
  },
  "events" : [ ]
}

So when using mongo spring repositories, the name of the method reflects where the data is being pulled from the source document.
The non-exported findByUuid method would be used with an object containing a uuid property:

uuid_object = {"uuid": "9262e9bf-5ebd-44ee-b80f-15cf107b32a5"}
envelope = submissionEnvelopeRepository.findByUuid(uuid_object);

whereas the second method just takes the UUID, which is more usable in our rest api, Hal browser, called from ingest UI.

uuid = "9262e9bf-5ebd-44ee-b80f-15cf107b32a5"
envelope = submissionEnvelopeRepository.findByUuidUuid(uuid);

In common language whenever anyone on the team talks about the uuid they mean this "9262e9bf-5ebd-44ee-b80f-15cf107b32a5" but actually in our code that is the Uuid of the Uuid.

Why do we have a custom Uuid class? I don't know.

@jacobwindsor
Copy link
Contributor Author

@ebi-ait/hca-dev we don't need this anymore right? Shall I close it?

@aaclan-ebi
Copy link
Contributor

Would still be nice to merge, we just need to make sure if the findByUuidUuid usage is replaced.

  • UI
  • archiver?
  • exporter?

Copy link
Contributor

@MightyAx MightyAx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this fix easier to merge we can expose the findbyUuidUuid method at both:
submissionEnvelopes/search/findByUuid &
submissionEnvelopes/search/findByUuidUuid

  1. Which would allow us to merge this change without changing downstream components.
  2. Then change the consuming components to use findByUuid
  3. Then make a new change here to remove the redundant findByUuidUuid

@jacobwindsor jacobwindsor marked this pull request as draft July 22, 2021 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants