Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using HwProj.APIGateway.API.Models.Solutions;
using HwProj.AuthService.Client;
using HwProj.CoursesService.Client;
using HwProj.Models.AuthService.DTO;
using HwProj.Models.CoursesService;
using HwProj.Models.CoursesService.DTO;
using HwProj.Models.CoursesService.ViewModels;
Expand Down Expand Up @@ -38,7 +37,7 @@ public SolutionsController(ISolutionsServiceClient solutionsClient, IAuthService
}

[HttpGet("{solutionId}")]
[ProducesResponseType(typeof(Solution), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(SolutionDto), (int)HttpStatusCode.OK)]
public async Task<IActionResult> GetSolutionById(long solutionId)
{
var result = await _solutionsClient.GetSolutionById(solutionId);
Expand Down Expand Up @@ -78,7 +77,7 @@ public async Task<IActionResult> GetStudentSolution(long taskId, string studentI

var mentorIds = studentSolutions.Values
.SelectMany(t => t.Tasks)
.SelectMany(t => t.Solution)
.SelectMany(t => t.Solutions)
.Select(t => t.LecturerId ?? "")
.Where(x => x != "")
.Distinct()
Expand All @@ -88,7 +87,7 @@ public async Task<IActionResult> GetStudentSolution(long taskId, string studentI

var solutionsGroupsIds = studentSolutions.Values
.SelectMany(t => t.Tasks)
.First(x => x.Id == taskId).Solution
.First(x => x.Id == taskId).Solutions
.Select(s => s.GroupId)
.Distinct()
.ToList();
Expand Down Expand Up @@ -120,7 +119,7 @@ public async Task<IActionResult> GetStudentSolution(long taskId, string studentI
Title = task.Title,
Tags = task.Tags,
TaskId = task.Id.ToString(),
Solutions = t.Solution.Select(s => new GetSolutionModel(s,
Solutions = t.Solutions.Select(s => new GetSolutionModel(s,
s.TaskId == taskId && s.GroupId is { } groupId
? solutionsGroups[groupId].StudentsIds
.Select(x => accountsCache[x])
Expand Down
1 change: 0 additions & 1 deletion HwProj.APIGateway/HwProj.APIGateway.API/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ COPY ["Directory.Build.props", "Directory.Build.props"]
COPY ["HwProj.APIGateway/HwProj.APIGateway.API/", "HwProj.APIGateway/HwProj.APIGateway.API/"]
COPY ["HwProj.NotificationsService/HwProj.NotificationsService.Client/", "HwProj.NotificationsService/HwProj.NotificationsService.Client/"]
COPY ["HwProj.Common/HwProj.Models/", "HwProj.Common/HwProj.Models/"]
COPY ["HwProj.Common/HwProj.Repositories/", "HwProj.Common/HwProj.Repositories/"]
COPY ["HwProj.Common/HwProj.HttpUtils/", "HwProj.Common/HwProj.HttpUtils/"]
COPY ["HwProj.Common/HwProj.Utils/", "HwProj.Common/HwProj.Utils/"]
COPY ["HwProj.EventBus/HwProj.EventBus.Client/", "HwProj.EventBus/HwProj.EventBus.Client/"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using HwProj.Models.AuthService.DTO;
using HwProj.Models.StatisticsService;
using HwProj.Models.SolutionsService;

namespace HwProj.APIGateway.API.Models.Statistics;

Expand All @@ -11,5 +11,5 @@ public class StatisticsCourseMatesModel
public string Name { get; set; }
public string Surname { get; set; }
public AccountDataDto[] Reviewers { get; set; } = Array.Empty<AccountDataDto>();
public List<StatisticsCourseHomeworksModel> Homeworks { get; set; } = new();
public List<StudentSolutionsTableHomeworkDto> Homeworks { get; set; } = new();
}
1 change: 0 additions & 1 deletion HwProj.AuthService/HwProj.AuthService.API/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ COPY ["Directory.Build.props", "Directory.Build.props"]
COPY ["HwProj.AuthService/HwProj.AuthService.API/", "HwProj.AuthService/HwProj.AuthService.API/"]
COPY ["HwProj.Common/HwProj.Common.Net8/", "HwProj.Common/HwProj.Common.Net8/"]
COPY ["HwProj.Common/HwProj.Models/", "HwProj.Common/HwProj.Models/"]
COPY ["HwProj.Common/HwProj.Repositories/", "HwProj.Common/HwProj.Repositories/"]
COPY ["HwProj.Common/HwProj.Repositories.Net8/", "HwProj.Common/HwProj.Repositories.Net8/"]
COPY ["HwProj.EventBus/HwProj.EventBus.Client/", "HwProj.EventBus/HwProj.EventBus.Client/"]
COPY ["HwProj.NotificationsService/HwProj.NotificationService.Events/", "HwProj.NotificationsService/HwProj.NotificationService.Events/"]
Expand Down
9 changes: 9 additions & 0 deletions HwProj.Common/HwProj.Common.Net8/AuthExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Http;

namespace HwProj.Common.Net8;

public static class AuthExtensions
{
public static string? GetUserIdFromHeader(this HttpRequest request) =>
request.Headers.TryGetValue("UserId", out var id) ? id.FirstOrDefault() : null;
}
5 changes: 1 addition & 4 deletions HwProj.Common/HwProj.Models/HwProj.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
<PackageReference Include="File.TypeChecker" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\HwProj.Repositories\HwProj.Repositories.csproj" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace HwProj.Models.SolutionsService
{
public class GetSolutionModel
{
public GetSolutionModel(Solution model, AccountDataDto[]? groupMates, AccountDataDto? lecturer)
public GetSolutionModel(SolutionDto model, AccountDataDto[]? groupMates, AccountDataDto? lecturer)
{
Id = model.Id;
GithubUrl = model.GithubUrl;
Expand Down
21 changes: 21 additions & 0 deletions HwProj.Common/HwProj.Models/SolutionsService/SolutionDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace HwProj.Models.SolutionsService
{
public class SolutionDto
{
public long Id { get; set; }
public string GithubUrl { get; set; }
public string Comment { get; set; }
public SolutionState State { get; set; }
public int Rating { get; set; }
public string StudentId { get; set; }
public string? LecturerId { get; set; }
public long? GroupId { get; set; }
public long TaskId { get; set; }
public DateTime PublicationDate { get; set; }
public bool IsModified { get; set; }
public DateTime? RatingDate { get; set; }
public string LecturerComment { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace HwProj.Models.SolutionsService
{
public class StudentSolutions
public class StudentSolutionsDto
{
public string StudentId { get; set; }
public Solution[] Solutions { get; set; }
public SolutionDto[] Solutions { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;

namespace HwProj.Models.SolutionsService
{
public class StudentSolutionsTableDto
{
public string StudentId { get; set; }
public List<StudentSolutionsTableHomeworkDto> Homeworks { get; set; }
}

public class StudentSolutionsTableHomeworkDto
{
public long Id { get; set; }
public List<StudentSolutionsTableTaskDto> Tasks { get; set; } = new List<StudentSolutionsTableTaskDto>();
}

public class StudentSolutionsTableTaskDto
{
public long Id { get; set; }
public List<SolutionDto> Solutions { get; set; } = new List<SolutionDto>();
}
}

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion HwProj.ContentService/HwProj.ContentService.API/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ COPY ["HwProj.ContentService/HwProj.ContentService.API/", "HwProj.ContentService
COPY ["HwProj.Common/HwProj.Utils/", "HwProj.Common/HwProj.Utils/"]
COPY ["HwProj.EventBus/HwProj.EventBus.Client/", "HwProj.EventBus/HwProj.EventBus.Client/"]
COPY ["HwProj.Common/HwProj.Models/", "HwProj.Common/HwProj.Models/"]
COPY ["HwProj.Common/HwProj.Repositories/", "HwProj.Common/HwProj.Repositories/"]

WORKDIR "/src/HwProj.ContentService/HwProj.ContentService.API"
RUN dotnet publish "HwProj.ContentService.API.csproj" -c Release -o /app/publish
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using HwProj.ContentService.API.Models.Enums;
using HwProj.Repositories;

namespace HwProj.ContentService.API.Models.Database;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace HwProj.CoursesService.API
{
public class ApplicationProfile : Profile
public class AutomapperProfile : Profile
{
public ApplicationProfile()
public AutomapperProfile()
{
CreateMap<Course, CreateCourseViewModel>().ReverseMap();
CreateMap<Course, UpdateCourseViewModel>().ReverseMap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using System.Threading.Tasks;
using AutoMapper;
using HwProj.CoursesService.API.Filters;
using HwProj.CoursesService.API.Models;
using HwProj.CoursesService.API.Services;
using HwProj.Models.CoursesService.ViewModels;
using HwProj.Utils.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Net;
using HwProj.Common.Net8;
using HwProj.CoursesService.API.Repositories;
using HwProj.Models.CoursesService.DTO;
using Microsoft.EntityFrameworkCore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using HwProj.Models;
using HwProj.Models.CoursesService.ViewModels;
using HwProj.Models.Roles;
using HwProj.Utils.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Linq;
using System.Threading.Tasks;
using HwProj.Common.Net8;

namespace HwProj.CoursesService.API.Controllers
{
Expand Down
8 changes: 4 additions & 4 deletions HwProj.CoursesService/HwProj.CoursesService.API/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src

COPY ["Directory.Build.props", "Directory.Build.props"]
Expand All @@ -7,8 +7,8 @@ COPY ["HwProj.CoursesService/HwProj.CoursesService.API/", "HwProj.CoursesService
COPY ["HwProj.Common/HwProj.Utils/", "HwProj.Common/HwProj.Utils/"]
COPY ["HwProj.Common/HwProj.Exceptions/", "HwProj.Common/HwProj.Exceptions/"]
COPY ["HwProj.EventBus/HwProj.EventBus.Client/", "HwProj.EventBus/HwProj.EventBus.Client/"]
COPY ["HwProj.Common/HwProj.Models/", "HwProj.Common/HwProj.Models/"]
COPY ["HwProj.Common/HwProj.Repositories/", "HwProj.Common/HwProj.Repositories/"]
COPY ["HwProj.Common/HwProj.Common.Net8/", "HwProj.Common/HwProj.Common.Net8/"]
COPY ["HwProj.Common/HwProj.Repositories.Net8/", "HwProj.Common/HwProj.Repositories.Net8/"]
COPY ["HwProj.AuthService/HwProj.AuthService.Client/", "HwProj.AuthService/HwProj.AuthService.Client/"]
COPY ["HwProj.ContentService/HwProj.ContentService.Client/", "HwProj.ContentService/HwProj.ContentService.Client/"]
COPY ["HwProj.Common/HwProj.HttpUtils/", "HwProj.Common/HwProj.HttpUtils/"]
Expand All @@ -17,7 +17,7 @@ COPY ["HwProj.NotificationsService/HwProj.NotificationService.Events/", "HwProj.
WORKDIR "/src/HwProj.CoursesService/HwProj.CoursesService.API"
RUN dotnet publish "HwProj.CoursesService.API.csproj" -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS final
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app

COPY --from=build /app/publish .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using HwProj.Models.CoursesService;
using HwProj.Models.CoursesService.DTO;
using Microsoft.EntityFrameworkCore.Internal;
using CriterionType = HwProj.Models.CoursesService.ViewModels.CriterionType;

namespace HwProj.CoursesService.API.Domains
Expand Down Expand Up @@ -147,7 +146,7 @@ public static Homework ToHomework(this CreateHomeworkViewModel homework)
IsDeadlineStrict = homework.IsDeadlineStrict,
PublicationDate = homework.PublicationDate,
Tasks = homework.Tasks.Select(t => t.ToHomeworkTask()).ToList(),
Tags = homework.Tags.Join(";"),
Tags = string.Join(";", homework.Tags),
};

public static CourseTemplate ToCourseTemplate(this CreateCourseViewModel createCourseViewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using HwProj.Common.Net8;
using HwProj.Models.CoursesService;
using HwProj.Models.CoursesService.ViewModels;
using HwProj.Utils.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>$(CSharpLanguageVersion)</LangVersion>
<Nullable>$(NullableReferenceTypes)</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0">
<PackageReference Include="AutoMapper" Version="15.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\HwProj.Common\HwProj.Common.Net8\HwProj.Common.Net8.csproj" />
<ProjectReference Include="..\..\HwProj.Common\HwProj.Exceptions\HwProj.Exceptions.csproj" />
<ProjectReference Include="..\..\HwProj.Common\HwProj.Repositories.Net8\HwProj.Repositories.Net8.csproj" />
<ProjectReference Include="..\..\HwProj.NotificationsService\HwProj.NotificationService.Events\HwProj.NotificationService.Events.csproj" />
<ProjectReference Include="..\..\HwProj.ContentService\HwProj.ContentService.Client\HwProj.ContentService.Client.csproj" />
<ProjectReference Include="..\..\HwProj.AuthService\HwProj.AuthService.Client\HwProj.AuthService.Client.csproj" />
<ProjectReference Include="..\..\HwProj.Common\HwProj.Repositories\HwProj.Repositories.csproj" />
<ProjectReference Include="..\..\HwProj.Common\HwProj.Utils\HwProj.Utils.csproj" />
<ProjectReference Include="..\..\HwProj.NotificationsService\HwProj.NotificationService.Events\HwProj.NotificationService.Events.csproj" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties properties_4launchsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
using HwProj.Repositories;
using HwProj.Repositories.Net8;

namespace HwProj.CoursesService.API.Models
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HwProj.Repositories;
using HwProj.Repositories.Net8;

namespace HwProj.CoursesService.API.Models
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HwProj.CoursesService.API.Services;
using HwProj.Repositories;
using HwProj.Repositories.Net8;
using Newtonsoft.Json;

namespace HwProj.CoursesService.API.Models
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
using HwProj.Repositories;
using HwProj.Repositories.Net8;

namespace HwProj.CoursesService.API.Models
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using HwProj.Repositories;
using HwProj.Repositories.Net8;

namespace HwProj.CoursesService.API.Models
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HwProj.Repositories;
using HwProj.Repositories.Net8;

namespace HwProj.CoursesService.API.Models
{
Expand Down
Loading
Loading