Folder structure reconstruction
This commit is contained in:
93
MailServer/Database.cs
Normal file
93
MailServer/Database.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SMTPServer
|
||||
{
|
||||
public class MysqlDB : DbContext
|
||||
{
|
||||
const string Hostname = "192.168.178.148";
|
||||
const string DatabaseName = "vmail";
|
||||
const string Uid = "root";
|
||||
const string Pwd = "fabian.11";
|
||||
|
||||
public DbSet<Domains> Domains { get; set; }
|
||||
|
||||
public DbSet<Accounts> Accounts { get; set; }
|
||||
|
||||
public DbSet<Folders> Folders { get; set; }
|
||||
|
||||
public DbSet<Aliases> Aliases { get; set; }
|
||||
|
||||
public DbSet<Mails> Mails { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
=> optionsBuilder.UseMySql(@"Server=" + Hostname + ";database=" + DatabaseName + ";uid=" + Uid + ";pwd=" + Pwd + ";");
|
||||
}
|
||||
|
||||
public class Domains
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Domain { get; set; }
|
||||
public bool IsMail { get; set; }
|
||||
}
|
||||
|
||||
public class Accounts
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; }
|
||||
public int Domain { get; set; }
|
||||
public string Password { get; set; }
|
||||
public bool CatchAll { get; set; }
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
|
||||
public class Folders
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int AccountId { get; set; }
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; }
|
||||
public int StandardFolder { get; set; }
|
||||
}
|
||||
|
||||
public enum StandardFolders
|
||||
{
|
||||
INBOX = 1,
|
||||
TRASH = 2,
|
||||
SPAM = 3
|
||||
}
|
||||
|
||||
public class Aliases
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[MaxLength(255)]
|
||||
public string SourceName { get; set; }
|
||||
public int SourceDomain { get; set; }
|
||||
public int DestinationAccount { get; set; }
|
||||
}
|
||||
|
||||
public class Mails
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int AccountId { get; set; }
|
||||
public DateTime ReceiveDate { get; set; }
|
||||
public string Data { get; set; }
|
||||
|
||||
[MaxLength(15)]
|
||||
public string SendedByServerIp { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string From { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string To { get; set; }
|
||||
public int Folder { get; set; }
|
||||
public bool Readed { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user