Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,4 @@ StyleCop.Cache
swagger-codegen
hwproj.front/static_dist/
hwproj.front/dist/
.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ public SolutionsController(ISolutionsServiceClient solutionsClient, IAuthService
}

[HttpGet("{solutionId}")]
[Authorize]
Comment thread
KirillBorisovich marked this conversation as resolved.
Outdated
[ProducesResponseType(typeof(Solution), (int)HttpStatusCode.OK)]
public async Task<IActionResult> GetSolutionById(long solutionId)
{
var result = await _solutionsClient.GetSolutionById(solutionId);
if (result.StudentId != UserId && !User.IsInRole(Roles.LecturerRole))
{
return Forbid();
}

return result == null
? NotFound()
: Ok(result);
Expand Down Expand Up @@ -429,6 +435,7 @@ public async Task<IActionResult> RateSolution(long solutionId,
}

[HttpGet("actuality/{solutionId}")]
[Authorize]
[ProducesResponseType(typeof(SolutionActualityDto), (int)HttpStatusCode.OK)]
public async Task<IActionResult> GetSolutionActuality(long solutionId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public async Task<IActionResult> GetLecturersStatistics(long courseId)
}

[HttpGet("{courseId}")]
[Authorize]
[ProducesResponseType(typeof(StatisticsCourseMatesModel[]), (int)HttpStatusCode.OK)]
public async Task<IActionResult> GetCourseStatistics(long courseId)
{
Expand Down Expand Up @@ -85,6 +86,7 @@ public async Task<IActionResult> GetCourseStatistics(long courseId)
}

[HttpGet("{courseId}/charts")]
[Authorize]
[ProducesResponseType(typeof(AdvancedCourseStatisticsViewModel), (int)HttpStatusCode.OK)]
public async Task<IActionResult> GetChartStatistics(long courseId)
{
Expand Down
2 changes: 1 addition & 1 deletion HwProj.AuthService/HwProj.AuthService.API/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
"DefaultConnectionForWindows": "Server=(localdb)\\mssqllocaldb;Database=AuthServiceDB;Trusted_Connection=True;TrustServerCertificate=true;",
"DefaultConnectionForLinux": "Server=localhost,1433;Database=AuthServiceDB;User ID=SA;Password=password_1234;"
"DefaultConnectionForLinux": "Server=localhost,1433;Database=AuthServiceDB;User ID=SA;Password=password_1234;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
Expand Down
3 changes: 2 additions & 1 deletion HwProj.Common/HwProj.Common.Net8/ConnectionString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public static class ConnectionString
{
public static string GetConnectionString(IConfiguration configuration)
{
var option = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
var option = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
Comment on lines 11 to 12
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эти изменения тут не нужны уже, видимо?

? "DefaultConnectionForLinux"
: "DefaultConnectionForWindows";
return configuration.GetConnectionString(option) ?? "";
Expand Down
3 changes: 2 additions & 1 deletion HwProj.Common/HwProj.Utils/Configuration/ConnectionString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public static class ConnectionString
{
public static string GetConnectionString(IConfiguration configuration)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return configuration.GetConnectionString("DefaultConnectionForLinux");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
"DefaultConnectionForWindows": "Server=(localdb)\\mssqllocaldb;Database=ContentServiceDB;Trusted_Connection=True;TrustServerCertificate=true;",
"DefaultConnectionForLinux": "Server=localhost,1433;Database=ContentServiceDB;User ID=SA;Password=password_1234;"
"DefaultConnectionForLinux": "Server=localhost,1433;Database=ContentServiceDB;User ID=SA;Password=password_1234;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
"DefaultConnectionForWindows": "Server=(localdb)\\mssqllocaldb;Database=NotificationsServiceDB;Trusted_Connection=True;TrustServerCertificate=true;MultipleActiveResultSets=True",
"DefaultConnectionForLinux": "Server=localhost,1433;Database=NotificationsServiceDB;User ID=SA;Password=password_1234;"
"DefaultConnectionForLinux": "Server=localhost,1433;Database=NotificationsServiceDB;User ID=SA;Password=password_1234;TrustServerCertificate=True;"
},
"Logging": {
"LogLevel": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AutoMapper;
using HwProj.CoursesService.Client;
using HwProj.Models.CoursesService;
using HwProj.Models.CoursesService.ViewModels;
using HwProj.Models.SolutionsService;
using HwProj.Models.StatisticsService;
using HwProj.SolutionsService.API.Domains;
using HwProj.SolutionsService.API.Models;
using HwProj.SolutionsService.API.Repositories;
using HwProj.SolutionsService.API.Services;
using HwProj.Utils.Auth;
using HwProj.Utils.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace HwProj.SolutionsService.API.Controllers
{
[Route("api/[controller]")]
[Authorize(AuthenticationSchemes = AuthSchemeConstants.UserIdAuthentication)]
[ApiController]
public class SolutionsController : Controller
{
Expand Down