Skip to content

Commit

Permalink
♻ refactor: Wasm support
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh425 committed Jan 11, 2025
1 parent 0a559ee commit 9982078
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.

using Masa.Alert.Domain.Shared.AlarmHistory;
using Masa.Alert.Domain.Shared.AlarmRules;

namespace Masa.Alert.Service.Admin.Services;

public class AlarmHistoryService : ServiceBase
Expand All @@ -11,8 +14,9 @@ public AlarmHistoryService(IServiceCollection services) : base()
}

[RoutePattern("", StartWithBaseUri = true, HttpMethod = "Get")]
public async Task<PaginatedListDto<AlarmHistoryDto>> GetListAsync(IEventBus eventbus, GetAlarmHistoryInputDto inputDto)
public async Task<PaginatedListDto<AlarmHistoryDto>> GetListAsync(IEventBus eventbus, [FromQuery] Guid? alarmRuleId, [FromQuery] DateTime? startTime, [FromQuery] DateTime? endTime, [FromQuery] Guid? handler, [FromQuery] AlarmHistorySearchTypes searchType = default, [FromQuery] AlarmHistorySearchTimeTypes timeType = default, [FromQuery] AlertSeverity alertSeverity = default, [FromQuery] AlarmHistoryHandleStatuses handleStatus = default, [FromQuery] string filter = "", [FromQuery] string sorting = "", [FromQuery] int page = 1, [FromQuery] int pagesize = 10)
{
var inputDto = new GetAlarmHistoryInputDto(filter, alarmRuleId, searchType, timeType, startTime, endTime, alertSeverity, handleStatus, handler ?? default, sorting, page, pagesize);
var query = new GetAlarmHistoryListQuery(inputDto);
await eventbus.PublishAsync(query);
return query.Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public AlarmRuleRecordService(IServiceCollection services) : base()
}

[RoutePattern("", StartWithBaseUri = true, HttpMethod = "Get")]
public async Task<PaginatedListDto<AlarmRuleRecordDto>> GetListAsync(IEventBus eventbus, GetAlarmRuleRecordInputDto inputDto)
public async Task<PaginatedListDto<AlarmRuleRecordDto>> GetListAsync(IEventBus eventbus, [FromQuery] Guid alarmHistoryId, [FromQuery] DateTime? startTime, [FromQuery] DateTime? endTime, [FromQuery] bool? isTrigger, [FromQuery] string sorting = "", [FromQuery] int page = 1, [FromQuery] int pagesize = 10)
{
var inputDto = new GetAlarmRuleRecordInputDto(alarmHistoryId, startTime, endTime, isTrigger, sorting, page, pagesize);
var query = new GetAlarmRuleRecordListQuery(inputDto);
await eventbus.PublishAsync(query);
return query.Result;
Expand Down
5 changes: 4 additions & 1 deletion src/Services/Masa.Alert.Service/Services/AlarmRuleService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.

using Masa.Alert.Domain.Shared.AlarmRules;

namespace Masa.Alert.Service.Admin.Services;

public class AlarmRuleService : ServiceBase
Expand All @@ -11,8 +13,9 @@ public AlarmRuleService(IServiceCollection services) : base()
}

[RoutePattern("", StartWithBaseUri = true, HttpMethod = "Get")]
public async Task<PaginatedListDto<AlarmRuleDto>> GetListAsync(IEventBus eventbus, GetAlarmRuleInputDto inputDto)
public async Task<PaginatedListDto<AlarmRuleDto>> GetListAsync(IEventBus eventbus, [FromQuery] DateTime? startTime, [FromQuery] DateTime? endTime, [FromQuery] AlarmRuleTypes type = default, [FromQuery] AlarmRuleSearchTimeTypes timeType = default, [FromQuery] string projectIdentity = "", [FromQuery] string appIdentity = "", [FromQuery] string metricId = "", [FromQuery] string filter = "", [FromQuery] string sorting = "", [FromQuery] int page = 1, [FromQuery] int pagesize = 10)
{
var inputDto = new GetAlarmRuleInputDto(filter, type, timeType, startTime, endTime, projectIdentity, appIdentity, metricId, sorting, page, pagesize);
var query = new GetAlarmRuleListQuery(inputDto);
await eventbus.PublishAsync(query);
return query.Result;
Expand Down
3 changes: 2 additions & 1 deletion src/Services/Masa.Alert.Service/Services/WebHookService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public WebHookService(IServiceCollection services) : base()
}

[RoutePattern("", StartWithBaseUri = true, HttpMethod = "Get")]
public async Task<PaginatedListDto<WebHookDto>> GetListAsync(IEventBus eventbus, GetWebHookInputDto inputDto)
public async Task<PaginatedListDto<WebHookDto>> GetListAsync(IEventBus eventbus, [FromQuery] string filter = "", [FromQuery] string sorting = "", [FromQuery] int page = 1, [FromQuery] int pagesize = 10)
{
var inputDto = new GetWebHookInputDto(filter, sorting, page, pagesize);
var query = new GetWebHookListQuery(inputDto);
await eventbus.PublishAsync(query);
return query.Result;
Expand Down

0 comments on commit 9982078

Please sign in to comment.