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

Add Phase Tickets API: Route, Handler, and Utility Function #1994

Conversation

MuhammadUmer44
Copy link
Contributor

@MuhammadUmer44 MuhammadUmer44 commented Nov 27, 2024

Describe the changes:

  • Implemented new API endpoint to fetch tickets by phase UUID, including route /features/{uuid}/phase/{uuid}/tickets, handler with authentication, and database utility function with comprehensive test coverage.

closes: #1982
closes: #1983
closes: #1984

Issue ticket number and link:

  • Ticket Number: [ 1982, 1983, 1984 ]
  • Link: [ https://github.com/stakwork/sphinx-tribes-frontend/issues/1982, https://github.com/stakwork/sphinx-tribes-frontend/issues/1983, https://github.com/stakwork/sphinx-tribes-frontend/issues/1984 ]

Evidence:

image

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested on Chrome
  • New feature (non-breaking change which adds functionality)
  • I have provided a screenshot of changes in my PR

@MuhammadUmer44
Copy link
Contributor Author

Hi @elraphty, @humansinstitute, @tobi-bams,
Please review this PR. I have also added unit tests to cover all edge cases.

@@ -327,3 +327,17 @@ func (db database) GetBountiesByPhaseUuid(phaseUuid string) []Bounty {
db.db.Model(&Bounty{}).Where("phase_uuid = ?", phaseUuid).Find(&bounties)
return bounties
}

func (db database) GetTicketsByPhase(featureUuid string, phaseUuid string) ([]Tickets, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@MuhammadUmer44 we are to get tickets by phaseUuid alone not by phaseUuid and featureUuid.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is no concept currently where we would have phases without a feature so this logic is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MuhammadUmer44 can you resolve this one so we can get it merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@humansinstitute, Sure, I am on it.

return
}

tickets, err := oh.db.GetTicketsByPhase(featureUuid, phaseUuid)
Copy link
Contributor

Choose a reason for hiding this comment

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

Also based on the issue related to this, you are suppose to return only the ticketUuids and not the entire ticket object

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this should have been updated and the approach is corrrect.

Initially I had a design to return uuids and then use a different operation to get all details.
But it makes more sense to just return the whole object in one go whilst we're there.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was a situation where the description in the ticket was correct but I'd not updated the title which still referenced UUIDs (updated)

return
}

_, err := oh.db.GetFeaturePhaseByUuid(featureUuid, phaseUuid)
Copy link
Contributor

Choose a reason for hiding this comment

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

You suppose to use this new function GetTicketsByPhase you just created here and not this function GetFeaturePhaseByUuid

@humansinstitute
Copy link
Contributor

Closing due to conflict with second pull request on same functionality.
#1997

@MuhammadUmer44
Copy link
Contributor Author

Closing due to conflict with second pull request on same functionality. #1997

@humansinstitute, I fix conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants