Skip to content

Commit

Permalink
Create additional internal endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Sathiyaraman-M committed Mar 8, 2024
1 parent 09f8787 commit a48c951
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/SmartLocate.Identity/Controllers/StudentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class StudentController(IMongoRepository<StudentActivationCode> activatio
public async Task<IActionResult> RequestActivation(StudentInvokeActivationRequest request)
{
var student = await daprClient.InvokeMethodAsync<StudentResponse>(HttpMethod.Get, SmartLocateServices.Students,
$"api/students/{request.StudentId}");
$"api/students/{request.StudentId}/details");
if (student == null)
{
return NotFound("Student Not Found");
Expand Down
18 changes: 18 additions & 0 deletions src/SmartLocate.Students/Controllers/StudentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,22 @@ public async Task<IActionResult> GetCount(Guid busRouteId)
var count = await mongoRepository.CountAsync(x => x.DefaultBusRouteId == busRouteId);
return Ok(count);
}

[AllowAnonymous]
[HttpGet("{id:guid}/details")]
[ProducesResponseType(typeof(StudentResponse), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> GetDetails(Guid id)
{
var student = await mongoRepository.GetAsync(id);
if (student == null)
{
return NotFound();
}

var studentResponse = new StudentResponse(student.Id, student.Name, student.Email, student.PhoneNumber,
student.Address, student.DefaultPickupDropOffLocation, student.DefaultBusRouteId,
student.DefaultBusRouteNumber, student.IsActivated);
return Ok(studentResponse);
}
}

0 comments on commit a48c951

Please sign in to comment.