Ajout des codes de retour pour les deux controllers
continuous-integration/drone/push Build is failing Details

pull/29/head
Maxime SAPOUNTZIS 1 year ago
parent ffcf615bfc
commit c8c2c969db

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Shared;
@ -19,6 +20,8 @@ namespace API.Controllers
}
[HttpGet("inquiries/{page}/{number}")]
[ProducesResponseType(typeof(InquiryDTO), 200)]
[ProducesResponseType(typeof(string), 204)]
public IActionResult GetInquiries(int page, int number)
{
var nbInquiry = _inquiryUserService.GetInquiries(page, number).Count();
@ -32,6 +35,8 @@ namespace API.Controllers
}
[HttpGet("inquiry/id/{id}")]
[ProducesResponseType(typeof(InquiryDTO), 200)]
[ProducesResponseType(typeof(string), 404)]
public IActionResult GetInquiryById(int id)
{
try
@ -47,6 +52,8 @@ namespace API.Controllers
}
[HttpGet("inquiry/title/{title}")]
[ProducesResponseType(typeof(InquiryDTO), 200)]
[ProducesResponseType(typeof(string), 404)]
public IActionResult GetInquiryByTitle(string title)
{
try

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Shared;
@ -21,6 +22,8 @@ namespace API.Controllers
}
[HttpGet("users/{page}/{number}")]
[ProducesResponseType(typeof(UserDTO), 200)]
[ProducesResponseType(typeof(string), 204)]
public IActionResult GetUsers(int page, int number)
{
var getUsers = new InClassName(page, number);
@ -38,6 +41,8 @@ namespace API.Controllers
}
[HttpGet("user/id/{id}")]
[ProducesResponseType(typeof(UserDTO), 200)]
[ProducesResponseType(typeof(string), 404)]
public IActionResult GetUserById(int id)
{
try
@ -52,6 +57,8 @@ namespace API.Controllers
}
[HttpGet("user/username/{username}")]
[ProducesResponseType(typeof(UserDTO), 200)]
[ProducesResponseType(typeof(string), 404)]
public IActionResult GetUserByUsername(string username)
{
try
@ -67,6 +74,8 @@ namespace API.Controllers
}
[HttpDelete]
[ProducesResponseType(typeof(UserDTO), 200)]
[ProducesResponseType(typeof(string), 404)]
public IActionResult DeleteUser(int id)
{
var success = _userUserService.DeleteUser(id);
@ -83,6 +92,8 @@ namespace API.Controllers
}
[HttpPost]
[ProducesResponseType(typeof(UserDTO), 201)]
[ProducesResponseType(typeof(string), 400)]
public IActionResult CreateUser([FromBody]UserDTO dto)
{
if (dto.Username == null || dto.Password == null || dto.Email == null)
@ -95,6 +106,10 @@ namespace API.Controllers
}
[HttpPut]
[ProducesResponseType(typeof(UserDTO), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
public IActionResult UpdateUser(int id, [FromBody] UserDTO userDTO)
{
if(id != userDTO.Id)

Loading…
Cancel
Save