Получение списка задач для Хоста по Ip
This commit is contained in:
@@ -31,16 +31,16 @@ namespace PARR.DAL.Context
|
||||
modelBuilder.Entity<JobMode>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = "auto" },
|
||||
new() { Id = new Guid("7516B952-510D-4AAA-971C-A14B184FC1D5"), DateCreated = dateCreated, DateModified = null, Name = "manual" }
|
||||
new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.auto.ToString() },
|
||||
new() { Id = new Guid("7516B952-510D-4AAA-971C-A14B184FC1D5"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.manual.ToString() }
|
||||
);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<JobStatus>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = "started", Description = "Задание запущено" },
|
||||
new() { Id = new Guid("7B945EB6-D885-4570-AFF5-8866F1F75FF2"), DateCreated = dateCreated, DateModified = null, Name = "finished", Description = "Задание выполнено" }
|
||||
new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.started.ToString(), Description = "Задание запущено" },
|
||||
new() { Id = new Guid("7B945EB6-D885-4570-AFF5-8866F1F75FF2"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.finished.ToString(), Description = "Задание выполнено" }
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
8
PARR.DAL/Contracts/JobModeEnum.cs
Normal file
8
PARR.DAL/Contracts/JobModeEnum.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PARR.DAL.Contracts
|
||||
{
|
||||
public enum JobModeEnum
|
||||
{
|
||||
auto,
|
||||
manual
|
||||
}
|
||||
}
|
||||
8
PARR.DAL/Contracts/JobStatusEnum.cs
Normal file
8
PARR.DAL/Contracts/JobStatusEnum.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PARR.DAL.Contracts
|
||||
{
|
||||
public enum JobStatusEnum
|
||||
{
|
||||
started,
|
||||
finished
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ namespace PARR.DAL.Models
|
||||
public Guid Id { get; set; }
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
public string? DateOper { get; set; }
|
||||
public DateTimeOffset DateOper { get; set; }
|
||||
public string? Other { get; set; }
|
||||
//Возможно нужно перенести в Job
|
||||
public int? TimeOut { get; set; }
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace PARR.DAL
|
||||
services.AddTransient<IApplicationTypeService, ApplicationTypeService>();
|
||||
services.AddTransient<IApplicationInHostService, ApplicationInHostService>();
|
||||
services.AddTransient<IJobService, JobService>();
|
||||
services.AddTransient<IJobJournalService, JobJournalService>();
|
||||
//services.AddTransient<ISchedulerService, SchedulerService>();
|
||||
|
||||
//services.AddTransient<IAreasInLayerService, AreasInLayerService>();
|
||||
|
||||
@@ -20,5 +20,15 @@ namespace PARR.DAL.Services.Implementations
|
||||
protected override DbSet<JobJournal> EntitySet => dataContext.JobJournals;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public async Task<JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date)
|
||||
{
|
||||
var opers = await EntitySet
|
||||
.Where(j => j.JobId == jobId && j.HostId == hostId && j.DateOper.DateTime.Date == date.DateTime.Date)
|
||||
.OrderBy(t => t.DateOper)
|
||||
.LastOrDefaultAsync();
|
||||
|
||||
return opers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces
|
||||
{
|
||||
internal interface IJobJournalService
|
||||
public interface IJobJournalService
|
||||
{
|
||||
Task<JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user