JobStatus init
This commit is contained in:
@@ -27,11 +27,11 @@
|
||||
public const string Metrics = Base + "/metrics";
|
||||
}
|
||||
|
||||
public static class Scheduler
|
||||
public static class Jobs
|
||||
{
|
||||
public const string GetAll = Base + "/schedulers/";
|
||||
public const string GetAll = Base + "/jobs/";
|
||||
|
||||
public const string GetByIp = Base + "/schedulers/ip/";
|
||||
public const string GetByIp = Base + "/jobs/ip/";
|
||||
//public const string Get = Base + "/schedulers/" + getParam;
|
||||
|
||||
//public const string GetAreas = Base + "/schedulers/" + getParam + "/areas";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace PARR.API.Contracts.V1.Requests.Queries
|
||||
{
|
||||
public class SchedulerGetAllQuery
|
||||
public class JobGetAllQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// true - вкл задания, false - выкл задания, null - все задания
|
||||
@@ -1,7 +1,8 @@
|
||||
namespace PARR.API.Contracts.V1.Requests.Queries
|
||||
{
|
||||
public class SchedulerGetByIpQuery
|
||||
public class JobGetByIpQuery
|
||||
{
|
||||
public string? Ip { get; set; }
|
||||
public DateTimeOffset? Date { get; set; }
|
||||
}
|
||||
}
|
||||
8
PARR.API/Contracts/V1/Responses/JobModeResponse.cs
Normal file
8
PARR.API/Contracts/V1/Responses/JobModeResponse.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PARR.API.Contracts.V1.Responses
|
||||
{
|
||||
public class JobModeResponse
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
namespace PARR.API.Contracts.V1.Responses
|
||||
{
|
||||
public class SchedulerBaseResponse
|
||||
public class JobBaseResponse
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public DateTimeOffset StartAt { get; set; }
|
||||
public int FrequencyMinute { get; set; }
|
||||
|
||||
public required JobModeResponse JobMode { get; set; }
|
||||
}
|
||||
|
||||
public class SchedulerGetAllResponse: SchedulerBaseResponse
|
||||
public class JobGetAllResponse : JobBaseResponse
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
|
||||
public class SchedulerResponse
|
||||
public class JobResponse
|
||||
{
|
||||
|
||||
}
|
||||
116
PARR.API/Controllers/V1/JobController.cs
Normal file
116
PARR.API/Controllers/V1/JobController.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.API.Contracts.V1;
|
||||
using PARR.API.Contracts.V1.Requests.Queries;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using static PARR.API.Contracts.V1.ApiRoutes;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
{
|
||||
public class JobController : BaseApiController
|
||||
{
|
||||
private readonly IMapper mapper;
|
||||
private readonly IJobService jobService;
|
||||
//private readonly ISchedulerService schedulerService;
|
||||
private readonly IClientService clientService;
|
||||
private readonly IHostService hostService;
|
||||
|
||||
public JobController(
|
||||
IMapper mapper,
|
||||
IJobService jobService,
|
||||
IClientService clientService,
|
||||
IHostService hostService
|
||||
)
|
||||
{
|
||||
this.mapper = mapper;
|
||||
this.jobService = jobService;
|
||||
//this.schedulerService = schedulerService;
|
||||
this.clientService = clientService;
|
||||
this.hostService = hostService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Список всех jobов постранично в соотвествии с фильтрами
|
||||
/// </summary>
|
||||
/// <param name="paginationQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet(ApiRoutes.Jobs.GetAll)]
|
||||
public async Task<IActionResult> GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] JobGetAllQuery filter)
|
||||
{
|
||||
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
|
||||
IQueryable<Job> query = jobService.Get().Include(t => t.JobMode).OrderBy(s => s.StartAt);
|
||||
|
||||
if (filter.IsEnabled.HasValue)
|
||||
query = query.Where(t => t.IsEnabled == filter.IsEnabled);
|
||||
|
||||
if (filter.StartDatePlanned.HasValue)
|
||||
query = query.Where(t => t.StartAt.DateTime.Date <= filter.StartDatePlanned.Value.DateTime.Date); ;
|
||||
|
||||
var jobs = await jobService.GetPage(query, paginationFilter).ToListAsync();
|
||||
|
||||
if (!jobs.Any())
|
||||
return NoContent();
|
||||
|
||||
var jobResponse = mapper.Map<List<JobGetAllResponse>>(jobs);
|
||||
var paginationResponse = new PagedResponse<JobGetAllResponse>(jobResponse, true).GetPaginatedProps(paginationFilter, query);
|
||||
|
||||
return Ok(paginationResponse);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet(ApiRoutes.Jobs.GetByIp)]
|
||||
public async Task<IActionResult> GetByClientIP([FromQuery] JobGetByIpQuery requestQuery)
|
||||
{
|
||||
var ip = requestQuery.Ip ?? clientService.GetClientIp()?.ToString();
|
||||
if (string.IsNullOrEmpty(ip))
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Client IP address is null." } }));
|
||||
|
||||
var date = requestQuery.Date ?? DateTimeOffset.Now;
|
||||
|
||||
// С одним IP может быть несколько информационных систем, соответственного а таблице храниться несколько записей хостов с одинаковым IP
|
||||
var hosts = await hostService.Get().Where(h => h.IP == ip).ToListAsync();
|
||||
var hostJobsDict = new Dictionary<DAL.Models.Host, List<Job>>();
|
||||
foreach (var host in hosts)
|
||||
{
|
||||
var jobsHost = await jobService.Get()
|
||||
.Include(a => a.Application).ThenInclude(ah => ah.ApplicationsInHosts)/*.ThenInclude(h => h.Host)*/
|
||||
.Include(jm=>jm.JobMode)
|
||||
.AsSplitQuery()
|
||||
.Where(j => j.Application != null && j.Application.ApplicationsInHosts.Any(ah => ah.HostId == host.Id))
|
||||
.ToListAsync();
|
||||
if (jobsHost.Any())
|
||||
hostJobsDict.Add(host, jobsHost);
|
||||
}
|
||||
//hostJobsDict.Values.Distinct();
|
||||
|
||||
var jobsJoined = new List<Job>();
|
||||
foreach(var job in hostJobsDict.Values)
|
||||
{
|
||||
job.ForEach(item =>
|
||||
{
|
||||
jobsJoined.Add(item);
|
||||
});
|
||||
}
|
||||
jobsJoined.Distinct();
|
||||
|
||||
|
||||
if (!jobsJoined.Any())
|
||||
return NoContent();
|
||||
|
||||
var jobResponse = mapper.Map<List<JobGetAllResponse>>(jobsJoined);
|
||||
|
||||
return Ok(new Response<List<JobGetAllResponse>>(jobResponse, true, new List<ErrorModel>(), $"{ip},{date}"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PARR.API.Contracts.V1.Requests.Queries;
|
||||
using PARR.API.Contracts.V1;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using AutoMapper;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Extensions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using PARR.API.Services.Interfaces;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
{
|
||||
public class ShchedullerController : BaseApiController
|
||||
{
|
||||
private readonly IMapper mapper;
|
||||
private readonly ISchedulerService schedulerService;
|
||||
private readonly IClientService clientService;
|
||||
|
||||
public ShchedullerController(
|
||||
IMapper mapper,
|
||||
ISchedulerService schedulerService,
|
||||
IClientService clientService
|
||||
)
|
||||
{
|
||||
this.mapper = mapper;
|
||||
this.schedulerService = schedulerService;
|
||||
this.clientService = clientService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Список всех планировщиков постранично в соотвествии с фильтрами
|
||||
/// </summary>
|
||||
/// <param name="paginationQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet(ApiRoutes.Scheduler.GetAll)]
|
||||
public async Task<IActionResult> GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] SchedulerGetAllQuery filter)
|
||||
{
|
||||
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
|
||||
IQueryable<Scheduler> query = schedulerService.Get().OrderBy(s => s.StartAt);
|
||||
|
||||
if (filter.IsEnabled.HasValue)
|
||||
query = query.Where(t => t.IsEnabled == filter.IsEnabled);
|
||||
|
||||
if (filter.StartDatePlanned.HasValue)
|
||||
query = query.Where(t => t.StartAt.DateTime.Date <= filter.StartDatePlanned.Value.DateTime.Date); ;
|
||||
|
||||
var schedulers = await schedulerService.GetPage(query, paginationFilter).ToListAsync();
|
||||
|
||||
if (!schedulers.Any())
|
||||
return NoContent();
|
||||
|
||||
var schedulerResponse = mapper.Map<List<SchedulerGetAllResponse>>(schedulers);
|
||||
var paginationResponse = new PagedResponse<SchedulerGetAllResponse>(schedulerResponse, true).GetPaginatedProps(paginationFilter, query);
|
||||
|
||||
return Ok(paginationResponse);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet(ApiRoutes.Scheduler.GetByIp)]
|
||||
public async Task<IActionResult> GetByClientIP([FromQuery] SchedulerGetByIpQuery requestQuery)
|
||||
{
|
||||
var ip = requestQuery.Ip ?? clientService.GetClientIp()?.ToString();
|
||||
if (string.IsNullOrEmpty(ip))
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Client IP address is null." } }));
|
||||
|
||||
// TODO;
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,14 @@ namespace PARR.API.MappingProfiles
|
||||
{
|
||||
public DomainToResponseProfile()
|
||||
{
|
||||
// --- Scheduler ---
|
||||
CreateMap<Scheduler, SchedulerBaseResponse>()
|
||||
.Include<Scheduler, SchedulerGetAllResponse>()
|
||||
// --- Job ---
|
||||
CreateMap<Job, JobBaseResponse>()
|
||||
.Include<Job, JobGetAllResponse>()
|
||||
.ForMember(d => d.FrequencyMinute, o => o.MapFrom(s => s.Frequency));
|
||||
CreateMap<Scheduler, SchedulerGetAllResponse>();
|
||||
CreateMap<Job, JobGetAllResponse>();
|
||||
|
||||
|
||||
CreateMap<JobMode, JobModeResponse>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace PARR.DAL.Context
|
||||
public DbSet<Application> Applications { get; set; }
|
||||
public DbSet<ApplicationType> ApplicationTypes { get; set; }
|
||||
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
|
||||
public DbSet<Scheduler> Schedulers { get; set; }
|
||||
//public DbSet<Scheduler> Schedulers { get; set; }
|
||||
|
||||
//todo init application type+check migrations
|
||||
|
||||
@@ -36,6 +36,14 @@ namespace PARR.DAL.Context
|
||||
);
|
||||
});
|
||||
|
||||
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 = "Задание выполнено" }
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Entity<ApplicationType>(f =>
|
||||
{
|
||||
|
||||
512
PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.Designer.cs
generated
Normal file
512
PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.Designer.cs
generated
Normal file
@@ -0,0 +1,512 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using PARR.DAL.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20230619021829_SchedulerClmnsToJob")]
|
||||
partial class SchedulerClmnsToJob
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("Applications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("HostId");
|
||||
|
||||
b.ToTable("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ApplicationTypes");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Поле СП xml АИХ ИТ",
|
||||
Name = "APP"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Поле ОС xml АИХ ИТ",
|
||||
Name = "OS"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Поле СУБД xml АИХ ИТ",
|
||||
Name = "DB"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("HostName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("IP")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LinkEK")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RegionalEK")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Responsible")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorkGroup")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Hosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Frequency")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid?>("JobCategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobModeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ScriptName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("StartAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("JobCategoryId");
|
||||
|
||||
b.HasIndex("JobModeId");
|
||||
|
||||
b.HasIndex("JobTypeId");
|
||||
|
||||
b.ToTable("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DateOper")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Info")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("JobId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobStatusId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Other")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("TimeOut")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HostId");
|
||||
|
||||
b.HasIndex("JobId");
|
||||
|
||||
b.HasIndex("JobStatusId");
|
||||
|
||||
b.ToTable("JobJournals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobModes");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Name = "auto"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Name = "manual"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
.WithMany("Applications")
|
||||
.HasForeignKey("ApplicationId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ApplicationType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
.WithMany("ApplicationsInHosts")
|
||||
.HasForeignKey("ApplicationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Host", "Host")
|
||||
.WithMany("ApplicationsInHosts")
|
||||
.HasForeignKey("HostId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
b.Navigation("Host");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobCategoryId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobModeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobType", "JobType")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
b.Navigation("JobCategorye");
|
||||
|
||||
b.Navigation("JobMode");
|
||||
|
||||
b.Navigation("JobType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Host", "Host")
|
||||
.WithMany("JobJournals")
|
||||
.HasForeignKey("HostId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Job", "Job")
|
||||
.WithMany("Journals")
|
||||
.HasForeignKey("JobId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobStatus", "Status")
|
||||
.WithMany("Journals")
|
||||
.HasForeignKey("JobStatusId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Host");
|
||||
|
||||
b.Navigation("Job");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Navigation("Applications");
|
||||
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
|
||||
b.Navigation("JobJournals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.Navigation("Journals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
|
||||
{
|
||||
b.Navigation("Journals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
72
PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.cs
Normal file
72
PARR.DAL/Migrations/20230619021829_SchedulerClmnsToJob.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SchedulerClmnsToJob : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Schedulers");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Frequency",
|
||||
table: "Jobs",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "Jobs",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<DateTimeOffset>(
|
||||
name: "StartAt",
|
||||
table: "Jobs",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Frequency",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsEnabled",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StartAt",
|
||||
table: "Jobs");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Schedulers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
Frequency = table.Column<int>(type: "integer", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: true),
|
||||
StartAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Schedulers", x => x.Id);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
528
PARR.DAL/Migrations/20230620022903_TblStatus.Designer.cs
generated
Normal file
528
PARR.DAL/Migrations/20230620022903_TblStatus.Designer.cs
generated
Normal file
@@ -0,0 +1,528 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using PARR.DAL.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20230620022903_TblStatus")]
|
||||
partial class TblStatus
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("ApplicationTypeId");
|
||||
|
||||
b.ToTable("Applications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("HostId");
|
||||
|
||||
b.ToTable("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ApplicationTypes");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Поле СП xml АИХ ИТ",
|
||||
Name = "APP"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Поле ОС xml АИХ ИТ",
|
||||
Name = "OS"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Поле СУБД xml АИХ ИТ",
|
||||
Name = "DB"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("HostName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("IP")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LinkEK")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RegionalEK")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Responsible")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorkGroup")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Hosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("ApplicationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Frequency")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid?>("JobCategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobModeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobTypeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ScriptName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("StartAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
|
||||
b.HasIndex("JobCategoryId");
|
||||
|
||||
b.HasIndex("JobModeId");
|
||||
|
||||
b.HasIndex("JobTypeId");
|
||||
|
||||
b.ToTable("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DateOper")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("HostId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Info")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("JobId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("JobStatusId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Other")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("TimeOut")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HostId");
|
||||
|
||||
b.HasIndex("JobId");
|
||||
|
||||
b.HasIndex("JobStatusId");
|
||||
|
||||
b.ToTable("JobJournals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobModes");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Name = "auto"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Name = "manual"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobStatuses");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Задание запущено",
|
||||
Name = "started"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Задание выполнено",
|
||||
Name = "finished"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
.WithMany("Applications")
|
||||
.HasForeignKey("ApplicationId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ApplicationType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
.WithMany("ApplicationsInHosts")
|
||||
.HasForeignKey("ApplicationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Host", "Host")
|
||||
.WithMany("ApplicationsInHosts")
|
||||
.HasForeignKey("HostId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
b.Navigation("Host");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", "Application")
|
||||
.WithMany()
|
||||
.HasForeignKey("ApplicationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobCategoryId");
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobModeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobType", "JobType")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("JobTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Application");
|
||||
|
||||
b.Navigation("JobCategorye");
|
||||
|
||||
b.Navigation("JobMode");
|
||||
|
||||
b.Navigation("JobType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Host", "Host")
|
||||
.WithMany("JobJournals")
|
||||
.HasForeignKey("HostId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.Job", "Job")
|
||||
.WithMany("Journals")
|
||||
.HasForeignKey("JobId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PARR.DAL.Models.JobStatus", "Status")
|
||||
.WithMany("Journals")
|
||||
.HasForeignKey("JobStatusId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Host");
|
||||
|
||||
b.Navigation("Job");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.Navigation("Applications");
|
||||
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
|
||||
{
|
||||
b.Navigation("ApplicationsInHosts");
|
||||
|
||||
b.Navigation("JobJournals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
|
||||
{
|
||||
b.Navigation("Journals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
|
||||
{
|
||||
b.Navigation("Journals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
|
||||
{
|
||||
b.Navigation("Jobs");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
40
PARR.DAL/Migrations/20230620022903_TblStatus.cs
Normal file
40
PARR.DAL/Migrations/20230620022903_TblStatus.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblStatus : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "JobStatuses",
|
||||
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание выполнено", "finished" },
|
||||
{ new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Задание запущено", "started" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "JobStatuses",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "JobStatuses",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,6 +181,12 @@ namespace PARR.DAL.Migrations
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Frequency")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid?>("JobCategoryId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -198,6 +204,9 @@ namespace PARR.DAL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("StartAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ApplicationId");
|
||||
@@ -336,6 +345,22 @@ namespace PARR.DAL.Migrations
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("JobStatuses");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Задание запущено",
|
||||
Name = "started"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
|
||||
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
Description = "Задание выполнено",
|
||||
Name = "finished"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
|
||||
@@ -362,35 +387,6 @@ namespace PARR.DAL.Migrations
|
||||
b.ToTable("JobTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Scheduler", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Frequency")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("StartAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Schedulers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||
{
|
||||
b.HasOne("PARR.DAL.Models.Application", null)
|
||||
|
||||
@@ -30,8 +30,21 @@ namespace PARR.DAL.Models
|
||||
public Guid ApplicationId { get; set; }
|
||||
[ForeignKey(nameof(ApplicationId))]
|
||||
public Application? Application { get; set; }
|
||||
/// <summary>
|
||||
/// Частота запуска Job в минутах
|
||||
/// </summary>
|
||||
public int Frequency { get; set; }
|
||||
/// <summary>
|
||||
/// В режиме manual значит время регистрации регламентной работы АСУ ЕСПП, в auto - время старта Job.
|
||||
/// </summary>
|
||||
public DateTimeOffset StartAt { get; set; }
|
||||
/// <summary>
|
||||
/// Активация Job
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
|
||||
public ICollection<JobJournal> Journals { get; set; } = new HashSet<JobJournal>();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,16 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
{
|
||||
[Table("Schedulers")]
|
||||
public class Scheduler : IBase
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int Frequency { get; set; }
|
||||
public required DateTimeOffset StartAt { get; set; }
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
//[Table("Schedulers")]
|
||||
//public class Scheduler : IBase
|
||||
//{
|
||||
// //[Key]
|
||||
// //public Guid Id { get; set; }
|
||||
// //public DateTimeOffset DateCreated { get; set; }
|
||||
// //public DateTimeOffset? DateModified { get; set; }
|
||||
// //public string? Name { get; set; }
|
||||
// //public int Frequency { get; set; }
|
||||
// //public required DateTimeOffset StartAt { get; set; }
|
||||
// //public bool IsEnabled { get; set; }
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace PARR.DAL
|
||||
services.AddTransient<IApplicationService, ApplicationService>();
|
||||
services.AddTransient<IApplicationTypeService, ApplicationTypeService>();
|
||||
services.AddTransient<IApplicationInHostService, ApplicationInHostService>();
|
||||
services.AddTransient<ISchedulerService, SchedulerService>();
|
||||
services.AddTransient<IJobService, JobService>();
|
||||
//services.AddTransient<ISchedulerService, SchedulerService>();
|
||||
|
||||
//services.AddTransient<IAreasInLayerService, AreasInLayerService>();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace PARR.DAL.Services.Implementations
|
||||
//}
|
||||
return await EntitySet
|
||||
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
|
||||
.AsSplitQuery()
|
||||
.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
|
||||
}
|
||||
|
||||
@@ -43,6 +44,7 @@ namespace PARR.DAL.Services.Implementations
|
||||
{
|
||||
return await EntitySet
|
||||
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
|
||||
.AsSplitQuery()
|
||||
.FirstOrDefaultAsync(h => h.IP == IP && h.LinkEK == linkEK && h.RegionalEK == regionalEK);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,16 @@ using PARR.DAL.Services.Interfaces;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations
|
||||
{
|
||||
internal class SchedulerService : BaseService<Scheduler>, ISchedulerService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
//internal class SchedulerService : BaseService<Scheduler>, ISchedulerService
|
||||
//{
|
||||
// private readonly DataContext dataContext;
|
||||
|
||||
public SchedulerService(DataContext dataContext, ILogger<SchedulerService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
protected override DbSet<Scheduler> EntitySet => dataContext.Schedulers;
|
||||
// public SchedulerService(DataContext dataContext, ILogger<SchedulerService> logger) : base(logger)
|
||||
// {
|
||||
// this.dataContext = dataContext;
|
||||
// }
|
||||
// protected override DbSet<Scheduler> EntitySet => dataContext.Schedulers;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
}
|
||||
// protected override DataContext EntitiContext => dataContext;
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces
|
||||
{
|
||||
public interface ISchedulerService : IBaseService<Scheduler>
|
||||
{
|
||||
}
|
||||
//public interface ISchedulerService : IBaseService<Scheduler>
|
||||
//{
|
||||
//}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user