Добавлен префикс таблицам первой структуры базы

This commit is contained in:
Mikhail Kuznetsov
2023-08-10 10:14:41 +10:00
parent f3538fdd5d
commit 39b1333969
38 changed files with 157 additions and 450 deletions

View File

@@ -8,16 +8,16 @@ namespace PARR.DAL.Context
{
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
public DbSet<JobType> JobTypes { get; set; }
public DbSet<JobCategory> JobCategories { get; set; }
public DbSet<JobMode> JobModes { get; set; }
public DbSet<JobStatus> JobStatuses { get; set; }
public DbSet<Host> Hosts { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<JobJournal> JobJournals { get; set; }
public DbSet<Application> Applications { get; set; }
public DbSet<ApplicationType> ApplicationTypes { get; set; }
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
public DbSet<V1_JobType> JobTypes { get; set; }
public DbSet<V1_JobCategory> JobCategories { get; set; }
public DbSet<V1_JobMode> JobModes { get; set; }
public DbSet<V1_JobStatus> JobStatuses { get; set; }
public DbSet<V1_Host> Hosts { get; set; }
public DbSet<V1_Job> Jobs { get; set; }
public DbSet<V1_JobJournal> JobJournals { get; set; }
public DbSet<V1_Application> Applications { get; set; }
public DbSet<V1_ApplicationType> ApplicationTypes { get; set; }
public DbSet<V1_ApplicationInHost> ApplicationsInHosts { get; set; }
//public DbSet<Scheduler> Schedulers { get; set; }
//todo init application type+check migrations
@@ -28,7 +28,7 @@ namespace PARR.DAL.Context
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
modelBuilder.Entity<JobMode>(f =>
modelBuilder.Entity<V1_JobMode>(f =>
{
f.HasData(
new() { Id = new Guid("FBA4202C-5BAD-49C4-B076-D1CA6E1FB158"), DateCreated = dateCreated, DateModified = null, Name = JobModeEnum.auto.ToString() },
@@ -36,7 +36,7 @@ namespace PARR.DAL.Context
);
});
modelBuilder.Entity<JobStatus>(f =>
modelBuilder.Entity<V1_JobStatus>(f =>
{
f.HasData(
new() { Id = new Guid("EDEF6DC3-ADAD-4C77-8AD1-63BB9052355A"), DateCreated = dateCreated, DateModified = null, Name = JobStatusEnum.started.ToString(), Description = "Задание запущено" },
@@ -45,7 +45,7 @@ namespace PARR.DAL.Context
});
modelBuilder.Entity<ApplicationType>(f =>
modelBuilder.Entity<V1_ApplicationType>(f =>
{
f.HasData(
new() { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.APP.ToString(), Description = "Поле СП xml АИХ ИТ" },

View File

@@ -78,7 +78,7 @@ namespace PARR.DAL.Migrations
b.ToTable("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -392,13 +392,13 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
b.HasOne("PARR.DAL.Models.V1_ApplicationType", "V1_ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
b.Navigation("V1_ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
@@ -420,9 +420,9 @@ namespace PARR.DAL.Migrations
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", null)
b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId");
});
@@ -492,7 +492,7 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});

View File

@@ -78,7 +78,7 @@ namespace PARR.DAL.Migrations
b.ToTable("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -392,13 +392,13 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
b.HasOne("PARR.DAL.Models.V1_ApplicationType", "V1_ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicationType");
b.Navigation("V1_ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
@@ -420,9 +420,9 @@ namespace PARR.DAL.Migrations
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", null)
b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId");
});
@@ -490,7 +490,7 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});

View File

@@ -22,7 +22,7 @@ namespace PARR.DAL.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -45,10 +45,10 @@ namespace PARR.DAL.Migrations
b.HasIndex("ApplicationTypeId");
b.ToTable("Applications");
b.ToTable("V1_Application");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -72,18 +72,15 @@ namespace PARR.DAL.Migrations
b.HasIndex("HostId");
b.ToTable("ApplicationsInHosts");
b.ToTable("V1_ApplicationInHost");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid?>("ApplicationTypeId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
@@ -97,11 +94,14 @@ namespace PARR.DAL.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid?>("V1_ApplicationTypeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationTypeId");
b.HasIndex("V1_ApplicationTypeId");
b.ToTable("ApplicationTypes");
b.ToTable("V1_ApplicationType");
b.HasData(
new
@@ -127,7 +127,7 @@ namespace PARR.DAL.Migrations
});
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Host", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -163,10 +163,10 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("Hosts");
b.ToTable("V1_Host");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -217,10 +217,10 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobTypeId");
b.ToTable("Jobs");
b.ToTable("V1_Job");
});
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -241,10 +241,10 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("JobCategories");
b.ToTable("V1_JobCategory");
});
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -285,10 +285,10 @@ namespace PARR.DAL.Migrations
b.HasIndex("JobStatusId");
b.ToTable("JobJournals");
b.ToTable("V1_JobJournal");
});
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobMode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -306,7 +306,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("JobModes");
b.ToTable("V1_JobMode");
b.HasData(
new
@@ -323,7 +323,7 @@ namespace PARR.DAL.Migrations
});
});
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobStatus", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -344,7 +344,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("JobStatuses");
b.ToTable("V1_JobStatus");
b.HasData(
new
@@ -363,7 +363,7 @@ namespace PARR.DAL.Migrations
});
});
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@@ -384,12 +384,12 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("JobTypes");
b.ToTable("V1_JobType");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
b.HasOne("PARR.DAL.Models.V1_ApplicationType", "ApplicationType")
.WithMany()
.HasForeignKey("ApplicationTypeId")
.OnDelete(DeleteBehavior.Cascade)
@@ -398,15 +398,15 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationType");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationInHost", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
b.HasOne("PARR.DAL.Models.V1_Application", "Application")
.WithMany("ApplicationsInHosts")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Host", "Host")
b.HasOne("PARR.DAL.Models.V1_Host", "Host")
.WithMany("ApplicationsInHosts")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
@@ -417,32 +417,32 @@ namespace PARR.DAL.Migrations
b.Navigation("Host");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.HasOne("PARR.DAL.Models.ApplicationType", null)
b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
.WithMany("ApplicationTypes")
.HasForeignKey("ApplicationTypeId");
.HasForeignKey("V1_ApplicationTypeId");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
b.HasOne("PARR.DAL.Models.V1_Application", "Application")
.WithMany()
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
b.HasOne("PARR.DAL.Models.V1_JobCategory", "JobCategorye")
.WithMany("Jobs")
.HasForeignKey("JobCategoryId");
b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
b.HasOne("PARR.DAL.Models.V1_JobMode", "JobMode")
.WithMany("Jobs")
.HasForeignKey("JobModeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobType", "JobType")
b.HasOne("PARR.DAL.Models.V1_JobType", "JobType")
.WithMany("Jobs")
.HasForeignKey("JobTypeId");
@@ -455,21 +455,21 @@ namespace PARR.DAL.Migrations
b.Navigation("JobType");
});
modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobJournal", b =>
{
b.HasOne("PARR.DAL.Models.Host", "Host")
b.HasOne("PARR.DAL.Models.V1_Host", "Host")
.WithMany("JobJournals")
.HasForeignKey("HostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Job", "Job")
b.HasOne("PARR.DAL.Models.V1_Job", "Job")
.WithMany("Journals")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.JobStatus", "Status")
b.HasOne("PARR.DAL.Models.V1_JobStatus", "Status")
.WithMany("Journals")
.HasForeignKey("JobStatusId")
.OnDelete(DeleteBehavior.Cascade)
@@ -482,44 +482,44 @@ namespace PARR.DAL.Migrations
b.Navigation("Status");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Application", b =>
{
b.Navigation("ApplicationsInHosts");
});
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
{
b.Navigation("ApplicationTypes");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Host", b =>
{
b.Navigation("ApplicationsInHosts");
b.Navigation("JobJournals");
});
modelBuilder.Entity("PARR.DAL.Models.Job", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_Job", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobCategory", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobMode", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobStatus", b =>
{
b.Navigation("Journals");
});
modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
modelBuilder.Entity("PARR.DAL.Models.V1_JobType", b =>
{
b.Navigation("Jobs");
});

