Database updates

This commit is contained in:
Andre Beging
2022-04-08 16:10:26 +02:00
parent e8f9c4c0f5
commit 7fb5ecf04a
15 changed files with 583 additions and 180 deletions

View File

@@ -2,7 +2,7 @@
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using EF Core template.
// Code is generated on: 04.04.2022 16:38:40
// Code is generated on: 05.04.2022 16:38:00
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View File

@@ -2,7 +2,7 @@
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using EF Core template.
// Code is generated on: 04.04.2022 16:38:40
// Code is generated on: 05.04.2022 16:38:00
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View File

@@ -2,7 +2,7 @@
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using EF Core template.
// Code is generated on: 04.04.2022 16:38:40
// Code is generated on: 05.04.2022 16:38:00
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View File

@@ -2,7 +2,7 @@
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using EF Core template.
// Code is generated on: 04.04.2022 16:38:40
// Code is generated on: 05.04.2022 16:38:00
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -40,6 +40,8 @@ namespace FoodsharingSiegen.Contracts.Entity
public virtual string EncryptedPassword { get; set; }
public virtual string Groups { get; set; }
public virtual IList<Interaction> Interactions { get; set; }
#region Extensibility Method Definitions

View File

@@ -1,23 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
using FoodsharingSiegen.Shared.Helper;
namespace FoodsharingSiegen.Contracts.Entity
{
/// <summary>
/// The user class (a. beging, 06.04.2022)
/// </summary>
public partial class User
{
#region Public Properties
/// <summary>
/// Gets or sets the value of the groups list (ab)
/// </summary>
[NotMapped]
public List<UserGroup> GroupsList
{
get
{
if (string.IsNullOrWhiteSpace(Groups)) return new List<UserGroup>();
var stringList = Groups.Split(",");
var enumList = stringList.Where(x => !string.IsNullOrWhiteSpace(x)).Select(Enum.Parse<UserGroup>).ToList();
return enumList;
}
set => Groups = string.Join(",", value);
}
/// <summary>
/// Gets or sets the value of the password (ab)
/// </summary>
[NotMapped]
public string Password
{
get => AuthHelper.Decrypt(EncryptedPassword);
get => AuthHelper.TryDecrypt(EncryptedPassword, out var password) ? password : string.Empty;
set => EncryptedPassword = AuthHelper.Encrypt(value);
}
#endregion
}
}

View File

@@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using EF Core template.
// Code is generated on: 05.04.2022 16:38:00
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
namespace FoodsharingSiegen.Contracts.Entity
{
public enum UserGroup : int
{
ReadOnly = 100,
WelcomeTeam = 200,
StoreManager = 300,
Ambassador = 400
}
}

View File

@@ -2,7 +2,7 @@
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using EF Core template.
// Code is generated on: 04.04.2022 16:38:40
// Code is generated on: 05.04.2022 16:38:00
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -20,11 +20,9 @@ namespace FoodsharingSiegen.Contracts.Entity
{
public enum UserType : int
{
Unverified = 0,
ReadOnly = 10,
WelcomeTeam = 20,
StoreManager = 30,
Ambassador = 40,
Admin = 50
Unverified = 100,
User = 200,
Admin = 300,
nix = 50
}
}