Skip to content

Commit

Permalink
setup odata and Api custom endpoints to use route prefix (#1109)
Browse files Browse the repository at this point in the history
* setup odata and Api custom endpoints to use route prefix defined in Nox.Solution

* Update src/Nox.Solution/Models/Infrastructure/Endpoints/Endpoints.cs

Co-authored-by: Gjorgji Grgovski <131167535+gjorgji-grgovski-authoritypartners@users.noreply.github.com>

* Update src/Nox.Solution/Models/Infrastructure/Endpoints/Endpoints.cs

Co-authored-by: Gjorgji Grgovski <131167535+gjorgji-grgovski-authoritypartners@users.noreply.github.com>

---------

Co-authored-by: Gjorgji Grgovski <131167535+gjorgji-grgovski-authoritypartners@users.noreply.github.com>
  • Loading branch information
1 parent a2d0421 commit de3e58a
Show file tree
Hide file tree
Showing 37 changed files with 211 additions and 785 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public virtual async Task<ActionResult<IQueryable<CountryTimeZoneDto>>> GetCount
}

[EnableQuery]
[HttpGet("api/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
[HttpGet("/api/v1/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
public virtual async Task<ActionResult<CountryTimeZoneDto>> GetCountryOwnedTimeZonesNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -85,7 +85,7 @@ public virtual async Task<ActionResult> PostToCountryOwnedTimeZones([FromRoute]
return Created(child);
}

[HttpPut("api/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
[HttpPut("/api/v1/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
public virtual async Task<ActionResult<CountryTimeZoneDto>> PutToCountryTimeZonesNonConventional(System.String key, System.Int64 relatedKey, [FromBody] CountryTimeZoneUpdateDto countryTimeZone)
{
if (!ModelState.IsValid)
Expand All @@ -109,7 +109,7 @@ public virtual async Task<ActionResult<CountryTimeZoneDto>> PutToCountryTimeZone
return Ok(child);
}

[HttpPatch("api/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
[HttpPatch("/api/v1/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
public virtual async Task<ActionResult> PatchToCountryTimeZonesNonConventional(System.String key, System.Int64 relatedKey, [FromBody] Delta<CountryTimeZoneDto> countryTimeZone)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -142,7 +142,7 @@ public virtual async Task<ActionResult> PatchToCountryTimeZonesNonConventional(S
return Ok(child);
}

[HttpDelete("api/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
[HttpDelete("/api/v1/Countries/{key}/CountryOwnedTimeZones/{relatedKey}")]
public virtual async Task<ActionResult> DeleteCountryTimeZoneNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -182,7 +182,7 @@ public virtual async Task<ActionResult<IQueryable<HolidayDto>>> GetCountryOwnedH
}

[EnableQuery]
[HttpGet("api/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
[HttpGet("/api/v1/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
public virtual async Task<ActionResult<HolidayDto>> GetCountryOwnedHolidaysNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -221,7 +221,7 @@ public virtual async Task<ActionResult> PostToCountryOwnedHolidays([FromRoute] S
return Created(child);
}

[HttpPut("api/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
[HttpPut("/api/v1/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
public virtual async Task<ActionResult<HolidayDto>> PutToHolidaysNonConventional(System.String key, System.Int64 relatedKey, [FromBody] HolidayUpdateDto holiday)
{
if (!ModelState.IsValid)
Expand All @@ -245,7 +245,7 @@ public virtual async Task<ActionResult<HolidayDto>> PutToHolidaysNonConventional
return Ok(child);
}

[HttpPatch("api/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
[HttpPatch("/api/v1/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
public virtual async Task<ActionResult> PatchToHolidaysNonConventional(System.String key, System.Int64 relatedKey, [FromBody] Delta<HolidayDto> holiday)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -278,7 +278,7 @@ public virtual async Task<ActionResult> PatchToHolidaysNonConventional(System.St
return Ok(child);
}

[HttpDelete("api/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
[HttpDelete("/api/v1/Countries/{key}/CountryOwnedHolidays/{relatedKey}")]
public virtual async Task<ActionResult> DeleteHolidayNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public virtual async Task<ActionResult<IQueryable<BankNoteDto>>> GetCurrencyComm
}

[EnableQuery]
[HttpGet("api/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
[HttpGet("/api/v1/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
public virtual async Task<ActionResult<BankNoteDto>> GetCurrencyCommonBankNotesNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -85,7 +85,7 @@ public virtual async Task<ActionResult> PostToCurrencyCommonBankNotes([FromRoute
return Created(child);
}

[HttpPut("api/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
[HttpPut("/api/v1/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
public virtual async Task<ActionResult<BankNoteDto>> PutToBankNotesNonConventional(System.String key, System.Int64 relatedKey, [FromBody] BankNoteUpdateDto bankNote)
{
if (!ModelState.IsValid)
Expand All @@ -109,7 +109,7 @@ public virtual async Task<ActionResult<BankNoteDto>> PutToBankNotesNonConvention
return Ok(child);
}

[HttpPatch("api/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
[HttpPatch("/api/v1/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
public virtual async Task<ActionResult> PatchToBankNotesNonConventional(System.String key, System.Int64 relatedKey, [FromBody] Delta<BankNoteDto> bankNote)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -142,7 +142,7 @@ public virtual async Task<ActionResult> PatchToBankNotesNonConventional(System.S
return Ok(child);
}

[HttpDelete("api/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
[HttpDelete("/api/v1/Currencies/{key}/CurrencyCommonBankNotes/{relatedKey}")]
public virtual async Task<ActionResult> DeleteBankNoteNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -182,7 +182,7 @@ public virtual async Task<ActionResult<IQueryable<ExchangeRateDto>>> GetCurrency
}

[EnableQuery]
[HttpGet("api/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
[HttpGet("/api/v1/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
public virtual async Task<ActionResult<ExchangeRateDto>> GetCurrencyExchangedFromRatesNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -221,7 +221,7 @@ public virtual async Task<ActionResult> PostToCurrencyExchangedFromRates([FromRo
return Created(child);
}

[HttpPut("api/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
[HttpPut("/api/v1/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
public virtual async Task<ActionResult<ExchangeRateDto>> PutToExchangeRatesNonConventional(System.String key, System.Int64 relatedKey, [FromBody] ExchangeRateUpdateDto exchangeRate)
{
if (!ModelState.IsValid)
Expand All @@ -245,7 +245,7 @@ public virtual async Task<ActionResult<ExchangeRateDto>> PutToExchangeRatesNonCo
return Ok(child);
}

[HttpPatch("api/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
[HttpPatch("/api/v1/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
public virtual async Task<ActionResult> PatchToExchangeRatesNonConventional(System.String key, System.Int64 relatedKey, [FromBody] Delta<ExchangeRateDto> exchangeRate)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -278,7 +278,7 @@ public virtual async Task<ActionResult> PatchToExchangeRatesNonConventional(Syst
return Ok(child);
}

[HttpDelete("api/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
[HttpDelete("/api/v1/Currencies/{key}/CurrencyExchangedFromRates/{relatedKey}")]
public virtual async Task<ActionResult> DeleteExchangeRateNonConventional(System.String key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public virtual async Task<ActionResult<IQueryable<EmployeePhoneNumberDto>>> GetE
}

[EnableQuery]
[HttpGet("api/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
[HttpGet("/api/v1/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
public virtual async Task<ActionResult<EmployeePhoneNumberDto>> GetEmployeeContactPhoneNumbersNonConventional(System.Int64 key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -85,7 +85,7 @@ public virtual async Task<ActionResult> PostToEmployeeContactPhoneNumbers([FromR
return Created(child);
}

[HttpPut("api/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
[HttpPut("/api/v1/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
public virtual async Task<ActionResult<EmployeePhoneNumberDto>> PutToEmployeePhoneNumbersNonConventional(System.Int64 key, System.Int64 relatedKey, [FromBody] EmployeePhoneNumberUpdateDto employeePhoneNumber)
{
if (!ModelState.IsValid)
Expand All @@ -109,7 +109,7 @@ public virtual async Task<ActionResult<EmployeePhoneNumberDto>> PutToEmployeePho
return Ok(child);
}

[HttpPatch("api/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
[HttpPatch("/api/v1/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
public virtual async Task<ActionResult> PatchToEmployeePhoneNumbersNonConventional(System.Int64 key, System.Int64 relatedKey, [FromBody] Delta<EmployeePhoneNumberDto> employeePhoneNumber)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -142,7 +142,7 @@ public virtual async Task<ActionResult> PatchToEmployeePhoneNumbersNonConvention
return Ok(child);
}

[HttpDelete("api/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
[HttpDelete("/api/v1/Employees/{key}/EmployeeContactPhoneNumbers/{relatedKey}")]
public virtual async Task<ActionResult> DeleteEmployeePhoneNumberNonConventional(System.Int64 key, System.Int64 relatedKey)
{
if (!ModelState.IsValid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static void AddNoxOdata(this IServiceCollection services, Action<ODataMod
.Expand()
.SkipToken()
.SetMaxTop(100);
var routeOptions = options.AddRouteComponents("api", builder.GetEdmModel(),
var routeOptions = options.AddRouteComponents(Nox.Presentation.Api.OData.ODataApi.GetRoutePrefix("/api/v1"), builder.GetEdmModel(),
service => service
.AddSingleton<IODataSerializerProvider, NoxODataSerializerProvider>())
.RouteOptions;
Expand Down
6 changes: 3 additions & 3 deletions schemas/infrastructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
}
],
"properties": {
"apiRootPrefix": {
"title": "The api route prefix, defaults to api/v1 or to api/vMajor({Solution.Version}) if Version is set in the root of the yaml.",
"description": "Defines the prefix for all routes OData end points. Do not start by \"/\", all will be Sanitized",
"apiRoutePrefix": {
"title": "The api route prefix, defaults to api/v1 or to api/vMajor({Solution.Version}) if Version is set in the root of the Solution.",
"description": "Defines the prefix for all Api routes end points.",
"oneOf": [
{
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
#

name: ClientApi

platformId: Nox-Tests

description: Project for Nox System Testing

version: "1.0"

domain:

entities:
Expand Down
24 changes: 12 additions & 12 deletions src/Nox.ClientApi.Tests/.nox/docs/IntegrationEvents.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Attribute|Type|Example
specversion|SemanticVersion|1.0
id|Guid|0d02bba1-dbf3-4ba4-93c1-2e416ec0c88d
source|https://{ENVIRONMENT}.{Solution.PlatformId}.com/{Solution.Name}|https://Nox-Tests.com/ClientApi
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Country.v1.0.CountryCreated
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Country.v1.0.0.CountryCreated
datacontenttype|ContentType|application/json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Country/v1.0/CountryCreated.json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Country/v1.0.0/CountryCreated.json
time|DateTimeUtc|2023-10-10T12:11:10.5312500Z
xtenantid|Text|b22ee68e-327f-4550-a077-8fb8426071f5
xuserid|Text|e945e9f9-b0ba-435d-bfe7-8966abeb8763
Expand All @@ -62,9 +62,9 @@ Attribute|Type|Example
specversion|SemanticVersion|1.0
id|Guid|0d02bba1-dbf3-4ba4-93c1-2e416ec0c88d
source|https://{ENVIRONMENT}.{Solution.PlatformId}.com/{Solution.Name}|https://Nox-Tests.com/ClientApi
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Country.v1.0.CountryUpdated
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Country.v1.0.0.CountryUpdated
datacontenttype|ContentType|application/json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Country/v1.0/CountryUpdated.json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Country/v1.0.0/CountryUpdated.json
time|DateTimeUtc|2023-10-10T12:11:10.5312500Z
xtenantid|Text|b22ee68e-327f-4550-a077-8fb8426071f5
xuserid|Text|e945e9f9-b0ba-435d-bfe7-8966abeb8763
Expand All @@ -90,9 +90,9 @@ Attribute|Type|Example
specversion|SemanticVersion|1.0
id|Guid|0d02bba1-dbf3-4ba4-93c1-2e416ec0c88d
source|https://{ENVIRONMENT}.{Solution.PlatformId}.com/{Solution.Name}|https://Nox-Tests.com/ClientApi
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Country.v1.0.CountryDeleted
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Country.v1.0.0.CountryDeleted
datacontenttype|ContentType|application/json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Country/v1.0/CountryDeleted.json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Country/v1.0.0/CountryDeleted.json
time|DateTimeUtc|2023-10-10T12:11:10.5312500Z
xtenantid|Text|b22ee68e-327f-4550-a077-8fb8426071f5
xuserid|Text|e945e9f9-b0ba-435d-bfe7-8966abeb8763
Expand Down Expand Up @@ -138,9 +138,9 @@ Attribute|Type|Example
specversion|SemanticVersion|1.0
id|Guid|0d02bba1-dbf3-4ba4-93c1-2e416ec0c88d
source|https://{ENVIRONMENT}.{Solution.PlatformId}.com/{Solution.Name}|https://Nox-Tests.com/ClientApi
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Workplace.v1.0.WorkplaceDeleted
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.Workplace.v1.0.0.WorkplaceDeleted
datacontenttype|ContentType|application/json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Workplace/v1.0/WorkplaceDeleted.json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/Workplace/v1.0.0/WorkplaceDeleted.json
time|DateTimeUtc|2023-10-10T12:11:10.5312500Z
xtenantid|Text|b22ee68e-327f-4550-a077-8fb8426071f5
xuserid|Text|e945e9f9-b0ba-435d-bfe7-8966abeb8763
Expand Down Expand Up @@ -179,9 +179,9 @@ Attribute|Type|Example
specversion|SemanticVersion|1.0
id|Guid|0d02bba1-dbf3-4ba4-93c1-2e416ec0c88d
source|https://{ENVIRONMENT}.{Solution.PlatformId}.com/{Solution.Name}|https://Nox-Tests.com/ClientApi
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.StoreOwner.v1.0.StoreOwnerCreated
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi.StoreOwner.v1.0.0.StoreOwnerCreated
datacontenttype|ContentType|application/json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/StoreOwner/v1.0/StoreOwnerCreated.json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/StoreOwner/v1.0.0/StoreOwnerCreated.json
time|DateTimeUtc|2023-10-10T12:11:10.5312500Z
xtenantid|Text|b22ee68e-327f-4550-a077-8fb8426071f5
xuserid|Text|e945e9f9-b0ba-435d-bfe7-8966abeb8763
Expand Down Expand Up @@ -226,9 +226,9 @@ Attribute|Type|Example
specversion|SemanticVersion|1.0
id|Guid|0d02bba1-dbf3-4ba4-93c1-2e416ec0c88d
source|https://{ENVIRONMENT}.{Solution.PlatformId}.com/{Solution.Name}|https://Nox-Tests.com/ClientApi
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi..v1.0.CountryPopulationHigherThan100M
type|{Solution.PlatformId}.{Solution.Name}.{Trait}.v{Solution.Version}.{eventName}|Nox-Tests.ClientApi..v1.0.0.CountryPopulationHigherThan100M
datacontenttype|ContentType|application/json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/TBD/v1.0/CountryPopulationHigherThan100M.json
dataschema|https://{ENVIRONMENT}.{Solution.PlatformId}.com/schemas/{Solution.Name}/{Trait}/v{Solution.Version}/{eventName}.json|https://Nox-Tests.com/schemas/ClientApi/TBD/v1.0.0/CountryPopulationHigherThan100M.json
time|DateTimeUtc|2023-10-10T12:11:10.5312500Z
xtenantid|Text|b22ee68e-327f-4550-a077-8fb8426071f5
xuserid|Text|e945e9f9-b0ba-435d-bfe7-8966abeb8763
Expand Down
9 changes: 5 additions & 4 deletions src/Nox.ClientApi.Tests/Controllers/CountriesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using ClientApi.Domain;
using ClientApi.Infrastructure.Persistence;
using Nox.Types;
using ClientApi.Tests.Controllers;

namespace ClientApi.Presentation.Api.OData;

Expand Down Expand Up @@ -59,7 +60,7 @@ public override async Task<ActionResult> PostToCountryShortNames([FromRoute] lon
/// </summary>
/// <returns>Prefer using Nox Solution Entity Definition (yaml) to register custom function</returns>
[EnableQuery]
[HttpGet("api/CountriesWithDebt")]
[HttpGet($"{Endpoints.RoutePrefix}/CountriesWithDebt")]
public ActionResult<IQueryable<Application.Dto.CountryDto>> CountriesWithDebt()
{
return Ok(new List<Application.Dto.CountryDto>() {
Expand All @@ -75,7 +76,7 @@ public override async Task<ActionResult> PostToCountryShortNames([FromRoute] lon
/// And Nox Solution Entity Definition (yaml) to register custom function
/// </summary>
/// <returns></returns>
[HttpGet("api/[controller]/[action]")]
[HttpGet($"{Endpoints.RoutePrefix}/[controller]/[action]")]
public ActionResult<IQueryable<Application.Dto.CountryDto>> CountriesWithDebt2()
{
return Ok(new List<Application.Dto.CountryDto>() {
Expand All @@ -90,7 +91,7 @@ public override async Task<ActionResult> PostToCountryShortNames([FromRoute] lon
/// Example of a non OData end point that returns Created StatusCode
/// </summary>
/// <returns></returns>
[HttpPost("api/[controller]/[action]")]
[HttpPost($"{Endpoints.RoutePrefix}/[controller]/[action]")]
public IResult CustomCreateCountry([FromBody] Application.Dto.CountryCreateDto country)
{
var createdCountry = new Application.Dto.CountryDto()
Expand All @@ -100,7 +101,7 @@ public IResult CustomCreateCountry([FromBody] Application.Dto.CountryCreateDto c
};

var routeValues = new { key = createdCountry.Id };
return Results.Created($"api/Countries/{createdCountry.Id}", routeValues);
return Results.Created($"{Endpoints.RoutePrefix}/Countries/{createdCountry.Id}", routeValues);
}

}
Loading

0 comments on commit de3e58a

Please sign in to comment.