fixed new change request logic
This commit is contained in:
@@ -388,7 +388,7 @@ public sealed class ProjectService(IDbContextFactory<ApplicationDbContext> conte
|
|||||||
{
|
{
|
||||||
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
||||||
|
|
||||||
if (await context.Projects.AnyAsync(p => p.Id == request.ProjectId, cancellationToken))
|
if (!await context.Projects.AnyAsync(p => p.Id == request.ProjectId, cancellationToken))
|
||||||
return Result.Fail(ValidationError.Create("Project does not exist"));
|
return Result.Fail(ValidationError.Create("Project does not exist"));
|
||||||
|
|
||||||
context.ChangeRequests.Add(new Domain.Entities.ChangeRequest
|
context.ChangeRequests.Add(new Domain.Entities.ChangeRequest
|
||||||
@@ -465,7 +465,7 @@ public sealed class ProjectService(IDbContextFactory<ApplicationDbContext> conte
|
|||||||
{
|
{
|
||||||
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
||||||
|
|
||||||
if (await context.Projects.AnyAsync(p => p.Id == request.ProjectId, cancellationToken))
|
if (!await context.Projects.AnyAsync(p => p.Id == request.ProjectId, cancellationToken))
|
||||||
return Result.Fail(ValidationError.Create("Project does not exist"));
|
return Result.Fail(ValidationError.Create("Project does not exist"));
|
||||||
|
|
||||||
context.ComplianceItems.Add(new Domain.Entities.ComplianceItem
|
context.ComplianceItems.Add(new Domain.Entities.ComplianceItem
|
||||||
|
|||||||
Reference in New Issue
Block a user