project_db + models

This commit is contained in:
2025-03-12 16:35:56 +04:00
parent 9c06125d66
commit cf45ffb67d
11 changed files with 190 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class InstallationRequest
{
public required string SoftwareId { get; set; }
public required string RequestId { get; set; }
public int Count { get; set; }
public double Price { get; set; }
public Request? Request { get; set; }
public Software? Software { get; set; }
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class Manufacturer
{
public required string Id { get; set; }
public required string ManufacturerName { get; set; }
public string? PrevManufacturerName { get; set; }
public string? PrevPrevManufacturerName { get; set; }
[ForeignKey("ManufacturerId")]
public List<Software>? Softwares { get; set; }
}

View File

@@ -0,0 +1,19 @@
using SmallSoftwareContracts.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class Post
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public required string PostId { get; set; }
public required string PostName { get; set; }
public PostType PostType { get; set; }
public double Salary { get; set; }
public bool IsActual { get; set; }
public DateTime ChangeDate { get; set; }
}

View File

@@ -0,0 +1,22 @@
using SmallSoftwareContracts.DataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class Request
{
public required string Id { get; set; } = Guid.NewGuid().ToString();
public required string WorkerId { get; set; }
public required string Email { get; set; }
public double Sum { get; set; }
public bool IsCancel { get; set; }
public Worker? Worker { get; set; }
[ForeignKey("RequestId")]
public List<InstallationRequest>? InstallationRequests { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class Salary
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public required string WorkerId { get; set; }
public double WorkerSalary { get; set; }
public DateTime SalaryDate { get; set; }
public Worker? Worker { get; set; }
}

View File

@@ -0,0 +1,29 @@
using SmallSoftwareContracts.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class Software
{
public required string Id { get; set; }
public required string SoftwareName { get; set; }
public SoftwareType SoftwareType { get; set; }
public required string ManufacturerId { get; set; }
public double Price { get; set; }
public bool IsDeleted { get; set; }
public string? PrevSoftwareName { get; set; }
public string? PrevPrevSoftwareName { get; set; }
public Manufacturer? Manufacturer { get; set; }
[ForeignKey("SoftwareId")]
public List<SoftwareHistory>? SoftwareHistories { get; set; }
[ForeignKey("SoftwareId")]
public List<InstallationRequest>? InstallationRequests { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class SoftwareHistory
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public required string SoftwareId { get; set; }
public double OldPrice { get; set; }
public DateTime ChangeDate { get; set; } = DateTime.UtcNow;
public Software? Software { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
internal class Worker
{
public required string Id { get; set; }
public required string FIO { get; set; }
public required string PostId { get; set; }
public DateTime BirthDate { get; set; }
public DateTime EmploymentDate { get; set; }
public bool IsDeleted { get; set; }
[ForeignKey("WorkerId")]
public List<Salary>? Salaries { get; set; }
[ForeignKey("WorkerId")]
public List<Request>? Requests { get; set; }
}