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
dbGastroSkyDatabaseContextconfigurationIConfigurationencryptionServiceIEncryptionServiceremoteFileStorageIRemoteFileStoragemapperIMapperloggerILogger<PostImageController>imageManipulationServiceIImageManipulationService
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
guidGuidPost image file GUID.
Returns
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
guidGuidPost image file GUID.
typestringImage type. Can be one of the following:
hd,original,thumbnail
Returns
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
dtoPostImageUploadRequestDtoRequest DTO containing the post image upload details.
Returns
Remarks
Check out the DocFX API docs PostImageUploadRequestDto page to find out more about the upload parameters.