diff --git a/ApiDto/Responses/Schedule/DisciplineScheduleResponse.cs b/ApiDto/Responses/Schedule/DisciplineScheduleResponse.cs
deleted file mode 100644
index ffc5578..0000000
--- a/ApiDto/Responses/Schedule/DisciplineScheduleResponse.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Mirea.Api.Dto.Responses.Schedule;
-
-///
-/// Represents information about a specific schedule entry for a professor.
-///
-public class DisciplineScheduleInfo
-{
- ///
- /// Gets or sets the day of the week for the schedule entry.
- ///
- [Required]
- public DayOfWeek DayOfWeek { get; set; }
-
- ///
- /// Gets or sets the pair number for the schedule entry.
- ///
- [Required]
- public int PairNumber { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the pair is on an even week.
- ///
- [Required]
- public bool IsEven { get; set; }
-
- ///
- /// Gets or sets the type of occupation for the schedule entry.
- ///
- [Required]
- public required IEnumerable TypeOfOccupation { get; set; }
-
- ///
- /// Gets or sets the names of the group for the schedule entry.
- ///
- [Required]
-
- public required string Group { get; set; }
- ///
- /// Gets or sets the IDs of the group for the schedule entry.
- ///
- [Required]
- public required int GroupId { get; set; }
-
- ///
- /// Gets or sets the names of the lecture halls for the schedule entry.
- ///
- public required IEnumerable LectureHalls { get; set; }
-
- ///
- /// Gets or sets the IDs of the lecture halls for the schedule entry.
- ///
- public required IEnumerable LectureHallsId { get; set; }
-
- ///
- /// Gets or sets the names of the professors for the schedule entry.
- ///
- public required IEnumerable Professors { get; set; }
-
- ///
- /// Gets or sets the IDs of the professors for the schedule entry.
- ///
- public required IEnumerable ProfessorsId { get; set; }
-
- ///
- /// Gets or sets the names of the campuses for the schedule entry.
- ///
- public required IEnumerable Campus { get; set; }
-
- ///
- /// Gets or sets the IDs of the campuses for the schedule entry.
- ///
- public required IEnumerable CampusId { get; set; }
-
- ///
- /// Gets or sets the links to online meetings for the schedule entry.
- ///
- public required IEnumerable LinkToMeet { get; set; }
-}
-
-///
-/// Represents a response containing schedule information for a professor.
-///
-public class DisciplineScheduleResponse
-{
- ///
- /// Gets or sets the name of the discipline.
- ///
- [Required]
- public required string Discipline { get; set; }
-
- ///
- /// Gets or sets the ID of the discipline.
- ///
- [Required]
- public required int DisciplineId { get; set; }
-
- ///
- /// Gets or sets the schedules for the professor.
- ///
- [Required]
- public required IEnumerable Schedules { get; set; }
-}
diff --git a/ApiDto/Responses/Schedule/GroupScheduleResponse.cs b/ApiDto/Responses/Schedule/GroupScheduleResponse.cs
deleted file mode 100644
index f3ee2f2..0000000
--- a/ApiDto/Responses/Schedule/GroupScheduleResponse.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Mirea.Api.Dto.Responses.Schedule;
-
-///
-/// Represents information about a specific schedule entry for a group.
-///
-public class GroupScheduleInfo
-{
- ///
- /// Gets or sets the day of the week for the schedule entry.
- ///
- [Required]
- public DayOfWeek DayOfWeek { get; set; }
-
- ///
- /// Gets or sets the pair number for the schedule entry.
- ///
- [Required]
- public int PairNumber { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the pair is on an even week.
- ///
- [Required]
- public bool IsEven { get; set; }
-
- ///
- /// Gets or sets the name of the discipline for the schedule entry.
- ///
- [Required]
- public required string Discipline { get; set; }
-
- ///
- /// Gets or sets the ID of the discipline for the schedule entry.
- ///
- [Required]
- public required int DisciplineId { get; set; }
-
- ///
- /// Gets or sets exclude or include weeks for a specific discipline.
- ///
- ///
- /// If is , then the values in show the weeks when there will be no discipline.
- ///
- /// If is , then the values in indicate the weeks during which a particular discipline will be studied.
- ///
- /// If is , then there are no specific
- ///
- ///
- public bool? IsExcludedWeeks { get; set; }
-
- ///
- /// The week numbers required for the correct display of the schedule.
- ///
- /// Whether there will be during the week or not depends on the property.
- ///
- ///
- /// To get the current week's number, use other queries.
- ///
- public IEnumerable? Weeks { get; set; }
-
- ///
- /// Gets or sets the type of occupation for the schedule entry.
- ///
- [Required]
- public required IEnumerable TypeOfOccupations { get; set; }
-
- ///
- /// Gets or sets the names of the lecture halls for the schedule entry.
- ///
- public required IEnumerable LectureHalls { get; set; }
-
- ///
- /// Gets or sets the IDs of the lecture halls for the schedule entry.
- ///
- public required IEnumerable LectureHallsId { get; set; }
-
- ///
- /// Gets or sets the names of the professors for the schedule entry.
- ///
- public required IEnumerable Professors { get; set; }
-
- ///
- /// Gets or sets the IDs of the professors for the schedule entry.
- ///
- public required IEnumerable ProfessorsId { get; set; }
-
- ///
- /// Gets or sets the names of the campuses for the schedule entry.
- ///
- public required IEnumerable Campus { get; set; }
-
- ///
- /// Gets or sets the IDs of the campuses for the schedule entry.
- ///
- public required IEnumerable CampusId { get; set; }
-
- ///
- /// Gets or sets the links to online meetings for the schedule entry.
- ///
- public required IEnumerable LinkToMeet { get; set; }
-}
-
-///
-/// Represents a response containing schedule information for a group.
-///
-public class GroupScheduleResponse
-{
- ///
- /// Gets or sets the name of the group.
- ///
- [Required]
- public required string Group { get; set; }
-
- ///
- /// Gets or sets the ID of the group.
- ///
- [Required]
- public required int GroupId { get; set; }
-
- ///
- /// Gets or sets the schedules for the group.
- ///
- [Required]
- public required IEnumerable Schedules { get; set; }
-}
diff --git a/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs b/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs
deleted file mode 100644
index 84adb3c..0000000
--- a/ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Mirea.Api.Dto.Responses.Schedule;
-
-///
-/// Represents information about a specific schedule entry for a lecture hall.
-///
-public class LectureHallScheduleInfo
-{
- ///
- /// Gets or sets the day of the week for the schedule entry.
- ///
- [Required]
- public DayOfWeek DayOfWeek { get; set; }
-
- ///
- /// Gets or sets the pair number for the schedule entry.
- ///
- [Required]
- public int PairNumber { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the pair is on an even week.
- ///
- [Required]
- public bool IsEven { get; set; }
-
- ///
- /// Gets or sets the name of the discipline for the schedule entry.
- ///
- [Required]
- public required string Discipline { get; set; }
-
- ///
- /// Gets or sets the ID of the discipline for the schedule entry.
- ///
- [Required]
- public required int DisciplineId { get; set; }
-
- ///
- /// Gets or sets exclude or include weeks for a specific discipline.
- ///
- ///
- /// If is , then the values in show the weeks when there will be no discipline.
- ///
- /// If is , then the values in indicate the weeks during which a particular discipline will be studied.
- ///
- /// If is , then there are no specific
- ///
- ///
-
- public bool? IsExcludedWeeks { get; set; }
- ///
- /// The week numbers required for the correct display of the schedule.
- ///
- /// Whether there will be during the week or not depends on the property.
- ///
- ///
- /// To get the current week's number, use other queries.
- ///
- public IEnumerable? Weeks { get; set; }
-
- ///
- /// Gets or sets the type of occupation for the schedule entry.
- ///
- [Required]
- public required IEnumerable TypeOfOccupations { get; set; }
-
- ///
- /// Gets or sets the names of the group for the schedule entry.
- ///
- [Required]
- public required string Group { get; set; }
- ///
- /// Gets or sets the IDs of the group for the schedule entry.
- ///
- [Required]
- public required int GroupId { get; set; }
-
- ///
- /// Gets or sets the names of the campuses for the schedule entry.
- ///
- public required IEnumerable Campus { get; set; }
-
- ///
- /// Gets or sets the IDs of the campuses for the schedule entry.
- ///
- public required IEnumerable CampusId { get; set; }
-
- ///
- /// Gets or sets the names of the professors for the schedule entry.
- ///
- public required IEnumerable Professors { get; set; }
-
- ///
- /// Gets or sets the IDs of the professors for the schedule entry.
- ///
- public required IEnumerable ProfessorsId { get; set; }
-
- ///
- /// Gets or sets the links to online meetings for the schedule entry.
- ///
- public required IEnumerable LinkToMeet { get; set; }
-}
-
-///
-/// Represents a response containing schedule information for a lecture hall.
-///
-public class LectureHallScheduleResponse
-{
- ///
- /// Gets or sets the names of the lecture halls.
- ///
- public required string LectureHalls { get; set; }
-
- ///
- /// Gets or sets the IDs of the lecture halls.
- ///
- public required int LectureHallsId { get; set; }
-
- ///
- /// Gets or sets the schedules for the lecture hall.
- ///
- [Required]
- public required IEnumerable Schedules { get; set; }
-}
diff --git a/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs b/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs
deleted file mode 100644
index b25711e..0000000
--- a/ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Mirea.Api.Dto.Responses.Schedule;
-
-///
-/// Represents information about a specific schedule entry for a professor.
-///
-public class ProfessorScheduleInfo
-{
- ///
- /// Gets or sets the day of the week for the schedule entry.
- ///
- [Required]
- public DayOfWeek DayOfWeek { get; set; }
-
- ///
- /// Gets or sets the pair number for the schedule entry.
- ///
- [Required]
- public int PairNumber { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the pair is on an even week.
- ///
- [Required]
- public bool IsEven { get; set; }
-
- ///
- /// Gets or sets the name of the discipline for the schedule entry.
- ///
- [Required]
- public required string Discipline { get; set; }
-
- ///
- /// Gets or sets the ID of the discipline for the schedule entry.
- ///
- [Required]
- public required int DisciplineId { get; set; }
-
- ///
- /// Gets or sets exclude or include weeks for a specific discipline.
- ///
- ///
- /// If is , then the values in show the weeks when there will be no discipline.
- ///
- /// If is , then the values in indicate the weeks during which a particular discipline will be studied.
- ///
- /// If is , then there are no specific
- ///
- ///
-
- public bool? IsExcludedWeeks { get; set; }
- ///
- /// The week numbers required for the correct display of the schedule.
- ///
- /// Whether there will be during the week or not depends on the property.
- ///
- ///
- /// To get the current week's number, use other queries.
- ///
- public IEnumerable? Weeks { get; set; }
-
- ///
- /// Gets or sets the type of occupation for the schedule entry.
- ///
- [Required]
- public required IEnumerable TypeOfOccupations { get; set; }
-
- ///
- /// Gets or sets the names of the group for the schedule entry.
- ///
- [Required]
-
- public required string Group { get; set; }
- ///
- /// Gets or sets the IDs of the group for the schedule entry.
- ///
- [Required]
- public required int GroupId { get; set; }
-
- ///
- /// Gets or sets the names of the lecture halls for the schedule entry.
- ///
- public required IEnumerable LectureHalls { get; set; }
-
- ///
- /// Gets or sets the IDs of the lecture halls for the schedule entry.
- ///
- public required IEnumerable LectureHallsId { get; set; }
-
- ///
- /// Gets or sets the names of the campuses for the schedule entry.
- ///
- public required IEnumerable Campus { get; set; }
-
- ///
- /// Gets or sets the IDs of the campuses for the schedule entry.
- ///
- public required IEnumerable CampusId { get; set; }
-
- ///
- /// Gets or sets the links to online meetings for the schedule entry.
- ///
- public required IEnumerable LinkToMeet { get; set; }
-}
-
-///
-/// Represents a response containing schedule information for a professor.
-///
-public class ProfessorScheduleResponse
-{
- ///
- /// Gets or sets the name of the professor.
- ///
- [Required]
- public required string Professor { get; set; }
-
- ///
- /// Gets or sets the ID of the professor.
- ///
- [Required]
- public required int ProfessorId { get; set; }
-
- ///
- /// Gets or sets the schedules for the professor.
- ///
- [Required]
- public required IEnumerable Schedules { get; set; }
-}
diff --git a/ApiDto/Responses/Schedule/ScheduleResponse.cs b/ApiDto/Responses/ScheduleResponse.cs
similarity index 98%
rename from ApiDto/Responses/Schedule/ScheduleResponse.cs
rename to ApiDto/Responses/ScheduleResponse.cs
index 599cc3e..71462b9 100644
--- a/ApiDto/Responses/Schedule/ScheduleResponse.cs
+++ b/ApiDto/Responses/ScheduleResponse.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-namespace Mirea.Api.Dto.Responses.Schedule;
+namespace Mirea.Api.Dto.Responses;
///
/// Represents a response object containing schedule information.
@@ -50,8 +50,8 @@ public class ScheduleResponse
/// If is , then there are no specific
///
///
-
public bool? IsExcludedWeeks { get; set; }
+
///
/// The week numbers required for the correct display of the schedule.
///
diff --git a/Endpoint/Controllers/V1/ScheduleController.cs b/Endpoint/Controllers/V1/ScheduleController.cs
index 904e3d2..81bc283 100644
--- a/Endpoint/Controllers/V1/ScheduleController.cs
+++ b/Endpoint/Controllers/V1/ScheduleController.cs
@@ -6,7 +6,6 @@ using Mirea.Api.DataAccess.Application.Cqrs.Schedule.Queries.GetScheduleList;
using Mirea.Api.Dto.Common;
using Mirea.Api.Dto.Requests;
using Mirea.Api.Dto.Responses;
-using Mirea.Api.Dto.Responses.Schedule;
using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Services;
using Mirea.Api.Endpoint.Configuration.General;
@@ -53,7 +52,7 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot new ScheduleResponse()
+ return Ok(result.Select(s => new ScheduleResponse
{
DayOfWeek = s.DayOfWeek,
PairNumber = s.PairNumber,
@@ -84,7 +83,6 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot
@@ -101,48 +99,19 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot> GetByGroup(int id,
+ public async Task>> GetByGroup(int id,
[FromQuery] bool? isEven = null,
[FromQuery] int[]? disciplines = null,
[FromQuery] int[]? professors = null,
- [FromQuery] int[]? lectureHalls = null)
-
+ [FromQuery] int[]? lectureHalls = null) =>
+ await Get(new ScheduleRequest
{
- var result = (await mediator.Send(new GetScheduleListQuery()
- {
+ Disciplines = disciplines,
IsEven = isEven,
- DisciplineIds = disciplines,
- GroupIds = [id],
- LectureHallIds = lectureHalls,
- ProfessorIds = professors
- })).Schedules;
-
- if (result.Count == 0) NoContent();
-
- return Ok(new GroupScheduleResponse()
- {
- Group = result[0].Group,
- GroupId = result[0].GroupId,
- Schedules = result.Select(g => new GroupScheduleInfo()
- {
- DayOfWeek = g.DayOfWeek,
- PairNumber = g.PairNumber,
- IsEven = g.IsEven,
- Discipline = g.Discipline,
- DisciplineId = g.DisciplineId,
- IsExcludedWeeks = g.IsExcludedWeeks,
- Weeks = g.Weeks,
- TypeOfOccupations = g.TypeOfOccupations,
- LectureHalls = g.LectureHalls,
- LectureHallsId = g.LectureHallsId,
- Professors = g.Professors,
- ProfessorsId = g.ProfessorsId,
- Campus = g.Campus,
- CampusId = g.CampusId,
- LinkToMeet = g.LinkToMeet
- })
+ Groups = [id],
+ Professors = professors,
+ LectureHalls = lectureHalls
});
- }
///
/// Retrieves schedules for a specific professor based on various filters.
@@ -158,52 +127,19 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot> GetByProfessor(int id,
+ public async Task>> GetByProfessor(int id,
[FromQuery] bool? isEven = null,
[FromQuery] int[]? disciplines = null,
[FromQuery] int[]? groups = null,
- [FromQuery] int[]? lectureHalls = null)
-
+ [FromQuery] int[]? lectureHalls = null) =>
+ await Get(new ScheduleRequest
{
- var result = (await mediator.Send(new GetScheduleListQuery()
- {
+ Disciplines = disciplines,
IsEven = isEven,
- DisciplineIds = disciplines,
- GroupIds = groups,
- LectureHallIds = lectureHalls,
- ProfessorIds = [id]
- })).Schedules;
-
- if (result.Count == 0) NoContent();
-
- return Ok(new ProfessorScheduleResponse()
- {
- Professor = result.Select(professor =>
- professor.Professors.FirstOrDefault(x => !string.IsNullOrEmpty(x))
- ).First()!,
- ProfessorId = result.Select(professor =>
- professor.ProfessorsId.FirstOrDefault(x => x != null)
- ).First()!.Value,
- Schedules = result.Select(p => new ProfessorScheduleInfo()
- {
- DayOfWeek = p.DayOfWeek,
- PairNumber = p.PairNumber,
- IsEven = p.IsEven,
- Discipline = p.Discipline,
- DisciplineId = p.DisciplineId,
- IsExcludedWeeks = p.IsExcludedWeeks,
- Weeks = p.Weeks,
- TypeOfOccupations = p.TypeOfOccupations,
- Group = p.Group,
- GroupId = p.GroupId,
- LectureHalls = p.LectureHalls,
- LectureHallsId = p.LectureHallsId,
- Campus = p.Campus,
- CampusId = p.CampusId,
- LinkToMeet = p.LinkToMeet
- })
+ Groups = groups,
+ Professors = [id],
+ LectureHalls = lectureHalls
});
- }
///
/// Retrieves schedules for a specific lecture hall based on various filters.
@@ -219,52 +155,19 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot> GetByLectureHall(int id,
+ public async Task>> GetByLectureHall(int id,
[FromQuery] bool? isEven = null,
[FromQuery] int[]? disciplines = null,
[FromQuery] int[]? groups = null,
- [FromQuery] int[]? professors = null)
-
+ [FromQuery] int[]? professors = null) =>
+ await Get(new ScheduleRequest
{
- var result = (await mediator.Send(new GetScheduleListQuery()
- {
+ Disciplines = disciplines,
IsEven = isEven,
- DisciplineIds = disciplines,
- GroupIds = groups,
- LectureHallIds = [id],
- ProfessorIds = professors
- })).Schedules;
-
- if (result.Count == 0) NoContent();
-
- return Ok(new LectureHallScheduleResponse()
- {
- LectureHalls = result.Select(lectureHall =>
- lectureHall.LectureHalls.FirstOrDefault(x => !string.IsNullOrEmpty(x))
- ).First()!,
- LectureHallsId = result.Select(lectureHall =>
- lectureHall.LectureHallsId.FirstOrDefault(x => x != null)
- ).First()!.Value,
- Schedules = result.Select(l => new LectureHallScheduleInfo()
- {
- DayOfWeek = l.DayOfWeek,
- PairNumber = l.PairNumber,
- IsEven = l.IsEven,
- Discipline = l.Discipline,
- DisciplineId = l.DisciplineId,
- IsExcludedWeeks = l.IsExcludedWeeks,
- Weeks = l.Weeks,
- TypeOfOccupations = l.TypeOfOccupations,
- Group = l.Group,
- GroupId = l.GroupId,
- Professors = l.Professors,
- ProfessorsId = l.ProfessorsId,
- Campus = l.Campus,
- CampusId = l.CampusId,
- LinkToMeet = l.LinkToMeet
- })
+ Groups = groups,
+ Professors = professors,
+ LectureHalls = [id]
});
- }
///
/// Retrieves schedules for a specific discipline based on various filters.
@@ -280,44 +183,17 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot> GetByDiscipline(int id,
+ public async Task>> GetByDiscipline(int id,
[FromQuery] bool? isEven = null,
[FromQuery] int[]? groups = null,
[FromQuery] int[]? professors = null,
- [FromQuery] int[]? lectureHalls = null)
-
+ [FromQuery] int[]? lectureHalls = null) =>
+ await Get(new ScheduleRequest
{
- var result = (await mediator.Send(new GetScheduleListQuery()
- {
+ Disciplines = [id],
IsEven = isEven,
- DisciplineIds = [id],
- GroupIds = groups,
- LectureHallIds = lectureHalls,
- ProfessorIds = professors
- })).Schedules;
-
- if (result.Count == 0) NoContent();
-
- return Ok(new DisciplineScheduleResponse()
- {
- Discipline = result[0].Discipline,
- DisciplineId = result[0].DisciplineId,
- Schedules = result.Select(d => new DisciplineScheduleInfo()
- {
- DayOfWeek = d.DayOfWeek,
- PairNumber = d.PairNumber,
- IsEven = d.IsEven,
- TypeOfOccupation = d.TypeOfOccupations,
- Group = d.Group,
- GroupId = d.GroupId,
- LectureHalls = d.LectureHalls,
- LectureHallsId = d.LectureHallsId,
- Professors = d.Professors,
- ProfessorsId = d.ProfessorsId,
- Campus = d.Campus,
- CampusId = d.CampusId,
- LinkToMeet = d.LinkToMeet
- })
+ Groups = groups,
+ Professors = professors,
+ LectureHalls = lectureHalls
});
- }
-}
\ No newline at end of file
+ }
\ No newline at end of file