Skip to content

Commit

Permalink
updating CRUD Methods attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
RudiThoeni committed Dec 18, 2024
1 parent 0952c8f commit 547fe59
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Helper/Helper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="SqlKata.Execution" Version="3.0.0-beta" />
<!--<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.2" /> not working if this update is done-->
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
<PackageReference Include="System.Interactive.Async" Version="5.0.0" />
<PackageReference Include="System.ServiceModel.Duplex" Version="4.9.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.9.0" />
Expand Down
17 changes: 13 additions & 4 deletions OdhApiCore/Controllers/api/AccommodationApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -963,9 +963,12 @@ private IActionResult GetFeatureListXML(CancellationToken cancellationToken)
/// <param name="accommodation">Accommodation Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
//[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
//[Authorize(Roles = "DataWriter,DataCreate,AccoManager,AccoCreate,AccommodationWriter,AccommodationManager,AccommodationCreate")]
[AuthorizeODH(PermissionAction.Create)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPost, Route("Accommodation")]
public Task<IActionResult> Post([FromBody] AccommodationV2 accommodation)
{
Expand Down Expand Up @@ -996,9 +999,12 @@ public Task<IActionResult> Post([FromBody] AccommodationV2 accommodation)
/// <param name="accommodation">Accommodation Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
//[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
[AuthorizeODH(PermissionAction.Update)]
//[Authorize(Roles = "DataWriter,DataModify,AccoManager,AccoModify,AccommodationWriter,AccommodationManager,AccommodationModify,AccommodationUpdate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPut, Route("Accommodation/{id}")]
public Task<IActionResult> Put(string id, [FromBody] AccommodationV2 accommodation)
{
Expand Down Expand Up @@ -1026,10 +1032,13 @@ public Task<IActionResult> Put(string id, [FromBody] AccommodationV2 accommodati
/// </summary>
/// <param name="id">Accommodation Id</param>
/// <returns>Http Response</returns>
[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
//[ApiExplorerSettings(IgnoreApi = true)]
//[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
[AuthorizeODH(PermissionAction.Delete)]
//[Authorize(Roles = "DataWriter,DataDelete,AccoManager,AccoDelete,AccommodationWriter,AccommodationManager,AccommodationDelete")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpDelete, Route("Accommodation/{id}")]
public Task<IActionResult> Delete(string id)
{
Expand Down
2 changes: 1 addition & 1 deletion OdhApiCore/Controllers/api/ArticleApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private Task<IActionResult> GetArticleTypeSingle(string id, string? language, st
//[ApiExplorerSettings(IgnoreApi = true)]
//[Authorize(Roles = "DataWriter,DataCreate,ArticleManager,ArticleCreate")]
[AuthorizeODH(PermissionAction.Create)]
[InvalidateCacheOutput(nameof(GetArticleList))]
//[InvalidateCacheOutput(nameof(GetArticleList))]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
Expand Down
15 changes: 12 additions & 3 deletions OdhApiCore/Controllers/api/EventApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,12 @@ private Task<IActionResult> GetEventTopicSingleAsync(string id, string? language
/// <param name="odhevent">Event Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetEventList))]
//[InvalidateCacheOutput(nameof(GetEventList))]
[AuthorizeODH(PermissionAction.Create)]
//[Authorize(Roles = "DataWriter,DataCreate,EventManager,EventCreate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPost, Route("Event")]
public Task<IActionResult> Post([FromBody] EventLinked odhevent)
{
Expand Down Expand Up @@ -393,9 +396,12 @@ public Task<IActionResult> Post([FromBody] EventLinked odhevent)
/// <param name="odhevent">Event Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetEventList))]
//[InvalidateCacheOutput(nameof(GetEventList))]
[AuthorizeODH(PermissionAction.Update)]
//[Authorize(Roles = "DataWriter,DataModify,EventManager,EventModify,EventUpdate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPut, Route("Event/{id}")]
public Task<IActionResult> Put(string id, [FromBody] EventLinked odhevent)
{
Expand Down Expand Up @@ -424,9 +430,12 @@ public Task<IActionResult> Put(string id, [FromBody] EventLinked odhevent)
/// <param name="id">Event Id</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetEventList))]
//[InvalidateCacheOutput(nameof(GetEventList))]
//[Authorize(Roles = "DataWriter,DataDelete,EventManager,EventDelete")]
[AuthorizeODH(PermissionAction.Delete)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpDelete, Route("Event/{id}")]
public Task<IActionResult> Delete(string id)
{
Expand Down
15 changes: 12 additions & 3 deletions OdhApiCore/Controllers/api/EventV2ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,12 @@ private Task<IActionResult> GetSingle(string id, string? language, string[] fiel
/// <param name="odhevent">Event Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetEventList))]
//[InvalidateCacheOutput(nameof(GetEventList))]
[AuthorizeODH(PermissionAction.Create)]
//[Authorize(Roles = "DataWriter,DataCreate,EventManager,EventCreate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPost, Route("Event")]
public Task<IActionResult> Post([FromBody] EventV2 odhevent)
{
Expand Down Expand Up @@ -434,7 +437,10 @@ public Task<IActionResult> Post([FromBody] EventV2 odhevent)
/// <param name="odhevent">Event Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetEventList))]
//[InvalidateCacheOutput(nameof(GetEventList))]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Update)]
//[Authorize(Roles = "DataWriter,DataModify,EventManager,EventModify,EventUpdate")]
[HttpPut, Route("Event/{id}")]
Expand Down Expand Up @@ -466,8 +472,11 @@ public Task<IActionResult> Put(string id, [FromBody] EventV2 odhevent)
/// <param name="id">Event Id</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetEventList))]
//[InvalidateCacheOutput(nameof(GetEventList))]
//[Authorize(Roles = "DataWriter,DataDelete,EventManager,EventDelete")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Delete)]
[HttpDelete, Route("Event/{id}")]
public Task<IActionResult> Delete(string id)
Expand Down
15 changes: 12 additions & 3 deletions OdhApiCore/Controllers/api/ODHActivityPoiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,11 @@ private Task<IActionResult> GetSmgPoiTypesSingle(string id, string? language, st
/// <param name="odhactivitypoi">ODHActivityPoi Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(ODHActivityPoiController), nameof(GetODHActivityPoiList))]
//[InvalidateCacheOutput(typeof(ODHActivityPoiController), nameof(GetODHActivityPoiList))]
//[Authorize(Roles = "DataWriter,DataCreate,ODHActivityPoiWriter,ODHActivityPoiManager,ODHActivityPoiCreate,SmgPoiManager,SmgPoiCreate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Create)]
[HttpPost, Route("ODHActivityPoi")]
public Task<IActionResult> Post([FromBody] ODHActivityPoiLinked odhactivitypoi)
Expand Down Expand Up @@ -450,8 +453,11 @@ public Task<IActionResult> Post([FromBody] ODHActivityPoiLinked odhactivitypoi)
/// <param name="odhactivitypoi">ODHActivityPoi Object</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(ODHActivityPoiController), nameof(GetODHActivityPoiList))]
//[InvalidateCacheOutput(typeof(ODHActivityPoiController), nameof(GetODHActivityPoiList))]
//[Authorize(Roles = "DataWriter,DataModify,ODHActivityPoiWriter,ODHActivityPoiManager,ODHActivityPoiModify,ODHActivityPoiUpdate,SmgPoiManager,SmgPoiModify")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Update)]
[HttpPut, Route("ODHActivityPoi/{id}")]
public Task<IActionResult> Put(string id, [FromBody] ODHActivityPoiLinked odhactivitypoi)
Expand Down Expand Up @@ -505,8 +511,11 @@ public Task<IActionResult> Put(string id, [FromBody] ODHActivityPoiLinked odhact
/// <param name="id">ODHActivityPoi Id</param>
/// <returns>Http Response</returns>
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(ODHActivityPoiController), nameof(GetODHActivityPoiList))]
//[InvalidateCacheOutput(typeof(ODHActivityPoiController), nameof(GetODHActivityPoiList))]
//[Authorize(Roles = "DataWriter,DataDelete,ODHActivityPoiWriter,ODHActivityPoiManager,ODHActivityPoiDelete,SmgPoiManager,SmgPoiDelete")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Delete)]
[HttpDelete, Route("ODHActivityPoi/{id}")]
public Task<IActionResult> Delete(string id)
Expand Down
9 changes: 9 additions & 0 deletions OdhApiCore/Controllers/api/PublisherController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ private Task<IActionResult> GetSingle(string id, string? language, string[] fiel
/// <param name="publisher">PublisherLinked Object</param>
/// <returns>Http Response</returns>
//[Authorize(Roles = "DataWriter,DataCreate,PublisherManager,PublisherCreate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Create)]
[HttpPost, Route("Publisher")]
public Task<IActionResult> Post([FromBody] PublisherLinked publisher)
Expand All @@ -216,6 +219,9 @@ public Task<IActionResult> Post([FromBody] PublisherLinked publisher)
/// <returns>Http Response</returns>
//[Authorize(Roles = "DataWriter,DataModify,PublisherManager,PublisherModify,PublisherUpdate")]
[AuthorizeODH(PermissionAction.Update)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPut, Route("Publisher/{id}")]
public Task<IActionResult> Put(string id, [FromBody] PublisherLinked publisher)
{
Expand All @@ -237,6 +243,9 @@ public Task<IActionResult> Put(string id, [FromBody] PublisherLinked publisher)
/// <returns>Http Response</returns>
//[Authorize(Roles = "DataWriter,DataDelete,PublisherManager,PublisherDelete")]
[AuthorizeODH(PermissionAction.Delete)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpDelete, Route("Publisher/{id}")]
public Task<IActionResult> Delete(string id)
{
Expand Down
9 changes: 9 additions & 0 deletions OdhApiCore/Controllers/api/SourceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ private Task<IActionResult> GetSingle(string id, string? language, string[] fiel
/// <param name="Source">SourceLinked Object</param>
/// <returns>Http Response</returns>
//[Authorize(Roles = "DataWriter,DataCreate,SourceManager,SourceCreate")]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AuthorizeODH(PermissionAction.Create)]
[HttpPost, Route("Source")]
public Task<IActionResult> Post([FromBody] SourceLinked source)
Expand All @@ -215,6 +218,9 @@ public Task<IActionResult> Post([FromBody] SourceLinked source)
/// <returns>Http Response</returns>
//[Authorize(Roles = "DataWriter,DataModify,SourceManager,SourceModify,SourceUpdate")]
[AuthorizeODH(PermissionAction.Update)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPut, Route("Source/{id}")]
public Task<IActionResult> Put(string id, [FromBody] SourceLinked source)
{
Expand All @@ -236,6 +242,9 @@ public Task<IActionResult> Put(string id, [FromBody] SourceLinked source)
/// <returns>Http Response</returns>
//[Authorize(Roles = "DataWriter,DataDelete,SourceManager,SourceDelete")]
[AuthorizeODH(PermissionAction.Delete)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpDelete, Route("Source/{id}")]
public Task<IActionResult> Delete(string id)
{
Expand Down
21 changes: 15 additions & 6 deletions OdhApiCore/Controllers/api/TagController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,13 @@ private Task<IActionResult> GetSingle(string id, string? language, string[] fiel
/// </summary>
/// <param name="tag">Tag Object</param>
/// <returns>Http Response</returns>
[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetTagAsync))]
//[ApiExplorerSettings(IgnoreApi = true)]
//[InvalidateCacheOutput(nameof(GetTagAsync))]
//[Authorize(Roles = "DataWriter,DataCreate,TagManager,TagCreate")]
[AuthorizeODH(PermissionAction.Create)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPost, Route("Tag")]
public Task<IActionResult> Post([FromBody] TagLinked tag)
{
Expand All @@ -239,10 +242,13 @@ public Task<IActionResult> Post([FromBody] TagLinked tag)
/// <param name="id">Tag Id</param>
/// <param name="tag">Tag Object</param>
/// <returns>Http Response</returns>
[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetTagAsync))]
//[ApiExplorerSettings(IgnoreApi = true)]
//[InvalidateCacheOutput(nameof(GetTagAsync))]
//[Authorize(Roles = "DataWriter,DataModify,TagManager,TagModify,TagUpdate")]
[AuthorizeODH(PermissionAction.Update)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpPut, Route("Tag/{id}")]
public Task<IActionResult> Put(string id, [FromBody] TagLinked tag)
{
Expand All @@ -263,10 +269,13 @@ public Task<IActionResult> Put(string id, [FromBody] TagLinked tag)
/// </summary>
/// <param name="id">Tag Id</param>
/// <returns>Http Response</returns>
[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(nameof(GetTagAsync))]
//[ApiExplorerSettings(IgnoreApi = true)]
//[InvalidateCacheOutput(nameof(GetTagAsync))]
//[Authorize(Roles = "DataWriter,DataDelete,TagManager,TagDelete")]
[AuthorizeODH(PermissionAction.Delete)]
[ProducesResponseType(typeof(PGCRUDResult), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[HttpDelete, Route("Tag/{id}")]
public Task<IActionResult> Delete(string id)
{
Expand Down
Loading

0 comments on commit 547fe59

Please sign in to comment.