Table of Contents

Class TestController

Namespace
GastroSky.Controllers.V1
Assembly
GastroSky.dll

TEST API controller FOR DEBUGGING PURPOSES ONLY! We can get really messy in here without any consequences :) Go ahead; go NUTS! ;DD

[ApiController]
[Authorize(Policy = "ADMIN_ONLY")]
[Route("api/v1/test")]
public class TestController : GastroSkyControllerBase
Inheritance
TestController
Inherited Members

Constructors

TestController(GastroSkyDatabaseContext, IEmailSenderGastroSky, IEmailTotpService, IRemoteFileStorage, IEmailGenerator)

TEST API controller FOR DEBUGGING PURPOSES ONLY! We can get really messy in here without any consequences :) Go ahead; go NUTS! ;DD

public TestController(GastroSkyDatabaseContext db, IEmailSenderGastroSky emailSender, IEmailTotpService emailTotpService, IRemoteFileStorage remoteFileStorage, IEmailGenerator emailGenerator)

Parameters

db GastroSkyDatabaseContext
emailSender IEmailSenderGastroSky
emailTotpService IEmailTotpService
remoteFileStorage IRemoteFileStorage
emailGenerator IEmailGenerator

Methods

DeleteTestFileFromRemoteFileStorage(string, Guid)

Deletes a file from the remote file storage location.

[HttpGet]
[Route("delete-test-file-from-remote-file-storage/{containerName}/{fileAccessToken:guid}")]
public Task<IActionResult> DeleteTestFileFromRemoteFileStorage(string containerName, Guid fileAccessToken)

Parameters

containerName string

Azure Blob Storage container that contains the requested file.

fileAccessToken Guid

File GUID.

Returns

Task<IActionResult>

IActionResult

DownloadTestFileFromRemoteFileStorage(string, Guid)

Downloads a test file that was uploaded using UploadTestFileToRemoteFileStorage(string).

[HttpGet]
[Route("download-test-file-from-remote-file-storage/{containerName}/{fileAccessToken:guid}")]
public Task<IActionResult> DownloadTestFileFromRemoteFileStorage(string containerName, Guid fileAccessToken)

Parameters

containerName string

Azure Blob Storage container that contains the requested file.

fileAccessToken Guid

File GUID.

Returns

Task<IActionResult>

IActionResult

DownloadTestImageFileFromRemoteFileStorage(string, Guid)

Downloads a test image that was uploaded using UploadTestImageFileToRemoteFileStorage(string, string).

[HttpGet]
[Route("download-test-img-file-from-remote-file-storage/{containerName}/{fileAccessToken:guid}")]
public Task DownloadTestImageFileFromRemoteFileStorage(string containerName, Guid fileAccessToken)

Parameters

containerName string

Azure Blob Storage container that contains the requested file.

fileAccessToken Guid

File GUID.

Returns

Task

IActionResult

SendTestEmail(string)

Sends out a test email to check if the IEmailSenderGastroSky implementation functions correctly.

[HttpGet]
[Route("send-test-email")]
public Task<IActionResult> SendTestEmail(string to)

Parameters

to string

Recipient email address.

Returns

Task<IActionResult>

IActionResult

SendTestEmail(string, string?, string?)

Sends out a test email of the determined template to check if the IEmailTotpService implementation functions correctly.

[HttpGet]
[Route("send-test-email/{emailId}")]
public Task<IActionResult> SendTestEmail(string emailId, string? to, string? language)

Parameters

emailId string

Email template

to string

Recipient email address.

language string

Desired email language.

Returns

Task<IActionResult>

IActionResult

SendTestEmailWithAttachments(string, string, string?, string?)

Sends out a test email with attachments and more parameters to test.

[HttpGet]
[Route("send-test-email-with-attachments")]
public Task<IActionResult> SendTestEmailWithAttachments(string from, string to, string? cc, string? bcc)

Parameters

from string

Sender email address.

to string

Recipient email address.

cc string

Carbon-copy email address.

bcc string

Blind-carbon-copy email address.

Returns

Task<IActionResult>

IActionResult

SendTestTotp(string, string?)

Sends out a test TOTP verification email to check if the IEmailTotpService implementation functions correctly.

[HttpGet]
[Route("send-test-email-totp")]
public Task<IActionResult> SendTestTotp(string to, string? language)

Parameters

to string

Recipient email address.

language string

Desired email language.

Returns

Task<IActionResult>

IActionResult

TestModelBinder(bool?)

Test endpoint for checking if the ASP.NET Core model binder works with certain parameter types.

[HttpGet]
[Route("test-model-binder")]
public IActionResult TestModelBinder(bool? optionalBoolValue = null)

Parameters

optionalBoolValue bool?

Does bool? bind properly? Hm!

Returns

IActionResult

IActionResult

UploadTestFileToRemoteFileStorage(string)

Uploads a test file containing the current UTC date and time as plaintext to the Azure Blob Storage.

[HttpGet]
[Route("upload-test-file-to-remote-file-storage")]
public Task<IActionResult> UploadTestFileToRemoteFileStorage(string containerName = "text-test")

Parameters

containerName string

Azure Blob Storage destination container name.

Returns

Task<IActionResult>

IActionResult

UploadTestImageFileToRemoteFileStorage(string, string)

Uploads a test image to the Azure Blob Storage.

[HttpGet]
[Route("upload-test-img-file-to-remote-file-storage")]
public Task<IActionResult> UploadTestImageFileToRemoteFileStorage(string containerName = "images-test", string localFilePath = "C:\\tmp\\psx.jpg")

Parameters

containerName string

Azure Blob Storage destination container name.

localFilePath string

The full path of the file to upload.

Returns

Task<IActionResult>

IActionResult

VerifyTestTotp(string, string)

Verifies a TOTP verification mail that was sent out using the /api/v1/test/send-test-email-totp endpoint.

[HttpGet]
[Route("validate-test-email-totp")]
public Task<IActionResult> VerifyTestTotp(string email, string totp)

Parameters

email string

Email address that received the TOTP to verify.

totp string

TOTP to verify.

Returns

Task<IActionResult>

IActionResult