Модели Apps, Scheduler

This commit is contained in:
Mikhail Kuznetsov
2023-06-13 13:57:55 +10:00
parent 8a72550ff0
commit b22c401156
12 changed files with 360 additions and 60 deletions

View File

@@ -14,5 +14,10 @@ namespace PARR.DAL.Context
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<Scheduler> Schedulers { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace PARR.DAL.Contracts
{
public enum ApplicationTypesEnum
{
APP,
OS,
DB
}
}

View File

@@ -0,0 +1,29 @@
using PARR.DAL.Models.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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>();
}
}
}

View File

@@ -0,0 +1,28 @@
using PARR.DAL.Models.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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

@@ -0,0 +1,20 @@
using PARR.DAL.Models.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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; }
}
}

View File

@@ -11,19 +11,17 @@ namespace PARR.DAL.Models
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string HostName { 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 string? OS { get; set; }
public string? DB { get; set; }
public string? APP { get; set; }
public ICollection<JobJournal> JobJournals { get; set; } = new HashSet<JobJournal>();
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
}
}

View File

@@ -21,7 +21,7 @@ namespace PARR.DAL.Models
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; }

View File

@@ -0,0 +1,19 @@
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

@@ -21,7 +21,7 @@ namespace PARR.DAL.Services.Implementations
this.logger = logger;
}
public async Task<Host?> GetHostByIPAndRegionalEKAsync(string IP, string RegionalEK)
public async Task<Host?> GetHostWithAppsAsync(string IP, string RegionalEK)//TODO
{
try
{