Change database to be better suited for website
This commit is contained in:
+20
-42
@@ -7,18 +7,14 @@ CREATE TABLE IF NOT EXISTS `Account` (
|
||||
`Email` varchar(60) DEFAULT NULL,
|
||||
`EmailVerified` tinyint(4) DEFAULT NULL,
|
||||
`PasswordHash` varchar(100) DEFAULT NULL,
|
||||
`FailedPasswordLock` tinyint(4) DEFAULT NULL,
|
||||
`PasswordAttempts` int(11) DEFAULT NULL,
|
||||
`CurrentPasswordAttempts` int(11) DEFAULT NULL,
|
||||
`Role` varchar(45) DEFAULT NULL,
|
||||
`EmailToken` varchar(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) AUTO_INCREMENT=1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `AccountInventory` (
|
||||
`AccountID` int(11) NOT NULL,
|
||||
`ProductID` int(11) NOT NULL,
|
||||
`Item` varchar(45) NOT NULL,
|
||||
`Quantity` int(11) DEFAULT NULL,
|
||||
`Stats` varchar(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`AccountID`,`ProductID`,`Item`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Product` (
|
||||
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(45) DEFAULT NULL,
|
||||
@@ -36,6 +32,14 @@ CREATE TABLE IF NOT EXISTS `ProductImage` (
|
||||
PRIMARY KEY (`ImageID`,`ProductID`)
|
||||
) AUTO_INCREMENT=1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ProductInventory` (
|
||||
`AccountID` int(11) NOT NULL,
|
||||
`ProductID` int(11) NOT NULL,
|
||||
`Key` varchar(45) NOT NULL,
|
||||
`Value` text DEFAULT NULL,
|
||||
PRIMARY KEY (`AccountID`,`ProductID`,`Key`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Cart` (
|
||||
`ID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`AccountID` int(11) DEFAULT NULL,
|
||||
@@ -47,17 +51,6 @@ CREATE TABLE IF NOT EXISTS `Cart` (
|
||||
CONSTRAINT `Cart_ibfk_2` FOREIGN KEY (`ProductID`) REFERENCES `Product` (`ID`)
|
||||
) AUTO_INCREMENT=1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ProjectMistData` (
|
||||
`AccountID` int(11) NOT NULL,
|
||||
`Credits` int(11) DEFAULT NULL,
|
||||
`OddballTimer` double DEFAULT NULL,
|
||||
`SessionToken` varchar(45) DEFAULT NULL,
|
||||
`SessionID` int(11) DEFAULT NULL,
|
||||
`Kills` int(11) DEFAULT NULL,
|
||||
`Deaths` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`AccountID`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Receipt` (
|
||||
`AccountID` int(11) NOT NULL,
|
||||
`ProductID` int(11) NOT NULL,
|
||||
@@ -66,17 +59,7 @@ CREATE TABLE IF NOT EXISTS `Receipt` (
|
||||
`Time` datetime DEFAULT NULL,
|
||||
`TaxAmount` int(11) DEFAULT NULL,
|
||||
`TotalCost` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`AccountID`,`ProductID`,`ReceiptID`,`LineItem`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `WebsiteData` (
|
||||
`AccountID` int(11) NOT NULL,
|
||||
`FailedPasswordLock` tinyint(4) DEFAULT NULL,
|
||||
`PasswordAttempts` int(11) DEFAULT NULL,
|
||||
`CurrentPasswordAttempts` int(11) DEFAULT NULL,
|
||||
`Role` varchar(45) DEFAULT NULL,
|
||||
`EmailToken` varchar(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`AccountID`)
|
||||
PRIMARY KEY (`AccountID`,`ProductID`,`ReceiptID`)
|
||||
);
|
||||
|
||||
INSERT INTO Account (
|
||||
@@ -84,23 +67,18 @@ INSERT INTO Account (
|
||||
UserName,
|
||||
Email,
|
||||
EmailVerified,
|
||||
PasswordHash
|
||||
) VALUES (
|
||||
1,
|
||||
'admin',
|
||||
'admin@mistox.com',
|
||||
1,
|
||||
'$2a$11$0UeWLLqTXe3FG161QVuI0OQJ9rulspUpMG581DI6KSzDXBbFKd00S'
|
||||
);
|
||||
|
||||
INSERT INTO WebsiteData (
|
||||
AccountID,
|
||||
PasswordHash,
|
||||
FailedPasswordLock,
|
||||
PasswordAttempts,
|
||||
CurrentPasswordAttempts,
|
||||
Role,
|
||||
EmailToken
|
||||
) VALUES (
|
||||
1,
|
||||
'admin',
|
||||
'admin@mistox.com',
|
||||
1,
|
||||
'$2a$11$0UeWLLqTXe3FG161QVuI0OQJ9rulspUpMG581DI6KSzDXBbFKd00S',
|
||||
1,
|
||||
1,
|
||||
5,
|
||||
|
||||
@@ -8,18 +8,14 @@ namespace MistoxWebsite.Server.Entities {
|
||||
public string Email { get; set; } = "";
|
||||
public bool EmailVerified { get; set; } = false;
|
||||
public string PasswordHash { get; set; } = "";
|
||||
public WebSiteData SiteData { get; set; } = new WebSiteData();
|
||||
public bool FailedPasswordLock { get; set; } = false;
|
||||
public int PasswordAttempts { get; set; } = 5;
|
||||
public int CurrentPasswordAttempts { get; set; } = 0;
|
||||
public string Role { get; set; } = "Generic";
|
||||
public string EmailToken { get; set; } = "";
|
||||
public string Error { get; set; } = "";
|
||||
}
|
||||
|
||||
public class AccountInventory {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int ProductID { get; set; } // PK
|
||||
public string Item { get; set; } = string.Empty; // PK
|
||||
public int Quantity { get; set; }
|
||||
public string Stats { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Product {
|
||||
public int ID { get; set; } // PK
|
||||
public string Name { get; set; } = "";
|
||||
@@ -31,44 +27,33 @@ namespace MistoxWebsite.Server.Entities {
|
||||
|
||||
public class ProductImage {
|
||||
public int ImageID { get; set; } // PK
|
||||
public int ProductID { get; set; }
|
||||
public int ProductID { get; set; } // PK
|
||||
public byte[] Image { get; set; } = Array.Empty<byte>();
|
||||
public string Name { get; set; } = "";
|
||||
}
|
||||
|
||||
public class Cart {
|
||||
public int ID { get; set; }
|
||||
public int AccountID { get; set; }
|
||||
public int ProductID { get; set; }
|
||||
public class ProductInventory {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int ProductID { get; set; } // PK
|
||||
public string Key { get; set; } = string.Empty; // PK
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ProjectMistData {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int Credits { get; set; }
|
||||
public int OddballTimer { get; set; }
|
||||
public string SessionToken { get; set; } = "";
|
||||
public int SessionID { get; set; }
|
||||
public int Kills { get; set; }
|
||||
public int Deaths { get; set; }
|
||||
public class Cart {
|
||||
public int ID { get; set; } // PK
|
||||
public int AccountID { get; set; }
|
||||
public int ProductID { get; set; }
|
||||
}
|
||||
|
||||
public class Receipt {
|
||||
public int AccountID { get; set; } // PK
|
||||
public int ProductID { get; set; } // PK
|
||||
public string ReceiptID { get; set; } = string.Empty;
|
||||
public string ReceiptID { get; set; } = string.Empty; // PK
|
||||
public int LineItem { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
public int TaxAmount { get; set; }
|
||||
public int TotalCost { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
}
|
||||
|
||||
public class WebSiteData {
|
||||
public int AccountID { get; set; } // PK
|
||||
public bool FailedPasswordLock { get; set; } = false;
|
||||
public int PasswordAttempts { get; set; } = 5;
|
||||
public int CurrentPasswordAttempts { get; set; } = 0;
|
||||
public string Role { get; set; } = "Generic";
|
||||
public string EmailToken { get; set; } = "";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user