Add controllers for the Get method #9

Merged
Wesser merged 33 commits from feat/controller-get into release/v1.0.0 2024-02-19 12:06:31 +03:00
3 changed files with 34 additions and 0 deletions
Showing only changes of commit a4dfccbc22 - Show all commits

View File

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Http;
using System;
using Microsoft.AspNetCore.Mvc;
namespace Mirea.Api.Endpoint.Common.Extensions;
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
public class BadRequestResponseAttribute() : ProducesResponseTypeAttribute(typeof(ErrorResponseVm), StatusCodes.Status400BadRequest);

View File

@ -0,0 +1,18 @@
namespace Mirea.Api.Endpoint.Common.Extensions;
/// <summary>
/// A class for providing information about an error
/// </summary>
public class ErrorResponseVm
{
/// <summary>
/// The text or translation code of the error. This field may not contain information in specific scenarios.
/// For example, it might be empty for HTTP 204 responses where no content is returned or if the validation texts have not been configured.
/// </summary>
public required string Error { get; set; }
/// <summary>
/// In addition to returning the response code in the header, it is also duplicated in this field.
/// Represents the HTTP response code.
/// </summary>
public required int Code { get; set; }
}

View File

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Http;
using System;
using Microsoft.AspNetCore.Mvc;
namespace Mirea.Api.Endpoint.Common.Extensions;
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
public class NotFoundResponseAttribute() : ProducesResponseTypeAttribute(typeof(ErrorResponseVm), StatusCodes.Status404NotFound);