mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-07 16:19:07 +00:00
fix(vendors): keep company location authoritative
This commit is contained in:
parent
4f4e3997ba
commit
2461df5f71
2 changed files with 15 additions and 2 deletions
|
|
@ -563,6 +563,8 @@ public class VendorDataServiceTests
|
||||||
CompanyName = "Addr Co",
|
CompanyName = "Addr Co",
|
||||||
ContactName = "Pat",
|
ContactName = "Pat",
|
||||||
Address = "9 Old Street",
|
Address = "9 Old Street",
|
||||||
|
City = "Oldtown",
|
||||||
|
State = "OT",
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
Company = company
|
Company = company
|
||||||
|
|
@ -577,6 +579,9 @@ public class VendorDataServiceTests
|
||||||
|
|
||||||
var stale = await service.GetDirectoryPagedAsync(1, 50, search: "9 old street", isActive: true);
|
var stale = await service.GetDirectoryPagedAsync(1, 50, search: "9 old street", isActive: true);
|
||||||
stale.TotalCount.Should().Be(0);
|
stale.TotalCount.Should().Be(0);
|
||||||
|
|
||||||
|
var staleCity = await service.GetDirectoryPagedAsync(1, 50, search: "oldtown", isActive: true);
|
||||||
|
staleCity.TotalCount.Should().Be(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -600,6 +605,8 @@ public class VendorDataServiceTests
|
||||||
{
|
{
|
||||||
CompanyName = "Addr Only Co",
|
CompanyName = "Addr Only Co",
|
||||||
ContactName = "Pat",
|
ContactName = "Pat",
|
||||||
|
City = "Oldtown",
|
||||||
|
State = "OT",
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
Company = addressOnlyCompany
|
Company = addressOnlyCompany
|
||||||
|
|
@ -621,6 +628,10 @@ public class VendorDataServiceTests
|
||||||
var partial = await service.GetDirectoryPagedAsync(
|
var partial = await service.GetDirectoryPagedAsync(
|
||||||
1, 50, isActive: true, locations: new[] { "123 Main" });
|
1, 50, isActive: true, locations: new[] { "123 Main" });
|
||||||
partial.TotalCount.Should().Be(0);
|
partial.TotalCount.Should().Be(0);
|
||||||
|
|
||||||
|
var staleLocation = await service.GetDirectoryPagedAsync(
|
||||||
|
1, 50, isActive: true, locations: new[] { "Oldtown, OT" });
|
||||||
|
staleLocation.TotalCount.Should().Be(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -208,12 +208,14 @@ namespace SeaHaven.DataServices.Implementation
|
||||||
: v.Address,
|
: v.Address,
|
||||||
City = v.Company != null &&
|
City = v.Company != null &&
|
||||||
((v.Company.City != null && v.Company.City.Trim() != "") ||
|
((v.Company.City != null && v.Company.City.Trim() != "") ||
|
||||||
(v.Company.State != null && v.Company.State.Trim() != ""))
|
(v.Company.State != null && v.Company.State.Trim() != "") ||
|
||||||
|
(v.Company.Address != null && v.Company.Address.Trim() != ""))
|
||||||
? v.Company.City
|
? v.Company.City
|
||||||
: v.City,
|
: v.City,
|
||||||
State = v.Company != null &&
|
State = v.Company != null &&
|
||||||
((v.Company.City != null && v.Company.City.Trim() != "") ||
|
((v.Company.City != null && v.Company.City.Trim() != "") ||
|
||||||
(v.Company.State != null && v.Company.State.Trim() != ""))
|
(v.Company.State != null && v.Company.State.Trim() != "") ||
|
||||||
|
(v.Company.Address != null && v.Company.Address.Trim() != ""))
|
||||||
? v.Company.State
|
? v.Company.State
|
||||||
: v.State,
|
: v.State,
|
||||||
Zip = v.Zip,
|
Zip = v.Zip,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue