36 changed files with 2692 additions and 206 deletions
@ -0,0 +1,27 @@
|
||||
using EVABackend.Areas.Identity.Data; |
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore; |
||||
|
||||
namespace EVABackend.Models |
||||
{ |
||||
public class EVABackendIdentityContext : IdentityDbContext<EVABackendUser> |
||||
{ |
||||
public EVABackendIdentityContext(DbContextOptions<EVABackendIdentityContext> options) |
||||
: base(options) |
||||
{ |
||||
} |
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
||||
{ |
||||
optionsBuilder.UseSqlite("Data Source=eva_users.db"); |
||||
} |
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder) |
||||
{ |
||||
base.OnModelCreating(builder); |
||||
// Customize the ASP.NET Identity model and override the defaults if needed. |
||||
// For example, you can rename the ASP.NET Identity table names and more. |
||||
// Add your customizations after calling base.OnModelCreating(builder); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using Microsoft.AspNetCore.Identity; |
||||
|
||||
namespace EVABackend.Areas.Identity.Data |
||||
{ |
||||
// Add profile data for application users by adding properties to the EVABackendUser class |
||||
public class EVABackendUser : IdentityUser |
||||
{ |
||||
} |
||||
} |
||||
@ -0,0 +1,36 @@
|
||||
using EVABackend.Areas.Identity.Data; |
||||
using EVABackend.Models; |
||||
using Microsoft.AspNetCore.Authentication.Cookies; |
||||
using Microsoft.AspNetCore.Hosting; |
||||
using Microsoft.AspNetCore.Identity; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.Extensions.Configuration; |
||||
using Microsoft.Extensions.DependencyInjection; |
||||
using System; |
||||
|
||||
[assembly: HostingStartup(typeof(EVABackend.Areas.Identity.IdentityHostingStartup))] |
||||
namespace EVABackend.Areas.Identity |
||||
{ |
||||
public class IdentityHostingStartup : IHostingStartup |
||||
{ |
||||
public void Configure(IWebHostBuilder builder) |
||||
{ |
||||
builder.ConfigureServices((context, services) => |
||||
{ |
||||
services.AddDbContext<EVABackendIdentityContext>(options => |
||||
options.UseSqlite( |
||||
context.Configuration.GetConnectionString("EVABackendIdentityContextConnection"))); |
||||
|
||||
services.AddDefaultIdentity<EVABackendUser>() |
||||
.AddRoles<IdentityRole>() |
||||
.AddEntityFrameworkStores<EVABackendIdentityContext>() |
||||
.AddDefaultTokenProviders(); |
||||
|
||||
services.ConfigureApplicationCookie(options => |
||||
{ |
||||
options.Cookie.Name = "EVABackend_Token"; |
||||
}); |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,194 @@
|
||||
using EVABackend.Areas.Identity.Data; |
||||
using EVABackend.Models; |
||||
using Microsoft.AspNetCore.Authentication; |
||||
using Microsoft.AspNetCore.Authentication.Cookies; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
using Microsoft.AspNetCore.Identity; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
|
||||
namespace EVABackend.Controllers |
||||
{ |
||||
[ApiController] |
||||
public class EVAController : ControllerBase |
||||
{ |
||||
private readonly EVAContext _context; |
||||
private readonly UserManager<EVABackendUser> _userManager; |
||||
private readonly RoleManager<IdentityRole> _roleManager; |
||||
private readonly SignInManager<EVABackendUser> _signInManager; |
||||
|
||||
public EVAController(UserManager<EVABackendUser> userManager, RoleManager<IdentityRole> roleManager, SignInManager<EVABackendUser> signInManager) |
||||
{ |
||||
_userManager = userManager; |
||||
_roleManager = roleManager; |
||||
_signInManager = signInManager; |
||||
|
||||
_context = new EVAContext(); |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("login")] |
||||
[AllowAnonymous] |
||||
public ActionResult Login() |
||||
{ |
||||
return Ok(new { status = "Nicht unterstützt" }); |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("create_dummy_data")] |
||||
[Authorize] |
||||
public async Task<ActionResult> CreateDummyData() |
||||
{ |
||||
if (_userManager.FindByNameAsync("Test") == null) |
||||
{ |
||||
|
||||
var user = new EVABackendUser |
||||
{ |
||||
UserName = "Test", |
||||
Email = "info@test.de" |
||||
}; |
||||
|
||||
await _userManager.CreateAsync(user, "123Abc!&"); |
||||
} |
||||
|
||||
var roleNames = new string[] { "Schueler", "Verwaltung", "Admin" }; |
||||
|
||||
foreach (var roleName in roleNames) |
||||
{ |
||||
if (!(await _roleManager.RoleExistsAsync(roleName))) |
||||
{ |
||||
await _roleManager.CreateAsync(new IdentityRole(roleName)); |
||||
} |
||||
} |
||||
|
||||
await _userManager.AddToRolesAsync((await _userManager.FindByNameAsync("Test")), roleNames); |
||||
|
||||
return Ok(); |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("login")] |
||||
[AllowAnonymous] |
||||
public async Task<ActionResult> Login([FromForm] string username, [FromForm] string password) |
||||
{ |
||||
var result = await _signInManager.PasswordSignInAsync(username, password, false, false); |
||||
if (result.Succeeded) |
||||
{ |
||||
return Ok(); |
||||
} |
||||
|
||||
return Unauthorized(); |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("logout")] |
||||
[Authorize] |
||||
public async Task<ActionResult> Logout() |
||||
{ |
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); |
||||
|
||||
return Ok(); |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("aufnahmeantrag")] |
||||
[AllowAnonymous] |
||||
public async Task<ActionResult> Aufnahmeantrag(Aufnahmeantrag model) |
||||
{ |
||||
var schueler = new Schueler |
||||
{ |
||||
Name = model.Name, |
||||
Vorname = model.Vonname, |
||||
IstErmaessigt = model.IstErmaessigt, |
||||
Ort = model.Ort, |
||||
Bankname = model.Bankname, |
||||
BLZ = model.BLZ, |
||||
Geburtsdatum = model.Geburtsdatum, |
||||
Geburtsort = model.Geburtsort, |
||||
Telefon = model.Telefon, |
||||
EMail = model.EMail, |
||||
PLZ = model.PLZ, |
||||
KontoNr = model.KontoNr, |
||||
Strasse = model.StrasseHNR |
||||
}; |
||||
|
||||
await _context.Schueler.AddAsync(schueler); |
||||
await _context.SaveChangesAsync(); |
||||
|
||||
var instrumente = _context.Instrumente.Where(i => model.Instrumente.Contains(i.Id)).ToList(); |
||||
|
||||
var kurs = new Kurs |
||||
{ |
||||
Bestaetigt = false, |
||||
Name = model.Name, |
||||
Kuendigungsfrist = 2, |
||||
UnterrichtsTyp = model.Typ, |
||||
Laufzeit = 6 |
||||
}; |
||||
|
||||
await _context.Kurse.AddAsync(kurs); |
||||
await _context.SaveChangesAsync(); |
||||
|
||||
kurs.Instrumente = instrumente.Select(i => new KursInstrument { InstrumentId = i.Id, KursId = kurs.Id }).ToList(); |
||||
|
||||
await _context.KursSchueler.AddAsync(new KursSchueler { KursId = kurs.Id, SchuelerId = schueler.Id }); |
||||
await _context.SaveChangesAsync(); |
||||
|
||||
var antrag = new Antrag |
||||
{ |
||||
UnterrichtTyp = model.Typ, |
||||
Schueler = schueler, |
||||
KursId = kurs.Id |
||||
}; |
||||
|
||||
await _context.Antraege.AddAsync(antrag); |
||||
await _context.SaveChangesAsync(); |
||||
|
||||
antrag.Instrumente = instrumente.Select(i => new AntragInstrument { AntragId = antrag.Id, InstrumentId = i.Id }).ToList(); |
||||
|
||||
await _context.SaveChangesAsync(); |
||||
|
||||
return Ok(); |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("instruments")] |
||||
[Authorize] |
||||
public ActionResult Instruments() |
||||
{ |
||||
var instruments = _context.Instrumente.ToList(); |
||||
|
||||
return Ok(instruments.ToArray()); |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("rooms")] |
||||
[Authorize(Roles = "Verwaltung")] |
||||
public ActionResult Rooms() |
||||
{ |
||||
var rooms = _context.Raeume.ToList(); |
||||
|
||||
var model = rooms.Select(r => new |
||||
{ |
||||
RaumID = r.Id, |
||||
RaumName= r.Name, |
||||
Instrumente = r.Instrumente.Select(i => new |
||||
{ |
||||
InstrumentID = i.InstrumentId, |
||||
InstrumentName = i.Instrument.Name |
||||
}) |
||||
}); |
||||
|
||||
return Ok(model.ToArray()); |
||||
} |
||||
|
||||
[HttpPut] |
||||
[Route("create_rooms")] |
||||
[Authorize(Roles = "Verwaltung")] |
||||
public async Task<ActionResult> CreateRooms(CreateRooms model) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -1,45 +0,0 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Threading.Tasks; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
|
||||
namespace EVABackend.Controllers |
||||
{ |
||||
[Route("api/[controller]")]
|
||||
[ApiController] |
||||
public class ValuesController : ControllerBase |
||||
{ |
||||
// GET api/values |
||||
[HttpGet] |
||||
public ActionResult<IEnumerable<string>> Get() |
||||
{ |
||||
return new string[] { "value1", "value2" }; |
||||
} |
||||
|
||||
// GET api/values/5 |
||||
[HttpGet("{id}")] |
||||
public ActionResult<string> Get(int id) |
||||
{ |
||||
return "value"; |
||||
} |
||||
|
||||
// POST api/values |
||||
[HttpPost] |
||||
public void Post([FromBody] string value) |
||||
{ |
||||
} |
||||
|
||||
// PUT api/values/5 |
||||
[HttpPut("{id}")] |
||||
public void Put(int id, [FromBody] string value) |
||||
{ |
||||
} |
||||
|
||||
// DELETE api/values/5 |
||||
[HttpDelete("{id}")] |
||||
public void Delete(int id) |
||||
{ |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,229 @@
|
||||
// <auto-generated /> |
||||
using System; |
||||
using EVABackend.Models; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
||||
|
||||
namespace EVABackend.Migrations |
||||
{ |
||||
[DbContext(typeof(EVABackendIdentityContext))] |
||||
[Migration("20190612100741_CreateIdentitySchema")] |
||||
partial class CreateIdentitySchema |
||||
{ |
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
||||
{ |
||||
#pragma warning disable 612, 618 |
||||
modelBuilder |
||||
.HasAnnotation("ProductVersion", "2.1.8-servicing-32085"); |
||||
|
||||
modelBuilder.Entity("EVABackend.Areas.Identity.Data.EVABackendUser", b => |
||||
{ |
||||
b.Property<string>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<int>("AccessFailedCount"); |
||||
|
||||
b.Property<string>("ConcurrencyStamp") |
||||
.IsConcurrencyToken(); |
||||
|
||||
b.Property<string>("Email") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<bool>("EmailConfirmed"); |
||||
|
||||
b.Property<bool>("LockoutEnabled"); |
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd"); |
||||
|
||||
b.Property<string>("NormalizedEmail") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<string>("NormalizedUserName") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<string>("PasswordHash"); |
||||
|
||||
b.Property<string>("PhoneNumber"); |
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed"); |
||||
|
||||
b.Property<string>("SecurityStamp"); |
||||
|
||||
b.Property<bool>("TwoFactorEnabled"); |
||||
|
||||
b.Property<string>("UserName") |
||||
.HasMaxLength(256); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("NormalizedEmail") |
||||
.HasName("EmailIndex"); |
||||
|
||||
b.HasIndex("NormalizedUserName") |
||||
.IsUnique() |
||||
.HasName("UserNameIndex"); |
||||
|
||||
b.ToTable("AspNetUsers"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => |
||||
{ |
||||
b.Property<string>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("ConcurrencyStamp") |
||||
.IsConcurrencyToken(); |
||||
|
||||
b.Property<string>("Name") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<string>("NormalizedName") |
||||
.HasMaxLength(256); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("NormalizedName") |
||||
.IsUnique() |
||||
.HasName("RoleNameIndex"); |
||||
|
||||
b.ToTable("AspNetRoles"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("ClaimType"); |
||||
|
||||
b.Property<string>("ClaimValue"); |
||||
|
||||
b.Property<string>("RoleId") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("RoleId"); |
||||
|
||||
b.ToTable("AspNetRoleClaims"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("ClaimType"); |
||||
|
||||
b.Property<string>("ClaimValue"); |
||||
|
||||
b.Property<string>("UserId") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("UserId"); |
||||
|
||||
b.ToTable("AspNetUserClaims"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => |
||||
{ |
||||
b.Property<string>("LoginProvider") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("ProviderKey") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("ProviderDisplayName"); |
||||
|
||||
b.Property<string>("UserId") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey"); |
||||
|
||||
b.HasIndex("UserId"); |
||||
|
||||
b.ToTable("AspNetUserLogins"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => |
||||
{ |
||||
b.Property<string>("UserId"); |
||||
|
||||
b.Property<string>("RoleId"); |
||||
|
||||
b.HasKey("UserId", "RoleId"); |
||||
|
||||
b.HasIndex("RoleId"); |
||||
|
||||
b.ToTable("AspNetUserRoles"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => |
||||
{ |
||||
b.Property<string>("UserId"); |
||||
|
||||
b.Property<string>("LoginProvider") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("Name") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("Value"); |
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name"); |
||||
|
||||
b.ToTable("AspNetUserTokens"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => |
||||
{ |
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") |
||||
.WithMany() |
||||
.HasForeignKey("RoleId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => |
||||
{ |
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => |
||||
{ |
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => |
||||
{ |
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") |
||||
.WithMany() |
||||
.HasForeignKey("RoleId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => |
||||
{ |
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
#pragma warning restore 612, 618 |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,217 @@
|
||||
using System; |
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
namespace EVABackend.Migrations |
||||
{ |
||||
public partial class CreateIdentitySchema : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetRoles", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<string>(nullable: false), |
||||
Name = table.Column<string>(maxLength: 256, nullable: true), |
||||
NormalizedName = table.Column<string>(maxLength: 256, nullable: true), |
||||
ConcurrencyStamp = table.Column<string>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetRoles", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetUsers", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<string>(nullable: false), |
||||
UserName = table.Column<string>(maxLength: 256, nullable: true), |
||||
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true), |
||||
Email = table.Column<string>(maxLength: 256, nullable: true), |
||||
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), |
||||
EmailConfirmed = table.Column<bool>(nullable: false), |
||||
PasswordHash = table.Column<string>(nullable: true), |
||||
SecurityStamp = table.Column<string>(nullable: true), |
||||
ConcurrencyStamp = table.Column<string>(nullable: true), |
||||
PhoneNumber = table.Column<string>(nullable: true), |
||||
PhoneNumberConfirmed = table.Column<bool>(nullable: false), |
||||
TwoFactorEnabled = table.Column<bool>(nullable: false), |
||||
LockoutEnd = table.Column<DateTimeOffset>(nullable: true), |
||||
LockoutEnabled = table.Column<bool>(nullable: false), |
||||
AccessFailedCount = table.Column<int>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetRoleClaims", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
RoleId = table.Column<string>(nullable: false), |
||||
ClaimType = table.Column<string>(nullable: true), |
||||
ClaimValue = table.Column<string>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); |
||||
table.ForeignKey( |
||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", |
||||
column: x => x.RoleId, |
||||
principalTable: "AspNetRoles", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetUserClaims", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
UserId = table.Column<string>(nullable: false), |
||||
ClaimType = table.Column<string>(nullable: true), |
||||
ClaimValue = table.Column<string>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); |
||||
table.ForeignKey( |
||||
name: "FK_AspNetUserClaims_AspNetUsers_UserId", |
||||
column: x => x.UserId, |
||||
principalTable: "AspNetUsers", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetUserLogins", |
||||
columns: table => new |
||||
{ |
||||
LoginProvider = table.Column<string>(maxLength: 128, nullable: false), |
||||
ProviderKey = table.Column<string>(maxLength: 128, nullable: false), |
||||
ProviderDisplayName = table.Column<string>(nullable: true), |
||||
UserId = table.Column<string>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); |
||||
table.ForeignKey( |
||||
name: "FK_AspNetUserLogins_AspNetUsers_UserId", |
||||
column: x => x.UserId, |
||||
principalTable: "AspNetUsers", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetUserRoles", |
||||
columns: table => new |
||||
{ |
||||
UserId = table.Column<string>(nullable: false), |
||||
RoleId = table.Column<string>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); |
||||
table.ForeignKey( |
||||
name: "FK_AspNetUserRoles_AspNetRoles_RoleId", |
||||
column: x => x.RoleId, |
||||
principalTable: "AspNetRoles", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_AspNetUserRoles_AspNetUsers_UserId", |
||||
column: x => x.UserId, |
||||
principalTable: "AspNetUsers", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AspNetUserTokens", |
||||
columns: table => new |
||||
{ |
||||
UserId = table.Column<string>(nullable: false), |
||||
LoginProvider = table.Column<string>(maxLength: 128, nullable: false), |
||||
Name = table.Column<string>(maxLength: 128, nullable: false), |
||||
Value = table.Column<string>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); |
||||
table.ForeignKey( |
||||
name: "FK_AspNetUserTokens_AspNetUsers_UserId", |
||||
column: x => x.UserId, |
||||
principalTable: "AspNetUsers", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_AspNetRoleClaims_RoleId", |
||||
table: "AspNetRoleClaims", |
||||
column: "RoleId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "RoleNameIndex", |
||||
table: "AspNetRoles", |
||||
column: "NormalizedName", |
||||
unique: true); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_AspNetUserClaims_UserId", |
||||
table: "AspNetUserClaims", |
||||
column: "UserId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_AspNetUserLogins_UserId", |
||||
table: "AspNetUserLogins", |
||||
column: "UserId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_AspNetUserRoles_RoleId", |
||||
table: "AspNetUserRoles", |
||||
column: "RoleId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "EmailIndex", |
||||
table: "AspNetUsers", |
||||
column: "NormalizedEmail"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "UserNameIndex", |
||||
table: "AspNetUsers", |
||||
column: "NormalizedUserName", |
||||
unique: true); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropTable( |
||||
name: "AspNetRoleClaims"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "AspNetUserClaims"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "AspNetUserLogins"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "AspNetUserRoles"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "AspNetUserTokens"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "AspNetRoles"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "AspNetUsers"); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,388 @@
|
||||
// <auto-generated /> |
||||
using System; |
||||
using EVABackend.Models; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
||||
|
||||
namespace EVABackend.Migrations.EVA |
||||
{ |
||||
[DbContext(typeof(EVAContext))] |
||||
[Migration("20190612101730_InitialCreate")] |
||||
partial class InitialCreate |
||||
{ |
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
||||
{ |
||||
#pragma warning disable 612, 618 |
||||
modelBuilder |
||||
.HasAnnotation("ProductVersion", "2.1.8-servicing-32085"); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Antrag", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<int>("KursId"); |
||||
|
||||
b.Property<int?>("SchuelerId"); |
||||
|
||||
b.Property<int?>("UnterrichtTypId"); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("SchuelerId"); |
||||
|
||||
b.HasIndex("UnterrichtTypId"); |
||||
|
||||
b.ToTable("Antraege"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.AntragInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("AntragId"); |
||||
|
||||
b.HasKey("InstrumentId", "AntragId"); |
||||
|
||||
b.HasIndex("AntragId"); |
||||
|
||||
b.ToTable("AntragInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Dozent", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("BLZ") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Bankname") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("EMail") |
||||
.IsRequired(); |
||||
|
||||
b.Property<DateTime>("Geburtsdatum"); |
||||
|
||||
b.Property<string>("Geburtsort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("KontoNr") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Ort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<int>("PLZ"); |
||||
|
||||
b.Property<string>("Strasse") |
||||
.IsRequired(); |
||||
|
||||
b.Property<decimal>("Stundensatz"); |
||||
|
||||
b.Property<string>("Telefon") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Vorname") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Donzenten"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.DozentInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("DozentId"); |
||||
|
||||
b.HasKey("InstrumentId", "DozentId"); |
||||
|
||||
b.HasIndex("DozentId"); |
||||
|
||||
b.ToTable("DozentInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Instrument", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Instrumente"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Kurs", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<bool>("Bestaetigt"); |
||||
|
||||
b.Property<int>("Kuendigungsfrist"); |
||||
|
||||
b.Property<int>("Laufzeit"); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.Property<int?>("UnterrichtsTypId"); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("UnterrichtsTypId"); |
||||
|
||||
b.ToTable("Kurse"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("KursId"); |
||||
|
||||
b.HasKey("InstrumentId", "KursId"); |
||||
|
||||
b.HasIndex("KursId"); |
||||
|
||||
b.ToTable("KursInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursSchueler", b => |
||||
{ |
||||
b.Property<int>("SchuelerId"); |
||||
|
||||
b.Property<int>("KursId"); |
||||
|
||||
b.Property<int?>("DozentId"); |
||||
|
||||
b.HasKey("SchuelerId", "KursId"); |
||||
|
||||
b.HasIndex("DozentId"); |
||||
|
||||
b.HasIndex("KursId"); |
||||
|
||||
b.ToTable("KursSchueler"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Raum", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<bool>("Belegt"); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Raeume"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.RaumInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("RaumId"); |
||||
|
||||
b.HasKey("InstrumentId", "RaumId"); |
||||
|
||||
b.HasIndex("RaumId"); |
||||
|
||||
b.ToTable("RaumInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Schueler", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("BLZ") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Bankname") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("EMail") |
||||
.IsRequired(); |
||||
|
||||
b.Property<DateTime>("Geburtsdatum"); |
||||
|
||||
b.Property<string>("Geburtsort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<bool>("IstErmaessigt"); |
||||
|
||||
b.Property<string>("KontoNr") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Ort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<int>("PLZ"); |
||||
|
||||
b.Property<string>("Strasse") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Telefon") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Vorname") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Schueler"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Unterricht", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<int?>("KursId"); |
||||
|
||||
b.Property<string>("Notiz"); |
||||
|
||||
b.Property<int?>("RaumId"); |
||||
|
||||
b.Property<DateTime>("Startzeit"); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("KursId"); |
||||
|
||||
b.HasIndex("RaumId"); |
||||
|
||||
b.ToTable("Unterrichte"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.UnterrichtTyp", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("UnterrichtTypen"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Antrag", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Schueler", "Schueler") |
||||
.WithMany() |
||||
.HasForeignKey("SchuelerId"); |
||||
|
||||
b.HasOne("EVABackend.Models.UnterrichtTyp", "UnterrichtTyp") |
||||
.WithMany() |
||||
.HasForeignKey("UnterrichtTypId"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.AntragInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Antrag", "Antrag") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("AntragId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.DozentInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Dozent", "Dozent") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("DozentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Kurs", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.UnterrichtTyp", "UnterrichtsTyp") |
||||
.WithMany() |
||||
.HasForeignKey("UnterrichtsTypId"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Kurs", "Kurs") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("KursId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursSchueler", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Dozent") |
||||
.WithMany("KursSchueler") |
||||
.HasForeignKey("DozentId"); |
||||
|
||||
b.HasOne("EVABackend.Models.Kurs", "Kurs") |
||||
.WithMany("KursSchueler") |
||||
.HasForeignKey("KursId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Schueler", "Schueler") |
||||
.WithMany("KursSchueler") |
||||
.HasForeignKey("SchuelerId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.RaumInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Raum", "Raum") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("RaumId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Unterricht", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Kurs") |
||||
.WithMany("Unterrichte") |
||||
.HasForeignKey("KursId"); |
||||
|
||||
b.HasOne("EVABackend.Models.Raum", "Raum") |
||||
.WithMany() |
||||
.HasForeignKey("RaumId"); |
||||
}); |
||||
#pragma warning restore 612, 618 |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,403 @@
|
||||
using System; |
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
namespace EVABackend.Migrations.EVA |
||||
{ |
||||
public partial class InitialCreate : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.CreateTable( |
||||
name: "Donzenten", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Name = table.Column<string>(nullable: false), |
||||
Vorname = table.Column<string>(nullable: false), |
||||
Geburtsdatum = table.Column<DateTime>(nullable: false), |
||||
Geburtsort = table.Column<string>(nullable: false), |
||||
PLZ = table.Column<int>(nullable: false), |
||||
Ort = table.Column<string>(nullable: false), |
||||
Strasse = table.Column<string>(nullable: false), |
||||
Telefon = table.Column<string>(nullable: false), |
||||
EMail = table.Column<string>(nullable: false), |
||||
Bankname = table.Column<string>(nullable: false), |
||||
BLZ = table.Column<string>(nullable: false), |
||||
KontoNr = table.Column<string>(nullable: false), |
||||
Stundensatz = table.Column<decimal>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Donzenten", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "Instrumente", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Name = table.Column<string>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Instrumente", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "Raeume", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Name = table.Column<string>(nullable: false), |
||||
Belegt = table.Column<bool>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Raeume", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "Schueler", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Name = table.Column<string>(nullable: false), |
||||
Vorname = table.Column<string>(nullable: false), |
||||
Geburtsdatum = table.Column<DateTime>(nullable: false), |
||||
Geburtsort = table.Column<string>(nullable: false), |
||||
PLZ = table.Column<int>(nullable: false), |
||||
Ort = table.Column<string>(nullable: false), |
||||
Strasse = table.Column<string>(nullable: false), |
||||
Telefon = table.Column<string>(nullable: false), |
||||
EMail = table.Column<string>(nullable: false), |
||||
Bankname = table.Column<string>(nullable: false), |
||||
BLZ = table.Column<string>(nullable: false), |
||||
KontoNr = table.Column<string>(nullable: false), |
||||
IstErmaessigt = table.Column<bool>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Schueler", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "UnterrichtTypen", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Name = table.Column<string>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_UnterrichtTypen", x => x.Id); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "DozentInstrument", |
||||
columns: table => new |
||||
{ |
||||
InstrumentId = table.Column<int>(nullable: false), |
||||
DozentId = table.Column<int>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_DozentInstrument", x => new { x.InstrumentId, x.DozentId }); |
||||
table.ForeignKey( |
||||
name: "FK_DozentInstrument_Donzenten_DozentId", |
||||
column: x => x.DozentId, |
||||
principalTable: "Donzenten", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_DozentInstrument_Instrumente_InstrumentId", |
||||
column: x => x.InstrumentId, |
||||
principalTable: "Instrumente", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "RaumInstrument", |
||||
columns: table => new |
||||
{ |
||||
InstrumentId = table.Column<int>(nullable: false), |
||||
RaumId = table.Column<int>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_RaumInstrument", x => new { x.InstrumentId, x.RaumId }); |
||||
table.ForeignKey( |
||||
name: "FK_RaumInstrument_Instrumente_InstrumentId", |
||||
column: x => x.InstrumentId, |
||||
principalTable: "Instrumente", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_RaumInstrument_Raeume_RaumId", |
||||
column: x => x.RaumId, |
||||
principalTable: "Raeume", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "Antraege", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
SchuelerId = table.Column<int>(nullable: true), |
||||
UnterrichtTypId = table.Column<int>(nullable: true), |
||||
KursId = table.Column<int>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Antraege", x => x.Id); |
||||
table.ForeignKey( |
||||
name: "FK_Antraege_Schueler_SchuelerId", |
||||
column: x => x.SchuelerId, |
||||
principalTable: "Schueler", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
table.ForeignKey( |
||||
name: "FK_Antraege_UnterrichtTypen_UnterrichtTypId", |
||||
column: x => x.UnterrichtTypId, |
||||
principalTable: "UnterrichtTypen", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "Kurse", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Name = table.Column<string>(nullable: false), |
||||
Laufzeit = table.Column<int>(nullable: false), |
||||
Kuendigungsfrist = table.Column<int>(nullable: false), |
||||
Bestaetigt = table.Column<bool>(nullable: false), |
||||
UnterrichtsTypId = table.Column<int>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Kurse", x => x.Id); |
||||
table.ForeignKey( |
||||
name: "FK_Kurse_UnterrichtTypen_UnterrichtsTypId", |
||||
column: x => x.UnterrichtsTypId, |
||||
principalTable: "UnterrichtTypen", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "AntragInstrument", |
||||
columns: table => new |
||||
{ |
||||
InstrumentId = table.Column<int>(nullable: false), |
||||
AntragId = table.Column<int>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_AntragInstrument", x => new { x.InstrumentId, x.AntragId }); |
||||
table.ForeignKey( |
||||
name: "FK_AntragInstrument_Antraege_AntragId", |
||||
column: x => x.AntragId, |
||||
principalTable: "Antraege", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_AntragInstrument_Instrumente_InstrumentId", |
||||
column: x => x.InstrumentId, |
||||
principalTable: "Instrumente", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "KursInstrument", |
||||
columns: table => new |
||||
{ |
||||
InstrumentId = table.Column<int>(nullable: false), |
||||
KursId = table.Column<int>(nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_KursInstrument", x => new { x.InstrumentId, x.KursId }); |
||||
table.ForeignKey( |
||||
name: "FK_KursInstrument_Instrumente_InstrumentId", |
||||
column: x => x.InstrumentId, |
||||
principalTable: "Instrumente", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_KursInstrument_Kurse_KursId", |
||||
column: x => x.KursId, |
||||
principalTable: "Kurse", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "KursSchueler", |
||||
columns: table => new |
||||
{ |
||||
SchuelerId = table.Column<int>(nullable: false), |
||||
KursId = table.Column<int>(nullable: false), |
||||
DozentId = table.Column<int>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_KursSchueler", x => new { x.SchuelerId, x.KursId }); |
||||
table.ForeignKey( |
||||
name: "FK_KursSchueler_Donzenten_DozentId", |
||||
column: x => x.DozentId, |
||||
principalTable: "Donzenten", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
table.ForeignKey( |
||||
name: "FK_KursSchueler_Kurse_KursId", |
||||
column: x => x.KursId, |
||||
principalTable: "Kurse", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_KursSchueler_Schueler_SchuelerId", |
||||
column: x => x.SchuelerId, |
||||
principalTable: "Schueler", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "Unterrichte", |
||||
columns: table => new |
||||
{ |
||||
Id = table.Column<int>(nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Startzeit = table.Column<DateTime>(nullable: false), |
||||
Notiz = table.Column<string>(nullable: true), |
||||
RaumId = table.Column<int>(nullable: true), |
||||
KursId = table.Column<int>(nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Unterrichte", x => x.Id); |
||||
table.ForeignKey( |
||||
name: "FK_Unterrichte_Kurse_KursId", |
||||
column: x => x.KursId, |
||||
principalTable: "Kurse", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
table.ForeignKey( |
||||
name: "FK_Unterrichte_Raeume_RaumId", |
||||
column: x => x.RaumId, |
||||
principalTable: "Raeume", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
}); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_Antraege_SchuelerId", |
||||
table: "Antraege", |
||||
column: "SchuelerId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_Antraege_UnterrichtTypId", |
||||
table: "Antraege", |
||||
column: "UnterrichtTypId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_AntragInstrument_AntragId", |
||||
table: "AntragInstrument", |
||||
column: "AntragId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_DozentInstrument_DozentId", |
||||
table: "DozentInstrument", |
||||
column: "DozentId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_Kurse_UnterrichtsTypId", |
||||
table: "Kurse", |
||||
column: "UnterrichtsTypId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_KursInstrument_KursId", |
||||
table: "KursInstrument", |
||||
column: "KursId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_KursSchueler_DozentId", |
||||
table: "KursSchueler", |
||||
column: "DozentId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_KursSchueler_KursId", |
||||
table: "KursSchueler", |
||||
column: "KursId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_RaumInstrument_RaumId", |
||||
table: "RaumInstrument", |
||||
column: "RaumId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_Unterrichte_KursId", |
||||
table: "Unterrichte", |
||||
column: "KursId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_Unterrichte_RaumId", |
||||
table: "Unterrichte", |
||||
column: "RaumId"); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropTable( |
||||
name: "AntragInstrument"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "DozentInstrument"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "KursInstrument"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "KursSchueler"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "RaumInstrument"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Unterrichte"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Antraege"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Donzenten"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Instrumente"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Kurse"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Raeume"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "Schueler"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
name: "UnterrichtTypen"); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,386 @@
|
||||
// <auto-generated /> |
||||
using System; |
||||
using EVABackend.Models; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
||||
|
||||
namespace EVABackend.Migrations.EVA |
||||
{ |
||||
[DbContext(typeof(EVAContext))] |
||||
partial class EVAContextModelSnapshot : ModelSnapshot |
||||
{ |
||||
protected override void BuildModel(ModelBuilder modelBuilder) |
||||
{ |
||||
#pragma warning disable 612, 618 |
||||
modelBuilder |
||||
.HasAnnotation("ProductVersion", "2.1.8-servicing-32085"); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Antrag", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<int>("KursId"); |
||||
|
||||
b.Property<int?>("SchuelerId"); |
||||
|
||||
b.Property<int?>("UnterrichtTypId"); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("SchuelerId"); |
||||
|
||||
b.HasIndex("UnterrichtTypId"); |
||||
|
||||
b.ToTable("Antraege"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.AntragInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("AntragId"); |
||||
|
||||
b.HasKey("InstrumentId", "AntragId"); |
||||
|
||||
b.HasIndex("AntragId"); |
||||
|
||||
b.ToTable("AntragInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Dozent", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("BLZ") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Bankname") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("EMail") |
||||
.IsRequired(); |
||||
|
||||
b.Property<DateTime>("Geburtsdatum"); |
||||
|
||||
b.Property<string>("Geburtsort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("KontoNr") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Ort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<int>("PLZ"); |
||||
|
||||
b.Property<string>("Strasse") |
||||
.IsRequired(); |
||||
|
||||
b.Property<decimal>("Stundensatz"); |
||||
|
||||
b.Property<string>("Telefon") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Vorname") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Donzenten"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.DozentInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("DozentId"); |
||||
|
||||
b.HasKey("InstrumentId", "DozentId"); |
||||
|
||||
b.HasIndex("DozentId"); |
||||
|
||||
b.ToTable("DozentInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Instrument", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Instrumente"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Kurs", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<bool>("Bestaetigt"); |
||||
|
||||
b.Property<int>("Kuendigungsfrist"); |
||||
|
||||
b.Property<int>("Laufzeit"); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.Property<int?>("UnterrichtsTypId"); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("UnterrichtsTypId"); |
||||
|
||||
b.ToTable("Kurse"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("KursId"); |
||||
|
||||
b.HasKey("InstrumentId", "KursId"); |
||||
|
||||
b.HasIndex("KursId"); |
||||
|
||||
b.ToTable("KursInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursSchueler", b => |
||||
{ |
||||
b.Property<int>("SchuelerId"); |
||||
|
||||
b.Property<int>("KursId"); |
||||
|
||||
b.Property<int?>("DozentId"); |
||||
|
||||
b.HasKey("SchuelerId", "KursId"); |
||||
|
||||
b.HasIndex("DozentId"); |
||||
|
||||
b.HasIndex("KursId"); |
||||
|
||||
b.ToTable("KursSchueler"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Raum", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<bool>("Belegt"); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Raeume"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.RaumInstrument", b => |
||||
{ |
||||
b.Property<int?>("InstrumentId"); |
||||
|
||||
b.Property<int?>("RaumId"); |
||||
|
||||
b.HasKey("InstrumentId", "RaumId"); |
||||
|
||||
b.HasIndex("RaumId"); |
||||
|
||||
b.ToTable("RaumInstrument"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Schueler", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("BLZ") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Bankname") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("EMail") |
||||
.IsRequired(); |
||||
|
||||
b.Property<DateTime>("Geburtsdatum"); |
||||
|
||||
b.Property<string>("Geburtsort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<bool>("IstErmaessigt"); |
||||
|
||||
b.Property<string>("KontoNr") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Ort") |
||||
.IsRequired(); |
||||
|
||||
b.Property<int>("PLZ"); |
||||
|
||||
b.Property<string>("Strasse") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Telefon") |
||||
.IsRequired(); |
||||
|
||||
b.Property<string>("Vorname") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("Schueler"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Unterricht", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<int?>("KursId"); |
||||
|
||||
b.Property<string>("Notiz"); |
||||
|
||||
b.Property<int?>("RaumId"); |
||||
|
||||
b.Property<DateTime>("Startzeit"); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("KursId"); |
||||
|
||||
b.HasIndex("RaumId"); |
||||
|
||||
b.ToTable("Unterrichte"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.UnterrichtTyp", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("Name") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.ToTable("UnterrichtTypen"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Antrag", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Schueler", "Schueler") |
||||
.WithMany() |
||||
.HasForeignKey("SchuelerId"); |
||||
|
||||
b.HasOne("EVABackend.Models.UnterrichtTyp", "UnterrichtTyp") |
||||
.WithMany() |
||||
.HasForeignKey("UnterrichtTypId"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.AntragInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Antrag", "Antrag") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("AntragId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.DozentInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Dozent", "Dozent") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("DozentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Kurs", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.UnterrichtTyp", "UnterrichtsTyp") |
||||
.WithMany() |
||||
.HasForeignKey("UnterrichtsTypId"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Kurs", "Kurs") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("KursId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.KursSchueler", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Dozent") |
||||
.WithMany("KursSchueler") |
||||
.HasForeignKey("DozentId"); |
||||
|
||||
b.HasOne("EVABackend.Models.Kurs", "Kurs") |
||||
.WithMany("KursSchueler") |
||||
.HasForeignKey("KursId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Schueler", "Schueler") |
||||
.WithMany("KursSchueler") |
||||
.HasForeignKey("SchuelerId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.RaumInstrument", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Instrument", "Instrument") |
||||
.WithMany() |
||||
.HasForeignKey("InstrumentId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Models.Raum", "Raum") |
||||
.WithMany("Instrumente") |
||||
.HasForeignKey("RaumId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("EVABackend.Models.Unterricht", b => |
||||
{ |
||||
b.HasOne("EVABackend.Models.Kurs") |
||||
.WithMany("Unterrichte") |
||||
.HasForeignKey("KursId"); |
||||
|
||||
b.HasOne("EVABackend.Models.Raum", "Raum") |
||||
.WithMany() |
||||
.HasForeignKey("RaumId"); |
||||
}); |
||||
#pragma warning restore 612, 618 |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,227 @@
|
||||
// <auto-generated /> |
||||
using System; |
||||
using EVABackend.Models; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
||||
|
||||
namespace EVABackend.Migrations |
||||
{ |
||||
[DbContext(typeof(EVABackendIdentityContext))] |
||||
partial class EVABackendIdentityContextModelSnapshot : ModelSnapshot |
||||
{ |
||||
protected override void BuildModel(ModelBuilder modelBuilder) |
||||
{ |
||||
#pragma warning disable 612, 618 |
||||
modelBuilder |
||||
.HasAnnotation("ProductVersion", "2.1.8-servicing-32085"); |
||||
|
||||
modelBuilder.Entity("EVABackend.Areas.Identity.Data.EVABackendUser", b => |
||||
{ |
||||
b.Property<string>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<int>("AccessFailedCount"); |
||||
|
||||
b.Property<string>("ConcurrencyStamp") |
||||
.IsConcurrencyToken(); |
||||
|
||||
b.Property<string>("Email") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<bool>("EmailConfirmed"); |
||||
|
||||
b.Property<bool>("LockoutEnabled"); |
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd"); |
||||
|
||||
b.Property<string>("NormalizedEmail") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<string>("NormalizedUserName") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<string>("PasswordHash"); |
||||
|
||||
b.Property<string>("PhoneNumber"); |
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed"); |
||||
|
||||
b.Property<string>("SecurityStamp"); |
||||
|
||||
b.Property<bool>("TwoFactorEnabled"); |
||||
|
||||
b.Property<string>("UserName") |
||||
.HasMaxLength(256); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("NormalizedEmail") |
||||
.HasName("EmailIndex"); |
||||
|
||||
b.HasIndex("NormalizedUserName") |
||||
.IsUnique() |
||||
.HasName("UserNameIndex"); |
||||
|
||||
b.ToTable("AspNetUsers"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => |
||||
{ |
||||
b.Property<string>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("ConcurrencyStamp") |
||||
.IsConcurrencyToken(); |
||||
|
||||
b.Property<string>("Name") |
||||
.HasMaxLength(256); |
||||
|
||||
b.Property<string>("NormalizedName") |
||||
.HasMaxLength(256); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("NormalizedName") |
||||
.IsUnique() |
||||
.HasName("RoleNameIndex"); |
||||
|
||||
b.ToTable("AspNetRoles"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("ClaimType"); |
||||
|
||||
b.Property<string>("ClaimValue"); |
||||
|
||||
b.Property<string>("RoleId") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("RoleId"); |
||||
|
||||
b.ToTable("AspNetRoleClaims"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => |
||||
{ |
||||
b.Property<int>("Id") |
||||
.ValueGeneratedOnAdd(); |
||||
|
||||
b.Property<string>("ClaimType"); |
||||
|
||||
b.Property<string>("ClaimValue"); |
||||
|
||||
b.Property<string>("UserId") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("Id"); |
||||
|
||||
b.HasIndex("UserId"); |
||||
|
||||
b.ToTable("AspNetUserClaims"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => |
||||
{ |
||||
b.Property<string>("LoginProvider") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("ProviderKey") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("ProviderDisplayName"); |
||||
|
||||
b.Property<string>("UserId") |
||||
.IsRequired(); |
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey"); |
||||
|
||||
b.HasIndex("UserId"); |
||||
|
||||
b.ToTable("AspNetUserLogins"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => |
||||
{ |
||||
b.Property<string>("UserId"); |
||||
|
||||
b.Property<string>("RoleId"); |
||||
|
||||
b.HasKey("UserId", "RoleId"); |
||||
|
||||
b.HasIndex("RoleId"); |
||||
|
||||
b.ToTable("AspNetUserRoles"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => |
||||
{ |
||||
b.Property<string>("UserId"); |
||||
|
||||
b.Property<string>("LoginProvider") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("Name") |
||||
.HasMaxLength(128); |
||||
|
||||
b.Property<string>("Value"); |
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name"); |
||||
|
||||
b.ToTable("AspNetUserTokens"); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => |
||||
{ |
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") |
||||
.WithMany() |
||||
.HasForeignKey("RoleId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => |
||||
{ |
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => |
||||
{ |
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => |
||||
{ |
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") |
||||
.WithMany() |
||||
.HasForeignKey("RoleId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
|
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => |
||||
{ |
||||
b.HasOne("EVABackend.Areas.Identity.Data.EVABackendUser") |
||||
.WithMany() |
||||
.HasForeignKey("UserId") |
||||
.OnDelete(DeleteBehavior.Cascade); |
||||
}); |
||||
#pragma warning restore 612, 618 |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,42 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel.DataAnnotations; |
||||
|
||||
namespace EVABackend.Models |
||||
{ |
||||
public class Aufnahmeantrag |
||||
{ |
||||
[Required] |
||||
public string Name { get; set; } |
||||
[Required] |
||||
public string Vonname { get; set; } |
||||
public bool IstErmaessigt { get; set; } |
||||
public DateTime Geburtsdatum { get; set; } |
||||
[Required] |
||||
public string Geburtsort { get; set; } |
||||
[Range(1, 100000)] |
||||
public int PLZ { get; set; } |
||||
[Required] |
||||
public string Ort { get; set; } |
||||
[Required] |
||||
public string StrasseHNR { get; set; } |
||||
[Required] |
||||
public string Bankname { get; set; } |
||||
[Required] |
||||
public string BLZ { get; set; } |
||||
[Required] |
||||
public string KontoNr { get; set; } |
||||
[Required] |
||||
public UnterrichtTyp Typ { get; set; } |
||||
[Required] |
||||
public List<int> Instrumente { get; set; } |
||||
[Required] |
||||
public string Laufzeit { get; set; } |
||||
[Required] |
||||
public string KursId { get; set; } |
||||
[Required] |
||||
public string Telefon { get; set; } |
||||
[Required] |
||||
public string EMail { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic; |
||||
using System.ComponentModel.DataAnnotations; |
||||
|
||||
namespace EVABackend.Models |
||||
{ |
||||
public class CreateRooms |
||||
{ |
||||
[Required] |
||||
public string Name { get; set; } |
||||
[Required] |
||||
public List<string> InstrumentIDs { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,227 @@
|
||||
using System.Reflection.Emit; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel.DataAnnotations; |
||||
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
||||
namespace EVABackend.Models |
||||
{ |
||||
public class EVAContext : DbContext |
||||
{ |
||||
public DbSet<Schueler> Schueler { get; set; } |
||||
public DbSet<Dozent> Donzenten { get; set; } |
||||
public DbSet<Kurs> Kurse { get; set; } |
||||
public DbSet<KursSchueler> KursSchueler { get; set; } |
||||
public DbSet<Unterricht> Unterrichte { get; set; } |
||||
public DbSet<Instrument> Instrumente { get; set; } |
||||
public DbSet<Raum> Raeume { get; set; } |
||||
public DbSet<Antrag> Antraege { get; set; } |
||||
public DbSet<UnterrichtTyp> UnterrichtTypen { get; set; } |
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
||||
{ |
||||
optionsBuilder.UseSqlite("Data Source=eva_ls.db"); |
||||
} |
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder) |
||||
{ |
||||
modelBuilder.Entity<KursSchueler>() |
||||
.HasKey(c => new { c.SchuelerId, c.KursId }); |
||||
|
||||
modelBuilder.Entity<RaumInstrument>() |
||||
.HasKey(c => new { c.InstrumentId, c.RaumId }); |
||||
|
||||
modelBuilder.Entity<KursInstrument>() |
||||
.HasKey(c => new { c.InstrumentId, c.KursId }); |
||||
|
||||
modelBuilder.Entity<DozentInstrument>() |
||||
.HasKey(c => new { c.InstrumentId, c.DozentId }); |
||||
|
||||
modelBuilder.Entity<AntragInstrument>() |
||||
.HasKey(c => new { c.InstrumentId, c.AntragId }); |
||||
|
||||
modelBuilder.Entity<KursSchueler>() |
||||
.HasOne(c => c.Schueler) |
||||
.WithMany(c => c.KursSchueler) |
||||
.HasForeignKey(c => c.SchuelerId); |
||||
|
||||
modelBuilder.Entity<KursSchueler>() |
||||
.HasOne(c => c.Kurs) |
||||
.WithMany(c => c.KursSchueler) |
||||
.HasForeignKey(c => c.KursId); |
||||
|
||||
modelBuilder.Entity<Kurs>() |
||||
.HasMany(c => c.Instrumente) |
||||
.WithOne(c => c.Kurs) |
||||
.HasForeignKey(c => c.KursId); |
||||
|
||||
modelBuilder.Entity<Dozent>() |
||||
.HasMany(c => c.Instrumente) |
||||
.WithOne(c => c.Dozent) |
||||
.HasForeignKey(c => c.DozentId); |
||||
|
||||
modelBuilder.Entity<Raum>() |
||||
.HasMany(c => c.Instrumente) |
||||
.WithOne(c => c.Raum) |
||||
.HasForeignKey(c => c.RaumId); |
||||
|
||||
modelBuilder.Entity<Antrag>() |
||||
.HasMany(c => c.Instrumente) |
||||
.WithOne(c => c.Antrag) |
||||
.HasForeignKey(c => c.AntragId); |
||||
} |
||||
} |
||||
|
||||
public abstract class Person |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
[Required] |
||||
public string Name { get; set; } |
||||
[Required] |
||||
public string Vorname { get; set; } |
||||
public DateTime Geburtsdatum { get; set; } |
||||
[Required] |
||||
public string Geburtsort { get; set; } |
||||
public int PLZ { get; set; } |
||||
[Required] |
||||
public string Ort { get; set; } |
||||
[Required] |
||||
public string Strasse { get; set; } |
||||
[Required] |
||||
public string Telefon { get; set; } |
||||
[Required] |
||||
public string EMail { get; set; } |
||||
[Required] |
||||
public string Bankname { get; set; } |
||||
[Required] |
||||
public string BLZ { get; set; } |
||||
[Required] |
||||
public string KontoNr { get; set; } |
||||
public virtual ICollection<KursSchueler> KursSchueler { get; set; } |
||||
} |
||||
|
||||
public class Schueler : Person |
||||
{ |
||||
public bool IstErmaessigt { get; set; } |
||||
} |
||||
|
||||
public class Dozent : Person |
||||
{ |
||||
public decimal Stundensatz { get; set; } |
||||
public virtual ICollection<DozentInstrument> Instrumente { get; set; } |
||||
} |
||||
|
||||
public class Kurs |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
[Required] |
||||
public string Name { get; set; } |
||||
public int Laufzeit { get; set; } |
||||
public int Kuendigungsfrist { get; set; } |
||||
public bool Bestaetigt { get; set; } |
||||
public UnterrichtTyp UnterrichtsTyp { get; set; } |
||||
public virtual ICollection<KursInstrument> Instrumente { get; set; } |
||||
public virtual ICollection<Unterricht> Unterrichte { get; set; } |
||||
public virtual ICollection<KursSchueler> KursSchueler { get; set; } |
||||
} |
||||
|
||||
public class KursSchueler |
||||
{ |
||||
public int SchuelerId { get; set; } |
||||
public int KursId { get; set; } |
||||
public virtual Schueler Schueler { get; set; } |
||||
public virtual Kurs Kurs { get; set; } |
||||
} |
||||
|
||||
public class Unterricht |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
public DateTime Startzeit { get; set; } |
||||
public string Notiz { get; set; } |
||||
public Raum Raum { get; set; } |
||||
} |
||||
|
||||
public class Raum |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
[Required] |
||||
public string Name { get; set; } |
||||
public bool Belegt { get; set; } |
||||
public virtual ICollection<RaumInstrument> Instrumente { get; set; } |
||||
} |
||||
|
||||
public class Antrag |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
public Schueler Schueler { get; set; } |
||||
public UnterrichtTyp UnterrichtTyp { get; set; } |
||||
public int KursId { get; set; } |
||||
public virtual ICollection<AntragInstrument> Instrumente { get; set; } |
||||
} |
||||
|
||||
public class UnterrichtTyp |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
[Required] |
||||
public string Name { get; set; } |
||||
} |
||||
|
||||
public class Instrument |
||||
{ |
||||
[Key] |
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
public int Id { get; set; } |
||||
[Required] |
||||
public string Name { get; set; } |
||||
} |
||||
|
||||
public class KursInstrument |
||||
{ |
||||
public int? InstrumentId { get; set; } |
||||
public Instrument Instrument { get; set; } |
||||
public int? KursId { get; set; } |
||||
public Kurs Kurs { get; set; } |
||||
} |
||||
|
||||
public class RaumInstrument |
||||
{ |
||||
public int? InstrumentId { get; set; } |
||||
public Instrument Instrument { get; set; } |
||||
public int? RaumId { get; set; } |
||||
public Raum Raum { get; set; } |
||||
} |
||||
|
||||
public class DozentInstrument |
||||
{ |
||||
public int? InstrumentId { get; set; } |
||||
public Instrument Instrument { get; set; } |
||||
public int? DozentId { get; set; } |
||||
public Dozent Dozent { get; set; } |
||||
} |
||||
|
||||
public class AntragInstrument |
||||
{ |
||||
public int? InstrumentId { get; set; } |
||||
public Instrument Instrument { get; set; } |
||||
public int? AntragId { get; set; } |
||||
public Antrag Antrag { get; set; } |
||||
} |
||||
|
||||
//public enum InstrumentTyp |
||||
//{ |
||||
// Klavier, Schlagzeug, Geige, Gitarre, Band |
||||
//} |
||||
} |
||||
@ -0,0 +1,26 @@
|
||||
Support for ASP.NET Core Identity was added to your project |
||||
- The code for adding Identity to your project was generated under Areas/Identity. |
||||
|
||||
Configuration of the Identity related services can be found in the Areas/Identity/IdentityHostingStartup.cs file. |
||||
|
||||
If your app was previously configured to use Identity, then you should remove the call to the AddIdentity method from your ConfigureServices method. |
||||
|
||||
The generated UI requires support for static files. To add static files to your app: |
||||
1. Call app.UseStaticFiles() from your Configure method |
||||
|
||||
To use ASP.NET Core Identity you also need to enable authentication. To authentication to your app: |
||||
1. Call app.UseAuthentication() from your Configure method (after static files) |
||||
|
||||
The generated UI requires MVC. To add MVC to your app: |
||||
1. Call services.AddMvc() from your ConfigureServices method |
||||
2. Call app.UseMvc() from your Configure method (after authentication) |
||||
|
||||
The generated database code requires Entity Framework Core Migrations. Run the following commands: |
||||
1. dotnet ef migrations add CreateIdentitySchema |
||||
2. dotnet ef database update |
||||
Or from the Visual Studio Package Manager Console: |
||||
1. Add-Migration CreateIdentitySchema |
||||
2. Update-Database |
||||
|
||||
Apps that use ASP.NET Core Identity should also use HTTPS. To enable HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. |
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,36 +1,80 @@
|
||||
import React, { Component } from "react"; |
||||
import TextField from "@material-ui/core/TextField"; |
||||
import { TextField, Typography, Grid, Fab, Container } from "@material-ui/core"; |
||||
import SendIcon from "@material-ui/icons/Send"; |
||||
import { withStyles, createStyles } from "@material-ui/styles"; |
||||
|
||||
const useStyles = createStyles(theme => ({ |
||||
textField: { |
||||
margingLeft: theme.spacing(1), |
||||
marginRight: theme.spacing(1) |
||||
}, |
||||
fab: { |
||||
margin: theme.spacing(1) |
||||
}, |
||||
form: { |
||||
backgroundColor: "#f5f5f5", |
||||
borderRadius: "5px", |
||||
margin: "20px", |
||||
padding: "20px", |
||||
boxShadow: "0px 0px 5px 0px lightgrey", |
||||
border: "1px solid lightgrey" |
||||
} |
||||
})); |
||||
|
||||
class Login extends Component { |
||||
state = {}; |
||||
state = { username: "", password: "" }; |
||||
|
||||
handleChange = name => event => { |
||||
this.setState({ [name]: event.target.value }); |
||||
}; |
||||
|
||||
render() { |
||||
const classes = this.props.classes; |
||||
|
||||
return ( |
||||
<form> |
||||
<TextField |
||||
variant="outlined" |
||||
margin="normal" |
||||
required |
||||
fullWidth |
||||
id="email" |
||||
label="Email Address" |
||||
name="email" |
||||
autoComplete="email" |
||||
autoFocus |
||||
/> |
||||
<TextField |
||||
type="password" |
||||
variant="outlined" |
||||
margin="normal" |
||||
required |
||||
fullWidth |
||||
id="password" |
||||
label="Password" |
||||
name="password" |
||||
autoComplete="password" |
||||
/> |
||||
</form> |
||||
<Container maxWidth="md"> |
||||
<div className={classes.form}> |
||||
<Grid container direction="row" justify="center" alignItems="center"> |
||||
<Grid container spacing={1}> |
||||
<Grid item xs={12}> |
||||
<Typography align="center" variant="h4"> |
||||
Login |
||||
</Typography> |
||||
</Grid> |
||||
<Grid item xs={12}> |
||||
<TextField |
||||
fullWidth={true} |
||||
id="outlined-name" |
||||
label="Username" |
||||
className={classes.textField} |
||||
value={this.state.username} |
||||
onChange={this.handleChange("username")} |
||||
margin="normal" |
||||
variant="outlined" |
||||
/> |
||||
</Grid> |
||||
<Grid item xs={12}> |
||||
<TextField |
||||
fullWidth={true} |
||||
id="outlined-name" |
||||
label="Password" |
||||
className={classes.textField} |
||||
value={this.state.password} |
||||
onChange={this.handleChange("password")} |
||||
margin="normal" |
||||
variant="outlined" |
||||
type="password" |
||||
/> |
||||
</Grid> |
||||
</Grid> |
||||
<Fab color="primary" aria-label="Send" className={classes.fab}> |
||||
<SendIcon /> |
||||
</Fab> |
||||
</Grid> |
||||
</div> |
||||
</Container> |
||||
); |
||||
} |
||||
} |
||||
|
||||
export default Login; |
||||
export default withStyles(useStyles)(Login); |
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 535 KiB |
@ -0,0 +1,17 @@
|
||||
# 2019-06-19 Protokoll |
||||
|
||||
_Teilnehmer: Levin Faber, Alexej Komnik, Tobias Schiffarth, Kai Senkowski_ |
||||
|
||||
_Ort: Schule_ |
||||
|
||||
## Agenda |
||||
* Prototyp vorantreiben |
||||
* Zeitplan |
||||
* Präsentation |
||||
|
||||
## Ergebnisse |
||||
* Abschließende Vorgangsliste für Zeitplan |
||||
* Weitere Implementation Prototyp (Authentifizierung) |
||||
|
||||
## Resultierende Aufgaben |
||||
Keine |
||||
Loading…
Reference in new issue