forked from ddrilling/AsbCloudServer
Merge branch 'dev' into feature/nullable-enabled-2
This commit is contained in:
commit
c05e676c01
@ -52,5 +52,15 @@ namespace AsbCloudApp.Data
|
||||
/// Частый вопрос
|
||||
/// </summary>
|
||||
public bool IsFrequently { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Автор вопроса
|
||||
/// </summary>
|
||||
public string AurhorQuestionName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Автор ответа
|
||||
/// </summary>
|
||||
public string? AurhorAnswerName { get; set; }
|
||||
}
|
||||
}
|
||||
|
8087
AsbCloudDb/Migrations/20230504111955_Add_Permission_For_FaqStatistics.Designer.cs
generated
Normal file
8087
AsbCloudDb/Migrations/20230504111955_Add_Permission_For_FaqStatistics.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,65 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Add_Permission_For_FaqStatistics : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "t_permission",
|
||||
columns: new[] { "id", "description", "name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 516, "Разрешение просматривать статистику вопросов", "FaqStatistics.get" },
|
||||
{ 517, "Разрешение редактировать вопрос", "FaqStatistics.edit" },
|
||||
{ 518, "Разрешение удалять вопрос", "FaqStatistics.delete" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "t_relation_user_role_permission",
|
||||
columns: new[] { "id_permission", "id_user_role" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 516, 1 },
|
||||
{ 517, 1 },
|
||||
{ 518, 1 }
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 516, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 517, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 518, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
||||
keyValue: 516);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
||||
keyValue: 517);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
||||
keyValue: 518);
|
||||
}
|
||||
}
|
||||
}
|
@ -1978,6 +1978,24 @@ namespace AsbCloudDb.Migrations
|
||||
Id = 515,
|
||||
Description = "Разрешение удалять РТК",
|
||||
Name = "ProcessMap.delete"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 516,
|
||||
Description = "Разрешение просматривать статистику вопросов",
|
||||
Name = "FaqStatistics.get"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 517,
|
||||
Description = "Разрешение редактировать вопрос",
|
||||
Name = "FaqStatistics.edit"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 518,
|
||||
Description = "Разрешение удалять вопрос",
|
||||
Name = "FaqStatistics.delete"
|
||||
});
|
||||
});
|
||||
|
||||
@ -3508,6 +3526,21 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 515
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 516
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 517
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 518
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -145,6 +145,10 @@
|
||||
new (){ Id = 513, Name="ProcessMap.get", Description="Разрешение просматривать РТК"},
|
||||
new (){ Id = 514, Name="ProcessMap.edit", Description="Разрешение редактировать РТК"},
|
||||
new (){ Id = 515, Name="ProcessMap.delete", Description="Разрешение удалять РТК"},
|
||||
|
||||
new (){ Id = 516, Name="FaqStatistics.get", Description="Разрешение просматривать статистику вопросов"},
|
||||
new (){ Id = 517, Name="FaqStatistics.edit", Description="Разрешение редактировать вопрос"},
|
||||
new (){ Id = 518, Name="FaqStatistics.delete", Description="Разрешение удалять вопрос"},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,11 @@ namespace AsbCloudInfrastructure.Repository
|
||||
IsFrequently = o.IsFrequently,
|
||||
State = o.State,
|
||||
DateCreatedQuestion = o.DateCreatedQuestion,
|
||||
IdAuthorQuestion = o.IdAuthorQuestion,
|
||||
AurhorQuestionName = o.AuthorQuestion.MakeDisplayName(),
|
||||
AurhorAnswerName = (o.AuthorAnswer != null)
|
||||
? o.AuthorAnswer.MakeDisplayName()
|
||||
: string.Empty,
|
||||
});
|
||||
|
||||
|
||||
@ -74,6 +79,9 @@ namespace AsbCloudInfrastructure.Repository
|
||||
entity.DateCreatedQuestion = entity.DateLastEditedQuestion = DateTimeOffset.UtcNow;
|
||||
entity.CounterQuestion = 1;
|
||||
entity.State = Faq.StateOpened;
|
||||
if (!string.IsNullOrEmpty(entity.Answer))
|
||||
entity.IdAuthorAnswer = entity.IdAuthorQuestion;
|
||||
|
||||
|
||||
db.Faqs.Add(entity);
|
||||
|
||||
|
@ -32,7 +32,6 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<FaqDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFilteredAsync(
|
||||
[FromQuery] FaqRequest request,
|
||||
@ -49,7 +48,6 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(FaqDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertAsync(
|
||||
[FromBody] FaqDto faqDto,
|
||||
@ -64,6 +62,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateAsync([FromBody] FaqDto faqDto, CancellationToken token)
|
||||
{
|
||||
@ -83,7 +82,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentInvalidException"></exception>
|
||||
[HttpGet("merge")]
|
||||
[HttpPost("merge")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> MergeAsync(
|
||||
[FromQuery] int sourceId1,
|
||||
|
@ -1,8 +1,10 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -112,5 +114,35 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обновляет статус скважины
|
||||
/// </summary>
|
||||
/// <param name="idWell">ключ скважины</param>
|
||||
/// <param name="idState">статус: 0 - Неизвестно, 1 - В работе, 2 - Завершена.</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{idWell}/state")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateWellStateAsync(int idWell,
|
||||
[Range(0, 2, ErrorMessage = "Статус некорректен")] int idState,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null || !await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var dto = wellService.GetOrDefault(idWell)!;
|
||||
dto.IdState = idState;
|
||||
|
||||
var result = await wellService.UpdateAsync(dto, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return Ok(result);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user