Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gizdatullin committed Oct 25, 2024
1 parent 4cc90a4 commit 64c57e9
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>
<PropertyGroup>
<VersionMajor>0</VersionMajor>
<VersionMinor>7</VersionMinor>
<VersionMinor>8</VersionMinor>
<BuildNumber>$(BuildNumber)</BuildNumber>
<BuildNumber Condition="'$(BuildNumber)' == ''">0</BuildNumber>
<PackageVersion>$(VersionMajor).$(VersionMinor).$(BuildNumber)$(VersionTag)</PackageVersion>
Expand Down
10 changes: 10 additions & 0 deletions Mindbox.YandexTracker.Abstractions/Entities/Issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public sealed record Issue
/// </remarks>
public bool IsFavorite { get; init; }

/// <summary>
/// Дата начала работы над задачей.
/// </summary>
public DateOnly? Start { get; init; }

/// <summary>
/// Текстовые метки, которые облегчают поиск и сортировку задач.
/// </summary>
public IReadOnlyCollection<string> Tags { get; init; } = [];

/// <summary>
/// Кастомные поля задачи
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public sealed record IssuesFilter
/// Статус задачи
/// </summary>
[DataMember(EmitDefaultValue = false, Name = "status")]
public IssueStatus? Status { get; init; }
public string? Status { get; init; }

/// <summary>
/// Предыдущий статус задачи
Expand Down
5 changes: 5 additions & 0 deletions Mindbox.YandexTracker.Abstractions/Entities/UserShortInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ public sealed record UserShortInfo
/// Идентификатор пользователя
/// </summary>
public required string Id { get; init; }

/// <summary>
/// Отображаемое имя пользователя.
/// </summary>
public required string Display { get; init; }
}
36 changes: 18 additions & 18 deletions Mindbox.YandexTracker.Tests/UnitTests/HashCodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public void GetHashCode_TwoSimilarIssueFilters_HashCodeShouldBeEqual()
Priority = Priority.Minor,
Sprints = ["sp1"],
Parent = "par1",
Status = new IssueStatus
{
Key = "key",
Name = "name"
},
Status = "key",
CreatedAtUtc = now,
Votes = 5,
Type = new IssueType
Expand Down Expand Up @@ -64,11 +60,7 @@ public void GetHashCode_TwoSimilarIssueFilters_HashCodeShouldBeEqual()
Priority = Priority.Minor,
Sprints = ["sp1"],
Parent = "par1",
Status = new IssueStatus
{
Key = "key",
Name = "name"
},
Status = "key",
CreatedAtUtc = now,
Votes = 5,
Type = new IssueType
Expand Down Expand Up @@ -97,25 +89,29 @@ public void GetHashCode_TwoSimilarProjects_HashCodeShouldBeEqual()
{
Author = new UserShortInfo
{
Id = "id"
Id = "id",
Display = "display"
},
Id = "5",
ChecklistIds = ["ch1", "ch2"],
Clients = [
new()
{
Id = "id2"
Id = "id2",
Display = "display2"
}
],
CreatedAtUtc = future,
CreatedBy = new UserShortInfo
{
Id = "w"
Id = "w",
Display = "displayw"
},
EndUtc = future.AddDays(-3),
Lead = new UserShortInfo
{
Id = "id"
Id = "id",
Display = "display"
},
Quarter = ["q1", "q2"],
ParentId = 3,
Expand All @@ -130,25 +126,29 @@ public void GetHashCode_TwoSimilarProjects_HashCodeShouldBeEqual()
{
Author = new UserShortInfo
{
Id = "id"
Id = "id",
Display = "display"
},
Id = "5",
ChecklistIds = ["ch1", "ch2"],
Clients = [
new()
{
Id = "id2"
Id = "id2",
Display = "display2"
}
],
CreatedAtUtc = future,
CreatedBy = new UserShortInfo
{
Id = "w"
Id = "w",
Display = "displayw"
},
EndUtc = future.AddDays(-3),
Lead = new UserShortInfo
{
Id = "id"
Id = "id",
Display = "display"
},
Quarter = ["q1", "q2"],
ParentId = 3,
Expand Down
2 changes: 1 addition & 1 deletion Mindbox.YandexTracker.Tests/YandexTrackerTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ await YandexTrackerClient.CreateQueueAsync(new Queue
Key = "task",
Name = "Задача"
},
Lead = new UserShortInfo { Id = CurrentUserId },
Lead = new UserShortInfo { Id = CurrentUserId, Display = CurrentUserLogin },
Name = TestQueueKey.ToUpperInvariant(),
IssueTypesConfig =
[
Expand Down
6 changes: 6 additions & 0 deletions Mindbox.YandexTracker/Dtos/Responses/Read/GetIssueResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ internal sealed record GetIssueResponse
[DataMember(Name = "favorite")]
public bool IsFavorite { get; init; }

[DataMember(Name = "start")]
public DateOnly? Start { get; set; }

[DataMember(Name = "tags")]
public IReadOnlyCollection<string> Tags { get; init; } = [];

[JsonExtensionData]
public Dictionary<string, object> Fields { get; init; } = [];
}
6 changes: 4 additions & 2 deletions Mindbox.YandexTracker/Extensions/ResponseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static Queue ToQueue(

public static UserShortInfo ToUserInfo(this FieldInfo value)
{
return new UserShortInfo { Id = value.Id! };
return new UserShortInfo { Id = value.Id, Display = value.Display };
}

public static Issue ToIssue(
Expand Down Expand Up @@ -152,7 +152,9 @@ public static Issue ToIssue(
UpdatedAt = value.UpdatedAt,
Status = value.Status.ToIssueStatus(issueStatusInfos),
PreviousStatus = value.PreviousStatus?.ToIssueStatus(issueStatusInfos),
IsFavorite = value.IsFavorite
IsFavorite = value.IsFavorite,
Start = value.Start,
Tags = value.Tags
};
}

Expand Down
20 changes: 20 additions & 0 deletions Mindbox.YandexTracker/YandexTrackerFilterHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Mindbox.YandexTracker;

/// <summary>
/// https://yandex.cloud/ru/docs/tracker/user/query-filter#query-functions
/// </summary>
public static class YandexTrackerFilterFunctions
{
public const string Empty = "empty()";
public const string NotEmpty = "notEmpty()";
public const string Now = "now()";
public const string Me = "me()";
public const string Today = "today()";
public const string Week = "week()";
public const string Month = "month()";
public const string Quarter = "quarter()";
public const string Year = "year()";
public const string Unresolved = "unresolved()";

public static string Group(string groupName) => $"group(value: \"{groupName}\")";
}

0 comments on commit 64c57e9

Please sign in to comment.