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
dbGastroSkyDatabaseContextmapperIMapperconfigurationIConfigurationemailValidatorIEmailValidatoremailTotpServiceIEmailTotpServiceslugGeneratorISlugGeneratorloggerILogger<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
dtoUserPostInteractionCreationRequestDtoRequest DTO containing the post and user details.
Returns
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
dtoUserPostInteractionCreationRequestDtoRequest DTO containing the post and user details.
Returns
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
dtoUserPostInteractionCreationRequestDtoRequest DTO containing user-post interaction creation details. Check out the API DocFX documentation on UserPostInteractionCreationRequestDto for more information.
Returns
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
Returns
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
postInteractionGuidGuidPost interaction GUID.
Returns
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
postSlugstringPost slug string.
emailFilterstringOnly return user-post interactions whose email address field matches this query parameter.
resolvedFilterbool?Pass
trueto only return user-post interactions that have been marked as resolved,falsefor unresolved ones. Default:null(resolved state not specified).timeRangeFilterTimeRangeFilterTime range filter for filtering based on the news article publication date. TimeRangeFilter
paginationFilterPaginationFilterPagination filter. PaginationFilter
sortingOrderSortingOrderDesired sorting order. Can be
0forSortingOrder.Ascendingor1forSortingOrder.Descending. SortingOrder
Returns
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
dtoUserPostInteractionAnonModificationRequestDtoRequest DTO containing the details of the user-post interaction to modify.
Returns
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
dtoUserPostInteractionModificationRequestDtoRequest DTO containing the user-post information fields to update. Check out the API DocFX documentation on UserPostInteractionModificationRequestDto for more information.
Returns
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
dtoUserPostInteractionStatusModificationRequestDtoRequest DTO containing the necessary details about the user-post interaction status modification. Check out the API DocFX documentation on UserPostInteractionStatusModificationRequestDto for more information.
Returns
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
postInteractionSlugstringThe user-post interaction slug.