hackerAPI icon indicating copy to clipboard operation
hackerAPI copied to clipboard

Enforce one-to-one relationships

Open logan-r opened this issue 4 years ago • 4 comments

Describe the bug Can associate multiple Hackers with accounts or multiple rolebindings with accounts

To Reproduce Steps to reproduce the behavior:

  1. Create an Account
  2. Create two Hackers associated with that Account

Expected behavior Attempt to create the second hacker would fail

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Had 2 or 3 Hackers associated with a handful of accounts during the 2021 McHacks application period

logan-r avatar Jan 28 '21 04:01 logan-r

Sounds like the proper long term solution for this is a DB re-arch that nests the hacker object for a given instance of the hackathon within the account object. I think we've discussed this in another issue somewhere else.

Edit lol yup: https://github.com/hackmcgill/hackerAPI/issues/650

krubenok avatar Jan 28 '21 04:01 krubenok

This is definitely a massive undertaking

pierreTklein avatar Jan 28 '21 13:01 pierreTklein

With the level of effort #650 would take, maybe a better approach to the redesign would be to wrap this API in a GraphQL api and then slowly remove and replace REST parts?

logan-r avatar Jan 28 '21 19:01 logan-r

I think there's a real discussion to be had on if going from REST to GQL is actually the correct architecture for an API like this. My gut says that GQL is probably overkill for this application, but I could be convinced otherwise. That being said, the admin side would get some nice benefits out of GQL that the hacker side might not see as much of.

Either way, the way Mongo is being used right now is fundamentally wrong so that needs to be addressed.

krubenok avatar Jan 29 '21 03:01 krubenok