Skip to content

Commit

Permalink
Deleting (real) projects no longer deletes drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed May 14, 2024
1 parent 63cc4a6 commit 9384f5c
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions backend/LexBoxApi/GraphQL/ProjectMutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,7 @@ public async Task<IQueryable<Project>> SoftDeleteProject(
var project = await dbContext.Projects.Include(p => p.Users).FirstOrDefaultAsync(p => p.Id == projectId);
if (project is null)
{
// Draft projects, if any, are deleted immediately, not soft-deleted
var deletedDraftCount = await dbContext.DraftProjects.Where(dp => dp.Id == projectId).ExecuteDeleteAsync();
if (deletedDraftCount == 0)
{
// No draft project either, so return standard project not found error
throw NotFoundException.ForType<Project>();
}
else
{
// Return an empty project list to indicate success
return dbContext.Projects.Where(p => p.Id == projectId);
}
throw NotFoundException.ForType<Project>();
}
if (project.DeletedDate is not null) throw new InvalidOperationException("Project already deleted");

Expand Down

0 comments on commit 9384f5c

Please sign in to comment.