feat(dal,api): В таблицу истории роботов, добавлено поле RobotId. Обновлены методы в api для ведения истории роботов.
This commit is contained in:
@@ -2,14 +2,19 @@
|
||||
|
||||
namespace PARR.API.Contracts.V1.Requests
|
||||
{
|
||||
public class RobotHistoryRequest
|
||||
public record RobotHistoryRequest
|
||||
{
|
||||
public RobotHistoryLevelEnum HistoryLevel { get; set; }
|
||||
public RobotHistoryLevelEnum HistoryLevel { get; init; }
|
||||
|
||||
public string? RobotMessage { get; set; }
|
||||
public string? RobotMessage { get; init; }
|
||||
|
||||
public string? EsppMessage { get; set; }
|
||||
public string? EsppMessage { get; init; }
|
||||
|
||||
public Guid TaskId { get; set; }
|
||||
public Guid TaskId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// ИД робота
|
||||
/// </summary>
|
||||
public string? RobotId { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
public string? RobotIp { get; set; }
|
||||
|
||||
public string? RobotId { get; set; }
|
||||
|
||||
public UserBaseResponse? User { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -123,7 +123,8 @@ namespace PARR.API.Controllers.V1
|
||||
EsppMessage = request.EsppMessage,
|
||||
TaskStatusCode = config.TaskStatusCode,
|
||||
RobotConfigurationId = request.TaskId,
|
||||
RobotIp = clientService.GetClientIp()?.ToString()
|
||||
RobotIp = clientService.GetClientIp()?.ToString(),
|
||||
RobotId = request.RobotId
|
||||
};
|
||||
|
||||
if (!await robotHistoryService.CreateAsync(history) || !await robotHistoryService.CommitAsync())
|
||||
|
||||
@@ -241,9 +241,8 @@ namespace PARR.Core.Services.RobotTask.Implementations
|
||||
HistoryLevel = (int)RobotHistoryLevelEnum.Start,
|
||||
TaskStatusCode = task.TaskStatusCode,
|
||||
RobotConfigurationId = taskId,
|
||||
RobotIp = robotIp
|
||||
//todo: Тут добавить RobotId
|
||||
//RobotId = robotId
|
||||
RobotIp = robotIp,
|
||||
RobotId = robotId
|
||||
};
|
||||
|
||||
if (!await robotHistoryRepository.CreateAsync(history) || !await robotHistoryRepository.CommitAsync())
|
||||
|
||||
3822
PARR.DAL/Migrations/20260526013309_tblRobotHistoriesAddRobotId.Designer.cs
generated
Normal file
3822
PARR.DAL/Migrations/20260526013309_tblRobotHistoriesAddRobotId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblRobotHistoriesAddRobotId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RobotId",
|
||||
table: "RobotHistories",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
comment: "Идентификатор робота. Форматы: H20-R1-T, H20-R1-S, H20-R1-ET, H20-R1-ES.");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RobotId",
|
||||
table: "RobotHistories");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -891,6 +891,10 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<Guid>("RobotConfigurationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("RobotId")
|
||||
.HasColumnType("text")
|
||||
.HasComment("Идентификатор робота. Форматы: H20-R1-T, H20-R1-S, H20-R1-ET, H20-R1-ES.");
|
||||
|
||||
b.Property<string>("RobotIp")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
||||
@@ -40,6 +40,13 @@ namespace PARR.Domain.Entities
|
||||
///// </summary>
|
||||
//public Guid IdSeries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор робота.
|
||||
/// Форматы: H20-R1-T, H20-R1-S, H20-R1-ET, H20-R1-ES
|
||||
/// </summary>
|
||||
[Comment("Идентификатор робота. Форматы: H20-R1-T, H20-R1-S, H20-R1-ET, H20-R1-ES.")]
|
||||
public string? RobotId { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(HistoryLevel))]
|
||||
public RobotHistoryLevel? RobotHistoryLevel { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user