Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/squad-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:

- name: Build and test
run: |
# TODO: Add your dotnet build/test commands here
# Go: go test ./...
# Python: pip install -r requirements.txt && pytest
# .NET: dotnet test
# Java (Maven): mvn test
# Java (Gradle): ./gradlew test
echo "No build commands configured — update squad-ci.yml"
dotnet restore
dotnet build --no-restore --configuration Release
dotnet test --no-build --configuration Release
2 changes: 2 additions & 0 deletions src/Api/Data/IssueRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ internal class IssueEntity
[BsonElement("updatedAt")]
public DateTime UpdatedAt { get; set; }
public bool IsArchived { get; set; }
public string? ArchivedBy { get; set; }
public DateTime? ArchivedAt { get; set; }
public List<LabelEntity>? Labels { get; set; }

public static IssueEntity FromDomain(Issue issue)
Expand Down
18 changes: 18 additions & 0 deletions src/Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@

var app = builder.Build();

app.UseExceptionHandler(errorApp => errorApp.Run(async context =>
{
var ex = context.Features.Get<Microsoft.AspNetCore.Diagnostics.IExceptionHandlerFeature>()?.Error;
if (ex is FluentValidation.ValidationException validationEx)
{
context.Response.StatusCode = StatusCodes.Status400BadRequest;
context.Response.ContentType = "application/problem+json";
var errors = validationEx.Errors
.GroupBy(e => e.PropertyName)
.ToDictionary(g => g.Key, g => g.Select(e => e.ErrorMessage).ToArray());
await context.Response.WriteAsJsonAsync(new { title = "Validation failed", errors });
}
else
{
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
}
}));

app.UseHttpsRedirection();
app.MapOpenApi();

Expand Down
12 changes: 6 additions & 6 deletions src/Shared/Domain/Issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
public record Issue(
string Id,
string Title,
string? Description,

Check warning on line 16 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'Description' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 16 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'Description' is unread. Did you forget to use it to initialize the property with that name?
IssueStatus Status,

Check warning on line 17 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'Status' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 17 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'Status' is unread. Did you forget to use it to initialize the property with that name?
DateTime CreatedAt,

Check warning on line 18 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'CreatedAt' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 18 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'CreatedAt' is unread. Did you forget to use it to initialize the property with that name?
DateTime UpdatedAt,

Check warning on line 19 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'UpdatedAt' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 19 in src/Shared/Domain/Issue.cs

View workflow job for this annotation

GitHub Actions / Build Solution

Parameter 'UpdatedAt' is unread. Did you forget to use it to initialize the property with that name?
IReadOnlyCollection<Label>? Labels = null)
{
/// <summary>
Expand Down Expand Up @@ -102,17 +102,17 @@
}

/// <summary>
/// Gets or sets a value indicating whether the issue is archived (soft-deleted).
/// Gets a value indicating whether the issue is archived (soft-deleted).
/// </summary>
public bool IsArchived { get; set; } = false;
public bool IsArchived { get; init; } = false;

/// <summary>
/// Gets or sets the user who archived the issue.
/// Gets the user who archived the issue.
/// </summary>
public string? ArchivedBy { get; set; }
public string? ArchivedBy { get; init; }

/// <summary>
/// Gets or sets the timestamp when the issue was archived.
/// Gets the timestamp when the issue was archived.
/// </summary>
public DateTime? ArchivedAt { get; set; }
public DateTime? ArchivedAt { get; init; }
}
4 changes: 2 additions & 2 deletions tests/Unit/Validators/ListIssuesQueryValidatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void ListIssuesQueryValidator_PageZero_ReturnsValidationError()
result.IsValid.Should().BeFalse();
result.Errors.Should().HaveCount(1);
result.Errors[0].PropertyName.Should().Be("Page");
result.Errors[0].ErrorMessage.Should().Contain("greater than 0");
result.Errors[0].ErrorMessage.Should().Contain("greater than or equal to 1");
}

[Fact]
Expand Down Expand Up @@ -100,7 +100,7 @@ public void ListIssuesQueryValidator_PageSizeZero_ReturnsValidationError()
result.IsValid.Should().BeFalse();
result.Errors.Should().HaveCount(1);
result.Errors[0].PropertyName.Should().Be("PageSize");
result.Errors[0].ErrorMessage.Should().Contain("greater than 0");
result.Errors[0].ErrorMessage.Should().Contain("between 1 and 100");
}

[Fact]
Expand Down
Loading