feat: add controller
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m23s
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m23s
This commit is contained in:
parent
29485368f8
commit
ee2351b5ed
37
ApiDto/Requests/ScheduleRequest.cs
Normal file
37
ApiDto/Requests/ScheduleRequest.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
namespace Mirea.Api.Dto.Requests;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a request object for retrieving schedules based on various filters.
|
||||||
|
/// </summary>
|
||||||
|
public class ScheduleRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an array of group IDs.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This array can contain null values.</remarks>
|
||||||
|
public int[]? Groups { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether to retrieve schedules for even weeks.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This property can contain null.</remarks>
|
||||||
|
public bool? IsEven { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an array of discipline IDs.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This array can contain null values.</remarks>
|
||||||
|
public int[]? Disciplines { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an array of professor IDs.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This array can contain null values.</remarks>
|
||||||
|
public int[]? Professors { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an array of lecture hall IDs.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This array can contain null values.</remarks>
|
||||||
|
public int[]? LectureHalls { get; set; } = null;
|
||||||
|
}
|
106
ApiDto/Responses/Schedule/DisciplineScheduleResponse.cs
Normal file
106
ApiDto/Responses/Schedule/DisciplineScheduleResponse.cs
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Dto.Responses.Schedule;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents information about a specific schedule entry for a professor.
|
||||||
|
/// </summary>
|
||||||
|
public class DisciplineScheduleInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the day of the week for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public DayOfWeek DayOfWeek { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the pair number for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int PairNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the pair is on an even week.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public bool IsEven { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of occupation for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
|
||||||
|
public required string Group { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int GroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LectureHalls { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> LectureHallsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Professors { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> ProfessorsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Campus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> CampusId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the links to online meetings for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LinkToMeet { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response containing schedule information for a professor.
|
||||||
|
/// </summary>
|
||||||
|
public class DisciplineScheduleResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the discipline.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Discipline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the discipline.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int DisciplineId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the schedules for the professor.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required IEnumerable<DisciplineScheduleInfo> Schedules { get; set; }
|
||||||
|
}
|
106
ApiDto/Responses/Schedule/GroupScheduleResponse.cs
Normal file
106
ApiDto/Responses/Schedule/GroupScheduleResponse.cs
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Dto.Responses.Schedule;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents information about a specific schedule entry for a group.
|
||||||
|
/// </summary>
|
||||||
|
public class GroupScheduleInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the day of the week for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public DayOfWeek DayOfWeek { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the pair number for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int PairNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the pair is on an even week.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public bool IsEven { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Discipline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int DisciplineId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of occupation for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LectureHalls { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> LectureHallsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Professors { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> ProfessorsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Campus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> CampusId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the links to online meetings for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LinkToMeet { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response containing schedule information for a group.
|
||||||
|
/// </summary>
|
||||||
|
public class GroupScheduleResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the group.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Group { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the group.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int GroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the schedules for the group.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required IEnumerable<GroupScheduleInfo> Schedules { get; set; }
|
||||||
|
}
|
105
ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs
Normal file
105
ApiDto/Responses/Schedule/LectureHallScheduleResponse.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Dto.Responses.Schedule;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents information about a specific schedule entry for a lecture hall.
|
||||||
|
/// </summary>
|
||||||
|
public class LectureHallScheduleInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the day of the week for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public DayOfWeek DayOfWeek { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the pair number for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int PairNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the pair is on an even week.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public bool IsEven { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Discipline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int DisciplineId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of occupation for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Group { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int GroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Campus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> CampusId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Professors { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> ProfessorsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the links to online meetings for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LinkToMeet { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response containing schedule information for a lecture hall.
|
||||||
|
/// </summary>
|
||||||
|
public class LectureHallScheduleResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the lecture halls.
|
||||||
|
/// </summary>
|
||||||
|
public required string LectureHalls { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the lecture halls.
|
||||||
|
/// </summary>
|
||||||
|
public required int LectureHallsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the schedules for the lecture hall.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required IEnumerable<LectureHallScheduleInfo> Schedules { get; set; }
|
||||||
|
}
|
108
ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs
Normal file
108
ApiDto/Responses/Schedule/ProfessorScheduleResponse.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Dto.Responses.Schedule;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents information about a specific schedule entry for a professor.
|
||||||
|
/// </summary>
|
||||||
|
public class ProfessorScheduleInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the day of the week for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public DayOfWeek DayOfWeek { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the pair number for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int PairNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the pair is on an even week.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public bool IsEven { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Discipline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int DisciplineId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of occupation for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
|
||||||
|
public required string Group { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int GroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LectureHalls { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> LectureHallsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Campus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> CampusId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the links to online meetings for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LinkToMeet { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response containing schedule information for a professor.
|
||||||
|
/// </summary>
|
||||||
|
public class ProfessorScheduleResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the professor.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Professor { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the professor.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int ProfessorId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the schedules for the professor.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required IEnumerable<ProfessorScheduleInfo> Schedules { get; set; }
|
||||||
|
}
|
94
ApiDto/Responses/Schedule/ScheduleResponse.cs
Normal file
94
ApiDto/Responses/Schedule/ScheduleResponse.cs
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Dto.Responses.Schedule;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a response object containing schedule information.
|
||||||
|
/// </summary>
|
||||||
|
public class ScheduleResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the day of the week for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public DayOfWeek DayOfWeek { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the pair number for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int PairNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the pair is on an even week.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public bool IsEven { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Discipline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the discipline for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int DisciplineId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of occupation for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string TypeOfOccupation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Group { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the group for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required int GroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LectureHalls { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the lecture halls for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> LectureHallsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Professors { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the professors for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> ProfessorsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the names of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> Campus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IDs of the campuses for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<int?> CampusId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the links to online meetings for the schedule entry.
|
||||||
|
/// </summary>
|
||||||
|
public required IEnumerable<string?> LinkToMeet { get; set; }
|
||||||
|
}
|
304
Endpoint/Controllers/V1/ScheduleController.cs
Normal file
304
Endpoint/Controllers/V1/ScheduleController.cs
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
using MediatR;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Mirea.Api.DataAccess.Application.Cqrs.Schedule.Queries.GetScheduleList;
|
||||||
|
using Mirea.Api.Dto.Requests;
|
||||||
|
using Mirea.Api.Dto.Responses;
|
||||||
|
using Mirea.Api.Dto.Responses.Schedule;
|
||||||
|
using Mirea.Api.Endpoint.Common.Attributes;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||||
|
|
||||||
|
public class ScheduleController(IMediator mediator) : BaseControllerV1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves schedules based on various filters.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The request object containing filter criteria.</param>
|
||||||
|
/// <returns>A list of schedules matching the filter criteria.</returns>
|
||||||
|
[HttpPost]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[BadRequestResponse]
|
||||||
|
[NotFoundResponse]
|
||||||
|
public async Task<ActionResult<List<ScheduleResponse>>> Get([FromBody] ScheduleRequest request)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ((request.Groups == null || !request.Groups.Any()) &&
|
||||||
|
(request.Disciplines == null || !request.Disciplines.Any()) &&
|
||||||
|
(request.Professors == null || !request.Professors.Any()) &&
|
||||||
|
(request.LectureHalls == null || !request.LectureHalls.Any()))
|
||||||
|
{
|
||||||
|
return BadRequest(new ErrorResponse()
|
||||||
|
{
|
||||||
|
Error = "At least one of the arguments must be selected."
|
||||||
|
+ (request.IsEven.HasValue
|
||||||
|
? $" \"{nameof(request.IsEven)}\" is not a strong argument"
|
||||||
|
: string.Empty),
|
||||||
|
Code = StatusCodes.Status400BadRequest
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = (await mediator.Send(new GetScheduleListQuery()
|
||||||
|
{
|
||||||
|
IsEven = request.IsEven,
|
||||||
|
DisciplineIds = request.Disciplines,
|
||||||
|
GroupIds = request.Groups,
|
||||||
|
LectureHallIds = request.LectureHalls,
|
||||||
|
ProfessorIds = request.Professors
|
||||||
|
})).Schedules;
|
||||||
|
|
||||||
|
if (result.Count == 0) NoContent();
|
||||||
|
|
||||||
|
return Ok(result.Select(s => new ScheduleResponse()
|
||||||
|
{
|
||||||
|
DayOfWeek = s.DayOfWeek,
|
||||||
|
PairNumber = s.PairNumber,
|
||||||
|
IsEven = s.IsEven,
|
||||||
|
Discipline = s.Discipline,
|
||||||
|
DisciplineId = s.DisciplineId,
|
||||||
|
TypeOfOccupation = s.TypeOfOccupation,
|
||||||
|
Group = s.Group,
|
||||||
|
GroupId = s.GroupId,
|
||||||
|
LectureHalls = s.LectureHalls,
|
||||||
|
LectureHallsId = s.LectureHallsId,
|
||||||
|
Professors = s.Professors,
|
||||||
|
ProfessorsId = s.ProfessorsId,
|
||||||
|
Campus = s.Campus,
|
||||||
|
CampusId = s.CampusId,
|
||||||
|
LinkToMeet = s.LinkToMeet
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves schedules for a specific group based on various filters.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The ID of the group.</param>
|
||||||
|
/// <param name="isEven">A value indicating whether to retrieve schedules for even weeks.</param>
|
||||||
|
/// <param name="disciplines">An array of discipline IDs.</param>
|
||||||
|
/// <param name="professors">An array of professor IDs.</param>
|
||||||
|
/// <param name="lectureHalls">An array of lecture hall IDs.</param>
|
||||||
|
/// <returns>A response containing schedules for the specified group.</returns>
|
||||||
|
[HttpGet("{id:int}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[BadRequestResponse]
|
||||||
|
[NotFoundResponse]
|
||||||
|
public async Task<ActionResult<GroupScheduleResponse>> GetByGroup(int id,
|
||||||
|
[FromQuery] bool? isEven = null,
|
||||||
|
[FromQuery] int[]? disciplines = null,
|
||||||
|
[FromQuery] int[]? professors = null,
|
||||||
|
[FromQuery] int[]? lectureHalls = null)
|
||||||
|
|
||||||
|
{
|
||||||
|
var result = (await mediator.Send(new GetScheduleListQuery()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
TypeOfOccupation = g.TypeOfOccupation,
|
||||||
|
LectureHalls = g.LectureHalls,
|
||||||
|
LectureHallsId = g.LectureHallsId,
|
||||||
|
Professors = g.Professors,
|
||||||
|
ProfessorsId = g.ProfessorsId,
|
||||||
|
Campus = g.Campus,
|
||||||
|
CampusId = g.CampusId,
|
||||||
|
LinkToMeet = g.LinkToMeet
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves schedules for a specific professor based on various filters.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The ID of the professor.</param>
|
||||||
|
/// <param name="isEven">A value indicating whether to retrieve schedules for even weeks.</param>
|
||||||
|
/// <param name="disciplines">An array of discipline IDs.</param>
|
||||||
|
/// <param name="groups">An array of group IDs.</param>
|
||||||
|
/// <param name="lectureHalls">An array of lecture hall IDs.</param>
|
||||||
|
/// <returns>A response containing schedules for the specified professor.</returns>
|
||||||
|
[HttpGet("{id:int}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[BadRequestResponse]
|
||||||
|
[NotFoundResponse]
|
||||||
|
public async Task<ActionResult<ProfessorScheduleResponse>> GetByProfessor(int id,
|
||||||
|
[FromQuery] bool? isEven = null,
|
||||||
|
[FromQuery] int[]? disciplines = null,
|
||||||
|
[FromQuery] int[]? groups = null,
|
||||||
|
[FromQuery] int[]? lectureHalls = null)
|
||||||
|
|
||||||
|
{
|
||||||
|
var result = (await mediator.Send(new GetScheduleListQuery()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
TypeOfOccupation = p.TypeOfOccupation,
|
||||||
|
Group = p.Group,
|
||||||
|
GroupId = p.GroupId,
|
||||||
|
LectureHalls = p.LectureHalls,
|
||||||
|
LectureHallsId = p.LectureHallsId,
|
||||||
|
Campus = p.Campus,
|
||||||
|
CampusId = p.CampusId,
|
||||||
|
LinkToMeet = p.LinkToMeet
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves schedules for a specific lecture hall based on various filters.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The ID of the lecture hall.</param>
|
||||||
|
/// <param name="isEven">A value indicating whether to retrieve schedules for even weeks.</param>
|
||||||
|
/// <param name="disciplines">An array of discipline IDs.</param>
|
||||||
|
/// <param name="professors">An array of professor IDs.</param>
|
||||||
|
/// <param name="groups">An array of group IDs.</param>
|
||||||
|
/// <returns>A response containing schedules for the specified lecture hall.</returns>
|
||||||
|
[HttpGet("{id:int}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[BadRequestResponse]
|
||||||
|
[NotFoundResponse]
|
||||||
|
public async Task<ActionResult<LectureHallScheduleResponse>> GetByLectureHall(int id,
|
||||||
|
[FromQuery] bool? isEven = null,
|
||||||
|
[FromQuery] int[]? disciplines = null,
|
||||||
|
[FromQuery] int[]? groups = null,
|
||||||
|
[FromQuery] int[]? professors = null)
|
||||||
|
|
||||||
|
{
|
||||||
|
var result = (await mediator.Send(new GetScheduleListQuery()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
TypeOfOccupation = l.TypeOfOccupation,
|
||||||
|
Group = l.Group,
|
||||||
|
GroupId = l.GroupId,
|
||||||
|
Professors = l.Professors,
|
||||||
|
ProfessorsId = l.ProfessorsId,
|
||||||
|
Campus = l.Campus,
|
||||||
|
CampusId = l.CampusId,
|
||||||
|
LinkToMeet = l.LinkToMeet
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves schedules for a specific discipline based on various filters.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The ID of the discipline.</param>
|
||||||
|
/// <param name="isEven">A value indicating whether to retrieve schedules for even weeks.</param>
|
||||||
|
/// <param name="groups">An array of group IDs.</param>
|
||||||
|
/// <param name="professors">An array of professor IDs.</param>
|
||||||
|
/// <param name="lectureHalls">An array of lecture hall IDs.</param>
|
||||||
|
/// <returns>A response containing schedules for the specified discipline.</returns>
|
||||||
|
[HttpGet("{id:int}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[BadRequestResponse]
|
||||||
|
[NotFoundResponse]
|
||||||
|
public async Task<ActionResult<DisciplineScheduleResponse>> GetByDiscipline(int id,
|
||||||
|
[FromQuery] bool? isEven = null,
|
||||||
|
[FromQuery] int[]? groups = null,
|
||||||
|
[FromQuery] int[]? professors = null,
|
||||||
|
[FromQuery] int[]? lectureHalls = null)
|
||||||
|
|
||||||
|
{
|
||||||
|
var result = (await mediator.Send(new GetScheduleListQuery()
|
||||||
|
{
|
||||||
|
IsEven = isEven,
|
||||||
|
DisciplineIds = [id],
|
||||||
|
GroupIds = groups,
|
||||||
|
LectureHallIds = [id],
|
||||||
|
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.TypeOfOccupation,
|
||||||
|
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
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user