Skip to content

Associate resource creation with challenge state. #15

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

Closed
ThomasKranitsas opened this issue Mar 14, 2020 · 33 comments
Closed

Associate resource creation with challenge state. #15

ThomasKranitsas opened this issue Mar 14, 2020 · 33 comments

Comments

@ThomasKranitsas
Copy link
Contributor

Currently, a resource can be created regardless of the challenge state. That would mean a member could register on a challenge even if the registration phase is not open.

As part of this ticket, you need to create a new table called ResourceRolePhaseDependency.
The format of the objects stored on this will be as follows:

{
  phaseId: 'UUID', // Maps to the `Phase` ID
  resourceRoleId: 'UUID', // Maps to the `ResourceRole` ID
  phaseState: 'Boolean'
}

Detailed requirements

  1. Create the model definition and create CRUD endpoints for this new model. Only admins and M2M token with valid scopes can use those endpoints. The phaseId should be validated by calling the Challenge API to fetch the Phases (GET <Challenge API URL>/challengephases) and the resourceRoleId should be validated by fetching the available ResourceRoles.
  2. Create sample data for the seed-tables script so we can insert initial data into the DB.
  3. Update the /resources endpoint based on the logic described in the next section.
  4. Update the Swagger definition as well as the POSTMAN collection.
  5. Update unit/e2e tests to reflect all changes.

Updated business logic for the /resources endpoint

When creating/updating/deleting a Resource we should:

  • Fetch the challenge data by calling the Challenge API using an M2M token
  • Check if there are any dependencies based on the ResourceRole of the newly created Resource
  • If there are any dependencies, validate if all requirements are met.

Let's take the member registration on a challenge as an example. The ResourceRole would depend on the Registration Phase to be open (isOpen: true).

If the requirements are not met, throw a 400 Bad Request with an appropriate error message (eg The resource cannot be created because the Registration phase is not open).

@ThomasKranitsas ThomasKranitsas changed the title Associate resource creation with challenge state [$350] Associate resource creation with challenge state Mar 14, 2020
@ThomasKranitsas
Copy link
Contributor Author

@topcoder-platform/tcxcommunity this is open for pickup! Worked based on the develop branch and create a PR once done.

@ThomasKranitsas
Copy link
Contributor Author

ThomasKranitsas commented Mar 14, 2020

@topcoder-platform/topcodercompetitors this is open for pickup! Worked based on the develop branch and create a PR once done.

@tcchhabra
Copy link

@ThomasKranitsas I would like to work on this, can you assign me as I cannot assign myself?

@ThomasKranitsas ThomasKranitsas changed the title [$350] Associate resource creation with challenge state [$350] Associate resource creation with challenge state. Mar 14, 2020
@ThomasKranitsas
Copy link
Contributor Author

Contest https://www.topcoder.com/challenges/30119420 has been created for this ticket.

This is an automated message for thomaskranitsas via Topcoder X

@ThomasKranitsas
Copy link
Contributor Author

@tcchhabra, please sign-up with Topcoder X tool

This is an automated message for thomaskranitsas via Topcoder X

@tcchhabra
Copy link

@ThomasKranitsas I have tried again using all 3 major browsers, safari/chrome and Firefox, I think this Topcoder x is broken. Can we use GitHub access management for ticket assignment ? It is a very reliable. I had created a ticket few weeks back and support also closed it without any help.

@cagdas001
Copy link

The registration phase of the challenge is not open. It's not possible to access forum & use the link

@ThomasKranitsas
Copy link
Contributor Author

I have opened the registration phase manually

@lijulat
Copy link

lijulat commented Mar 15, 2020

@ThomasKranitsas Can I work on this issue? The self registraion link is broken hence don't have rights to assign this to myself

@ThomasKranitsas
Copy link
Contributor Author

Contest https://www.topcoder.com/challenges/30119420 has been updated - it has been assigned to codingdrone.

This is an automated message for thomaskranitsas via Topcoder X

@ThomasKranitsas
Copy link
Contributor Author

Hey @codingdrone! Can we have an update please?

@codingdrone
Copy link

Working, would be done in few hours.

@codingdrone
Copy link

@ThomasKranitsas can you please provide some sample data for ResourceRolePhaseDependency table? Like sample data for Rosource table is provided in Resource.json

@ThomasKranitsas
Copy link
Contributor Author

Example:

{
  phaseId: 'a93544bc-c165-4af4-b55e-18f3593b457a', // Registration phase
  resourceRoleId: '732339e7-8e30-49d7-9198-cccf9451e221', // Submitter role
  phaseState: true // Should be open
}

The above would translate into: The Registration phase must be open in order for a Submitter role to be created

@asadath1395
Copy link

@ThomasKranitsas Its been more than a day, can i take it now?

@callmekatootie
Copy link

@codingdrone Status check. Are you on track to submit within the next 7 hours? If not, I am afraid I will have to reassign the ticket. Kindly give an update here.

P.S. @ThomasKranitsas is still the CoPilot for the project. They are not feeling well and I am only helping them temporarily with the open items.

@ThomasKranitsas
Copy link
Contributor Author

Contest https://www.topcoder.com/challenges/30119420 has been updated - sadathanwar17 has been unassigned.

This is an automated message for thomaskranitsas via Topcoder X

@ThomasKranitsas
Copy link
Contributor Author

Contest https://www.topcoder.com/challenges/30119420 has been updated - sadathanwar17 has been unassigned.

This is an automated message for thomaskranitsas via Topcoder X

@ThomasKranitsas
Copy link
Contributor Author

Contest https://www.topcoder.com/challenges/30119420 has been updated - it has been assigned to sadathanwar17.

This is an automated message for thomaskranitsas via Topcoder X

@callmekatootie
Copy link

@asadath1395 Status Check. Are you actively working on this and on track to submit?

@asadath1395
Copy link

@callmekatootie Yes i am actively working. I might need another 12 hours since scope is quite big

@callmekatootie
Copy link

That's cool. Thanks for the update

@asadath1395
Copy link

I am opening this up for others as i will not be able to complete soon

@asadath1395 asadath1395 removed their assignment Mar 18, 2020
@ThomasKranitsas ThomasKranitsas changed the title [$350] Associate resource creation with challenge state. Associate resource creation with challenge state. Mar 18, 2020
@ThomasKranitsas
Copy link
Contributor Author

This is no longer open for pickup.

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

No branches or pull requests

7 participants