-
-
Notifications
You must be signed in to change notification settings - Fork 0
SnakeAid Release: The Snake Catching and Rescue Pairing #46
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
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
f6aca47
Refactor SnakeAid Service:
DuongNManh a2c03e8
Merge branch 'dev' of https://github.com/Snake-AID/SnakeAid.Backend i…
DuongNManh 4d74740
feat: add GetDetailIncidentAsync method to retrieve detailed snakebit…
DuongNManh 00e681f
chore: remove deploy workflow and add VSCode settings for dotnet solu…
the-khiem7 4603bfa
feat: enhance Jenkins pipeline with improved Docker build and cleanup…
the-khiem7 75ecb09
feat: refactor Docker build and cleanup processes in Jenkins pipeline
the-khiem7 7cc3342
hotfix(Jenkins): Convert from docker plugin into sh command to avoud …
the-khiem7 9544982
fix: update Docker build commands to use docker.build for improved co…
the-khiem7 32e5707
feat: add CancelIncident endpoint to allow cancellation of snakebite …
DuongNManh 305d914
chore: update subproject commit reference in SnakeAid.Docs
the-khiem7 c07587e
feat: centralize Doppler configuration management and enhance app set…
the-khiem7 7362879
refactor(config): simplify Doppler integration and remove complex con…
the-khiem7 ff92c4d
build: update launch configurations, environment variables, and docs …
the-khiem7 112acb9
Merge pull request #38 from Snake-AID/devops/OPS002_Doppler-Config-Ce…
the-khiem7 737432a
Enhance session timeout service with detailed logging and monitoring …
DuongNManh 5898926
Merge branch 'main' into dev
the-khiem7 661eb1a
feat: implement RescueMissionController and service for managing resc…
NeoNgyn c2469a1
Merge branch 'dev' into feature/SA008-Rescue_Mission
NeoNgyn 1d6c04d
update: optimize status validation logic
NeoNgyn 0911b55
fix: update RescueMissionStatusResponse to use mission's UpdatedAt ti…
NeoNgyn 580226d
Merge branch 'feature/SA008-Rescue_Mission' of https://github.com/Sna…
NeoNgyn 1480186
feat: implement RescueMissionController and service for managing resc…
NeoNgyn 7e583e3
Refactor rescue mission handling and incident management
DuongNManh 2051967
feat: add SnakeCatchingRequest functionality with controller, service…
NeoNgyn 6839357
feat: add functionality to accept snake catching requests and handle …
NeoNgyn a899aca
feat: enhance snake catching request with detailed species identifica…
NeoNgyn a044469
feat: implement SnakeCatchingMissionController and service for managi…
NeoNgyn f11006a
feat: implement CatchingMissionDetail functionality with controller, …
NeoNgyn ab6f2a0
feat: implement SnakeCatchingMissionController and service methods fo…
NeoNgyn a78e297
feat: add GetDetailAsync method to retrieve snake catching request de…
NeoNgyn 90b7aa3
Feature/sa009 snake catching
NeoNgyn 45b928f
fix: abort mission Id error
DuongNManh 28f9911
feat: add GetAllSnakeCatchingRequests method and corresponding contro…
NeoNgyn 2ddd9cc
fix: uow method
DuongNManh e73273e
Merge branch 'dev' of https://github.com/Snake-AID/SnakeAid.Backend i…
DuongNManh 30dde4b
Merge pull request #43 from Snake-AID/feature/SA008-Rescue_Pairing
DuongNManh 68437fc
Merge branch 'dev' into feature/SA009-Snake_Catching
NeoNgyn 4423ad0
refactor: update API routes for catching missions and requests; impro…
NeoNgyn 926cf6a
feat: add GetAllSnakeCatchingRequests method and corresponding contro…
NeoNgyn be72b4d
refactor: uncomment and update RescueMissionController methods and do…
NeoNgyn 45b2c12
refactor: uncomment and update RescueMissionController methods and do…
NeoNgyn 2a403a6
feat: enhance FirstAidGuidelineService to support guideline content o…
NeoNgyn 5e5678e
feat: enhance FirstAidGuidelineService to support guideline content o…
NeoNgyn 6a0620a
refactor: update ports and configurations for consistent HTTP/HTTPS h…
the-khiem7 ae9a819
Merge branch 'dev' of https://github.com/Snake-AID/SnakeAid.Backend i…
the-khiem7 288d01c
Merge branch 'main' into dev
the-khiem7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
SnakeAid.Api/Controllers/CatchingMissionDetailController.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| using MapsterMapper; | ||
| using Microsoft.AspNetCore.Authorization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using SnakeAid.Core.Meta; | ||
| using SnakeAid.Core.Requests.SnakeCatchingMission; | ||
| using SnakeAid.Core.Responses.SnakeCatchingMission; | ||
| using SnakeAid.Core.Validators; | ||
| using SnakeAid.Service.Interfaces; | ||
| using Swashbuckle.AspNetCore.Annotations; | ||
|
|
||
| namespace SnakeAid.Api.Controllers | ||
| { | ||
| [Route("api/catchingmission/details")] | ||
| [ApiController] | ||
| [Authorize] | ||
| public class CatchingMissionDetailController : BaseController<CatchingMissionDetailController> | ||
| { | ||
| private readonly ICatchingMissionDetailService _catchingMissionDetailService; | ||
|
|
||
| public CatchingMissionDetailController( | ||
| ILogger<CatchingMissionDetailController> logger, | ||
| IHttpContextAccessor httpContextAccessor, | ||
| IMapper mapper, | ||
| ICatchingMissionDetailService catchingMissionDetailService) | ||
| : base(logger, httpContextAccessor, mapper) | ||
| { | ||
| _catchingMissionDetailService = catchingMissionDetailService; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a new catching mission detail | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Records the details of snakes caught during a mission, including species and quantity. | ||
| /// This should be called when recording the results of a catching mission. | ||
| /// </remarks> | ||
| [HttpPost] | ||
| [ValidateModel] | ||
| [SwaggerOperation( | ||
| Summary = "Create Catching Mission Detail", | ||
| Description = "Create a new catching mission detail record for snakes caught during a mission")] | ||
| [SwaggerResponse(200, "Created successfully", typeof(ApiResponse<CatchingMissionDetailResponse>))] | ||
| [SwaggerResponse(400, "Validation error or invalid data")] | ||
| [SwaggerResponse(401, "Unauthorized")] | ||
| [SwaggerResponse(404, "Mission or snake species not found")] | ||
| public async Task<IActionResult> CreateCatchingMissionDetail([FromBody] CreateCatchingMissionDetailRequest request) | ||
| { | ||
| var result = await _catchingMissionDetailService.CreateCatchingMissionDetailAsync(request); | ||
| return Ok(ApiResponseBuilder.BuildSuccessResponse(result, "Catching mission detail created successfully!")); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| using Microsoft.AspNetCore.Authorization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using SnakeAid.Core.Meta; | ||
| using SnakeAid.Service.Interfaces; | ||
| using Swashbuckle.AspNetCore.Annotations; | ||
|
|
||
| namespace SnakeAid.Api.Controllers | ||
| { | ||
| [Route("api/monitoring")] | ||
| [ApiController] | ||
| // [Authorize] // Only authenticated users can access monitoring | ||
| public class MonitoringController : ControllerBase | ||
| { | ||
| private readonly ISessionTimeoutService _timeoutService; | ||
| private readonly ILogger<MonitoringController> _logger; | ||
|
|
||
| public MonitoringController( | ||
| ISessionTimeoutService timeoutService, | ||
| ILogger<MonitoringController> logger) | ||
| { | ||
| _timeoutService = timeoutService; | ||
| _logger = logger; | ||
| } | ||
|
|
||
|
|
||
| /// Get session timeout service status | ||
| [HttpGet("session-timeout-status")] | ||
| [SwaggerOperation(Summary = "Session Timeout Status", Description = "Get current status of session timeout monitoring service")] | ||
| [SwaggerResponse(200, "Service status retrieved", typeof(ApiResponse<object>))] | ||
| public IActionResult GetSessionTimeoutStatus() | ||
| { | ||
| try | ||
| { | ||
| var (totalSessions, expiredCount, pendingCount) = _timeoutService.GetQueueStatus(); | ||
| var isHealthy = _timeoutService.IsHealthy(); | ||
|
|
||
| var status = new | ||
| { | ||
| IsHealthy = isHealthy, | ||
| TotalSessionsMonitored = totalSessions, | ||
| ExpiredSessionsInQueue = expiredCount, | ||
| PendingSessionsInQueue = pendingCount, | ||
| CheckedAt = DateTime.UtcNow, | ||
| ServiceStatus = isHealthy ? "Healthy" : "Unhealthy" | ||
| }; | ||
|
|
||
| var response = ApiResponseBuilder.BuildSuccessResponse(status, "Session timeout service status retrieved"); | ||
| return Ok(response); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError(ex, "Error retrieving session timeout status: {Message}", ex.Message); | ||
| var response = ApiResponseBuilder.BuildErrorResponse("Failed to retrieve session timeout status"); | ||
| return StatusCode(500, response); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /// Health check endpoint for session timeout service | ||
| [HttpGet("health/session-timeout")] | ||
| [SwaggerOperation(Summary = "Session Timeout Health Check", Description = "Simple health check for session timeout monitoring")] | ||
| [SwaggerResponse(200, "Service is healthy")] | ||
| [SwaggerResponse(503, "Service is unhealthy")] | ||
| public IActionResult SessionTimeoutHealthCheck() | ||
| { | ||
| try | ||
| { | ||
| var isHealthy = _timeoutService.IsHealthy(); | ||
|
|
||
| if (isHealthy) | ||
| { | ||
| return Ok(new { Status = "Healthy", CheckedAt = DateTime.UtcNow }); | ||
| } | ||
| else | ||
| { | ||
| return StatusCode(503, new { Status = "Unhealthy", CheckedAt = DateTime.UtcNow }); | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError(ex, "Session timeout health check failed: {Message}", ex.Message); | ||
| return StatusCode(503, new { Status = "Unhealthy", Error = ex.Message, CheckedAt = DateTime.UtcNow }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Monitoring endpoints are exposed without authorization. This leaks operational state (timeouts, queue sizes, health) and can aid attackers. Re-enable [Authorize] (and ideally restrict to an admin role/policy) or gate these endpoints to Development environments only.