-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
182 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/oed-testdata.Server/Infrastructure/TestdataStore/Kartverket/IKartverketStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace oed_testdata.Server.Infrastructure.TestdataStore.Kartverket; | ||
|
||
public interface IKartverketStore | ||
{ | ||
public Task<KartverketResponse> GetProperties(int partyId); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/oed-testdata.Server/Infrastructure/TestdataStore/Kartverket/KartverketFileStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace oed_testdata.Server.Infrastructure.TestdataStore.Kartverket | ||
{ | ||
public class KartverketFileStore(ILogger<KartverketFileStore> logger) : FileStore, IKartverketStore | ||
{ | ||
private const string BasePath = "./Testdata/Json/Kartverket"; | ||
|
||
public async Task<KartverketResponse> GetProperties(int partyId) | ||
{ | ||
var response = await GetForParty<KartverketResponse>(BasePath, partyId); | ||
if (response is not null) | ||
{ | ||
logger.LogInformation("Returning SPECIFIC property testdata for partyId [{partyId}]", partyId); | ||
return response; | ||
} | ||
|
||
logger.LogInformation("Returning DEFAULT property testdata for partyId [{partyId}]", partyId); | ||
return await GetDefault<KartverketResponse>(BasePath); | ||
|
||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/oed-testdata.Server/Infrastructure/TestdataStore/Kartverket/KartverketResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
namespace oed_testdata.Server.Infrastructure.TestdataStore.Kartverket | ||
{ | ||
public class KartverketResponse | ||
{ | ||
public PropertyRights PropertyRights { get; set; } | ||
} | ||
|
||
public class PropertyRights | ||
{ | ||
public IEnumerable<Property> Properties { get; set; } | ||
|
||
public IEnumerable<PropertyWithRights> PropertiesWithRights { get; set; } | ||
} | ||
|
||
public class Property | ||
{ | ||
public string Address { get; set; } | ||
|
||
public string City { get; set; } | ||
|
||
public string PostalCode { get; set; } | ||
|
||
// Eiendomsrett / Framfesterett (1,2,3) / Veirett / Borett / Leierett | ||
public string Type { get; set; } | ||
|
||
// Kommunenavn | ||
public string Municipality { get; set; } | ||
|
||
// Kommunenummer | ||
public string MunicipalityNumber { get; set; } | ||
|
||
// Gårdsnummer | ||
public string HoldingNumber { get; set; } | ||
|
||
// Bruksnummer | ||
public string SubholdingNumber { get; set; } | ||
|
||
// Festenummer | ||
public string LeaseNumber { get; set; } | ||
|
||
// Seksjonsnummer | ||
public string SectionNumber { get; set; } | ||
|
||
// Eierandel i brøk | ||
public string FractionOwnership { get; set; } | ||
|
||
// Is added from the "landbruk" integration | ||
public bool IsAgriculture { get; set; } | ||
} | ||
|
||
public class PropertyWithRights : Property | ||
{ | ||
public List<Right> Rights { get; set; } | ||
} | ||
|
||
public class Right | ||
{ | ||
public string DocumentYear { get; set; } | ||
|
||
public string DocumentNumber { get; set; } | ||
|
||
public string OfficeNumber { get; set; } | ||
|
||
public string JudgementNumber { get; set; } | ||
|
||
public string JudgmentType { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
src/oed-testdata.Server/Infrastructure/TestdataStore/Svv/SvvFileStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/oed-testdata.Server/Testdata/Json/Kartverket/default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"propertyRights": { | ||
"properties": [ | ||
{ | ||
"address": "Pilestredet Park 4-H0102", | ||
"city": "Oslo", | ||
"postalCode": "0176", | ||
"type": "Eiendomsrett", | ||
"municipality": "Oslo", | ||
"municipalityNumber": "0301", | ||
"holdingNumber": "208", | ||
"subholdingNumber": "951", | ||
"leaseNumber": "0", | ||
"sectionNumber": "1", | ||
"fractionOwnership": "1/1", | ||
"isAgriculture": false | ||
} | ||
], | ||
"propertiesWithRights": [] | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/oed-testdata.Server/Testdata/Kartverket/KartverketEndpoints.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using oed_testdata.Server.Infrastructure.TestdataStore.Kartverket; | ||
|
||
namespace oed_testdata.Server.Testdata.Kartverket; | ||
|
||
public static class KartverketEndpoints | ||
{ | ||
public static void MapKartverketEndpoints(this WebApplication app) | ||
{ | ||
app | ||
.MapGroup("/api/testdata/externalapi/kartverket/{instanceOwnerPartyId:int}/{instanceGuid:guid}") | ||
.MapEndpoints() | ||
.AllowAnonymous(); | ||
} | ||
|
||
private static RouteGroupBuilder MapEndpoints(this RouteGroupBuilder group) | ||
{ | ||
group.MapGet("/", GetProperties); | ||
return group; | ||
} | ||
|
||
private static async Task<IResult> GetProperties( | ||
int instanceOwnerPartyId, | ||
HttpContext httpContext, | ||
IKartverketStore store, | ||
ILoggerFactory loggerFactory) | ||
{ | ||
var logger = loggerFactory.CreateLogger(typeof(KartverketEndpoints)); | ||
logger.LogInformation("Handling call for {path}", httpContext.Request.Path.Value); | ||
|
||
var resp = await store.GetProperties(instanceOwnerPartyId); | ||
return Results.Ok(resp); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/oed-testdata.Server/Testdata/WebApplicationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using oed_testdata.Server.Testdata.Bank; | ||
using oed_testdata.Server.Testdata.Estate; | ||
using oed_testdata.Server.Testdata.Kartverket; | ||
using oed_testdata.Server.Testdata.Svv; | ||
|
||
namespace oed_testdata.Server.Testdata | ||
{ | ||
public static class WebApplicationExtensions | ||
{ | ||
public static void MapTestdataEndpoints(this WebApplication app) | ||
{ | ||
app.MapEstateEndpoints(); | ||
app.MapBankEndpoints(); | ||
app.MapSvvEndpoints(); | ||
app.MapKartverketEndpoints(); | ||
} | ||
} | ||
} |