diff --git a/csharp/App/Backend/DataTypes/DeletedFolder.cs b/csharp/App/Backend/DataTypes/DeletedFolder.cs deleted file mode 100644 index d25995835..000000000 --- a/csharp/App/Backend/DataTypes/DeletedFolder.cs +++ /dev/null @@ -1,11 +0,0 @@ -using SQLite; - -namespace InnovEnergy.App.Backend.DataTypes; - -public class DeletedFolder : Folder -{ - [PrimaryKey] - public override Int64 Id { get; set; } -} - -//Deleted Things need to have AT LEAST every property that normal things have \ No newline at end of file diff --git a/csharp/App/Backend/DataTypes/DeletedInstallation.cs b/csharp/App/Backend/DataTypes/DeletedInstallation.cs deleted file mode 100644 index 5cd103d84..000000000 --- a/csharp/App/Backend/DataTypes/DeletedInstallation.cs +++ /dev/null @@ -1,10 +0,0 @@ -using SQLite; - -namespace InnovEnergy.App.Backend.DataTypes; - -//Deleted Things need to have AT LEAST every property that normal things have -public class DeletedInstallation : Installation -{ - [PrimaryKey] - public override Int64 Id { get; set; } -} \ No newline at end of file diff --git a/csharp/App/Backend/DataTypes/DeletedUser.cs b/csharp/App/Backend/DataTypes/DeletedUser.cs deleted file mode 100644 index 04e169dc8..000000000 --- a/csharp/App/Backend/DataTypes/DeletedUser.cs +++ /dev/null @@ -1,13 +0,0 @@ -using SQLite; - -namespace InnovEnergy.App.Backend.DataTypes; - -//Deleted Things need to have AT LEAST every property that normal things have - -public class DeletedUser : User -{ - public override String Name { get; set; } = null!; - - [PrimaryKey] - public override Int64 Id { get; set; } -} \ No newline at end of file diff --git a/csharp/App/Backend/DataTypes/Methods/Folder.cs b/csharp/App/Backend/DataTypes/Methods/Folder.cs index 9a7dfa766..a71960f52 100644 --- a/csharp/App/Backend/DataTypes/Methods/Folder.cs +++ b/csharp/App/Backend/DataTypes/Methods/Folder.cs @@ -23,17 +23,6 @@ public static class FolderMethods .NotNull(); } - public static DeletedFolder ToDeletedFolder(this Folder folder) - { - var deletedFolder = new DeletedFolder(); - foreach (var property in folder.GetType().GetProperties()) - { - property.SetValue(deletedFolder,property.GetValue(folder)); - } - - return deletedFolder; - } - public static IEnumerable UsersWithInheritedAccess(this Folder folder) { return folder diff --git a/csharp/App/Backend/DataTypes/Methods/Installation.cs b/csharp/App/Backend/DataTypes/Methods/Installation.cs index 76d6ac88b..fbae86041 100644 --- a/csharp/App/Backend/DataTypes/Methods/Installation.cs +++ b/csharp/App/Backend/DataTypes/Methods/Installation.cs @@ -70,17 +70,6 @@ public static class InstallationMethods .SelectMany(f => f.UsersWithDirectAccess()) .NotNull(); } - - public static DeletedInstallation ToDeletedInstallation(this Installation installation) - { - var deletedInstallation = new DeletedInstallation(); - foreach (var property in installation.GetType().GetProperties()) - { - property.SetValue(deletedInstallation, property.GetValue(installation)); - } - - return deletedInstallation; - } public static IEnumerable Ancestors(this Installation installation) { diff --git a/csharp/App/Backend/DataTypes/Methods/Session.cs b/csharp/App/Backend/DataTypes/Methods/Session.cs index 7d626a218..120a1ab72 100644 --- a/csharp/App/Backend/DataTypes/Methods/Session.cs +++ b/csharp/App/Backend/DataTypes/Methods/Session.cs @@ -74,7 +74,6 @@ public static class SessionMethods && folder is not null && user.HasWriteAccess && user.HasAccessTo(folder) - && Db.Create(folder.ToDeletedFolder()) && Db.Delete(folder); } @@ -144,7 +143,6 @@ public static class SessionMethods && installation is not null && user.HasWriteAccess && user.HasAccessTo(installation) - && Db.Create(installation.ToDeletedInstallation()) && Db.Delete(installation); } @@ -205,7 +203,6 @@ public static class SessionMethods && userToDelete is not null && sessionUser.HasWriteAccess && sessionUser.HasAccessTo(userToDelete) - && Db.Create(sessionUser.ToDeletedUser()) && Db.Delete(userToDelete); } diff --git a/csharp/App/Backend/DataTypes/Methods/User.cs b/csharp/App/Backend/DataTypes/Methods/User.cs index 6b825f6b5..8cf801112 100644 --- a/csharp/App/Backend/DataTypes/Methods/User.cs +++ b/csharp/App/Backend/DataTypes/Methods/User.cs @@ -204,17 +204,6 @@ public static class UserMethods user.Password = other.Password; return user; } - - public static DeletedUser ToDeletedUser(this User user) - { - var deletedUser = new DeletedUser(); - foreach (var property in user.GetType().GetProperties()) - { - property.SetValue(deletedUser,property.GetValue(user)); - } - - return deletedUser; - } public static User HidePassword(this User user) { diff --git a/csharp/App/Backend/Database/Create.cs b/csharp/App/Backend/Database/Create.cs index 24944ba2b..627b5a191 100644 --- a/csharp/App/Backend/Database/Create.cs +++ b/csharp/App/Backend/Database/Create.cs @@ -20,30 +20,15 @@ public static partial class Db return Insert(installation); } - public static Boolean Create(DeletedInstallation installation) - { - return Insert(installation); - } - public static Boolean Create(Folder folder) { return Insert(folder); } - public static Boolean Create(DeletedFolder folder) - { - return Insert(folder); - } - public static Boolean Create(User user) { return Insert(user); } - - public static Boolean Create(DeletedUser user) - { - return Insert(user); - } public static Boolean Create(Session session) { diff --git a/csharp/App/Backend/Database/Db.cs b/csharp/App/Backend/Database/Db.cs index 45d6e4097..0a630bc50 100644 --- a/csharp/App/Backend/Database/Db.cs +++ b/csharp/App/Backend/Database/Db.cs @@ -33,10 +33,7 @@ public static partial class Db // fileConnection.Backup(memoryConnection.DatabasePath); memoryConnection.CreateTable(); - memoryConnection.CreateTable(); memoryConnection.CreateTable(); - memoryConnection.CreateTable(); - memoryConnection.CreateTable(); memoryConnection.CreateTable(); memoryConnection.CreateTable(); memoryConnection.CreateTable(); @@ -71,19 +68,6 @@ public static partial class Db { memoryConnection.Insert(obj); } - foreach (var obj in fileConnection.Table()) - { - memoryConnection.Insert(obj); - } - foreach (var obj in fileConnection.Table()) - { - memoryConnection.Insert(obj); - } - foreach (var obj in fileConnection.Table()) - { - memoryConnection.Insert(obj); - } - return memoryConnection; }))(); @@ -100,10 +84,6 @@ public static partial class Db public static TableQuery FolderAccess => Connection.Table(); public static TableQuery InstallationAccess => Connection.Table(); public static TableQuery OrderNumber2Installation => Connection.Table(); - - public static TableQuery DeletedInstallations => Connection.Table(); - public static TableQuery DeletedUsers => Connection.Table(); - public static TableQuery DeletedFolders => Connection.Table(); public static void Init() { @@ -118,10 +98,7 @@ public static partial class Db Connection.RunInTransaction(() => { Connection.CreateTable(); - Connection.CreateTable(); Connection.CreateTable(); - Connection.CreateTable(); - Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable();