v0.0.3 twa sys

This commit is contained in:
2025-11-19 07:57:43 +07:00
parent a586da6edc
commit ccf08a3077
24 changed files with 75 additions and 35 deletions

View File

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class Files
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public ulong IdFiles { get; set; }
[ForeignKey("IdFolders")]
public ulong IdFolders { get; set; } // BIGINT FK → Folders.idFolders
public string Code { get; set; } = ""; // VARCHAR(100)
public string Name { get; set; } = ""; // VARCHAR(100)
public string Path { get; set; } = ""; // TEXT
public string Options { get; set; } = ""; // LONGTEXT (JSON, metadata)
public DateTime CreateDate { get; set; } = DateTime.UtcNow; // DATETIME (UTC khuyên dùng)
public DateTime? LastModified { get; set; } = null; // DATETIME NULL
public int Status { get; set; } // INT(11)
public Folder? Folder { get; set; } = null!; // nav
}
}

View File

@ -0,0 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class Folder
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public ulong IdFolders { get; set; } // BIGINT PK
public ulong? IdParent { get; set; } // BIGINT FK, null = root
public string Name { get; set; } = ""; // VARCHAR(45)
public string Code { get; set; } = ""; // VARCHAR(100)
public string Path { get; set; } = ""; // TEXT
public string Options { get; set; } = ""; // LONGTEXT
public DateTime CreateDate { get; set; } = DateTime.UtcNow; // DATETIME
public DateTime? LastModified { get; set; } = null; // DATETIME NULL
public int Status { get; set; } // INT(11)
public Folder? Parent { get; set; } = null;
public ICollection<Folder> Children { get; set; } = new List<Folder>();
}
}

View File

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class Folders_has_StorageArea
{
[ForeignKey("")]
public ulong IdFolders { get; set; }
[ForeignKey("")]
public long IdStorage { get; set; }
public Folder Folder { get; set; } = null!;
public StorageArea Storage { get; set; } = null!;
}
}

View File

@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class LocalServer
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long IdLocalServer { get; set; } = 0;
public string IpPrivateServer { get; set; } = "";
public string IpPrivateServerv6 { get; set; } = "";
public string IpPublicServer { get; set; } = "";
public string PathServer { get; set; } = "";
public string SerialNumber { get; set; } = "";
public string OsVersion { get; set; } = "";
public string OsName { get; set; } = "";
public string OsArch { get; set; } = "";
public string OsKernal { get; set; } = "";
public int SocketNum { get; set; } = 0;
public string CpuName { get; set; } = "";
public float TotalRam { get; set; } = 0;
public string BiosVender { get; set; } = "";
public string ProductUuid { get; set; } = "";
public int Status { get; set; } = 0;
}
}

View File

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class MicrosoftAccount
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long IdCloudAccount { get; set; }
public string AccName { get; set; } = null!;
public string ClientID { get; set; } = null!; // GUID string
public string TenantID { get; set; } = null!;
public string? ClientSecret { get; set; } // encrypted at rest
public string? SiteID { get; set; }
public string? DriveID { get; set; }
public string? PathSharePoint { get; set; }
public string? RefreshToken { get; set; } // encrypted
public string? AccessToken { get; set; } // optional cache
public DateTime? ExpiresAt { get; set; }
public string? Scopes { get; set; }
public DateTime CreateDate { get; set; }
public DateTime? LastModified { get; set; }
public int Status { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class RefreshToken
{
[Key]
public string IdRefreshToken { get; set; } = "";
[ForeignKey("IdServerAuthorization")]
public ulong IdServerAuthorization { get; set; }
public string __RefreshToken { get; set; } = ""; // refreshToken
public DateTime CreateDate { get; set; }
public DateTime ExpireDate { get; set; }
public int Status { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class RefreshToken_Log
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public ulong IdRefreshTokenLog { get; set; }
public string IdRefreshToken { get; set; } = null!;
public DateTime DateRenew { get; set; } // UTC
public int Count { get; set; } = 1;
public int LifeTime { get; set; }
public int Status { get; set; } = 1;
public RefreshToken RefreshToken { get; set; } = null!;
}
}

View File

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class ServerAuthorization
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public ulong IdServerAuthorization { get; set; }
[ForeignKey("IdStorageServer")]
public long IdStorageServer { get; set; }
public DateTime CreateDate { get; set; }
public int Count { get; set; }
public int Status { get; set; }
[NotMapped()]
public ICollection<Token> Tokens { get; set; } = new List<Token>();
[NotMapped()]
public ICollection<RefreshToken> RefreshTokens { get; set; } = new List<RefreshToken>();
}
}

View File

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class ServerAuthorization_has_Token
{
[ForeignKey("")]
public ulong IdServerAuthorization { get; set; }
[ForeignKey("")]
public string IdToken { get; set; } = "";
public int Count { get; set; }
public int Status { get; set; }
public ServerAuthorization ServerAuthorization { get; set; } = null!;
public Token Token { get; set; } = null!;
}
}

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class StorageArea
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long IdStorage { get; set; } // PK (AUTO_INCREMENT nếu DB đang để vậy)
public ulong? IdEmp { get; set; } = null; // FK -> Emp (nếu có)
public DateTime CreateDate { get; set; } = DateTime.UtcNow;
public double TotalSize { get; set; } = 0; // map FLOAT MySQL -> double
public int Status { get; set; } = 0;
}
}

View File

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class StorageArea_has_StorageServer
{
[ForeignKey("IdStorage")]
public long IdStorage { get; set; }
[ForeignKey("IdStorageServer")]
public long IdStorageServer { get; set; }
[Column("priority", TypeName = "int")]
public int Priority { get; set; } = 0;
[Column("createDate", TypeName = "datetime")]
public DateTime CreateDate { get; set; } = DateTime.UtcNow;
[Column("status", TypeName = "int")]
public int Status { get; set; } = 0;
}
}

View File

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class StorageServer
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long IdStorageServer { get; set; }
public long? IdEmp { get; set; }
[ForeignKey("IdTypeStorageServer")]
public long IdTypeStorageServer { get; set; }
public string StorageName { get; set; } = "";
public DateTime? CreateDate { get; set; }
public int? Size { get; set; } = null;
public string ControllerID { get; set; } = "";
public int Status { get; set; } = 0;
[NotMapped]
public TypeStorageServer TypeStorageServer { set; get; } = null!;
}
}

View File

@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class StorageServer_has_LocalServer
{
[ForeignKey("IdStorageServer")]
public long IdStorageServer { get; set; } = 0;
[ForeignKey("IdLocalServer")]
public long IdLocalServer { get; set; } = 0;
public DateTime CreateDate { get; set; } = DateTime.UtcNow; // nên lưu UTC
public DateTime? ModifyDate { get; set; } = null; // nên lưu UTC
public int Status { get; set; } = 0;
}
}

View File

@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class StorageServer_has_MicrosoftAccount
{
[ForeignKey("")]
public long IdStorageServer { get; set; }
[ForeignKey("")]
public long IdCloudAccount { get; set; }
public DateTime CreateDate { get; set; } = DateTime.UtcNow;
public int Status { get; set; } = 1;
public StorageServer StorageServer { get; set; } = null!;
public MicrosoftAccount CloudAccount { get; set; } = null!;
}
}

View File

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class StorageServers_ValidationDomain
{
[ForeignKey("")]
public long IdStorageServer { get; set; }
[ForeignKey("")]
public long IdValidationDomain { get; set; }
[Column("modifyDate", TypeName = "datetime")]
public DateTime? ModifyDate { get; set; } = null;
[Column("createDate", TypeName = "datetime")]
public DateTime CreateDate { get; set; } = DateTime.UtcNow;
[Column("status", TypeName = "int")]
public int Status { get; set; } = 0;
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc.Filters;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class SyncFile_Log
{
public ulong Id { get; set; }
[ForeignKey("")]
public long IdFiles { get; set; }
[ForeignKey("")]
public long IdStorageServer { get; set; }
[ForeignKey("")]
public long IdLocalServer { get; set; }
[ForeignKey("")]
public long IdCloudAccount { get; set; } // FK -> CloudAccounts.id
public DateTime SyncDate { get; set; } = DateTime.UtcNow; // UTC
public string? PathOnServer { get; set; } // đường dẫn lưu trên đích
public int Status { get; set; } // 0=pending,1=ok,2=retry,3=failed,...
// nav
public Files File { get; set; } = null!;
}
}

View File

@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class Token
{
[Key]
public string IdToken { get; set; } = "";
public string AccessToken { get; set; } = "";
public DateTime CreateDate { get; set; }
public DateTime ExpireDate { get; set; }
public int Status { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class TypeStorageServer
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdTypeStorageServer { get; set; }
public string TypeName { get; set; }
public TypeStorageServer()
{
IdTypeStorageServer = 0;
TypeName = string.Empty;
}
}
}

View File

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels.SotrageModel
{
public class ValidationDomain
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long IdValidationDomain { set; get; }
public string Protocol { set; get; }
public int PortNumber { set; get; }
public string DomainName { set; get; }
public ValidationDomain()
{
IdValidationDomain = 0;
Protocol = string.Empty;
DomainName = string.Empty;
PortNumber = -1;
}
}
}