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

Allow creating documents under a different initial state #52

Merged

Conversation

joncarlson
Copy link
Collaborator

@joncarlson joncarlson commented Mar 6, 2024

Use case

To support our work with EDPub, we'd like "Collection Metadata" documents sent from EDPub to be temporarily quarantined in a state other than "Draft"; until a curator has a chance to review it.

This is accomplished by adding a new node to the workflow and a new query parameter to the createDocument endpoint: 'initialState'

The provided initialState must satisfy these conditions:

  1. has to be a state in the model's workflow
  2. has to be an INITIAL state (i.e. has an edge that connects to the "Init" node)

To Test

(This part you may need help with, was a chore to figure out authentication via Postman)

  • Send a POST request to the /meditor/api/models/Collection Metadata/documents?initialState=From EarthdataPub endpoint, note the initialState.
  • Visit the "Collection Metadata" document list page and you should see the document you created

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A test fixture, added comments on a couple lines...

"id": "Draft",
"readyForUse": false
},
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the initial state we'll be testing with, "Another Init Node", in addition to "Draft"

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :)

"source": "Published",
"target": "Hidden"
},
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And these two edges are new. Basically a document can go from: "Init" -> "Another Init Node" -> "Draft"

…due to being a string array instead of a label/value pair
Copy link
Contributor

@KrupaRami KrupaRami left a comment

Choose a reason for hiding this comment

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

Everything seems to be working as expected...approving!

Copy link
Contributor

@benforshey benforshey left a comment

Choose a reason for hiding this comment

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

The manual testing worked well with curl, and all tests passed.

@joncarlson joncarlson merged commit 96edc1d into main Mar 20, 2024
5 checks passed
@joncarlson joncarlson deleted the feature/MEDITOR-797-create-using-different-init-state branch March 20, 2024 12:20
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.

3 participants