Table of Contents

Class PostInteractionController

Namespace
GastroSky.Controllers.V1
Assembly
GastroSky.dll

Endpoints for letting users interact with a user post.

[ApiController]
[Authorize]
[Route("api/v1/post-interactions")]
[Produces("application/json", new string[] { })]
public class PostInteractionController : GastroSkyControllerBase
Inheritance
PostInteractionController
Inherited Members

Constructors

PostInteractionController(GastroSkyDatabaseContext, IMapper, IConfiguration, IEmailValidator, IEmailTotpService, ISlugGenerator, ILogger<PostInteractionController>)

Endpoints for letting users interact with a user post.

public PostInteractionController(GastroSkyDatabaseContext db, IMapper mapper, IConfiguration configuration, IEmailValidator emailValidator, IEmailTotpService emailTotpService, ISlugGenerator slugGenerator, ILogger<PostInteractionController> logger)

Parameters

db GastroSkyDatabaseContext
mapper IMapper
configuration IConfiguration
emailValidator IEmailValidator
emailTotpService IEmailTotpService
slugGenerator ISlugGenerator
logger ILogger<PostInteractionController>

Methods

ConfirmPostInteractionCreation(UserPostInteractionCreationRequestDto)

Confirms the anonymous creation of a new user-post interaction.

[HttpPost]
[Route("anon/confirm")]
[AllowAnonymous]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionAnonResponseDto>>(201)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(429)]
[ProducesResponseType(500)]
public Task<IActionResult> ConfirmPostInteractionCreation(UserPostInteractionCreationRequestDto dto)

Parameters

dto UserPostInteractionCreationRequestDto

Request DTO containing the post and user details.

Returns

Task<IActionResult>

IActionResult

CreateNewPostInteraction(UserPostInteractionCreationRequestDto)

Create a new user-post interaction anonymously.

[HttpPost]
[Route("anon")]
[AllowAnonymous]
[ProducesResponseType(200)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(429)]
[ProducesResponseType(500)]
public Task<IActionResult> CreateNewPostInteraction(UserPostInteractionCreationRequestDto dto)

Parameters

dto UserPostInteractionCreationRequestDto

Request DTO containing the post and user details.

Returns

Task<IActionResult>

IActionResult

CreatePostInteractionManually(UserPostInteractionCreationRequestDto)

Creates a user-post interaction as an authenticated user or manually on behalf of another person (as a post author).

[HttpPost]
[Route("")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:W")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionResponseDto>>(201)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> CreatePostInteractionManually(UserPostInteractionCreationRequestDto dto)

Parameters

dto UserPostInteractionCreationRequestDto

Request DTO containing user-post interaction creation details. Check out the API DocFX documentation on UserPostInteractionCreationRequestDto for more information.

Returns

Task<IActionResult>

IActionResult

GetPostInteraction(string, string)

Gets a specific user-post interaction.

[HttpGet]
[Route("{postSlug}/{postInteractionSlug}")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:R")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionResponseDto>>(200)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> GetPostInteraction(string postSlug, string postInteractionSlug)

Parameters

postSlug string

Post slug string.

postInteractionSlug string

User-post interaction slug string.

Returns

Task<IActionResult>

IActionResult

GetPostInteractionAnon(Guid)

Gets a specific user-post interaction anonymously.

[HttpGet]
[AllowAnonymous]
[Route("anon/{postInteractionGuid:guid}")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionAnonResponseDto>>(200)]
[ProducesResponseType(404)]
public Task<IActionResult> GetPostInteractionAnon(Guid postInteractionGuid)

Parameters

postInteractionGuid Guid

Post interaction GUID.

Returns

Task<IActionResult>

IActionResult

GetPostInteractions(string, string?, bool?, TimeRangeFilter?, PaginationFilter?, SortingOrder)

Gets a list of user-post interactions for a given post.

[HttpGet]
[Route("{postSlug}")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:R")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionResponseDto>>(200)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
public Task<IActionResult> GetPostInteractions(string postSlug, string? emailFilter = null, bool? resolvedFilter = null, TimeRangeFilter? timeRangeFilter = null, PaginationFilter? paginationFilter = null, SortingOrder sortingOrder = SortingOrder.Descending)

Parameters

postSlug string

Post slug string.

emailFilter string

Only return user-post interactions whose email address field matches this query parameter.

resolvedFilter bool?

Pass true to only return user-post interactions that have been marked as resolved, false for unresolved ones. Default: null (resolved state not specified).

timeRangeFilter TimeRangeFilter

Time range filter for filtering based on the news article publication date. TimeRangeFilter

paginationFilter PaginationFilter

Pagination filter. PaginationFilter

sortingOrder SortingOrder

Desired sorting order. Can be 0 for SortingOrder.Ascending or 1 for SortingOrder.Descending. SortingOrder

Returns

Task<IActionResult>

IActionResult

ModifyPostInteractionAnon(UserPostInteractionAnonModificationRequestDto)

Modifies a specific user-post interaction anonymously.

[HttpPut]
[AllowAnonymous]
[Route("anon")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionAnonResponseDto>>(200)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> ModifyPostInteractionAnon(UserPostInteractionAnonModificationRequestDto dto)

Parameters

dto UserPostInteractionAnonModificationRequestDto

Request DTO containing the details of the user-post interaction to modify.

Returns

Task<IActionResult>

IActionResult

ModifyPostInteractionManually(UserPostInteractionModificationRequestDto)

Modifies an existing user-post interaction.

[HttpPut]
[Route("")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:R")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:W")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionResponseDto>>(200)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> ModifyPostInteractionManually(UserPostInteractionModificationRequestDto dto)

Parameters

dto UserPostInteractionModificationRequestDto

Request DTO containing the user-post information fields to update. Check out the API DocFX documentation on UserPostInteractionModificationRequestDto for more information.

Returns

Task<IActionResult>

IActionResult

ModifyPostInteractionStatus(UserPostInteractionStatusModificationRequestDto)

Moves a user-post interaction into a different state.

[HttpPut]
[Route("status")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:R")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:W")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionResponseDto>>(200)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> ModifyPostInteractionStatus(UserPostInteractionStatusModificationRequestDto dto)

Parameters

dto UserPostInteractionStatusModificationRequestDto

Request DTO containing the necessary details about the user-post interaction status modification. Check out the API DocFX documentation on UserPostInteractionStatusModificationRequestDto for more information.

Returns

Task<IActionResult>

IActionResult

ResolvePostInteraction(string)

Marks a user-post interaction as resolved.

[HttpPut]
[Route("resolve/{postInteractionSlug}")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:R")]
[Authorize(Policy = "https://api.gastrosky.ch/identity/claims/resources/post-interactions:W")]
[ProducesResponseType<ResponseBodyDto<UserPostInteractionResponseDto>>(200)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> ResolvePostInteraction(string postInteractionSlug)

Parameters

postInteractionSlug string

The user-post interaction slug.

Returns

Task<IActionResult>

IActionResult