1
0
mirror of https://github.com/bitwarden/server synced 2025-12-24 20:23:21 +00:00

[PM-20576] OrganizationReport - Queries and Command (#5983)

This commit is contained in:
Vijay Oommen
2025-06-24 09:13:43 -05:00
committed by GitHub
parent 494c41e3b1
commit 86a4ce5a51
19 changed files with 962 additions and 1 deletions

View File

@@ -27,4 +27,22 @@ public class OrganizationReportRepository :
return Mapper.Map<ICollection<OrganizationReport>>(results);
}
}
public async Task<OrganizationReport> GetLatestByOrganizationIdAsync(Guid organizationId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var result = await dbContext.OrganizationReports
.Where(p => p.OrganizationId == organizationId)
.OrderByDescending(p => p.Date)
.Take(1)
.FirstOrDefaultAsync();
if (result == null)
return default;
return Mapper.Map<OrganizationReport>(result);
}
}
}