View File

@@ -1,24 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Applications")]
public class Application : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public Guid ApplicationTypeId { get; set; }
[ForeignKey(nameof(ApplicationTypeId))]
public ApplicationType? ApplicationType { get; set; }
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
//public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationsInHosts")]
public class ApplicationInHost : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public Host? Host { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationTypes")]
public class ApplicationType : IBase
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<ApplicationType> ApplicationTypes { get; set; } = new HashSet<ApplicationType>();
}
}

View File

@@ -1,27 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Hosts")]
public class Host : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? HostName { get; set; }
public required string IP { get; set; }
public string? RegionalEK { get; set; }
public string? LinkEK { get; set; }
public string? Status { get; set; }
public string? WorkGroup { get; set; }
public string? Responsible { get; set; }
public ICollection<JobJournal> JobJournals { get; set; } = new HashSet<JobJournal>();
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
}
}

View File

@@ -1,50 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Jobs")]
public class Job : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public required string ScriptName { get; set; }
public Guid JobModeId { get; set; }
[ForeignKey(nameof(JobModeId))]
public JobMode? JobMode { get; set; }
public Guid? JobCategoryId { get; set; }
[ForeignKey(nameof(JobCategoryId))]
public JobCategory? JobCategorye { get; set; }
public Guid? JobTypeId { get; set; }
[ForeignKey(nameof(JobTypeId))]
public JobType? JobType { get; set; }
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>();
}
}

