perf: drop duplicated company-existence query in job Create
The create path ran the same Companies.AnyAsync existence check twice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1405,9 +1405,7 @@ Canonical profile:
|
||||
if (title.Length == 0) return BadRequest("Job title is required.");
|
||||
if (request.CompanyId <= 0) return BadRequest("Valid companyId is required.");
|
||||
|
||||
var companyOk = await _db.Companies.AnyAsync(c => c.Id == request.CompanyId, cancellationToken);
|
||||
if (!companyOk) return BadRequest("companyId does not exist.");
|
||||
|
||||
// Scoped by the Company query filter, so this also rejects another user's companyId.
|
||||
var companyExists = await _db.Companies.AnyAsync(c => c.Id == request.CompanyId, cancellationToken);
|
||||
if (!companyExists) return BadRequest("companyId does not exist.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user