Table of Contents

Class PostImageController

Namespace
GastroSky.Controllers.V1
Assembly
GastroSky.dll

Endpoints for handling user post-related image uploads and downloads.

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

Constructors

PostImageController(GastroSkyDatabaseContext, IConfiguration, IEncryptionService, IRemoteFileStorage, IMapper, ILogger<PostImageController>, IImageManipulationService)

Endpoints for handling user post-related image uploads and downloads.

public PostImageController(GastroSkyDatabaseContext db, IConfiguration configuration, IEncryptionService encryptionService, IRemoteFileStorage remoteFileStorage, IMapper mapper, ILogger<PostImageController> logger, IImageManipulationService imageManipulationService)

Parameters

db GastroSkyDatabaseContext
configuration IConfiguration
encryptionService IEncryptionService
remoteFileStorage IRemoteFileStorage
mapper IMapper
logger ILogger<PostImageController>
imageManipulationService IImageManipulationService

Methods

DeletePostImage(Guid)

Deletes a post image.

[HttpDelete]
[Route("{guid:guid}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
public Task<IActionResult> DeletePostImage(Guid guid)

Parameters

guid Guid

Post image file GUID.

Returns

Task<IActionResult>

IActionResult

Remarks

After successful deletion, it will no longer be accessible. This should almost always never be done. But if truly needed, only do it on archived/deleted posts!

GetPostImage(Guid, string)

Gets a specific post image.

[HttpGet]
[AllowAnonymous]
[Route("{guid:guid}/{type}")]
[Produces("application/octet-stream", new string[] { "application/json" })]
public Task GetPostImage(Guid guid, string type)

Parameters

guid Guid

Post image file GUID.

type string

Image type. Can be one of the following: hd, original, thumbnail

Returns

Task

IActionResult

UploadPostImage(PostImageUploadRequestDto)

Uploads a new post image.

[HttpPost]
[Route("")]
[ProducesResponseType(400)]
[ProducesResponseType(403)]
[ProducesResponseType(404)]
[ProducesResponseType(500)]
[ProducesResponseType<ResponseBodyDto<PostImageResponseDto>>(201)]
[DisableRequestSizeLimit]
[RequestFormLimits(MultipartBodyLengthLimit = 16777216, ValueLengthLimit = 2147483647)]
public Task<IActionResult> UploadPostImage(PostImageUploadRequestDto dto)

Parameters

dto PostImageUploadRequestDto

Request DTO containing the post image upload details.

Returns

Task<IActionResult>

IActionResult

Remarks

Check out the DocFX API docs PostImageUploadRequestDto page to find out more about the upload parameters.