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

28 create quest grant endpoint with tokens #58

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

jose-carlos-sousa
Copy link
Contributor

This PR involves several key operations:

  1. Token Verification: The middleware checks if the provided token is correct.
  2. Data Retrieval: It retrieves the following:
    • The Edition based on the provided input.
    • The Participant associated with the given quest_code.
    • The Enrollment of the Participant for the specified edition.
  3. Quest Attachment: It attaches a new quest to the enrollment_quest relationship.

Required Fields

To successfully use this endpoint, you must provide:

  • quest_code: This is used to identify and retrieve the Participant.
  • edition: This specifies the edition number.

Problems Encountered

  • Edition Value Issue: The edition is always returned as the one with id 1, regardless of the actual value provided in the edition field. This inconsistency needs to be investigated and resolved.

Additional Considerations

  • Database Complexity: The database contains many tables, and it can be challenging to understand the relationships and meanings of various fields, especially the keys. To aid in understanding:
    • A UML diagram or other visual aids could be extremely beneficial in clarifying the structure and relationships within the database.

@jose-carlos-sousa jose-carlos-sousa linked an issue Sep 23, 2024 that may be closed by this pull request
@jose-carlos-sousa jose-carlos-sousa force-pushed the 28-create-quest-grant-endpoint-with-tokens branch from e74830f to b911d54 Compare September 23, 2024 19:54
@jose-carlos-sousa jose-carlos-sousa force-pushed the 28-create-quest-grant-endpoint-with-tokens branch from b911d54 to 99e667c Compare September 23, 2024 19:55
return response()->json([
'status' => 'error',
'message' => 'Participant not enrolled in this edition!',
], 400);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
], 400);
], 412);

412 - Precondition failed

'errors' => $validator->errors(),
], 400);
}
$editionId = $request->input('edition')->id;
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that the input needs to be in the following format?

{
  "edition": {
    "id": 1,
  }
}

@jose-carlos-sousa jose-carlos-sousa marked this pull request as ready for review September 25, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Quest grant endpoint with tokens
2 participants