Skip to content

feat: add GET /api/v1/organisations/{organisationId} endpoint#695

Merged
phoenixdahdev merged 7 commits intohngprojects:devfrom
C3Techie:feature/get-organisation-by-id
Mar 2, 2025
Merged

feat: add GET /api/v1/organisations/{organisationId} endpoint#695
phoenixdahdev merged 7 commits intohngprojects:devfrom
C3Techie:feature/get-organisation-by-id

Conversation

@C3Techie
Copy link
Contributor

@C3Techie C3Techie commented Mar 1, 2025

Resolves #679

Description

  • What was changed: Added a new endpoint GET /api/v1/organisations/{organisationId} to retrieve an organisation by its ID.
  • Why it was changed: The feature was implemented to allow users to retrieve organisation details by its unique ID.

Changes Implemented

  • Implemented the getOrganisationById method in the OrganisationService class to retrieve an organisation by its ID.
  • Added a new GET /api/v1/organisations/{organisationId} endpoint in the OrganisationController class.
  • Created integration tests for the GET endpoint in the e2e test class to validate functionality for both valid and invalid organisation IDs.
  • Added unit tests in the OrganisationServiceTest class for the getOrganisationById method to ensure correct behavior for existing and non-existing organisation IDs.
  • Updated the response handling in the service to throw a NotFoundException when the organisation is not found.

Manual testing performed: Validated API with Postman to ensure correct response for both valid and invalid organisation IDs:

  • Screenshot from Postman
    Valid Organization ID Response

Screenshot (18)

Invalid Organization ID Response

Screenshot (23)

Screenshot from Swagger

POST request to create an Organisation

Screenshot (17)

GET Organisation by ID

Screenshot (16)

C3Techie added 4 commits March 1, 2025 00:00
- Add test for successful retrieval of an organisation by ID.
- Add test for NotFoundException when organisation ID doesn't exist.
- Ensure interaction with repository methods is correctly verified.
@C3Techie C3Techie requested a review from Am0du March 1, 2025 08:35
@phoenixdahdev phoenixdahdev merged commit f67b47d into hngprojects:dev Mar 2, 2025
1 check failed
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.

[Feat] Endpoint to Retrieve an Organization by its ID

3 participants