Skip to content

Commit

Permalink
feat: update getlist & get
Browse files Browse the repository at this point in the history
  • Loading branch information
Qinyouzeng committed Sep 12, 2024
1 parent fcc04ab commit 2ca6d3e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ public class AlarmRuleDto : AuditEntityDto<Guid, Guid>
public List<AlarmRuleItemDto> Items { get; set; } = new();

public string ModifierName { get; set; } = string.Empty;

public string Source { get; set; } = default!;

public bool Show { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class GetAlarmRuleInputDto : PaginatedOptionsDto<GetAlarmRuleInputDto>

public Guid TeamId { get; set; }

public bool Show { get; set; } = true;

public GetAlarmRuleInputDto()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task UpdateAsync(UpdateAlarmRuleCommand updateCommand)
var queryable = await _repository.WithDetailsAsync();
var entity = await queryable.FirstOrDefaultAsync(x => x.Id == updateCommand.AlarmRuleId);

MasaArgumentException.ThrowIfNull(entity, _i18n.T("AlarmRule"));
MasaArgumentException.ThrowIfNull(entity, _i18n.T("AlarmRule"));

updateCommand.AlarmRule.Adapt(entity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private async Task<Expression<Func<AlarmRuleQueryModel, bool>>> CreateFilteredPr
Expression<Func<AlarmRuleQueryModel, bool>> condition = x => true;
condition = condition.And(!string.IsNullOrEmpty(options.Filter), x => x.DisplayName.Contains(options.Filter));
condition = condition.And(options.Type != default, x => x.Type == options.Type);
condition = condition.And(x => x.Show == options.Show);
if (options.TimeType == AlarmRuleSearchTimeTypes.ModificationTime)
{
condition = condition.And(options.StartTime.HasValue, x => x.ModificationTime >= options.StartTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public AlarmRule(string displayName, AlarmRuleTypes type, string projectIdentity
IsGetTotal = isGetTotal;
TotalVariable = totalVariable;
WhereExpression = whereExpression;
Source = source;
Source = source ?? string.Empty;
Show = show;

SetChartConfig(chartYAxisUnit);
Expand Down

0 comments on commit 2ca6d3e

Please sign in to comment.