View File

@@ -1,24 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobCategories")]
public class JobCategory : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// app, db
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
}
}

View File

@@ -1,39 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobJournals")]
public class JobJournal : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public DateTimeOffset DateOper { get; set; }
public string? Other { get; set; }
//Возможно нужно перенести в Job
public int? TimeOut { get; set; }
//Возможно нужно перенести в Job
public string? Info { get; set; }
public Guid JobStatusId { get; set; }
[ForeignKey(nameof(JobStatusId))]
public JobStatus? Status { get; set; }
public Guid HostId { get; set; }
[ForeignKey(nameof(HostId))]
public Host? Host { get; set; }
public Guid JobId { get; set; }
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobModes")]
public class JobMode : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// manual, auto
/// </summary>
public required string Name { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
}
}

View File

@@ -1,24 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobStatuses")]
public class JobStatus : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// started, finished, timeout, error
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<JobJournal> Journals { get; set; } = new HashSet<JobJournal>();
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("JobTypes")]
public class JobType : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// log-rotate, vacuum-psqld
/// </summary>
public required string Name { get; set; }
public string? Description { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
}
}

View File

@@ -1,19 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
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; }
//}
}

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class ApplicationInHostService : BaseService<ApplicationInHost>, IApplicationInHostService
internal class ApplicationInHostService : BaseService<V1_ApplicationInHost>, IApplicationInHostService
{
private readonly DataContext dataContext;
private readonly ILogger<ApplicationInHostService> logger;
@@ -18,7 +18,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger;
}
protected override DbSet<ApplicationInHost> EntitySet => dataContext.ApplicationsInHosts;
protected override DbSet<V1_ApplicationInHost> EntitySet => dataContext.ApplicationsInHosts;
protected override DataContext EntitiContext => dataContext;
}

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class ApplicationService : BaseService<Application>, IApplicationService
internal class ApplicationService : BaseService<V1_Application>, IApplicationService
{
private readonly DataContext dataContext;
private readonly ILogger<ApplicationService> logger;
@@ -18,11 +18,11 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger;
}
protected override DbSet<Application> EntitySet => dataContext.Applications;
protected override DbSet<V1_Application> EntitySet => dataContext.Applications;
protected override DataContext EntitiContext => dataContext;
public async Task<Application?> GetByNameAsync(string appName)
public async Task<V1_Application?> GetByNameAsync(string appName)
{
return await EntitySet.FirstOrDefaultAsync(t => t.Name.ToLower() == appName.Trim().ToLower());
}

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class ApplicationTypeService : BaseService<ApplicationType>, IApplicationTypeService
internal class ApplicationTypeService : BaseService<V1_ApplicationType>, IApplicationTypeService
{
private readonly DataContext dataContext;
private readonly ILogger<ApplicationTypeService> logger;
@@ -18,7 +18,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger;
}
protected override DbSet<ApplicationType> EntitySet => dataContext.ApplicationTypes;
protected override DbSet<V1_ApplicationType> EntitySet => dataContext.ApplicationTypes;
protected override DataContext EntitiContext => dataContext;
}

View File

@@ -1,18 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class HostService : BaseService<Host>, IHostService
internal class HostService : BaseService<V1_Host>, IHostService
{
private readonly DataContext dataContext;
private readonly ILogger<HostService> logger;
protected override DbSet<Host> EntitySet => dataContext.Hosts;
protected override DbSet<V1_Host> EntitySet => dataContext.Hosts;
protected override DataContext EntitiContext => dataContext;
public HostService(DataContext dataContext, ILogger<HostService> logger) : base(logger)
@@ -21,7 +21,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger;
}
public async Task<Host?> GetHostWithAppsAsync(string IP, string RegionalEK)
public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string RegionalEK)
{
//try
@@ -40,7 +40,7 @@ namespace PARR.DAL.Services.Implementations
.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
}
public async Task<Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK)
public async Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK)
{
return await EntitySet
.Include(t => t.ApplicationsInHosts).ThenInclude(a => a.Application).ThenInclude(t => t.ApplicationType)
@@ -49,7 +49,7 @@ namespace PARR.DAL.Services.Implementations
}
public async Task<Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
public async Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
{
return await EntitySet.FirstOrDefaultAsync(h => h.IP == IP && h.RegionalEK == RegionalEK);
}

View File

