#195 database structures

This commit is contained in:
Hamid Reza Mohammadi 2021-08-26 16:56:03 +04:30
parent 1fd8f30d44
commit 6179e96857
9 changed files with 3161 additions and 2 deletions

View File

@ -8,8 +8,8 @@
},
"AllowedHosts": "*",
"GoogleAnalyticsCode": "",
"APIRoot": "https://ganjgah.ir",
"GlobalAPIRoot": "https://ganjgah.ir",
"APIRoot": "http://localhost:3439",
"GlobalAPIRoot": "http://localhost:3439",
"SiteUrl": "http://localhost:33081",
"ReadOnlyMode": "False"
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class UserBehaviourLogs : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LockoutMessage",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ScreenName",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "BannedEmails",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NormalizedEmail = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BannedEmails", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UserBehaviourLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UserBehaviourLogs", x => x.Id);
table.ForeignKey(
name: "FK_UserBehaviourLogs_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_UserBehaviourLogs_UserId",
table: "UserBehaviourLogs",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BannedEmails");
migrationBuilder.DropTable(
name: "UserBehaviourLogs");
migrationBuilder.DropColumn(
name: "LockoutMessage",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "ScreenName",
table: "AspNetUsers");
}
}
}

View File

@ -1703,6 +1703,23 @@ namespace RMuseum.Migrations
b.ToTable("AuditLogs");
});
modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.BannedEmail", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("BannedEmails");
});
modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppRole", b =>
{
b.Property<Guid>("Id")
@ -1769,6 +1786,9 @@ namespace RMuseum.Migrations
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("LockoutMessage")
.HasColumnType("nvarchar(max)");
b.Property<string>("NickName")
.HasColumnType("nvarchar(max)");
@ -1792,6 +1812,9 @@ namespace RMuseum.Migrations
b.Property<Guid?>("RImageId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ScreenName")
.HasColumnType("nvarchar(max)");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
@ -1907,6 +1930,28 @@ namespace RMuseum.Migrations
b.ToTable("Sessions");
});
modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RUserBehaviourLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateTime")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("UserId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UserBehaviourLogs");
});
modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RVerifyQueueItem", b =>
{
b.Property<Guid>("Id")
@ -2731,6 +2776,17 @@ namespace RMuseum.Migrations
b.Navigation("RAppUser");
});
modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RUserBehaviourLog", b =>
{
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("RSecurityBackend.Models.Generic.Db.RGenericOption", b =>
{
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser")

View File

@ -114,5 +114,15 @@ namespace RSecurityBackend.DbContext
/// Options
/// </summary>
public DbSet<RGenericOption> Options { get; set; }
/// <summary>
/// user bad behaviour loigs
/// </summary>
public DbSet<RUserBehaviourLog> UserBehaviourLogs { get; set; }
/// <summary>
/// banned emails
/// </summary>
public DbSet<BannedEmail> BannedEmails { get; set; }
}
}

View File

@ -0,0 +1,25 @@
using System;
namespace RSecurityBackend.Models.Auth.Db
{
/// <summary>
/// banned emails (previous users who had been kicked out and their emails are logged to not allow them to signup again)
/// </summary>
public class BannedEmail
{
/// <summary>
/// id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// all capital email
/// </summary>
public string NormalizedEmail { get; set; }
/// <summary>
/// cause
/// </summary>
public string Description { get; set; }
}
}

View File

@ -58,5 +58,15 @@ namespace RSecurityBackend.Models.Auth.Db
/// web site
/// </summary>
public string Website { get; set; }
/// <summary>
/// user screen name
/// </summary>
public string ScreenName { get; set; }
/// <summary>
/// if user is locked out purposely as some kind of temporary punishment put the message for him or her here
/// </summary>
public string LockoutMessage { get; set; }
}
}

View File

@ -0,0 +1,35 @@
using System;
namespace RSecurityBackend.Models.Auth.Db
{
/// <summary>
/// logs for user bad actions which may due to rule end in him or her being banned from the platform
/// </summary>
public class RUserBehaviourLog
{
/// <summary>
/// id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// user id
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// user
/// </summary>
public RAppUser User { get; set; }
/// <summary>
/// datetime
/// </summary>
public DateTime DateTime { get; set; }
/// <summary>
/// description
/// </summary>
public string Description { get; set; }
}
}

View File

@ -714,6 +714,16 @@
Options
</summary>
</member>
<member name="P:RSecurityBackend.DbContext.RSecurityDbContext`3.UserBehaviourLogs">
<summary>
user bad behaviour loigs
</summary>
</member>
<member name="P:RSecurityBackend.DbContext.RSecurityDbContext`3.BannedEmails">
<summary>
banned emails
</summary>
</member>
<member name="T:RSecurityBackend.Models.Audit.Db.REvent">
<summary>
Audit Event
@ -769,6 +779,26 @@
Jason Data
</summary>
</member>
<member name="T:RSecurityBackend.Models.Auth.Db.BannedEmail">
<summary>
banned emails (previous users who had been kicked out and their emails are logged to not allow them to signup again)
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.BannedEmail.Id">
<summary>
id
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.BannedEmail.NormalizedEmail">
<summary>
all capital email
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.BannedEmail.Description">
<summary>
cause
</summary>
</member>
<member name="T:RSecurityBackend.Models.Auth.Db.RAppRole">
<summary>
Role Permissions (a set of defined permision policies which could be assigned to users)
@ -845,6 +875,16 @@
web site
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RAppUser.ScreenName">
<summary>
user screen name
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RAppUser.LockoutMessage">
<summary>
if user is locked out purposely as some kind of temporary punishment put the message for him or her here
</summary>
</member>
<member name="T:RSecurityBackend.Models.Auth.Db.RAppUserStatus">
<summary>
User Status
@ -981,6 +1021,36 @@
User Token
</summary>
</member>
<member name="T:RSecurityBackend.Models.Auth.Db.RUserBehaviourLog">
<summary>
logs for user bad actions which may due to rule end in him or her being banned from the platform
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RUserBehaviourLog.Id">
<summary>
id
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RUserBehaviourLog.UserId">
<summary>
user id
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RUserBehaviourLog.User">
<summary>
user
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RUserBehaviourLog.DateTime">
<summary>
datetime
</summary>
</member>
<member name="P:RSecurityBackend.Models.Auth.Db.RUserBehaviourLog.Description">
<summary>
description
</summary>
</member>
<member name="T:RSecurityBackend.Models.Auth.Db.RVerifyQueueItem">
<summary>
User SignUp Queue