From f5739647b2e1bef4a2e0c9f2acf52805155f1ee0 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Mon, 7 Oct 2024 02:45:38 +0300 Subject: [PATCH] refactor: remove default produce 200 code --- Endpoint/Controllers/V1/CampusController.cs | 3 --- Endpoint/Controllers/V1/DisciplineController.cs | 3 --- Endpoint/Controllers/V1/FacultyController.cs | 3 --- Endpoint/Controllers/V1/GroupController.cs | 4 ---- Endpoint/Controllers/V1/LectureHallController.cs | 4 ---- Endpoint/Controllers/V1/ProfessorController.cs | 3 --- Endpoint/Controllers/V1/ScheduleController.cs | 6 ------ 7 files changed, 26 deletions(-) diff --git a/Endpoint/Controllers/V1/CampusController.cs b/Endpoint/Controllers/V1/CampusController.cs index c0f22f9..ddfcf5f 100644 --- a/Endpoint/Controllers/V1/CampusController.cs +++ b/Endpoint/Controllers/V1/CampusController.cs @@ -1,6 +1,5 @@ using Asp.Versioning; using MediatR; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Mirea.Api.DataAccess.Application.Cqrs.Campus.Queries.GetCampusBasicInfoList; using Mirea.Api.DataAccess.Application.Cqrs.Campus.Queries.GetCampusDetails; @@ -21,7 +20,6 @@ public class CampusController(IMediator mediator) : BaseController /// /// Basic information about campuses. [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] public async Task>> Get() { var result = await mediator.Send(new GetCampusBasicInfoListQuery()); @@ -42,7 +40,6 @@ public class CampusController(IMediator mediator) : BaseController /// Campus ID. /// Details of the specified campus. [HttpGet("{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task> GetDetails(int id) diff --git a/Endpoint/Controllers/V1/DisciplineController.cs b/Endpoint/Controllers/V1/DisciplineController.cs index d0528aa..e02b94d 100644 --- a/Endpoint/Controllers/V1/DisciplineController.cs +++ b/Endpoint/Controllers/V1/DisciplineController.cs @@ -1,6 +1,5 @@ using Asp.Versioning; using MediatR; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Mirea.Api.DataAccess.Application.Cqrs.Discipline.Queries.GetDisciplineDetails; using Mirea.Api.DataAccess.Application.Cqrs.Discipline.Queries.GetDisciplineList; @@ -23,7 +22,6 @@ public class DisciplineController(IMediator mediator) : BaseController /// Number of items per page. /// Paginated list of disciplines. [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize) { @@ -48,7 +46,6 @@ public class DisciplineController(IMediator mediator) : BaseController /// Discipline ID. /// Details of the specified discipline. [HttpGet("{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task> GetDetails(int id) diff --git a/Endpoint/Controllers/V1/FacultyController.cs b/Endpoint/Controllers/V1/FacultyController.cs index 6e0ffda..56c88ad 100644 --- a/Endpoint/Controllers/V1/FacultyController.cs +++ b/Endpoint/Controllers/V1/FacultyController.cs @@ -1,6 +1,5 @@ using Asp.Versioning; using MediatR; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyDetails; using Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyList; @@ -23,7 +22,6 @@ public class FacultyController(IMediator mediator) : BaseController /// Number of items per page. /// Paginated list of faculties. [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize) { @@ -49,7 +47,6 @@ public class FacultyController(IMediator mediator) : BaseController /// Faculty ID. /// Details of the specified faculty. [HttpGet("{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task> GetDetails(int id) diff --git a/Endpoint/Controllers/V1/GroupController.cs b/Endpoint/Controllers/V1/GroupController.cs index d0daa28..ebac4cb 100644 --- a/Endpoint/Controllers/V1/GroupController.cs +++ b/Endpoint/Controllers/V1/GroupController.cs @@ -1,6 +1,5 @@ using Asp.Versioning; using MediatR; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Mirea.Api.DataAccess.Application.Cqrs.Group.Queries.GetGroupDetails; using Mirea.Api.DataAccess.Application.Cqrs.Group.Queries.GetGroupList; @@ -37,7 +36,6 @@ public class GroupController(IMediator mediator) : BaseController /// The page size for pagination (optional). /// A list of groups. [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize) { @@ -64,7 +62,6 @@ public class GroupController(IMediator mediator) : BaseController /// The ID of the group to retrieve. /// Detailed information about the group. [HttpGet("{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task> GetDetails(int id) @@ -90,7 +87,6 @@ public class GroupController(IMediator mediator) : BaseController /// The ID of the faculty. /// A list of groups belonging to the specified faculty. [HttpGet("GetByFaculty/{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task>> GetByFaculty(int id) diff --git a/Endpoint/Controllers/V1/LectureHallController.cs b/Endpoint/Controllers/V1/LectureHallController.cs index d8fb077..d648128 100644 --- a/Endpoint/Controllers/V1/LectureHallController.cs +++ b/Endpoint/Controllers/V1/LectureHallController.cs @@ -1,6 +1,5 @@ using Asp.Versioning; using MediatR; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Mirea.Api.DataAccess.Application.Cqrs.LectureHall.Queries.GetLectureHallDetails; using Mirea.Api.DataAccess.Application.Cqrs.LectureHall.Queries.GetLectureHallList; @@ -21,7 +20,6 @@ public class LectureHallController(IMediator mediator) : BaseController /// /// A list of lecture halls. [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] public async Task>> Get() { var result = await mediator.Send(new GetLectureHallListQuery()); @@ -42,7 +40,6 @@ public class LectureHallController(IMediator mediator) : BaseController /// The ID of the lecture hall to retrieve. /// The details of the specified lecture hall. [HttpGet("{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task> GetDetails(int id) @@ -68,7 +65,6 @@ public class LectureHallController(IMediator mediator) : BaseController /// The ID of the campus. /// A list of lecture halls in the specified campus. [HttpGet("GetByCampus/{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task>> GetByCampus(int id) diff --git a/Endpoint/Controllers/V1/ProfessorController.cs b/Endpoint/Controllers/V1/ProfessorController.cs index 46b1794..8b1a58d 100644 --- a/Endpoint/Controllers/V1/ProfessorController.cs +++ b/Endpoint/Controllers/V1/ProfessorController.cs @@ -1,6 +1,5 @@ using Asp.Versioning; using MediatR; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Mirea.Api.DataAccess.Application.Cqrs.Professor.Queries.GetProfessorDetails; using Mirea.Api.DataAccess.Application.Cqrs.Professor.Queries.GetProfessorList; @@ -23,7 +22,6 @@ public class ProfessorController(IMediator mediator) : BaseController /// The page size for pagination (optional). /// A list of professors. [HttpGet] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] public async Task>> Get([FromQuery] int? page, [FromQuery] int? pageSize) { @@ -49,7 +47,6 @@ public class ProfessorController(IMediator mediator) : BaseController /// The ID of the professor to retrieve. /// Detailed information about the professor. [HttpGet("{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [BadRequestResponse] [NotFoundResponse] public async Task> GetDetails(int id) diff --git a/Endpoint/Controllers/V1/ScheduleController.cs b/Endpoint/Controllers/V1/ScheduleController.cs index bcac4d2..a3fec0a 100644 --- a/Endpoint/Controllers/V1/ScheduleController.cs +++ b/Endpoint/Controllers/V1/ScheduleController.cs @@ -35,10 +35,8 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotThe request object containing filter criteria. /// A list of schedules matching the filter criteria. [HttpPost] - [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] [BadRequestResponse] - [NotFoundResponse] public async Task>> Get([FromBody] ScheduleRequest request) { if ((request.Groups == null || request.Groups.Length == 0) && @@ -100,7 +98,6 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of lecture hall IDs. /// A response containing schedules for the specified group. [HttpGet("GetByGroup/{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] [BadRequestResponse] [NotFoundResponse] @@ -128,7 +125,6 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of lecture hall IDs. /// A response containing schedules for the specified professor. [HttpGet("GetByProfessor/{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] [BadRequestResponse] [NotFoundResponse] @@ -156,7 +152,6 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of group IDs. /// A response containing schedules for the specified lecture hall. [HttpGet("GetByLectureHall/{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] [BadRequestResponse] [NotFoundResponse] @@ -184,7 +179,6 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshotAn array of lecture hall IDs. /// A response containing schedules for the specified discipline. [HttpGet("GetByDiscipline/{id:int}")] - [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] [BadRequestResponse] [NotFoundResponse]