Skip to content

Commit

Permalink
Merge pull request #290 from bcgov/yj
Browse files Browse the repository at this point in the history
chore: clean up test code
  • Loading branch information
ychung-mot authored May 14, 2024
2 parents ea5fc15 + 7e1c0e3 commit 8635726
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 64 deletions.
18 changes: 0 additions & 18 deletions server/StrDss.Api/Controllers/RentalListingReportsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,5 @@ public async Task<ActionResult> GetRentalListingHistory(long? platformId, int pa

return Ok(history);
}

[ApiAuthorize(Permissions.ListingFileUpload)]
[HttpGet("addaddress")]
public async Task<ActionResult> InsertAddress()
{
await _listingService.InsertTestAddress();

return NoContent();
}

[ApiAuthorize(Permissions.ListingFileUpload)]
[HttpGet("getaddress")]
public async Task<ActionResult> GetAddress()
{
var location = await _listingService.GetTestAddress();

return Ok(location);
}
}
}
1 change: 1 addition & 0 deletions server/StrDss.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
}
});

//https://github.com/npgsql/efcore.pg/issues/2736#issuecomment-1875391344
NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite();

builder.Services.AddApiVersioning(options =>
Expand Down
32 changes: 0 additions & 32 deletions server/StrDss.Data/Repositories/PhysicalAddressRepository.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using NetTopologySuite.Geometries;
using StrDss.Common;
using StrDss.Data.Entities;
using StrDss.Model;
Expand All @@ -12,8 +11,6 @@ public interface IPhysicalAddressRepository
{
Task AddPhysicalAddressAsync(DssPhysicalAddress address);
Task<DssPhysicalAddress?> GetPhysicalAdderssFromMasterListingAsync(long offeringOrgId, string listingId, string address);
Task InsertTestAddress();
Task<string> GetTestAddress();
}
public class PhysicalAddressRepository : RepositoryBase<DssPhysicalAddress>, IPhysicalAddressRepository
{
Expand Down Expand Up @@ -43,34 +40,5 @@ public async Task AddPhysicalAddressAsync(DssPhysicalAddress address)

return listing.LocatingPhysicalAddress;
}

public async Task InsertTestAddress()
{
var address = new DssPhysicalAddress
{
OriginalAddressTxt = "Test",
MatchAddressTxt = "Test",
MatchScoreAmt = 30,
UpdDtm = DateTime.UtcNow,
LocationGeometry = new Point(-123.3709161, 48.4177006) { SRID = 4326 }
};

await _dbContext.DssPhysicalAddresses.AddAsync(address);
_dbContext.SaveChanges();
}

public async Task<string> GetTestAddress()
{
var address = await _dbSet.AsNoTracking().FirstOrDefaultAsync();
var location = "";

if (address != null)
{
location = address.LocationGeometry?.ToString();
_logger.LogInformation(address.LocationGeometry?.ToString());
}

return location ?? "";
}
}
}
14 changes: 0 additions & 14 deletions server/StrDss.Service/RentalListingReportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public interface IRentalListingReportService
Task<Dictionary<string, List<string>>> UploadRentalReport(string reportPeriod, long orgId, Stream stream);
Task ProcessRentalReportUploadsAsync();
Task<PagedDto<RentalUploadHistoryViewDto>> GetRentalListingUploadHistory(long? platformId, int pageSize, int pageNumber, string orderBy, string direction);
Task InsertTestAddress();
Task<string> GetTestAddress();
}
public class RentalListingReportService : ServiceBase, IRentalListingReportService
{
Expand Down Expand Up @@ -483,17 +481,5 @@ public async Task<PagedDto<RentalUploadHistoryViewDto>> GetRentalListingUploadHi
{
return await _reportRepo.GetRentalListingUploadHistory(platformId, pageSize, pageNumber, orderBy, direction);
}

public async Task InsertTestAddress()
{
await _addressRepo.InsertTestAddress();
}

public async Task<string> GetTestAddress()
{
var address = await _addressRepo.GetTestAddress();
return address;
}

}
}

0 comments on commit 8635726

Please sign in to comment.