Skip to content

Commit 0f27a89

Browse files
committed
fixed indents
1 parent 65fbd77 commit 0f27a89

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

Gordon360/Controllers/ScheduleController.cs

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,72 +11,72 @@
1111
using System.Threading.Tasks;
1212
namespace Gordon360.Controllers;
1313

14-
[Route("api/[controller]")]
15-
public class ScheduleController(IScheduleService scheduleService) : GordonControllerBase
14+
[Route("api/[controller]")]
15+
public class ScheduleController(IScheduleService scheduleService) : GordonControllerBase
16+
{
17+
/// <summary>
18+
/// Gets all session objects for a user
19+
/// </summary>
20+
/// <returns>A IEnumerable of session objects as well as the schedules</returns>
21+
[HttpGet]
22+
[Route("{username}/allcourses")]
23+
[Obsolete("This method is deprecated. Use '/{username}/allcourses-by-term' which is grouped by term.")]
24+
public async Task<ActionResult<CoursesBySessionViewModel>> GetAllCourses(string username)
1625
{
17-
/// <summary>
18-
/// Gets all session objects for a user
19-
/// </summary>
20-
/// <returns>A IEnumerable of session objects as well as the schedules</returns>
21-
[HttpGet]
22-
[Route("{username}/allcourses")]
23-
[Obsolete("This method is deprecated. Use '/{username}/allcourses-by-term' which is grouped by term.")]
24-
public async Task<ActionResult<CoursesBySessionViewModel>> GetAllCourses(string username)
25-
{
26-
var groups = AuthUtils.GetGroups(User);
27-
var authenticatedUsername = AuthUtils.GetUsername(User);
28-
29-
IEnumerable<CoursesBySessionViewModel> result;
30-
if (authenticatedUsername.EqualsIgnoreCase(username) || groups.Contains(AuthGroup.FacStaff))
31-
{
32-
result = await scheduleService.GetAllCoursesAsync(username);
33-
}
34-
else
35-
{
36-
result = await scheduleService.GetAllInstructorCoursesAsync(username);
37-
}
26+
var groups = AuthUtils.GetGroups(User);
27+
var authenticatedUsername = AuthUtils.GetUsername(User);
3828

39-
return Ok(result);
29+
IEnumerable<CoursesBySessionViewModel> result;
30+
if (authenticatedUsername.EqualsIgnoreCase(username) || groups.Contains(AuthGroup.FacStaff))
31+
{
32+
result = await scheduleService.GetAllCoursesAsync(username);
4033
}
41-
42-
/// <summary>
43-
/// Gets all term objects for a user — only includes published schedules
44-
/// </summary>
45-
/// <returns>A IEnumerable of term objects with their schedules</returns>
46-
[HttpGet]
47-
[Route("{username}/allcourses-by-term")]
48-
[StateYourBusiness(operation = Operation.READ_ONE, resource = Resource.STUDENT_SCHEDULE)]
49-
public async Task<ActionResult<IEnumerable<CoursesByTermViewModel>>> GetAllCoursesByTerm(string username)
34+
else
5035
{
51-
var groups = AuthUtils.GetGroups(User);
52-
var authenticatedUsername = AuthUtils.GetUsername(User);
36+
result = await scheduleService.GetAllInstructorCoursesAsync(username);
37+
}
5338

54-
IEnumerable<CoursesByTermViewModel> result;
55-
if (authenticatedUsername.EqualsIgnoreCase(username) || groups.Contains(AuthGroup.FacStaff))
56-
{
57-
result = await scheduleService.GetAllCoursesByTermAsync(username);
58-
}
59-
else
60-
{
61-
result = await scheduleService.GetAllInstructorCoursesByTermAsync(username);
62-
}
39+
return Ok(result);
40+
}
6341

64-
// Filter only published terms
65-
var publishedResult = result
66-
.Where(r => r.ShowOnWeb?.Equals("Y", StringComparison.OrdinalIgnoreCase) == true)
67-
.ToList();
68-
return Ok(publishedResult);
69-
}
42+
/// <summary>
43+
/// Gets all term objects for a user — only includes published schedules
44+
/// </summary>
45+
/// <returns>A IEnumerable of term objects with their schedules</returns>
46+
[HttpGet]
47+
[Route("{username}/allcourses-by-term")]
48+
[StateYourBusiness(operation = Operation.READ_ONE, resource = Resource.STUDENT_SCHEDULE)]
49+
public async Task<ActionResult<IEnumerable<CoursesByTermViewModel>>> GetAllCoursesByTerm(string username)
50+
{
51+
var groups = AuthUtils.GetGroups(User);
52+
var authenticatedUsername = AuthUtils.GetUsername(User);
7053

71-
/// <summary>
72-
/// Get whether the currently logged-in user can read student schedules
73-
/// </summary>
74-
/// <returns>Whether they can read student schedules</returns>
75-
[HttpGet]
76-
[Route("canreadstudent")]
77-
public async Task<ActionResult<bool>> GetCanReadStudentSchedules()
54+
IEnumerable<CoursesByTermViewModel> result;
55+
if (authenticatedUsername.EqualsIgnoreCase(username) || groups.Contains(AuthGroup.FacStaff))
56+
{
57+
result = await scheduleService.GetAllCoursesByTermAsync(username);
58+
}
59+
else
7860
{
79-
var groups = AuthUtils.GetGroups(User);
80-
return groups.Contains(AuthGroup.Advisors);
61+
result = await scheduleService.GetAllInstructorCoursesByTermAsync(username);
8162
}
63+
64+
// Filter only published terms
65+
var publishedResult = result
66+
.Where(r => r.ShowOnWeb?.Equals("Y", StringComparison.OrdinalIgnoreCase) == true)
67+
.ToList();
68+
return Ok(publishedResult);
69+
}
70+
71+
/// <summary>
72+
/// Get whether the currently logged-in user can read student schedules
73+
/// </summary>
74+
/// <returns>Whether they can read student schedules</returns>
75+
[HttpGet]
76+
[Route("canreadstudent")]
77+
public async Task<ActionResult<bool>> GetCanReadStudentSchedules()
78+
{
79+
var groups = AuthUtils.GetGroups(User);
80+
return groups.Contains(AuthGroup.Advisors);
8281
}
82+
}

0 commit comments

Comments
 (0)