Skip to content

Commit e80df17

Browse files
johnbrittonCopilot
andauthored
LEGLINK-907: Fix validation bug in tenant create/update (#1790)
* Fix validation bug in tenant create/update * Remove vendor requirement for facility config * Remove 'no vendor' negative tests and names Remove 'no vendor' negative test cases and their step name constants. Deleted Create400NoVendor and Update400NoVendor from DotNet/Automation.UI/Services/ApiHealth/TestSuites/ApiEndPointLibrary.cs and removed the corresponding test steps from DotNet/Automation.UI/Services/ApiHealth/TestSuites/TenantServiceTestSuite.cs. Cleans up unused step names and obsolete negative test cases; no other behavior changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7995790 commit e80df17

4 files changed

Lines changed: 1 addition & 21 deletions

File tree

DotNet/Automation.UI/Services/ApiHealth/TestSuites/ApiEndPointLibrary.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ public static class TenantSteps
406406
{
407407
public const string Create201 = "Create → 201";
408408
public const string Create400Duplicate = "Create → 400 (duplicate)";
409-
public const string Create400NoVendor = "Create → 400 (no vendor)";
410409
public const string Create400NoName = "Create → 400 (no name)";
411410
public const string Search200 = "Search → 200";
412411
public const string Search204NoResults = "Search → 204 (no results)";
@@ -416,7 +415,6 @@ public static class TenantSteps
416415
public const string Get404 = "Get → 404";
417416
public const string Update200 = "Update → 200";
418417
public const string Update404NonExistent = "Update → 404 (non-existent)";
419-
public const string Update400NoVendor = "Update → 400 (no vendor)";
420418
public const string CheckExists200 = "CheckExists → 200";
421419
public const string CheckExists404 = "CheckExists → 404";
422420
public const string SoftDelete204 = "SoftDelete → 204";

DotNet/Automation.UI/Services/ApiHealth/TestSuites/TenantServiceTestSuite.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ AdHocReportRequest BuildAdhoc(
100100
results.Add(await RunStepAsync(StepNames.Create400Duplicate, 400, async () =>
101101
await _client.CreateAsync(BuildFacility(facilityId, vendor: testVendor), ct), ct: ct));
102102

103-
// Create → 400 (no vendor)
104-
results.Add(await RunStepAsync(StepNames.Create400NoVendor, 400, async () =>
105-
await _client.CreateAsync(BuildFacility($"ApiHealth-NoVendor-{Guid.NewGuid():N}", "NoVendor", null), ct), ct: ct));
106-
107103
// Create → 400 (no name)
108104
results.Add(await RunStepAsync(StepNames.Create400NoName, 400, async () =>
109105
await _client.CreateAsync(BuildFacility($"ApiHealth-NoName-{Guid.NewGuid():N}", name: null, allowNullName: true, vendor: testVendor), ct), ct: ct));
@@ -187,10 +183,6 @@ AdHocReportRequest BuildAdhoc(
187183
results.Add(await RunStepAsync(StepNames.Update404NonExistent, 404, async () =>
188184
await _client.UpdateAsync(fakeFacilityId, BuildFacility(fakeFacilityId), ct), ct: ct));
189185

190-
// Update → 400 (no vendor)
191-
results.Add(await RunStepAsync(StepNames.Update400NoVendor, 400, async () =>
192-
await _client.UpdateAsync(facilityId, BuildFacility(facilityId, vendor: null), ct), ct: ct));
193-
194186
// === GET /api/Facility/{id} (exists check) ===
195187

196188
// CheckExists → 200

DotNet/Tenant/Controllers/FacilityController.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ public async Task<IActionResult> StoreFacility(FacilityModel newFacility, Cancel
219219
return BadRequest();
220220
}
221221

222-
if (newFacility.Vendor == null)
223-
{
224-
return BadRequest("Vendor must be provided.");
225-
}
226-
227222
try
228223
{
229224
await _facilityManager.CreateAsync(facilityEntity, cancellationToken);
@@ -324,11 +319,6 @@ public async Task<ActionResult<FacilityModel>> PutFacility(string facilityId, Fa
324319
return NotFound();
325320
}
326321

327-
if (facilityConfig.Vendor == null)
328-
{
329-
return BadRequest("Vendor must be provided.");
330-
}
331-
332322
var oldFacility = _mapperDtoToModel.Map<FacilityModel, Facility>(existingModel);
333323
var newFacility = _mapperDtoToModel.Map<FacilityModel, Facility>(facilityConfig);
334324

Web/Admin.UI/src/app/components/tenant/facility-config-form/facility-config-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class FacilityConfigFormComponent implements OnInit, OnChanges {
129129
facilityId: new FormControl('', [Validators.required, facilityIdConditionalValidator(this.appConfig?.allowAlphaNumericFacilityId ?? true)]),
130130
facilityName: new FormControl('', Validators.required),
131131
timeZone: new FormControl('', Validators.required),
132-
vendor: new FormControl<IVendorVersion | null>(null, Validators.required),
132+
vendor: new FormControl<IVendorVersion | null>(null),
133133
monthlyReports: new FormControl([]),
134134
dailyReports: new FormControl([]),
135135
weeklyReports: new FormControl([]),

0 commit comments

Comments
 (0)