@@ -7,7 +7,7 @@ using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class JobCategoryService : BaseService<JobCategory>, IJobCategoryService
internal class JobCategoryService : BaseService<V1_JobCategory>, IJobCategoryService
{
private readonly DataContext dataContext;
private readonly ILogger<JobCategoryService> logger;
@@ -17,7 +17,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<JobCategory> EntitySet => dataContext.JobCategories;
protected override DbSet<V1_JobCategory> EntitySet => dataContext.JobCategories;
protected override DataContext EntitiContext => dataContext;
}

View File

@@ -2,13 +2,13 @@
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Extensions;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class JobJournalService : BaseService<JobJournal>, IJobJournalService
internal class JobJournalService : BaseService<V1_JobJournal>, IJobJournalService
{
private readonly DataContext dataContext;
private readonly ILogger<JobJournalService> logger;
@@ -18,11 +18,11 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<JobJournal> EntitySet => dataContext.JobJournals;
protected override DbSet<V1_JobJournal> EntitySet => dataContext.JobJournals;
protected override DataContext EntitiContext => dataContext;
public async Task<JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date)
public async Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date)
{
//var n=DateTimeOffset.UtcNow;
//var opers = await EntitySet

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class JobModeService : BaseService<JobMode>, IJobModeService
internal class JobModeService : BaseService<V1_JobMode>, IJobModeService
{
private readonly DataContext dataContext;
private readonly ILogger<JobModeService> logger;
@@ -17,7 +17,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<JobMode> EntitySet => dataContext.JobModes;
protected override DbSet<V1_JobMode> EntitySet => dataContext.JobModes;
protected override DataContext EntitiContext => dataContext;
}

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
using System;
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace PARR.DAL.Services.Implementations
{
internal class JobService : BaseService<Job>, IJobService
internal class JobService : BaseService<V1_Job>, IJobService
{
private readonly DataContext dataContext;
private readonly ILogger<JobService> logger;
@@ -22,7 +22,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<Job> EntitySet => dataContext.Jobs;
protected override DbSet<V1_Job> EntitySet => dataContext.Jobs;
protected override DataContext EntitiContext => dataContext;

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class JobStatusService : BaseService<JobStatus>, IJobStatusService
internal class JobStatusService : BaseService<V1_JobStatus>, IJobStatusService
{
private readonly DataContext dataContext;
private readonly ILogger<JobStatusService> logger;
@@ -17,7 +17,7 @@ namespace PARR.DAL.Services.Implementations
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<JobStatus> EntitySet => dataContext.JobStatuses;
protected override DbSet<V1_JobStatus> EntitySet => dataContext.JobStatuses;
protected override DataContext EntitiContext => dataContext;
}

View File

@@ -1,9 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
public interface IApplicationInHostService : IBaseService<ApplicationInHost>
public interface IApplicationInHostService : IBaseService<V1_ApplicationInHost>
{
}
}

View File

@@ -1,10 +1,10 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
public interface IApplicationService : IBaseService<Application>
public interface IApplicationService : IBaseService<V1_Application>
{
Task<Application?> GetByNameAsync(string appName);
Task<V1_Application?> GetByNameAsync(string appName);
}
}

View File

@@ -1,9 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
public interface IApplicationTypeService : IBaseService<ApplicationType>
public interface IApplicationTypeService : IBaseService<V1_ApplicationType>
{
}
}

View File

@@ -1,12 +1,12 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
public interface IHostService : IBaseService<Host>
public interface IHostService : IBaseService<V1_Host>
{
Task<Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK);
Task<Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK);
Task<V1_Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK);
Task<V1_Host?> GetHostWithAppsAsync(string IP, string linkEK, string regionalEK);
//Task<Host?> GetHostByRegionalEKAsync(string LinkEK);
//Task<bool> UpdateAsync(Host host);
}

View File

@@ -3,7 +3,7 @@ using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
internal interface IJobCategoryService : IBaseService<JobCategory>
internal interface IJobCategoryService : IBaseService<V1_JobCategory>
{
}
}

View File

@@ -1,9 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
namespace PARR.DAL.Services.Interfaces
{
public interface IJobJournalService
{
Task<JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date);
Task<V1_JobJournal?> GetLastAsync(Guid jobId, Guid hostId, DateTimeOffset date);
}
}

View File

@@ -1,9 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
internal interface IJobModeService : IBaseService<JobMode>
internal interface IJobModeService : IBaseService<V1_JobMode>
{
}
}

View File

@@ -1,9 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
public interface IJobService : IBaseService<Job>
public interface IJobService : IBaseService<V1_Job>
{
}
}

View File

@@ -1,9 +1,9 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces
{
internal interface IJobStatusService : IBaseService<JobStatus>
internal interface IJobStatusService : IBaseService<V1_JobStatus>
{
}
}