feat: перелопатил синхронизацию преподавателей
Backend CI / build-and-test (push) Failing after 13m11s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m12s
Frontend CI / build-and-check (push) Failing after 16m9s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m6s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m58s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m58s
Backend CI / build-and-test (push) Failing after 13m11s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Failing after 10m12s
Frontend CI / build-and-check (push) Failing after 16m9s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14m6s
🚀 Create and publish a Docker image / Build & publish backend image (push) Failing after 14m58s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Failing after 14m58s
This commit is contained in:
@@ -25,6 +25,7 @@ public class LecturesController : ControllerBase
|
||||
|
||||
private int CurrentUserId => int.Parse(
|
||||
User.FindFirstValue(ClaimTypes.NameIdentifier) ?? User.FindFirstValue("sub") ?? "0");
|
||||
private bool CurrentUserIsAdmin => User.IsInRole("Admin");
|
||||
|
||||
/// <summary>Получить каталог лекций с фильтрацией и пагинацией.</summary>
|
||||
/// <param name="filter">
|
||||
@@ -84,7 +85,7 @@ public class LecturesController : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<LectureDto>> Update(int id, [FromBody] UpdateLectureRequest req) =>
|
||||
Ok(await _lectures.UpdateAsync(id, req));
|
||||
Ok(await _lectures.UpdateAsync(id, req, CurrentUserId, CurrentUserIsAdmin));
|
||||
|
||||
/// <summary>Удалить лекцию по ID.</summary>
|
||||
/// <remarks>Только Admin. Каскадно удаляет записи и отзывы.</remarks>
|
||||
@@ -168,7 +169,7 @@ public class LecturesController : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> Attendance(int id, int userId, [FromBody] bool attended)
|
||||
{
|
||||
await _lectures.MarkAttendanceAsync(id, userId, attended);
|
||||
await _lectures.MarkAttendanceAsync(id, userId, attended, CurrentUserId, CurrentUserIsAdmin);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
@@ -187,7 +188,7 @@ public class LecturesController : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult> Enrollments(int id, [FromQuery] PaginationRequest pagination) =>
|
||||
Ok(await _lectures.GetEnrollmentsAsync(id, pagination));
|
||||
Ok(await _lectures.GetEnrollmentsAsync(id, pagination, CurrentUserId, CurrentUserIsAdmin));
|
||||
|
||||
/// <summary>Получить отзывы к лекции.</summary>
|
||||
/// <remarks>Только Admin или Teacher.</remarks>
|
||||
@@ -204,5 +205,5 @@ public class LecturesController : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult> Reviews(int id, [FromQuery] PaginationRequest pagination) =>
|
||||
Ok(await _reviews.GetByLectureAsync(id, pagination));
|
||||
Ok(await _reviews.GetByLectureAsync(id, pagination, CurrentUserId, CurrentUserIsAdmin));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public class UsersController : ControllerBase
|
||||
private int CurrentUserId => int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier) ?? User.FindFirstValue("sub") ?? "0");
|
||||
|
||||
private static CurrentUserDto ToCurrentUserDto(UserDto user) => new(
|
||||
user.Id,
|
||||
user.Email,
|
||||
user.DisplayName,
|
||||
user.AvatarUrl,
|
||||
|
||||
@@ -95,6 +95,7 @@ builder.Services.AddScoped<IGamificationService, GamificationService>();
|
||||
builder.Services.AddScoped<IAchievementService, AchievementService>();
|
||||
builder.Services.AddScoped<ILlmAnalysisService, LlmAnalysisService>();
|
||||
builder.Services.AddScoped<IScheduleSyncService, ScheduleSyncService>();
|
||||
builder.Services.AddScoped<IMicrosoftAuthClient, MicrosoftAuthClient>();
|
||||
builder.Services.AddScoped<INotificationService, NotificationService>();
|
||||
builder.Services.AddScoped<INotificationProvider, EmailNotificationProvider>();
|
||||
builder.Services.AddSingleton<INotificationScheduler, QuartzNotificationScheduler>();
|
||||
|
||||
@@ -5063,6 +5063,10 @@
|
||||
"CurrentUserDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
@@ -6010,6 +6014,10 @@
|
||||
"UserAuthDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
|
||||
Reference in New Issue
Block a user