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:
@@ -75,8 +75,23 @@ public class ReviewService : IReviewService
|
||||
await _db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<PagedResult<ReviewDto>> GetByLectureAsync(int lectureId, PaginationRequest pagination)
|
||||
public async Task<PagedResult<ReviewDto>> GetByLectureAsync(
|
||||
int lectureId,
|
||||
PaginationRequest pagination,
|
||||
int? currentUserId = null,
|
||||
bool isAdmin = false)
|
||||
{
|
||||
if (!isAdmin)
|
||||
{
|
||||
if (!currentUserId.HasValue)
|
||||
throw new ForbiddenException();
|
||||
|
||||
var lecture = await _db.Lectures.FirstOrDefaultAsync(l => l.Id == lectureId)
|
||||
?? throw new NotFoundException("Lecture", lectureId);
|
||||
if (lecture.TeacherId != currentUserId.Value)
|
||||
throw new ForbiddenException("Teacher can access reviews only for their own lectures.");
|
||||
}
|
||||
|
||||
var query = BaseQuery().Where(r => r.LectureId == lectureId);
|
||||
var total = await query.CountAsync();
|
||||
var items = await query.OrderByDescending(r => r.CreatedAt)
|
||||
|
||||
Reference in New Issue
Block a user