Compare commits
105 Commits
test-jenki
...
master
Author | SHA1 | Date | |
---|---|---|---|
50236f8ea0 | |||
2b4cd79484 | |||
79f6bede98 | |||
c9a4e7aa0d | |||
73f01e8e2c | |||
57759fb91e | |||
815bd676d1 | |||
1412362b79 | |||
6f8cf6dcb4 | |||
b9928d6ce0 | |||
7b122e160e | |||
479fd2114b | |||
fcfd8665c2 | |||
a4ed6faa05 | |||
4ed509bd0a | |||
0fd20fd2b1 | |||
530c49f1b7 | |||
e6b632f8f6 | |||
e83bc3fa73 | |||
012c8828e1 | |||
663b33e4a8 | |||
fde1196069 | |||
cd1a0af239 | |||
![]() |
b0e0e5c5f5 | ||
![]() |
81aebe44de | ||
3c57f7770e | |||
![]() |
db2de42824 | ||
![]() |
8e59538db8 | ||
553a27a92a | |||
712f87c696 | |||
0c0bdc70e5 | |||
8530f3e940 | |||
c96dd4f567 | |||
![]() |
9efefd96fe | ||
![]() |
6131bbe706 | ||
![]() |
bc6709e905 | ||
![]() |
2cac5bd829 | ||
![]() |
09b7db8aaf | ||
68200162da | |||
572b48c15e | |||
4580c2fe17 | |||
1dc09fae4e | |||
![]() |
544b8a1982 | ||
eefab76c50 | |||
![]() |
5d8f5578c3 | ||
247ce78c2b | |||
![]() |
31db5c9b73 | ||
e65ad753ad | |||
8712191acc | |||
5ed3e025ec | |||
33a51eef3f | |||
ccfdff6791 | |||
![]() |
46b2d54f26 | ||
![]() |
6cc4ed74a9 | ||
![]() |
a35e2ed567 | ||
![]() |
e6a6ac290a | ||
![]() |
71687cafad | ||
b6a80a2e89 | |||
c55f504741 | |||
2db796f3dc | |||
f957654596 | |||
4aea17277a | |||
e2b55ada11 | |||
6ed0708e49 | |||
e27ccdd05d | |||
![]() |
2d152df1b1 | ||
![]() |
a88dfaa54f | ||
8ccdcb955e | |||
![]() |
a53f35a90a | ||
![]() |
ceb836d734 | ||
![]() |
b5c37e40e4 | ||
![]() |
b2387e0cc0 | ||
![]() |
561b688519 | ||
![]() |
6cb742caa2 | ||
21710903ed | |||
![]() |
4793312858 | ||
e53d87416b | |||
53c2d7cfcc | |||
f0c14da49c | |||
0196595df2 | |||
cd63f5e402 | |||
18fe024fd1 | |||
333283443e | |||
b242455a88 | |||
d6c7107915 | |||
9dfac7d081 | |||
553232acf7 | |||
7860c1d535 | |||
84616f3344 | |||
a303a7da7e | |||
422d794d79 | |||
501738f247 | |||
![]() |
afe73424df | ||
ebb250bd88 | |||
850ae8e610 | |||
![]() |
bdeca6efbe | ||
f123ef65eb | |||
dfc3cdac98 | |||
e3bcf28f46 | |||
d2d8bd8cab | |||
f455c985d2 | |||
50a11e0434 | |||
13e0e77b52 | |||
d59c20bd0b | |||
7e15254cc1 |
32
Jenkinsfile
vendored
32
Jenkinsfile
vendored
@ -1,24 +1,3 @@
|
|||||||
//pipeline {
|
|
||||||
// agent any
|
|
||||||
// stages {
|
|
||||||
// stage('Build image') {
|
|
||||||
// steps {
|
|
||||||
// echo "Building docker image"
|
|
||||||
// script {
|
|
||||||
// dir('SessionCompanion/SessionCompanion'){
|
|
||||||
// def customImage = docker.build("session-companion:${env.BUILD_ID}")
|
|
||||||
// //customImage.withRun('-p 5050:5050')
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// stage('Delete image') {
|
|
||||||
// steps {
|
|
||||||
// sh "docker rmi session-companion:${env.BUILD_ID}"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
@ -34,15 +13,22 @@ pipeline {
|
|||||||
dir('SessionCompanion') {
|
dir('SessionCompanion') {
|
||||||
sh "echo $USER"
|
sh "echo $USER"
|
||||||
withEnv(["HOME=${env.WORKSPACE}"]){
|
withEnv(["HOME=${env.WORKSPACE}"]){
|
||||||
|
dir ('SessionCompanion/ClientApp') {
|
||||||
|
sh 'npm cache clean --force'
|
||||||
|
sh 'npm install'
|
||||||
|
}
|
||||||
sh 'dotnet build'
|
sh 'dotnet build'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Clarify') {
|
stage('Clear') {
|
||||||
steps {
|
steps {
|
||||||
sh "echo Dziala"
|
withEnv(["HOME=${env.WORKSPACE}"]){
|
||||||
|
sh 'rm -rf .local'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database
|
||||||
|
{
|
||||||
|
public class ApplicationDbContext : DbContext
|
||||||
|
{
|
||||||
|
public virtual DbSet<Alignment> Alignments { get; set; }
|
||||||
|
public virtual DbSet<Background> Backgrounds { get; set; }
|
||||||
|
public virtual DbSet<Biography> Biographies { get; set; }
|
||||||
|
public virtual DbSet<Character> Characters { get; set; }
|
||||||
|
public virtual DbSet<Charisma> Charismas { get; set; }
|
||||||
|
public virtual DbSet<Class> Classes { get; set; }
|
||||||
|
public virtual DbSet<Constitution> Constitutions { get; set; }
|
||||||
|
public virtual DbSet<Dexterity> Dexterities { get; set; }
|
||||||
|
public virtual DbSet<Intelligence> Intelligences { get; set; }
|
||||||
|
public virtual DbSet<Race> Races { get; set; }
|
||||||
|
public virtual DbSet<Statistics> Statistics { get; set; }
|
||||||
|
public virtual DbSet<Strength> Strengths { get; set; }
|
||||||
|
public virtual DbSet<User> Users { get; set; }
|
||||||
|
public virtual DbSet<Wisdom> Wisdoms { get; set; }
|
||||||
|
|
||||||
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder builder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(builder);
|
||||||
|
builder.Entity<User>().HasData(SeedData.SeedUsers());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
317
SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.Designer.cs
generated
Normal file
317
SessionCompanion/SessionCompanion.Database/Migrations/20201203161115_Base-Tables.Designer.cs
generated
Normal file
@ -0,0 +1,317 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using SessionCompanion.Database;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20201203161115_Base-Tables")]
|
||||||
|
partial class BaseTables
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.UseIdentityColumns()
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||||
|
.HasAnnotation("ProductVersion", "5.0.0");
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Alignments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Backgrounds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("AlignmentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("BackgroundId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ClassId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("RaceId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Sex")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AlignmentId");
|
||||||
|
|
||||||
|
b.HasIndex("BackgroundId");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("ClassId");
|
||||||
|
|
||||||
|
b.HasIndex("RaceId");
|
||||||
|
|
||||||
|
b.ToTable("Biographies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("Characters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Classes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Races");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("ArmorClass")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CurrentHealthPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ExperiencePoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("HealthPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Initiative")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Level")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Proficiency")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Speed")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Statistics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Nickname")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Nickname = "Morwiec",
|
||||||
|
Password = "123"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Nickname = "Cichoklepiec",
|
||||||
|
Password = "123"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Nickname = "Ruletka",
|
||||||
|
Password = "123"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("AlignmentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Background", "Background")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("BackgroundId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Biography")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Class", "Class")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("ClassId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Race", "Race")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("RaceId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Alignment");
|
||||||
|
|
||||||
|
b.Navigation("Background");
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
|
||||||
|
b.Navigation("Class");
|
||||||
|
|
||||||
|
b.Navigation("Race");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.User", "User")
|
||||||
|
.WithMany("Character")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Statistics")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
|
||||||
|
b.Navigation("Statistics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,248 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class BaseTables : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Alignments",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Alignments", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Backgrounds",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Backgrounds", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Classes",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Classes", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Races",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Races", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Users",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Nickname = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Characters",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
UserId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Characters", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Characters_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Biographies",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
ClassId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
RaceId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
AlignmentId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
BackgroundId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Sex = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Biographies", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Biographies_Alignments_AlignmentId",
|
||||||
|
column: x => x.AlignmentId,
|
||||||
|
principalTable: "Alignments",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Biographies_Backgrounds_BackgroundId",
|
||||||
|
column: x => x.BackgroundId,
|
||||||
|
principalTable: "Backgrounds",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Biographies_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Biographies_Classes_ClassId",
|
||||||
|
column: x => x.ClassId,
|
||||||
|
principalTable: "Classes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Biographies_Races_RaceId",
|
||||||
|
column: x => x.RaceId,
|
||||||
|
principalTable: "Races",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Statistics",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ExperiencePoints = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Level = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Speed = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Initiative = table.Column<int>(type: "int", nullable: false),
|
||||||
|
HealthPoints = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CurrentHealthPoints = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ArmorClass = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Proficiency = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Statistics", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Statistics_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Users",
|
||||||
|
columns: new[] { "Id", "Nickname", "Password" },
|
||||||
|
values: new object[] { 1, "Morwiec", "123" });
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Users",
|
||||||
|
columns: new[] { "Id", "Nickname", "Password" },
|
||||||
|
values: new object[] { 2, "Cichoklepiec", "123" });
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Users",
|
||||||
|
columns: new[] { "Id", "Nickname", "Password" },
|
||||||
|
values: new object[] { 3, "Ruletka", "123" });
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Biographies_AlignmentId",
|
||||||
|
table: "Biographies",
|
||||||
|
column: "AlignmentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Biographies_BackgroundId",
|
||||||
|
table: "Biographies",
|
||||||
|
column: "BackgroundId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Biographies_CharacterId",
|
||||||
|
table: "Biographies",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Biographies_ClassId",
|
||||||
|
table: "Biographies",
|
||||||
|
column: "ClassId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Biographies_RaceId",
|
||||||
|
table: "Biographies",
|
||||||
|
column: "RaceId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Characters_UserId",
|
||||||
|
table: "Characters",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Statistics_CharacterId",
|
||||||
|
table: "Statistics",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Biographies");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Statistics");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Alignments");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Backgrounds");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Classes");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Races");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Characters");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Users");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
683
SessionCompanion/SessionCompanion.Database/Migrations/20201213175031_Username column rename.Designer.cs
generated
Normal file
683
SessionCompanion/SessionCompanion.Database/Migrations/20201213175031_Username column rename.Designer.cs
generated
Normal file
@ -0,0 +1,683 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using SessionCompanion.Database;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20201213175031_Username column rename")]
|
||||||
|
partial class Usernamecolumnrename
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.UseIdentityColumns()
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||||
|
.HasAnnotation("ProductVersion", "5.0.0");
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Alignments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Backgrounds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("AlignmentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("BackgroundId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ClassId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("RaceId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Sex")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AlignmentId");
|
||||||
|
|
||||||
|
b.HasIndex("BackgroundId");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("ClassId");
|
||||||
|
|
||||||
|
b.HasIndex("RaceId");
|
||||||
|
|
||||||
|
b.ToTable("Biographies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("Characters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<bool>("CanDeception")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanIntimidation")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanPerformance")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanPersuasion")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Deception")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Intimidation")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Performance")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Persuasion")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Charismas");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Classes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Constitutions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Acrobatics")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanAcrobatics")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSleightOfHand")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanStealth")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SleightOfHand")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Stealth")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Dexterities");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Arcana")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanArcana")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanHistory")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanInvestigation")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanNature")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanReligion")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("History")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Investigation")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Nature")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Religion")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Intelligences");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Races");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("ArmorClass")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CurrentHealthPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ExperiencePoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("HealthPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Initiative")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Level")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Proficiency")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Speed")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Statistics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Athletics")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanAthletics")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Strengths");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Password = "123",
|
||||||
|
Username = "Morwiec"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Password = "123",
|
||||||
|
Username = "Cichoklepiec"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Password = "123",
|
||||||
|
Username = "Ruletka"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("AnimalHandling")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanAnimalHandling")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanInsight")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanMedicine")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanPerception")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSurvival")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Insight")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Medicine")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Perception")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Survival")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Wisdoms");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("AlignmentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Background", "Background")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("BackgroundId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Biography")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Class", "Class")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("ClassId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Race", "Race")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("RaceId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Alignment");
|
||||||
|
|
||||||
|
b.Navigation("Background");
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
|
||||||
|
b.Navigation("Class");
|
||||||
|
|
||||||
|
b.Navigation("Race");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.User", "User")
|
||||||
|
.WithMany("Character")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Charisma")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Charisma", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Constitution")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Constitution", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Dexterity")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Dexterity", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Intelligence")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Intelligence", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Statistics")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Strength")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Strength", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Wisdom")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Wisdom", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
|
||||||
|
b.Navigation("Charisma");
|
||||||
|
|
||||||
|
b.Navigation("Constitution");
|
||||||
|
|
||||||
|
b.Navigation("Dexterity");
|
||||||
|
|
||||||
|
b.Navigation("Intelligence");
|
||||||
|
|
||||||
|
b.Navigation("Statistics");
|
||||||
|
|
||||||
|
b.Navigation("Strength");
|
||||||
|
|
||||||
|
b.Navigation("Wisdom");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,251 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class Usernamecolumnrename : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Nickname",
|
||||||
|
table: "Users",
|
||||||
|
newName: "Username");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Charismas",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Value = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Modification = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SavingThrows = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Deception = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanDeception = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Intimidation = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanIntimidation = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Performance = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanPerformance = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Persuasion = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanPersuasion = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Charismas", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Charismas_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Constitutions",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Value = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Modification = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SavingThrows = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Constitutions", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Constitutions_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Dexterities",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Value = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Modification = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SavingThrows = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Acrobatics = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanAcrobatics = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
SleightOfHand = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSleightOfHand = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Stealth = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanStealth = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Dexterities", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Dexterities_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Intelligences",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Value = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Modification = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SavingThrows = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Arcana = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanArcana = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
History = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanHistory = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Investigation = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanInvestigation = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Nature = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanNature = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Religion = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanReligion = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Intelligences", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Intelligences_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Strengths",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Value = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Modification = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SavingThrows = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Athletics = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanAthletics = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Strengths", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Strengths_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Wisdoms",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
CharacterId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Value = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Modification = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SavingThrows = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
AnimalHandling = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanAnimalHandling = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Insight = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanInsight = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Medicine = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanMedicine = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Perception = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanPerception = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Survival = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CanSurvival = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Wisdoms", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Wisdoms_Characters_CharacterId",
|
||||||
|
column: x => x.CharacterId,
|
||||||
|
principalTable: "Characters",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Charismas_CharacterId",
|
||||||
|
table: "Charismas",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Constitutions_CharacterId",
|
||||||
|
table: "Constitutions",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Dexterities_CharacterId",
|
||||||
|
table: "Dexterities",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Intelligences_CharacterId",
|
||||||
|
table: "Intelligences",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Strengths_CharacterId",
|
||||||
|
table: "Strengths",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Wisdoms_CharacterId",
|
||||||
|
table: "Wisdoms",
|
||||||
|
column: "CharacterId",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Charismas");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Constitutions");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Dexterities");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Intelligences");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Strengths");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Wisdoms");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Username",
|
||||||
|
table: "Users",
|
||||||
|
newName: "Nickname");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,681 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using SessionCompanion.Database;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.UseIdentityColumns()
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||||
|
.HasAnnotation("ProductVersion", "5.0.0");
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Alignments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Backgrounds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("AlignmentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("BackgroundId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ClassId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("RaceId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Sex")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AlignmentId");
|
||||||
|
|
||||||
|
b.HasIndex("BackgroundId");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.HasIndex("ClassId");
|
||||||
|
|
||||||
|
b.HasIndex("RaceId");
|
||||||
|
|
||||||
|
b.ToTable("Biographies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("UserId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("Characters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<bool>("CanDeception")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanIntimidation")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanPerformance")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanPersuasion")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Deception")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Intimidation")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Performance")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Persuasion")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Charismas");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Classes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Constitutions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Acrobatics")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanAcrobatics")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSleightOfHand")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanStealth")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SleightOfHand")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Stealth")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Dexterities");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Arcana")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanArcana")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanHistory")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanInvestigation")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanNature")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanReligion")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("History")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Investigation")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Nature")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Religion")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Intelligences");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Races");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("ArmorClass")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CurrentHealthPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ExperiencePoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("HealthPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Initiative")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Level")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Proficiency")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Speed")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Statistics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Athletics")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanAthletics")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Strengths");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Username")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Users");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Password = "123",
|
||||||
|
Username = "Morwiec"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Password = "123",
|
||||||
|
Username = "Cichoklepiec"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Password = "123",
|
||||||
|
Username = "Ruletka"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("AnimalHandling")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("CanAnimalHandling")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanInsight")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanMedicine")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanPerception")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSaveThrows")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("CanSurvival")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("CharacterId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Insight")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Medicine")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Modification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Perception")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SavingThrows")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Survival")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Value")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CharacterId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("Wisdoms");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("AlignmentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Background", "Background")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("BackgroundId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Biography")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Class", "Class")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("ClassId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Race", "Race")
|
||||||
|
.WithMany("Biography")
|
||||||
|
.HasForeignKey("RaceId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Alignment");
|
||||||
|
|
||||||
|
b.Navigation("Background");
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
|
||||||
|
b.Navigation("Class");
|
||||||
|
|
||||||
|
b.Navigation("Race");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.User", "User")
|
||||||
|
.WithMany("Character")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Charisma")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Charisma", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Constitution")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Constitution", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Dexterity")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Dexterity", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Intelligence")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Intelligence", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Statistics")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Strength")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Strength", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
|
.WithOne("Wisdom")
|
||||||
|
.HasForeignKey("SessionCompanion.Database.Tables.Wisdom", "CharacterId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
|
||||||
|
b.Navigation("Charisma");
|
||||||
|
|
||||||
|
b.Navigation("Constitution");
|
||||||
|
|
||||||
|
b.Navigation("Dexterity");
|
||||||
|
|
||||||
|
b.Navigation("Intelligence");
|
||||||
|
|
||||||
|
b.Navigation("Statistics");
|
||||||
|
|
||||||
|
b.Navigation("Strength");
|
||||||
|
|
||||||
|
b.Navigation("Wisdom");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Biography");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Character");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class AlignmentRepository : Repository<Alignment>, IRepository<Alignment>
|
||||||
|
{
|
||||||
|
public AlignmentRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class BackgroundRepository : Repository<Background>, IRepository<Background>
|
||||||
|
{
|
||||||
|
public BackgroundRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories.Base
|
||||||
|
{
|
||||||
|
public interface IRepository<T> where T : BaseEntity
|
||||||
|
{
|
||||||
|
IQueryable<T> Get();
|
||||||
|
IQueryable<T> Get(Expression<Func<T, bool>> expression);
|
||||||
|
Task<T> Get(int id);
|
||||||
|
Task Create(T entity);
|
||||||
|
Task Update(T entity);
|
||||||
|
void Delete(T entity);
|
||||||
|
Task<bool> Any(Expression<Func<T, bool>> expression);
|
||||||
|
Task<bool> Any(int id);
|
||||||
|
void Dispose();
|
||||||
|
Task Save();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories.Base
|
||||||
|
{
|
||||||
|
public class Repository<T> : IRepository<T> where T : BaseEntity
|
||||||
|
{
|
||||||
|
protected ApplicationDbContext RepositoryContext { get; set; }
|
||||||
|
|
||||||
|
public Repository(ApplicationDbContext repositoryContext)
|
||||||
|
{
|
||||||
|
this.RepositoryContext = repositoryContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IQueryable<T> Get()
|
||||||
|
{
|
||||||
|
return this.RepositoryContext.Set<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IQueryable<T> Get(Expression<Func<T, bool>> expression)
|
||||||
|
{
|
||||||
|
return this.RepositoryContext.Set<T>().Where(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> Any(Expression<Func<T, bool>> expression)
|
||||||
|
{
|
||||||
|
return RepositoryContext.Set<T>().AnyAsync(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> Any(int id)
|
||||||
|
{
|
||||||
|
return RepositoryContext.Set<T>().AnyAsync(n => n.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<T> Get(int id)
|
||||||
|
{
|
||||||
|
return await RepositoryContext.Set<T>().FindAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual Task Create(T entity)
|
||||||
|
{
|
||||||
|
return Task.FromResult(RepositoryContext.Set<T>().AddAsync(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual Task Update(T entity)
|
||||||
|
{
|
||||||
|
return Task.FromResult(RepositoryContext.Set<T>().Update(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Delete(T entity)
|
||||||
|
{
|
||||||
|
this.RepositoryContext.Set<T>().Remove(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Save()
|
||||||
|
{
|
||||||
|
await RepositoryContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
RepositoryContext.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class BiographyRepository : Repository<Biography>, IRepository<Biography>
|
||||||
|
{
|
||||||
|
public BiographyRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class CharacterRepository : Repository<Character>, IRepository<Character>
|
||||||
|
{
|
||||||
|
public CharacterRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class CharismaRepository : Repository<Charisma>, IRepository<Charisma>
|
||||||
|
{
|
||||||
|
public CharismaRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class ClassRepository : Repository<Class>, IRepository<Class>
|
||||||
|
{
|
||||||
|
public ClassRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class ConstitutionRepository : Repository<Constitution>, IRepository<Constitution>
|
||||||
|
{
|
||||||
|
public ConstitutionRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class DexterityRepository : Repository<Dexterity>, IRepository<Dexterity>
|
||||||
|
{
|
||||||
|
public DexterityRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class IntelligenceRepository : Repository<Intelligence>, IRepository<Intelligence>
|
||||||
|
{
|
||||||
|
public IntelligenceRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class RaceRepository : Repository<Race>, IRepository<Race>
|
||||||
|
{
|
||||||
|
public RaceRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class StatisticsRepository : Repository<Statistics>, IRepository<Statistics>
|
||||||
|
{
|
||||||
|
public StatisticsRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class StrengthRepository : Repository<Strength>, IRepository<Strength>
|
||||||
|
{
|
||||||
|
public StrengthRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class UserRepository : Repository<User>, IRepository<User>
|
||||||
|
{
|
||||||
|
public UserRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class WisdomRepository : Repository<Wisdom>, IRepository<Wisdom>
|
||||||
|
{
|
||||||
|
public WisdomRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
39
SessionCompanion/SessionCompanion.Database/SeedData.cs
Normal file
39
SessionCompanion/SessionCompanion.Database/SeedData.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database
|
||||||
|
{
|
||||||
|
public class SeedData
|
||||||
|
{
|
||||||
|
static public List<User> SeedUsers()
|
||||||
|
{
|
||||||
|
List<User> users = new List<User>
|
||||||
|
{
|
||||||
|
new User
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Username = "Morwiec",
|
||||||
|
Password = "123"
|
||||||
|
},
|
||||||
|
new User
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Username = "Cichoklepiec",
|
||||||
|
Password = "123"
|
||||||
|
},
|
||||||
|
new User
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Username = "Ruletka",
|
||||||
|
Password = "123"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Alignment : BaseEntity
|
||||||
|
{
|
||||||
|
public virtual ICollection<Biography> Biography { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Background : BaseEntity
|
||||||
|
{
|
||||||
|
public virtual ICollection<Biography> Biography { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class BaseEntity
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Biography : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Class))]
|
||||||
|
public int ClassId { get; set; }
|
||||||
|
public virtual Class Class { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Race))]
|
||||||
|
public int RaceId { get; set; }
|
||||||
|
public virtual Race Race { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Alignment))]
|
||||||
|
public int AlignmentId { get; set; }
|
||||||
|
public virtual Alignment Alignment { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Background))]
|
||||||
|
public int BackgroundId { get; set; }
|
||||||
|
public virtual Background Background { get; set; }
|
||||||
|
|
||||||
|
public string Sex { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Character : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(User))]
|
||||||
|
public int UserId { get; set; }
|
||||||
|
public virtual User User { get; set; }
|
||||||
|
public virtual Biography Biography { get; set; }
|
||||||
|
public virtual Statistics Statistics { get; set; }
|
||||||
|
public virtual Charisma Charisma { get; set; }
|
||||||
|
public virtual Constitution Constitution { get; set; }
|
||||||
|
public virtual Dexterity Dexterity { get; set; }
|
||||||
|
public virtual Intelligence Intelligence { get; set; }
|
||||||
|
public virtual Strength Strength { get; set; }
|
||||||
|
public virtual Wisdom Wisdom { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Charisma : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int Value { get; set; }
|
||||||
|
public int Modification { get; set; }
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
public int Deception { get; set; }
|
||||||
|
public bool CanDeception { get; set; }
|
||||||
|
public int Intimidation { get; set; }
|
||||||
|
public bool CanIntimidation { get; set; }
|
||||||
|
public int Performance { get; set; }
|
||||||
|
public bool CanPerformance { get; set; }
|
||||||
|
public int Persuasion { get; set; }
|
||||||
|
public bool CanPersuasion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
14
SessionCompanion/SessionCompanion.Database/Tables/Class.cs
Normal file
14
SessionCompanion/SessionCompanion.Database/Tables/Class.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Class : BaseEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
//public int HitDie { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Biography> Biography { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Constitution : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int Value { get; set; }
|
||||||
|
public int Modification { get; set; }
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Dexterity : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int Value { get; set; }
|
||||||
|
public int Modification { get; set; }
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
public int Acrobatics { get; set; }
|
||||||
|
public bool CanAcrobatics { get; set; }
|
||||||
|
public int SleightOfHand { get; set; }
|
||||||
|
public bool CanSleightOfHand { get; set; }
|
||||||
|
public int Stealth { get; set; }
|
||||||
|
public bool CanStealth { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Intelligence : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int Value { get; set; }
|
||||||
|
public int Modification { get; set; }
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
public int Arcana { get; set; }
|
||||||
|
public bool CanArcana { get; set; }
|
||||||
|
public int History { get; set; }
|
||||||
|
public bool CanHistory { get; set; }
|
||||||
|
public int Investigation { get; set; }
|
||||||
|
public bool CanInvestigation { get; set; }
|
||||||
|
public int Nature { get; set; }
|
||||||
|
public bool CanNature { get; set; }
|
||||||
|
public int Religion { get; set; }
|
||||||
|
public bool CanReligion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
12
SessionCompanion/SessionCompanion.Database/Tables/Race.cs
Normal file
12
SessionCompanion/SessionCompanion.Database/Tables/Race.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Race : BaseEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public virtual ICollection<Biography> Biography { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Statistics : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int ExperiencePoints { get; set; }
|
||||||
|
public int Level { get; set; }
|
||||||
|
public int Speed { get; set; }
|
||||||
|
public int Initiative { get; set; }
|
||||||
|
public int HealthPoints { get; set; }
|
||||||
|
public int CurrentHealthPoints { get; set; }
|
||||||
|
public int ArmorClass { get; set; }
|
||||||
|
public int Proficiency { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Strength : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int Value { get; set; }
|
||||||
|
public int Modification { get; set; }
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
public int Athletics { get; set; }
|
||||||
|
public bool CanAthletics { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
SessionCompanion/SessionCompanion.Database/Tables/User.cs
Normal file
13
SessionCompanion/SessionCompanion.Database/Tables/User.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class User : BaseEntity
|
||||||
|
{
|
||||||
|
public string Username { get; set; }
|
||||||
|
public string Password { get; set; }
|
||||||
|
public ICollection<Character> Character { get; set; }
|
||||||
|
}
|
||||||
|
}
|
29
SessionCompanion/SessionCompanion.Database/Tables/Wisdom.cs
Normal file
29
SessionCompanion/SessionCompanion.Database/Tables/Wisdom.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Wisdom : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
public int Value { get; set; }
|
||||||
|
public int Modification { get; set; }
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
public int AnimalHandling { get; set; }
|
||||||
|
public bool CanAnimalHandling { get; set; }
|
||||||
|
public int Insight { get; set; }
|
||||||
|
public bool CanInsight { get; set; }
|
||||||
|
public int Medicine { get; set; }
|
||||||
|
public bool CanMedicine { get; set; }
|
||||||
|
public int Perception { get; set; }
|
||||||
|
public bool CanPerception { get; set; }
|
||||||
|
public int Survival { get; set; }
|
||||||
|
public bool CanSurvival { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Extensions.EitherType
|
||||||
|
{
|
||||||
|
public class Either<TL, TR>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Kontruktor dla lewej zmiennej
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">Wartość lewej zmiennej</param>
|
||||||
|
public Either(TL left)
|
||||||
|
{
|
||||||
|
this.Left = left;
|
||||||
|
this.IsLeft = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Konstruktor dla prawej zmiennej
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="right">Wartość prawej zmiennej</param>
|
||||||
|
public Either(TR right)
|
||||||
|
{
|
||||||
|
this.Right = right;
|
||||||
|
this.IsLeft = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lewa zmienna
|
||||||
|
/// </summary>
|
||||||
|
public TL Left { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prawa zmienna
|
||||||
|
/// </summary>
|
||||||
|
public TR Right { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Zmienna informujaca czy wykorzystana zostąła zmienna lewa czy prawa
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLeft { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tworzy obiekt typu Either wykorzystując zmienną lewą
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">Wartość lewej zmiennej</param>
|
||||||
|
public static implicit operator Either<TL, TR>(TL left) => new Either<TL, TR>(left);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tworzy obiekt typu Either wykorzystując zmienną prawą
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="right">Wartosć prawej zmiennej</param>
|
||||||
|
public static implicit operator Either<TL, TR>(TR right) => new Either<TL, TR>(right);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bazowa metoda dopasowania wzorów.
|
||||||
|
/// Jeśli podana jest wartość lewa, to Match zwróci wynik lewej funkcji, w przeciwnym razie wynik prawej funkcji.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Typ zwracanej wartości</typeparam>
|
||||||
|
/// <param name="leftFunc">Lewa funkcja </param>
|
||||||
|
/// <param name="rightFunc">Prawa funkcja</param>
|
||||||
|
/// <returns>Wynik prawej/lewej funkcji</returns>
|
||||||
|
public T Match<T>(Func<TL, T> leftFunc, Func<TR, T> rightFunc)
|
||||||
|
{
|
||||||
|
if (leftFunc == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(leftFunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rightFunc == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(rightFunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.IsLeft ? leftFunc(this.Left) : rightFunc(this.Right);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bazowa metoda dopasowania wzorów.
|
||||||
|
/// Jeśli podana jest wartość lewa, to Match wykona lewą funkcję, w przeciwnym razie wykona funkcję prawą.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="leftFunc">Lewa funkcja </param>
|
||||||
|
/// <param name="rightFunc">Prawa funkcja</param>
|
||||||
|
public void Match(Action<TL> leftFunc, Action<TR> rightFunc)
|
||||||
|
{
|
||||||
|
if (leftFunc == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(leftFunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rightFunc == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(rightFunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.IsLeft)
|
||||||
|
{
|
||||||
|
leftFunc(this.Left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rightFunc(this.Right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Funkcja ustala czy uzyta została lewa zmienna, jesli tak to zwraca jej wartość inaczej zwraca defaultowy obiekt
|
||||||
|
/// o typie takim jak lewa zmienna
|
||||||
|
/// </summary>
|
||||||
|
/// <returns> Wartosć lewej zmiennej lub defaultową wartość o typie lewej zmiennej</returns>
|
||||||
|
public TL LeftOrDefault() => this.Match(l => l, r => default(TL));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Funkcja ustala czy uzyta została prawa zmienna, jesli tak to zwraca jej wartość inaczej zwraca defaultowy obiekt
|
||||||
|
/// o typie takim jak lewa zmienna
|
||||||
|
/// </summary>
|
||||||
|
/// <returns> Wartosć lewej zmiennej lub defaultową wartość o typie prawej zmiennej</returns>
|
||||||
|
public TR RightOrDefault() => this.Match(l => default(TR), r => r);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,184 @@
|
|||||||
|
# Either
|
||||||
|
|
||||||
|
### Jak używać
|
||||||
|
|
||||||
|
Either umożliwa nam zwrócenie z metody bądź nawet kontrolera, dwóch możliwych wyników.
|
||||||
|
Dla ułatwienia zrozumienai poniżej podaję przykłady stosowania.
|
||||||
|
|
||||||
|
Jako typ zmiennej zwracanej z api:
|
||||||
|
W tym przypadku wskazujemy, że nasze api zwróci albo CharacterViewModel albo ErrorResponse
|
||||||
|
```cs
|
||||||
|
public async Task<Either<CharacterViewModel, ErrorResponse>> Get(int id)
|
||||||
|
```
|
||||||
|
Aby zwrócić ten typ mamy dwie możliwości.
|
||||||
|
Możemy wywołać metodę z serisu, która ma nam zwrócić CharacterViewModel.
|
||||||
|
Następnie sprawdzić czy otrzymana wartość CharacerViewModel zawiera jakiekolwiek dane i odpowiednio, jeśli tak to zwracamy otrzymany viewmodel a jeśli nie tworzymy ErrorResponse i zwracamy wynik:
|
||||||
|
```cs
|
||||||
|
public async Task<Either<CharacterViewModel, ErrorResponse>> Get(int id)
|
||||||
|
{
|
||||||
|
Either<CharacterViewModel, ErrorResponse> result = await _service.Get(id);
|
||||||
|
|
||||||
|
if (result.Left != null)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ErrorResponse { StatusCode = 400, Message = "Coś poszło nie tak" };
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
W przypadku jesli serwis nie znajdzie wartości otrzymamy:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"left":null,
|
||||||
|
"right":{
|
||||||
|
"statusCode":400,
|
||||||
|
"message":"Coś poszło nie tak"},
|
||||||
|
"isLeft":false}
|
||||||
|
```
|
||||||
|
|
||||||
|
Drugim sposobem jest zmiana działania serwisu:
|
||||||
|
|
||||||
|
```cs
|
||||||
|
public async Task<Either<CharacterViewModel, ErrorResponse>> GetCharacter(int id)
|
||||||
|
{
|
||||||
|
var repoResult = await this.Repository.Get(id);
|
||||||
|
if (repoResult != null)
|
||||||
|
{
|
||||||
|
return Mapper.Map<CharacterViewModel>(repoResult);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ErrorResponse()
|
||||||
|
{
|
||||||
|
StatusCode = 404,
|
||||||
|
Message = "Coś poszło nie tak"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Wtedy kontroler wygląda tak :
|
||||||
|
```sh
|
||||||
|
public async Task<Either<CharacterViewModel, ErrorResponse>> Get(int id)
|
||||||
|
{
|
||||||
|
return await this._service.GetCharacter(id);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Przypisanie nowej wartości
|
||||||
|
Jeśli z jakiegośpowodu będziemy chcieli zmienić wartość obiektu Either, musimy dokonać tego w taki oto sposób:
|
||||||
|
```cs
|
||||||
|
UserViewModel user = new UserViewModel() { Id = 1, Username = "Testowy", Password = "Secret" };
|
||||||
|
Either<UserViewModel, string> test = "asd";
|
||||||
|
|
||||||
|
// zmieniamy wartość Either
|
||||||
|
test = user;
|
||||||
|
|
||||||
|
// Warto zauważyć, że możemy zmienić wartość obiektu znajdujacego się wewnątrz
|
||||||
|
// którejś ze zmiennej o ile jest on publiczny
|
||||||
|
test.Left.Username = "test";
|
||||||
|
|
||||||
|
// Jednak jeśli dokonamy tego po zmianie wartości obietu na inny pomimo tego, że
|
||||||
|
// dla kodu jest to ok, to nie zadziała to poprawnie, ponieważ wartość starego obiektu
|
||||||
|
// jest zmieniana na null(dla boola na false)
|
||||||
|
test = "asd";
|
||||||
|
test.Left.Username = "błąd";
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### LeftOrDefault() oraz RightOrDefault()
|
||||||
|
|
||||||
|
Zwracają one wartość wybranej zmiennej bądź jej wartość defaultową.
|
||||||
|
Dla wiekszości obiektów jest to null, wyjatkiem jest tutaj bool, który zwróci nam false.
|
||||||
|
```cs
|
||||||
|
var test = (Either<bool, string>)true;
|
||||||
|
|
||||||
|
var a = test.LeftOrDefault(); // zwróci nam true
|
||||||
|
var b = test.RightOrDefault(); // zwróci nam null
|
||||||
|
|
||||||
|
test = "asd";
|
||||||
|
|
||||||
|
var c = test.LeftOrDefault(); // zwróci nam false
|
||||||
|
var d = test.RightOrDefault(); // zwróci nam "asd"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Match
|
||||||
|
|
||||||
|
Funkcja ta pozwala nam na odpalenie odpowiedniej metody w zależności od tego jako typ zmiennej jest aktualnie przechowywany w obiekcie Either. Niestety ograniczeniem jest to, ze obie funkcje musza docelowo zwrócić ten sam typ.
|
||||||
|
```cs
|
||||||
|
// ładujemy userviewmodel do obiektu Either i wywoływamy matcha pdając dwie funkcje
|
||||||
|
test = user;
|
||||||
|
// zwwrócny zostanie string "Test1"
|
||||||
|
test.Match(this.Test1, this.Test2);
|
||||||
|
|
||||||
|
// ładujemy stringa do obiektu Either i wywoływamy matcha pdając dwie funkcje
|
||||||
|
test = "asd";
|
||||||
|
// zwwrócny zostanie string "Test2"
|
||||||
|
test.Match(this.Test1, this.Test2);
|
||||||
|
|
||||||
|
public string Test1(UserViewModel viewModel)
|
||||||
|
{
|
||||||
|
return "Test1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Test2(string text)
|
||||||
|
{
|
||||||
|
return "Test2";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Warto zauważyć, że możemy wykorzystać tutaj lambde by rozszerzyć nasze możliwości:
|
||||||
|
```cs
|
||||||
|
test = "asd";
|
||||||
|
|
||||||
|
test.Match(
|
||||||
|
Test1,
|
||||||
|
second =>
|
||||||
|
{
|
||||||
|
int z = Test2(second);
|
||||||
|
// tutaj możemy robić już co nam się tylko podoba
|
||||||
|
// pamiętać należy ze finalnie musimy coś zwrócić
|
||||||
|
// chyba, że nasze obie funkcje są typu void
|
||||||
|
return z.ToString();
|
||||||
|
});
|
||||||
|
|
||||||
|
public string Test1(UserViewModel viewModel)
|
||||||
|
{
|
||||||
|
return "Test1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Test2(string text)
|
||||||
|
{
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Możemy też podać jedna funkcję typu void a drugą typu innego np. string albo int:
|
||||||
|
```cs
|
||||||
|
y = "";
|
||||||
|
test = "asd";
|
||||||
|
|
||||||
|
test.Match(
|
||||||
|
Test1,
|
||||||
|
second =>
|
||||||
|
{
|
||||||
|
var x = this.Test2(second);
|
||||||
|
//jednak nie ma możliwości zwrócenia wartości
|
||||||
|
// możemy za to zwrócić wyniki do zewnętrznej zmiennej
|
||||||
|
y = x;
|
||||||
|
});
|
||||||
|
|
||||||
|
public void Test1(UserViewModel viewModel)
|
||||||
|
{
|
||||||
|
//...coś robi
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Test2(string text)
|
||||||
|
{
|
||||||
|
return "Test2";
|
||||||
|
}
|
||||||
|
```
|
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Base
|
||||||
|
{
|
||||||
|
public interface IServiceBase<TViewModel, TEntity> : IDisposable
|
||||||
|
{
|
||||||
|
IEnumerable<TViewModel> Get();
|
||||||
|
Task<TViewModel> Get(int id);
|
||||||
|
Task<IEnumerable<TEntity>> Get(Expression<Func<TEntity, bool>> expresssion);
|
||||||
|
Task Create(TViewModel viewModel);
|
||||||
|
Task Update(int id, TViewModel viewModel);
|
||||||
|
Task Delete(int id);
|
||||||
|
Task SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Base
|
||||||
|
{
|
||||||
|
public class ServiceBase<TViewModel, TEntity> : IServiceBase<TViewModel, TEntity> where TEntity : BaseEntity
|
||||||
|
{
|
||||||
|
protected IMapper Mapper { get; private set; }
|
||||||
|
protected IRepository<TEntity> Repository { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ServiceBase(IMapper mapper, IRepository<TEntity> repository)
|
||||||
|
{
|
||||||
|
Mapper = mapper;
|
||||||
|
Repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IEnumerable<TViewModel> Get()
|
||||||
|
{
|
||||||
|
var models = Repository.Get();
|
||||||
|
return Mapper.Map<IEnumerable<TViewModel>>(models);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task<TViewModel> Get(int id)
|
||||||
|
{
|
||||||
|
var result = await Repository.Get(id);
|
||||||
|
return Mapper.Map<TViewModel>(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task<IEnumerable<TEntity>> Get(Expression<Func<TEntity, bool>> expression)
|
||||||
|
{
|
||||||
|
var result = await Repository.Get(expression).ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Create(TViewModel viewModel)
|
||||||
|
{
|
||||||
|
var model = Mapper.Map<TEntity>(viewModel);
|
||||||
|
await Repository.Create(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Update(int id, TViewModel viewModel)
|
||||||
|
{
|
||||||
|
var model = Mapper.Map<TEntity>(viewModel);
|
||||||
|
model.Id = id;
|
||||||
|
await Repository.Update(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Delete(int id)
|
||||||
|
{
|
||||||
|
var model = await Repository.Get(id);
|
||||||
|
Repository.Delete(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task SaveAsync()
|
||||||
|
{
|
||||||
|
await Repository.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
Repository.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.AlignmentViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IAlignmentService : IServiceBase<AlignmentViewModel, Alignment>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.BackgroundViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IBackgroundService : IServiceBase<BackgroundViewModel, Background>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.BiographyViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IBiographyService : IServiceBase<BiographyViewModel, Biography>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharacterViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICharacterService : IServiceBase<CharacterViewModel, Character>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharismaViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICharismaService : IServiceBase<CharismaViewModel, Charisma>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ClassViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IClassService : IServiceBase<ClassViewModel, Class>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ConstitutionViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IConstitutionService : IServiceBase<ConstitutionViewModel, Constitution>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.DexterityViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDexterityService : IServiceBase<DexterityViewModel, Dexterity>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.IntelligenceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IIntelligenceService : IServiceBase<IntelligenceViewModel, Intelligence>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.RaceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRaceService : IServiceBase<RaceViewModel, Race>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.StatisticsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IStatisticsService : IServiceBase<StatisticsViewModel, Statistics>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.StrengthViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IStrengthService : IServiceBase<StrengthViewModel, Strength>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.UserViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IUserService : IServiceBase<UserViewModel, User>
|
||||||
|
{
|
||||||
|
Task<UserViewModel> SearchUserByUsername(string userName);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.WisdomViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IWisdomService : IServiceBase<WisdomViewModel, Wisdom>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.AlignmentViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
class AlignmentProfile : Profile
|
||||||
|
{
|
||||||
|
public AlignmentProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AlignmentViewModel, Alignment>();
|
||||||
|
CreateMap<Alignment, AlignmentViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.BackgroundViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class BackgroundProfile : Profile
|
||||||
|
{
|
||||||
|
public BackgroundProfile()
|
||||||
|
{
|
||||||
|
CreateMap<BackgroundViewModel, Background>();
|
||||||
|
CreateMap<Background, BackgroundViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.BiographyViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class BiographyProfile : Profile
|
||||||
|
{
|
||||||
|
public BiographyProfile()
|
||||||
|
{
|
||||||
|
CreateMap<BiographyViewModel, Biography>();
|
||||||
|
CreateMap<Biography, BiographyViewModel>();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.CharacterViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class CharacterProfile : Profile
|
||||||
|
{
|
||||||
|
public CharacterProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Character, CharacterViewModel>();
|
||||||
|
CreateMap<CharacterViewModel, Character>();
|
||||||
|
|
||||||
|
CreateMap<Character, CharacterForLoginViewModel>()
|
||||||
|
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
|
||||||
|
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
|
||||||
|
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<Character, CharacterBasicStatsViewModel>()
|
||||||
|
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
|
||||||
|
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
|
||||||
|
.ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)).ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.CharismaViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class CharismaProfile : Profile
|
||||||
|
{
|
||||||
|
public CharismaProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CharismaViewModel, Charisma>();
|
||||||
|
CreateMap<Charisma, CharismaViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.ClassViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class ClassProfile : Profile
|
||||||
|
{
|
||||||
|
public ClassProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ClassViewModel, Class>();
|
||||||
|
CreateMap<Class, ClassViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.ConstitutionViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class ConstitutionProfile : Profile
|
||||||
|
{
|
||||||
|
public ConstitutionProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ConstitutionViewModel, Constitution>();
|
||||||
|
CreateMap<Constitution,ConstitutionViewModel > ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.DexterityViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class DexterityProfile : Profile
|
||||||
|
{
|
||||||
|
public DexterityProfile()
|
||||||
|
{
|
||||||
|
CreateMap<DexterityViewModel, Dexterity>();
|
||||||
|
CreateMap<Dexterity, DexterityViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.IntelligenceViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class IntelligenceProfile : Profile
|
||||||
|
{
|
||||||
|
public IntelligenceProfile()
|
||||||
|
{
|
||||||
|
CreateMap<IntelligenceViewModel, Intelligence>();
|
||||||
|
CreateMap<Intelligence, IntelligenceViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.RaceViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class RaceProfile : Profile
|
||||||
|
{
|
||||||
|
public RaceProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Race, RaceViewModel>();
|
||||||
|
CreateMap<RaceViewModel, Race>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.StatisticsViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class StatisticsProfile : Profile
|
||||||
|
{
|
||||||
|
public StatisticsProfile()
|
||||||
|
{
|
||||||
|
CreateMap<StatisticsViewModel, Statistics>();
|
||||||
|
CreateMap<Statistics, StatisticsViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.StrengthViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class StrengthProfile : Profile
|
||||||
|
{
|
||||||
|
public StrengthProfile()
|
||||||
|
{
|
||||||
|
CreateMap<StrengthViewModel, Strength>();
|
||||||
|
CreateMap<Strength, StrengthViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.UserViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class UserProfile : Profile
|
||||||
|
{
|
||||||
|
public UserProfile()
|
||||||
|
{
|
||||||
|
CreateMap<UserViewModel, User>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.WisdomViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class WisdomProfile : Profile
|
||||||
|
{
|
||||||
|
public WisdomProfile()
|
||||||
|
{
|
||||||
|
CreateMap<WisdomViewModel, Wisdom>();
|
||||||
|
CreateMap<Wisdom, WisdomViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.AlignmentViewModels;
|
||||||
|
using AutoMapper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class AlignmentService : ServiceBase<AlignmentViewModel, Alignment>, IAlignmentService
|
||||||
|
{
|
||||||
|
public AlignmentService(IMapper mapper, IRepository<Alignment> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.BackgroundViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class BackgroundServices : ServiceBase<BackgroundViewModel, Background>, IBackgroundService
|
||||||
|
{
|
||||||
|
public BackgroundServices(IMapper mapper, IRepository<Background> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.BiographyViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class BiographyService : ServiceBase<BiographyViewModel, Biography>, IBiographyService
|
||||||
|
{
|
||||||
|
public BiographyService(IMapper mapper, IRepository<Biography> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.CharacterViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using System.IO;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class CharacterService : ServiceBase<CharacterViewModel, Character>, ICharacterService
|
||||||
|
{
|
||||||
|
public CharacterService(IMapper mapper, IRepository<Character> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.CharismaViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class CharismaService : ServiceBase<CharismaViewModel, Charisma>, ICharismaService
|
||||||
|
{
|
||||||
|
public CharismaService(IMapper mapper, IRepository<Charisma> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ClassViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class ClassService : ServiceBase<ClassViewModel, Class>, IClassService
|
||||||
|
{
|
||||||
|
public ClassService(IMapper mapper, IRepository<Class> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ConstitutionViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class ConstitutionService : ServiceBase<ConstitutionViewModel, Constitution>, IConstitutionService
|
||||||
|
{
|
||||||
|
public ConstitutionService(IMapper mapper, IRepository<Constitution> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.DexterityViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class DexterityService : ServiceBase<DexterityViewModel, Dexterity>, IDexterityService
|
||||||
|
{
|
||||||
|
public DexterityService(IMapper mapper, IRepository<Dexterity> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.IntelligenceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class IntelligenceService : ServiceBase<IntelligenceViewModel, Intelligence>, IIntelligenceService
|
||||||
|
{
|
||||||
|
public IntelligenceService(IMapper mapper, IRepository<Intelligence> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.RaceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class RaceService : ServiceBase<RaceViewModel, Race>, IRaceService
|
||||||
|
{
|
||||||
|
public RaceService(IMapper mapper, IRepository<Race> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.StatisticsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class StatisticsService : ServiceBase<StatisticsViewModel, Statistics>, IStatisticsService
|
||||||
|
{
|
||||||
|
public StatisticsService(IMapper mapper, IRepository<Statistics> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.StrengthViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class StrengthService : ServiceBase<StrengthViewModel, Strength>, IStrengthService
|
||||||
|
{
|
||||||
|
public StrengthService(IMapper mapper, IRepository<Strength> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.UserViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class UserService : ServiceBase<UserViewModel, User>, IUserService
|
||||||
|
{
|
||||||
|
public UserService(IMapper mapper, IRepository<User> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public async Task<UserViewModel> SearchUserByUsername(string userName)
|
||||||
|
{
|
||||||
|
var User = await Repository.Get(u => u.Username.Equals(userName)).FirstOrDefaultAsync();
|
||||||
|
return Mapper.Map<UserViewModel>(User);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.WisdomViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class WisdomService : ServiceBase<WisdomViewModel, Wisdom>, IWisdomService
|
||||||
|
{
|
||||||
|
public WisdomService(IMapper mapper, IRepository<Wisdom> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
|
||||||
|
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,10 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.AlignmentViewModels
|
||||||
|
{
|
||||||
|
public class AlignmentViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator przynależności postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.ApiResponses
|
||||||
|
{
|
||||||
|
public class ErrorResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Kod błędu
|
||||||
|
/// </summary>
|
||||||
|
public int StatusCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wiadomość błędu do pokazania
|
||||||
|
/// </summary>
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.ApiResponses
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wiadomość mówiąca o poprawnym wykonaniu zadania
|
||||||
|
/// </summary>
|
||||||
|
public class SuccessResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Konstruktor obiektu
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message"> Wiadomość dotycząca operacji </param>
|
||||||
|
public SuccessResponse(string message)
|
||||||
|
{
|
||||||
|
this.SuccessCode = 200;
|
||||||
|
this.SuccessMessage = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Kod odpowiedzi, domyślnie nadawany jest 200
|
||||||
|
/// </summary>
|
||||||
|
public int SuccessCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wiadomość dotycząca wykoanania operacji
|
||||||
|
/// </summary>
|
||||||
|
public string SuccessMessage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.BackgroundViewModels
|
||||||
|
{
|
||||||
|
public class BackgroundViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator przeszłości postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.BiographyViewModels
|
||||||
|
{
|
||||||
|
public class BiographyViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator biografii postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nazwa postaci
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator klasy postaci
|
||||||
|
/// </summary>
|
||||||
|
public int ClassId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator przynależności postaci
|
||||||
|
/// </summary>
|
||||||
|
public int AlignmentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator przeszłości postaci
|
||||||
|
/// </summary>
|
||||||
|
public int BackgroundId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Płeć postaci
|
||||||
|
/// </summary>
|
||||||
|
public string Sex { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.CharacterViewModels
|
||||||
|
{
|
||||||
|
public class CharacterBasicStatsViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nazwa postaci
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Poziom postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Level { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Aktualna ilość życia postaci
|
||||||
|
/// </summary>
|
||||||
|
public int CurrentHealthPoints { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.CharacterViewModels
|
||||||
|
{
|
||||||
|
public class CharacterForLoginViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Id użytkownika do którego przypisana jest postać
|
||||||
|
/// </summary>
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nazwa postaci
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nazwa klasy postaci
|
||||||
|
/// </summary>
|
||||||
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Poziom postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Level { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.CharacterViewModels
|
||||||
|
{
|
||||||
|
public class CharacterViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Id użytkownika do którego przypisana jest postać
|
||||||
|
/// </summary>
|
||||||
|
public int UserId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.CharismaViewModels
|
||||||
|
{
|
||||||
|
public class CharismaViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator charyzmy postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość charyzmy
|
||||||
|
/// </summary>
|
||||||
|
public int Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modyfikator rzutów
|
||||||
|
/// </summary>
|
||||||
|
public int Modification { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modyfikator rzutów obronnych
|
||||||
|
/// </summary>
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w charyźmie
|
||||||
|
/// </summary>
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności oszustwa
|
||||||
|
/// </summary>
|
||||||
|
public int Deception { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w oszustwie
|
||||||
|
/// </summary>
|
||||||
|
public bool CanDeception { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności zastraszania
|
||||||
|
/// </summary>
|
||||||
|
public int Intimidation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w zastraszaniu
|
||||||
|
/// </summary>
|
||||||
|
public bool CanIntimidation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności występowania
|
||||||
|
/// </summary>
|
||||||
|
public int Performance { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w występowaniu
|
||||||
|
/// </summary>
|
||||||
|
public bool CanPerformance { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności perswazji
|
||||||
|
/// </summary>
|
||||||
|
public int Persuasion { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w perswazji
|
||||||
|
/// </summary>
|
||||||
|
public bool CanPersuasion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.ClassViewModels
|
||||||
|
{
|
||||||
|
public class ClassViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator klasy postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Nazwa klasy
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.ConstitutionViewModels
|
||||||
|
{
|
||||||
|
public class ConstitutionViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator kondycji postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość kondycji
|
||||||
|
/// </summary>
|
||||||
|
public int Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modyfikator rzutów
|
||||||
|
/// </summary>
|
||||||
|
public int Modification { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modyfikator rzutów obronnych
|
||||||
|
/// </summary>
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w kondycji
|
||||||
|
/// </summary>
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.DexterityViewModels
|
||||||
|
{
|
||||||
|
public class DexterityViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator zręczności postaci
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identyfikator postaci
|
||||||
|
/// </summary>
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość zręczności
|
||||||
|
/// </summary>
|
||||||
|
public int Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modyfikator rzutów
|
||||||
|
/// </summary>
|
||||||
|
public int Modification { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Modyfikator rzutów obronnych
|
||||||
|
/// </summary>
|
||||||
|
public int SavingThrows { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w zręczności
|
||||||
|
/// </summary>
|
||||||
|
public bool CanSaveThrows { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności akrobatyki
|
||||||
|
/// </summary>
|
||||||
|
public int Acrobatics { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w akrobatyce
|
||||||
|
/// </summary>
|
||||||
|
public bool CanAcrobatics { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności zwinnych dłoni
|
||||||
|
/// </summary>
|
||||||
|
public int SleightOfHand { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w zwinnych dłoniach
|
||||||
|
/// </summary>
|
||||||
|
public bool CanSleightOfHand { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wartość umiejętności skradania się
|
||||||
|
/// </summary>
|
||||||
|
public int Stealth { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Czy postać posiada biegłość w skradaniu się
|
||||||
|
/// </summary>
|
||||||
|
public bool CanStealth { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user