Merge pull request 'Jews are behind everything' (#27) from fix/my_mind into master

This commit is contained in:
maxchil 2020-08-04 17:47:05 +02:00
commit 2f96bd0e89
29 changed files with 2353 additions and 551 deletions

View File

@ -1,68 +1,68 @@
using System.Threading.Tasks;
using InternshipSystem.Repository;
using Microsoft.AspNetCore.Mvc;
namespace InternshipSystem.Api.Controllers
{
[ApiController]
[Route("admin")]
public class AdminController : ControllerBase
{
public AdminController(DatabaseFiller fillerService)
{
FillerService = fillerService;
}
public DatabaseFiller FillerService { get; }
[HttpPost("fill")]
public async Task<IActionResult> Fill() {
await FillerService.FillCompany();
await FillerService.FillStudents();
await FillerService.FillSubjects();
await FillerService.FillInternshipTypes();
await FillerService.FillEditions();
await FillerService.FillInternShips();
return Ok();
}
// [HttpPost("fill/companies")]
// public async Task<IActionResult> FillCompaniesAsync()
// {
// await FillerService.FillCompany();
// return Ok();
// }
//
// [HttpPost("fill/students")]
// public async Task<IActionResult> FillStudentsAsync() {
// await FillerService.FillStudents();
// return Ok();
// }
//
// [HttpPost("fill/subjects")]
// public async Task<IActionResult> FillSubjectsAsync()
// {
// await FillerService.FillSubjects();
// return Ok();
// }
//
// [HttpPost("fill/internshiptypes")]
// public async Task<IActionResult> FillInternshipTypesAsync() {
// await FillerService.FillInternshipTypes();
// return Ok();
// }
//
// [HttpPost("fill/editions")]
// public async Task<IActionResult> FillEditionsAsync() {
// await FillerService.FillEditions();
// return Ok();
// }
//
// [HttpPost("fill/internships")]
// public async Task<IActionResult> FillInternShipsAsync() {
// await FillerService.FillInternShips();
// return Ok();
// }
}
}
// using System.Threading.Tasks;
// using InternshipSystem.Repository;
// using Microsoft.AspNetCore.Mvc;
//
// namespace InternshipSystem.Api.Controllers
// {
// [ApiController]
// [Route("admin")]
// public class AdminController : ControllerBase
// {
// public AdminController(DatabaseFiller fillerService)
// {
// FillerService = fillerService;
// }
//
// public DatabaseFiller FillerService { get; }
//
//
// [HttpPost("fill")]
// public async Task<IActionResult> Fill() {
// await FillerService.FillCompany();
// await FillerService.FillStudents();
// await FillerService.FillSubjects();
// await FillerService.FillInternshipTypes();
// await FillerService.FillEditions();
// await FillerService.FillInternShips();
// return Ok();
// }
//
// // [HttpPost("fill/companies")]
// // public async Task<IActionResult> FillCompaniesAsync()
// // {
// // await FillerService.FillCompany();
// // return Ok();
// // }
// //
// // [HttpPost("fill/students")]
// // public async Task<IActionResult> FillStudentsAsync() {
// // await FillerService.FillStudents();
// // return Ok();
// // }
// //
// // [HttpPost("fill/subjects")]
// // public async Task<IActionResult> FillSubjectsAsync()
// // {
// // await FillerService.FillSubjects();
// // return Ok();
// // }
// //
// // [HttpPost("fill/internshiptypes")]
// // public async Task<IActionResult> FillInternshipTypesAsync() {
// // await FillerService.FillInternshipTypes();
// // return Ok();
// // }
// //
// // [HttpPost("fill/editions")]
// // public async Task<IActionResult> FillEditionsAsync() {
// // await FillerService.FillEditions();
// // return Ok();
// // }
// //
// // [HttpPost("fill/internships")]
// // public async Task<IActionResult> FillInternShipsAsync() {
// // await FillerService.FillInternShips();
// // return Ok();
// // }
// }
// }

View File

@ -29,7 +29,7 @@ namespace InternshipSystem.Api
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
options.IncludeXmlComments(xmlPath);
})
.AddScoped<DatabaseFiller>()
// .AddScoped<DatabaseFiller>()
.AddControllers()
;

View File

@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using InternshipSystem.Core.Entity.Internship;
using InternshipSystem.Core.UglyOrmArtifacts;
namespace InternshipSystem.Core
{
public class Edition
{
public long Id { get; private set; }
public DateTime EditionStart { get; private set; }
public DateTime EditionFinish { get; private set; }
public DateTime ReportingStart { get; private set; }
public Course Course { get; private set; }
public IReadOnlyCollection<InternshipSubject> AvailableSubjects { get; private set; }
public long Id { get; set; }
public DateTime EditionStart { get; set; }
public DateTime EditionFinish { get; set; }
public DateTime ReportingStart { get; set; }
public Course Course { get; set; }
public List<Internship> Internships { get; set; }
public List<EditionSubject> AvailableSubjects { get; set; }
public Edition CreateEdition(DateTime start, DateTime end, DateTime reportingStart)
{

View File

@ -1,4 +1,6 @@
using System.Collections.Generic;
using InternshipSystem.Core.Entity.Internship;
using InternshipSystem.Core.UglyOrmArtifacts;
namespace InternshipSystem.Core
{
@ -6,7 +8,7 @@ namespace InternshipSystem.Core
{
public long Id { get; set; }
public Mentor Mentor { get; set; }
public List<InternshipSubject> ChosenSubjects { get; set; }
public DocumentState State { get; set; }
public List<ProgramSubject> ChosenSubjects { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using System;
using InternshipSystem.Core.Entity.Internship;
namespace InternshipSystem.Core
{

View File

@ -0,0 +1,9 @@
namespace InternshipSystem.Core.Entity.Internship
{
public class InternshipSubject
{
public long Id { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,6 +1,6 @@
namespace InternshipSystem.Repository.Model
namespace InternshipSystem.Core.Entity.Internship
{
public class InternshipTypeReadModel
public class InternshipType
{
public long Id { get; set; }
public string Type { get; set; }

View File

@ -0,0 +1,12 @@
using InternshipSystem.Core.Entity.Internship;
namespace InternshipSystem.Core.UglyOrmArtifacts
{
public class EditionSubject
{
public long EditionId { get; set; }
public Edition Edition { get; set; }
public long InternshipSubjectId { get; set; }
public InternshipSubject Subject { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using InternshipSystem.Core.Entity.Internship;
namespace InternshipSystem.Core.UglyOrmArtifacts
{
public class ProgramSubject
{
public long InternshipProgramId { get; set; }
public InternshipProgram Program { get; set; }
public long InternshipSubjectId { get; set; }
public InternshipSubject Subject { get; set; }
}
}

View File

@ -1,6 +1,6 @@
namespace InternshipSystem.Core
{
public struct BranchAddress
public class BranchAddress
{
public string Street { get; set; }
public string Building { get; set; }

View File

@ -1,7 +0,0 @@
namespace InternshipSystem.Core
{
public struct InternshipSubject
{
public string Description { get; set; }
}
}

View File

@ -1,8 +0,0 @@
namespace InternshipSystem.Core
{
public struct InternshipType
{
public string Type { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,6 +1,6 @@
namespace InternshipSystem.Core
{
public struct Mentor
public class Mentor
{
public string FirstName { get; set; }
public string LastName { get; set; }

View File

@ -1,8 +1,12 @@
namespace InternshipSystem.Core
{
public struct Nip
public class Nip
{
private readonly string nip;
public Nip()
{
}
private Nip(string maybeNip)
{

View File

@ -1,6 +1,22 @@
namespace InternshipSystem.Core
{
public struct PhoneNumber
public class PhoneNumber
{
private readonly string phoneNumber;
public PhoneNumber()
{
}
private PhoneNumber(string maybePhoneNumber)
{
phoneNumber = maybePhoneNumber;
}
public static implicit operator string(PhoneNumber phoneNumber) =>
phoneNumber.phoneNumber;
public static implicit operator PhoneNumber(string maybephoneNumber) =>
new PhoneNumber(maybephoneNumber);
}
}

View File

@ -1,311 +1,313 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using InternshipSystem.Core;
using InternshipSystem.Repository.Model;
using Microsoft.EntityFrameworkCore;
namespace InternshipSystem.Repository
{
public class DatabaseFiller
{
public DatabaseFiller(InternshipDbContext context)
{
Context = context;
}
public InternshipDbContext Context { get; }
public async Task FillCompany()
{
var companies = new List<CompanyReadModel>
{
new CompanyReadModel
{
Name = "Intel",
SiteAddress = new Uri("https://www.intel.com/content/www/us/en/jobs/locations/poland.html"),
Nip = "9570752316",
Range = RangeOfActivity.International,
Branches = new List<BranchOfficeReadModel>
{
new BranchOfficeReadModel
{
City = "Gdańsk",
Street = "ul. Słowackiego",
Building = "173",
PostalCode = "80-298",
Country = "Poland",
},
new BranchOfficeReadModel
{
City = "Gdańsk",
Street = "Jana z Kolna",
Building = "11",
PostalCode = "80-001",
Country = "Poland",
},
new BranchOfficeReadModel
{
City = "Boston",
Street = "State St",
Building = "53",
PostalCode = "MA 02109",
Country = "Stany Zjednoczone",
}
}
},
new CompanyReadModel
{
Name = "Asseco Poland",
SiteAddress = new Uri("http://pl.asseco.com"),
Nip = "5842068320",
Range = RangeOfActivity.National,
Branches = new List<BranchOfficeReadModel>
{
new BranchOfficeReadModel
{
City = "Gdańsk",
Street = "ul. Podolska",
Building = "21",
PostalCode = "81-321",
Country = "Poland"
},
new BranchOfficeReadModel
{
City = "Wrocław",
Street = "Traugutta",
Building = "1/7",
PostalCode = "50-449",
Country = "Poland"
}
}
}
};
await Context.Companies.AddRangeAsync(companies);
await Context.SaveChangesAsync();
}
public async Task FillStudents()
{
var interns = new List<Student>
{
new Student
{
FirstName = "Jan",
LastName = "Kowalski",
AlbumNumber = 123456,
Email = "s123456@student.pg.edu.pl",
Semester = 4,
},
new Student
{
FirstName = "Adam",
LastName = "Kołek",
AlbumNumber = 102137,
Email = "s102137@student.pg.edu.pl",
Semester = 6,
}
};
await Context.Students.AddRangeAsync(interns);
await Context.SaveChangesAsync();
}
public async Task FillInternshipTypes()
{
var internshipTypes = new List<InternshipTypeReadModel>
{
new InternshipTypeReadModel
{
Type = "FreeInternship",
Description = "Praktyka bezpłatna",
},
new InternshipTypeReadModel
{
Type = "GraduateInternship"
},
new InternshipTypeReadModel
{
Type = "FreeApprenticeship"
},
new InternshipTypeReadModel
{
Type = "PaidApprenticeship",
Description = "np. przemysłowy"
},
new InternshipTypeReadModel
{
Type = "ForeignInternship",
Description = "np. IAESTE, ERASMUS"
},
new InternshipTypeReadModel
{
Type = "UOP"
},
new InternshipTypeReadModel
{
Type = "UD"
},
new InternshipTypeReadModel
{
Type = "UZ"
},
new InternshipTypeReadModel
{
Type = "Other",
Description = "Należy wprowadzić samodzielnie"
}
};
await Context.InternshipTypes.AddRangeAsync(internshipTypes);
await Context.SaveChangesAsync();
}
public async Task FillSubjects()
{
var subjects = new List<InternshipSubjectReadModel>
{
new InternshipSubjectReadModel
{
Description = "Modelowanie baz danych"
},
new InternshipSubjectReadModel
{
Description = "Oprogramowywanie kart graficznych"
},
new InternshipSubjectReadModel
{
Description = "Projektowanie UI"
}
};
await Context.Subjects.AddRangeAsync(subjects);
await Context.SaveChangesAsync();
}
public async Task FillEditions()
{
var editions = new List<EditionReadModel>
{
new EditionReadModel
{
EditionStart = new DateTime(2000, 5, 10),
EditionFinish = new DateTime(2000, 11, 10),
ReportingStart = new DateTime(2000, 9, 30),
AvailableSubjects = new List<EditionSubject>
{
new EditionSubject
{
InternshipId = Context.Subjects
.First(i => i.Description.Equals("Modelowanie baz danych"))
.Id,
},
new EditionSubject
{
InternshipId = Context.Subjects
.First(i => i.Description.Equals("Oprogramowywanie kart graficznych"))
.Id
},
new EditionSubject
{
InternshipId = Context.Subjects
.First(i => i.Description.Equals("Projektowanie UI"))
.Id
}
}.ToImmutableList(),
Course = new Course
{
Name = "Informatyka",
}
}
};
await Context.Editions.AddRangeAsync(editions);
await Context.SaveChangesAsync();
}
public async Task FillInternShips()
{
var intenrships = new List<InternshipReadModel>
{
new InternshipReadModel
{
Student = Context.Students.First(i => i.AlbumNumber.Equals(123456)),
InternshipRegistration = new InternshipRegistrationReadModel()
{
Company = Context.Companies.First(c => c.Nip.Equals("9570752316")), //Intel
Type = Context.InternshipTypes.First(t => t.Type.Equals("UOP")),
Start = new DateTime(2000, 7, 1),
End = new DateTime(2000, 8, 30),
State = DocumentState.Submitted,
BranchAddress =
Context.Companies
.Include(c => c.Branches)
.First(c => c.Nip.Equals("9570752316"))
.Branches
.First(),
},
InternshipProgram = new InternshipProgramReadModel()
{
FirstName = "Horacy",
LastName = "Wościcki",
Email = "howos@intel.com",
PhoneNumber = "605-555-555",
ChosenSubjects = new List<ProgramSubject>
{
new ProgramSubject
{
InternshipSubjectId =
Context.Subjects
.First(s => s.Description.Equals("Projektowanie UI"))
.Id
},
new ProgramSubject
{
InternshipSubjectId =
Context.Subjects
.First(s => s.Description.Equals("Oprogramowywanie kart graficznych"))
.Id
}
}
},
},
new InternshipReadModel
{
Student = Context.Students.First(i => i.AlbumNumber == 102137),
InternshipRegistration = new InternshipRegistrationReadModel()
{
Company = Context.Companies.First(c => c.Nip.Equals("5842068320")), //Asseco
Type = Context.InternshipTypes.First(t => t.Type.Equals("UZ")),
Start = new DateTime(2000, 7, 1),
End = new DateTime(2000, 8, 30),
State = DocumentState.Submitted,
BranchAddress =
Context.Companies
.Include(c => c.Branches)
.First(c => c.Nip.Equals("5842068320"))
.Branches
.First(),
},
InternshipProgram = new InternshipProgramReadModel()
{
FirstName = "Henryk",
LastName = "Polaciński",
Email = "hepol@asseco.pl",
PhoneNumber = "555-525-545",
ChosenSubjects = new List<ProgramSubject>
{
new ProgramSubject
{
InternshipSubjectId =
Context.Subjects
.First(s => s.Description.Equals("Modelowanie baz danych"))
.Id
}
},
},
},
};
await Context.Internships.AddRangeAsync(intenrships);
await Context.SaveChangesAsync();
}
}
}
// using System;
// using System.Collections.Generic;
// using System.Collections.Immutable;
// using System.Linq;
// using System.Threading.Tasks;
// using InternshipSystem.Core;
// using InternshipSystem.Core.Entity.Internship;
// using InternshipSystem.Core.UglyOrmArtifacts;
// using InternshipSystem.Repository.Model;
// using Microsoft.EntityFrameworkCore;
//
// namespace InternshipSystem.Repository
// {
// public class DatabaseFiller
// {
// public DatabaseFiller(InternshipDbContext context)
// {
// Context = context;
// }
//
// public InternshipDbContext Context { get; }
//
// public async Task FillCompany()
// {
// var companies = new List<CompanyReadModel>
// {
// new CompanyReadModel
// {
// Name = "Intel",
// SiteAddress = new Uri("https://www.intel.com/content/www/us/en/jobs/locations/poland.html"),
// Nip = "9570752316",
// Range = RangeOfActivity.International,
// Branches = new List<BranchOfficeReadModel>
// {
// new BranchOfficeReadModel
// {
// City = "Gdańsk",
// Street = "ul. Słowackiego",
// Building = "173",
// PostalCode = "80-298",
// Country = "Poland",
// },
// new BranchOfficeReadModel
// {
// City = "Gdańsk",
// Street = "Jana z Kolna",
// Building = "11",
// PostalCode = "80-001",
// Country = "Poland",
// },
// new BranchOfficeReadModel
// {
// City = "Boston",
// Street = "State St",
// Building = "53",
// PostalCode = "MA 02109",
// Country = "Stany Zjednoczone",
// }
// }
// },
// new CompanyReadModel
// {
// Name = "Asseco Poland",
// SiteAddress = new Uri("http://pl.asseco.com"),
// Nip = "5842068320",
// Range = RangeOfActivity.National,
// Branches = new List<BranchOfficeReadModel>
// {
// new BranchOfficeReadModel
// {
// City = "Gdańsk",
// Street = "ul. Podolska",
// Building = "21",
// PostalCode = "81-321",
// Country = "Poland"
// },
// new BranchOfficeReadModel
// {
// City = "Wrocław",
// Street = "Traugutta",
// Building = "1/7",
// PostalCode = "50-449",
// Country = "Poland"
// }
// }
// }
// };
// await Context.Companies.AddRangeAsync(companies);
// await Context.SaveChangesAsync();
// }
//
// public async Task FillStudents()
// {
// var interns = new List<Student>
// {
// new Student
// {
// FirstName = "Jan",
// LastName = "Kowalski",
// AlbumNumber = 123456,
// Email = "s123456@student.pg.edu.pl",
// Semester = 4,
// },
// new Student
// {
// FirstName = "Adam",
// LastName = "Kołek",
// AlbumNumber = 102137,
// Email = "s102137@student.pg.edu.pl",
// Semester = 6,
// }
// };
// await Context.Students.AddRangeAsync(interns);
// await Context.SaveChangesAsync();
// }
//
// public async Task FillInternshipTypes()
// {
// var internshipTypes = new List<InternshipType>
// {
// new InternshipType
// {
// Type = "FreeInternship",
// Description = "Praktyka bezpłatna",
// },
// new InternshipType
// {
// Type = "GraduateInternship"
// },
// new InternshipType
// {
// Type = "FreeApprenticeship"
// },
// new InternshipType
// {
// Type = "PaidApprenticeship",
// Description = "np. przemysłowy"
// },
// new InternshipType
// {
// Type = "ForeignInternship",
// Description = "np. IAESTE, ERASMUS"
// },
// new InternshipType
// {
// Type = "UOP"
// },
// new InternshipType
// {
// Type = "UD"
// },
// new InternshipType
// {
// Type = "UZ"
// },
// new InternshipType
// {
// Type = "Other",
// Description = "Należy wprowadzić samodzielnie"
// }
// };
// await Context.InternshipTypes.AddRangeAsync(internshipTypes);
// await Context.SaveChangesAsync();
// }
//
// public async Task FillSubjects()
// {
// var subjects = new List<InternshipSubject>
// {
// new InternshipSubject
// {
// Description = "Modelowanie baz danych"
// },
// new InternshipSubject
// {
// Description = "Oprogramowywanie kart graficznych"
// },
// new InternshipSubject
// {
// Description = "Projektowanie UI"
// }
// };
// await Context.Subjects.AddRangeAsync(subjects);
// await Context.SaveChangesAsync();
// }
//
// public async Task FillEditions()
// {
// var editions = new List<EditionReadModel>
// {
// new EditionReadModel
// {
// EditionStart = new DateTime(2000, 5, 10),
// EditionFinish = new DateTime(2000, 11, 10),
// ReportingStart = new DateTime(2000, 9, 30),
// AvailableSubjects = new List<EditionSubject>
// {
// new EditionSubject
// {
// InternshipId = Context.Subjects
// .First(i => i.Description.Equals("Modelowanie baz danych"))
// .Id,
// },
// new EditionSubject
// {
// InternshipId = Context.Subjects
// .First(i => i.Description.Equals("Oprogramowywanie kart graficznych"))
// .Id
// },
// new EditionSubject
// {
// InternshipId = Context.Subjects
// .First(i => i.Description.Equals("Projektowanie UI"))
// .Id
// }
// }.ToImmutableList(),
// Course = new Course
// {
// Name = "Informatyka",
// }
// }
// };
// await Context.Editions.AddRangeAsync(editions);
// await Context.SaveChangesAsync();
// }
//
// public async Task FillInternShips()
// {
// var intenrships = new List<InternshipReadModel>
// {
// new InternshipReadModel
// {
// Student = Context.Students.First(i => i.AlbumNumber.Equals(123456)),
// InternshipRegistration = new InternshipRegistrationReadModel()
// {
// Company = Context.Companies.First(c => c.Nip.Equals("9570752316")), //Intel
// Type = Context.InternshipTypes.First(t => t.Type.Equals("UOP")),
// Start = new DateTime(2000, 7, 1),
// End = new DateTime(2000, 8, 30),
// State = DocumentState.Submitted,
// BranchAddress =
// Context.Companies
// .Include(c => c.Branches)
// .First(c => c.Nip.Equals("9570752316"))
// .Branches
// .First(),
// },
// InternshipProgram = new InternshipProgramReadModel()
// {
// FirstName = "Horacy",
// LastName = "Wościcki",
// Email = "howos@intel.com",
// PhoneNumber = "605-555-555",
// ChosenSubjects = new List<ProgramSubject>
// {
// new ProgramSubject
// {
// InternshipSubjectId =
// Context.Subjects
// .First(s => s.Description.Equals("Projektowanie UI"))
// .Id
// },
// new ProgramSubject
// {
// InternshipSubjectId =
// Context.Subjects
// .First(s => s.Description.Equals("Oprogramowywanie kart graficznych"))
// .Id
// }
// }
// },
// },
// new InternshipReadModel
// {
// Student = Context.Students.First(i => i.AlbumNumber == 102137),
// InternshipRegistration = new InternshipRegistrationReadModel()
// {
// Company = Context.Companies.First(c => c.Nip.Equals("5842068320")), //Asseco
// Type = Context.InternshipTypes.First(t => t.Type.Equals("UZ")),
// Start = new DateTime(2000, 7, 1),
// End = new DateTime(2000, 8, 30),
// State = DocumentState.Submitted,
// BranchAddress =
// Context.Companies
// .Include(c => c.Branches)
// .First(c => c.Nip.Equals("5842068320"))
// .Branches
// .First(),
// },
// InternshipProgram = new InternshipProgramReadModel()
// {
// FirstName = "Henryk",
// LastName = "Polaciński",
// Email = "hepol@asseco.pl",
// PhoneNumber = "555-525-545",
// ChosenSubjects = new List<ProgramSubject>
// {
// new ProgramSubject
// {
// InternshipSubjectId =
// Context.Subjects
// .First(s => s.Description.Equals("Modelowanie baz danych"))
// .Id
// }
// },
// },
// },
// };
// await Context.Internships.AddRangeAsync(intenrships);
// await Context.SaveChangesAsync();
// }
// }
// }

View File

@ -1,24 +1,14 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using InternshipSystem.Core;
using InternshipSystem.Repository.Model;
using InternshipSystem.Core.Entity.Internship;
using InternshipSystem.Core.UglyOrmArtifacts;
namespace InternshipSystem.Repository
{
public class InternshipDbContext : DbContext
{
public DbSet<Document> Documents { get; set; }
public DbSet<Course> Courses { get; set; }
public DbSet<CompanyReadModel> Companies { get; set; }
public DbSet<InternshipSubjectReadModel> Subjects { get; set; }
public DbSet<EditionReadModel> Editions { get; set; }
public DbSet<Student> Students { get; set; }
public DbSet<Approval> Approvals { get; set; }
public DbSet<BranchOfficeReadModel> BranchOffices { get; set; }
public DbSet<InternshipRegistrationReadModel> Registrations { get; set; }
public DbSet<InternshipProgramReadModel> Programs { get; set; }
public DbSet<InternshipReadModel> Internships { get; set; }
public DbSet<InternshipTypeReadModel> InternshipTypes { get; set; }
public DbSet<Company> Companies { get; set; }
public DbSet<Edition> Editions { get; set; }
public InternshipDbContext(DbContextOptions<InternshipDbContext> options)
: base(options)
@ -31,18 +21,28 @@ namespace InternshipSystem.Repository
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<BranchOffice>()
.OwnsOne(bo => bo.Address);
modelBuilder.Entity<InternshipProgram>()
.OwnsOne(ip => ip.Mentor)
.OwnsOne(m => m.PhoneNumber);
modelBuilder.Entity<Company>()
.OwnsOne(c => c.Nip);
modelBuilder.Entity<ProgramSubject>(builder =>
{
builder
.HasKey(subject => new { subject.InternshipProgramId, subject.InternshipSubjectId });
builder
.HasOne<InternshipProgramReadModel>()
.HasOne<InternshipProgram>()
.WithMany(model => model.ChosenSubjects)
.HasForeignKey(subject => subject.InternshipProgramId);
builder
.HasOne<InternshipSubjectReadModel>()
.HasOne<InternshipSubject>()
.WithMany()
.HasForeignKey(subject => subject.InternshipSubjectId);
});
@ -50,17 +50,17 @@ namespace InternshipSystem.Repository
modelBuilder.Entity<EditionSubject>(builder =>
{
builder
.HasKey(subject => new { subject.EditionId, subject.InternshipId});
.HasKey(subject => new { subject.EditionId, subject.InternshipSubjectId});
builder
.HasOne<EditionReadModel>()
.HasOne<Edition>()
.WithMany(model => model.AvailableSubjects)
.HasForeignKey(p => p.EditionId);
builder
.HasOne<InternshipSubjectReadModel>()
.HasOne<InternshipSubject>()
.WithMany()
.HasForeignKey(subject => subject.InternshipId);
.HasForeignKey(subject => subject.InternshipSubjectId);
});
}
}

View File

@ -0,0 +1,692 @@
// <auto-generated />
using System;
using InternshipSystem.Repository;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace InternshipSystem.Repository.Migrations
{
[DbContext(typeof(InternshipDbContext))]
[Migration("20200804152816_Init")]
partial class Init
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("InternshipSystem.Core.Approval", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("InternshipId")
.HasColumnName("internship_id")
.HasColumnType("bigint");
b.Property<byte[]>("Scan")
.HasColumnName("scan")
.HasColumnType("bytea");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_approval");
b.HasIndex("InternshipId")
.HasName("ix_approval_internship_id");
b.ToTable("approval");
});
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CompanyId")
.HasColumnName("company_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_branch_office");
b.HasIndex("CompanyId")
.HasName("ix_branch_office_company_id");
b.ToTable("branch_office");
});
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnName("name")
.HasColumnType("text");
b.Property<int>("Range")
.HasColumnName("range")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_companies");
b.ToTable("companies");
});
modelBuilder.Entity("InternshipSystem.Core.Course", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnName("name")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_course");
b.ToTable("course");
});
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.Property<long?>("InternshipId")
.HasColumnName("internship_id")
.HasColumnType("bigint");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_document");
b.HasIndex("InternshipId")
.HasName("ix_document_internship_id");
b.ToTable("document");
});
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CourseId")
.HasColumnName("course_id")
.HasColumnType("bigint");
b.Property<DateTime>("EditionFinish")
.HasColumnName("edition_finish")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("EditionStart")
.HasColumnName("edition_start")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("ReportingStart")
.HasColumnName("reporting_start")
.HasColumnType("timestamp without time zone");
b.HasKey("Id")
.HasName("pk_editions");
b.HasIndex("CourseId")
.HasName("ix_editions_course_id");
b.ToTable("editions");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipSubject", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_internship_subject");
b.ToTable("internship_subject");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipType", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnName("type")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_internship_type");
b.ToTable("internship_type");
});
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("EditionId")
.HasColumnName("edition_id")
.HasColumnType("bigint");
b.Property<long?>("InternshipProgramId")
.HasColumnName("internship_program_id")
.HasColumnType("bigint");
b.Property<long?>("InternshipRegistrationId")
.HasColumnName("internship_registration_id")
.HasColumnType("bigint");
b.Property<long?>("ReportId")
.HasColumnName("report_id")
.HasColumnType("bigint");
b.Property<long?>("StudentId")
.HasColumnName("student_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_internship");
b.HasIndex("EditionId")
.HasName("ix_internship_edition_id");
b.HasIndex("InternshipProgramId")
.HasName("ix_internship_internship_program_id");
b.HasIndex("InternshipRegistrationId")
.HasName("ix_internship_internship_registration_id");
b.HasIndex("ReportId")
.HasName("ix_internship_report_id");
b.HasIndex("StudentId")
.HasName("ix_internship_student_id");
b.ToTable("internship");
});
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_internship_program");
b.ToTable("internship_program");
});
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("BranchAddressId")
.HasColumnName("branch_address_id")
.HasColumnType("bigint");
b.Property<long?>("CompanyId")
.HasColumnName("company_id")
.HasColumnType("bigint");
b.Property<DateTime>("End")
.HasColumnName("end")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("Start")
.HasColumnName("start")
.HasColumnType("timestamp without time zone");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.Property<long?>("TypeId")
.HasColumnName("type_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_internship_registration");
b.HasIndex("BranchAddressId")
.HasName("ix_internship_registration_branch_address_id");
b.HasIndex("CompanyId")
.HasName("ix_internship_registration_company_id");
b.HasIndex("TypeId")
.HasName("ix_internship_registration_type_id");
b.ToTable("internship_registration");
});
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_report");
b.ToTable("report");
});
modelBuilder.Entity("InternshipSystem.Core.Student", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AlbumNumber")
.HasColumnName("album_number")
.HasColumnType("integer");
b.Property<string>("Email")
.HasColumnName("email")
.HasColumnType("text");
b.Property<string>("FirstName")
.HasColumnName("first_name")
.HasColumnType("text");
b.Property<string>("LastName")
.HasColumnName("last_name")
.HasColumnType("text");
b.Property<int>("Semester")
.HasColumnName("semester")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_student");
b.ToTable("student");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
{
b.Property<long>("EditionId")
.HasColumnName("edition_id")
.HasColumnType("bigint");
b.Property<long>("InternshipSubjectId")
.HasColumnName("internship_subject_id")
.HasColumnType("bigint");
b.Property<long?>("EditionId1")
.HasColumnName("edition_id1")
.HasColumnType("bigint");
b.Property<long?>("SubjectId")
.HasColumnName("subject_id")
.HasColumnType("bigint");
b.HasKey("EditionId", "InternshipSubjectId")
.HasName("pk_edition_subject");
b.HasIndex("EditionId1")
.HasName("ix_edition_subject_edition_id1");
b.HasIndex("InternshipSubjectId")
.HasName("ix_edition_subject_internship_subject_id");
b.HasIndex("SubjectId")
.HasName("ix_edition_subject_subject_id");
b.ToTable("edition_subject");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
{
b.Property<long>("InternshipProgramId")
.HasColumnName("internship_program_id")
.HasColumnType("bigint");
b.Property<long>("InternshipSubjectId")
.HasColumnName("internship_subject_id")
.HasColumnType("bigint");
b.Property<long?>("ProgramId")
.HasColumnName("program_id")
.HasColumnType("bigint");
b.Property<long?>("SubjectId")
.HasColumnName("subject_id")
.HasColumnType("bigint");
b.HasKey("InternshipProgramId", "InternshipSubjectId")
.HasName("pk_program_subject");
b.HasIndex("InternshipSubjectId")
.HasName("ix_program_subject_internship_subject_id");
b.HasIndex("ProgramId")
.HasName("ix_program_subject_program_id");
b.HasIndex("SubjectId")
.HasName("ix_program_subject_subject_id");
b.ToTable("program_subject");
});
modelBuilder.Entity("InternshipSystem.Core.Approval", b =>
{
b.HasOne("InternshipSystem.Core.Internship", null)
.WithMany("Approvals")
.HasForeignKey("InternshipId")
.HasConstraintName("fk_approval_internship_internship_id");
});
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
{
b.HasOne("InternshipSystem.Core.Company", null)
.WithMany("Branches")
.HasForeignKey("CompanyId")
.HasConstraintName("fk_branch_office_companies_company_id");
b.OwnsOne("InternshipSystem.Core.BranchAddress", "Address", b1 =>
{
b1.Property<long>("BranchOfficeId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.Property<string>("Building")
.HasColumnName("building")
.HasColumnType("text");
b1.Property<string>("City")
.HasColumnName("city")
.HasColumnType("text");
b1.Property<string>("Country")
.HasColumnName("country")
.HasColumnType("text");
b1.Property<string>("PostalCode")
.HasColumnName("postal_code")
.HasColumnType("text");
b1.Property<string>("Street")
.HasColumnName("street")
.HasColumnType("text");
b1.HasKey("BranchOfficeId")
.HasName("pk_branch_office");
b1.ToTable("branch_office");
b1.WithOwner()
.HasForeignKey("BranchOfficeId")
.HasConstraintName("fk_branch_address_branch_office_branch_office_id");
});
});
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
{
b.OwnsOne("InternshipSystem.Core.Nip", "Nip", b1 =>
{
b1.Property<long>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.HasKey("CompanyId")
.HasName("pk_companies");
b1.ToTable("companies");
b1.WithOwner()
.HasForeignKey("CompanyId")
.HasConstraintName("fk_nip_companies_company_id");
});
});
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
{
b.HasOne("InternshipSystem.Core.Internship", null)
.WithMany("Documents")
.HasForeignKey("InternshipId")
.HasConstraintName("fk_document_internship_internship_id");
});
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
{
b.HasOne("InternshipSystem.Core.Course", "Course")
.WithMany()
.HasForeignKey("CourseId")
.HasConstraintName("fk_editions_course_course_id");
});
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
{
b.HasOne("InternshipSystem.Core.Edition", null)
.WithMany("Internships")
.HasForeignKey("EditionId")
.HasConstraintName("fk_internship_editions_edition_id");
b.HasOne("InternshipSystem.Core.InternshipProgram", "InternshipProgram")
.WithMany()
.HasForeignKey("InternshipProgramId")
.HasConstraintName("fk_internship_internship_program_internship_program_id");
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
.WithMany()
.HasForeignKey("InternshipRegistrationId")
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
b.HasOne("InternshipSystem.Core.Report", "Report")
.WithMany()
.HasForeignKey("ReportId")
.HasConstraintName("fk_internship_report_report_id");
b.HasOne("InternshipSystem.Core.Student", "Student")
.WithMany()
.HasForeignKey("StudentId")
.HasConstraintName("fk_internship_student_student_id");
});
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
{
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
{
b1.Property<long>("InternshipProgramId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.Property<string>("Email")
.HasColumnName("email")
.HasColumnType("text");
b1.Property<string>("FirstName")
.HasColumnName("first_name")
.HasColumnType("text");
b1.Property<string>("LastName")
.HasColumnName("last_name")
.HasColumnType("text");
b1.HasKey("InternshipProgramId")
.HasName("pk_internship_program");
b1.ToTable("internship_program");
b1.WithOwner()
.HasForeignKey("InternshipProgramId")
.HasConstraintName("fk_mentor_internship_program_internship_program_id");
b1.OwnsOne("InternshipSystem.Core.PhoneNumber", "PhoneNumber", b2 =>
{
b2.Property<long>("MentorInternshipProgramId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b2.HasKey("MentorInternshipProgramId")
.HasName("pk_internship_program");
b2.ToTable("internship_program");
b2.WithOwner()
.HasForeignKey("MentorInternshipProgramId")
.HasConstraintName("fk_phone_number_internship_program_mentor_internship_program_id");
});
});
});
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
{
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
.WithMany()
.HasForeignKey("BranchAddressId")
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
b.HasOne("InternshipSystem.Core.Company", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.HasConstraintName("fk_internship_registration_companies_company_id");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.HasConstraintName("fk_internship_registration_internship_type_type_id");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
{
b.HasOne("InternshipSystem.Core.Edition", null)
.WithMany("AvailableSubjects")
.HasForeignKey("EditionId")
.HasConstraintName("fk_edition_subject_editions_edition_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId1")
.HasConstraintName("fk_edition_subject_editions_edition_id1");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", null)
.WithMany()
.HasForeignKey("InternshipSubjectId")
.HasConstraintName("fk_edition_subject_internship_subject_internship_subject_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
.WithMany()
.HasForeignKey("SubjectId")
.HasConstraintName("fk_edition_subject_internship_subject_subject_id");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
{
b.HasOne("InternshipSystem.Core.InternshipProgram", null)
.WithMany("ChosenSubjects")
.HasForeignKey("InternshipProgramId")
.HasConstraintName("fk_program_subject_internship_program_internship_program_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", null)
.WithMany()
.HasForeignKey("InternshipSubjectId")
.HasConstraintName("fk_program_subject_internship_subject_internship_subject_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.InternshipProgram", "Program")
.WithMany()
.HasForeignKey("ProgramId")
.HasConstraintName("fk_program_subject_internship_program_program_id");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
.WithMany()
.HasForeignKey("SubjectId")
.HasConstraintName("fk_program_subject_internship_subject_subject_id");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,497 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace InternshipSystem.Repository.Migrations
{
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "companies",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(nullable: true),
range = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_companies", x => x.id);
});
migrationBuilder.CreateTable(
name: "course",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_course", x => x.id);
});
migrationBuilder.CreateTable(
name: "internship_program",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
first_name = table.Column<string>(nullable: true),
last_name = table.Column<string>(nullable: true),
email = table.Column<string>(nullable: true),
state = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_internship_program", x => x.id);
});
migrationBuilder.CreateTable(
name: "internship_subject",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
description = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_internship_subject", x => x.id);
});
migrationBuilder.CreateTable(
name: "internship_type",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
type = table.Column<string>(nullable: true),
description = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_internship_type", x => x.id);
});
migrationBuilder.CreateTable(
name: "report",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
state = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_report", x => x.id);
});
migrationBuilder.CreateTable(
name: "student",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
album_number = table.Column<int>(nullable: false),
first_name = table.Column<string>(nullable: true),
last_name = table.Column<string>(nullable: true),
email = table.Column<string>(nullable: true),
semester = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_student", x => x.id);
});
migrationBuilder.CreateTable(
name: "branch_office",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
street = table.Column<string>(nullable: true),
building = table.Column<string>(nullable: true),
city = table.Column<string>(nullable: true),
postal_code = table.Column<string>(nullable: true),
country = table.Column<string>(nullable: true),
company_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_branch_office", x => x.id);
table.ForeignKey(
name: "fk_branch_office_companies_company_id",
column: x => x.company_id,
principalTable: "companies",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "editions",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
edition_start = table.Column<DateTime>(nullable: false),
edition_finish = table.Column<DateTime>(nullable: false),
reporting_start = table.Column<DateTime>(nullable: false),
course_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_editions", x => x.id);
table.ForeignKey(
name: "fk_editions_course_course_id",
column: x => x.course_id,
principalTable: "course",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "program_subject",
columns: table => new
{
internship_program_id = table.Column<long>(nullable: false),
internship_subject_id = table.Column<long>(nullable: false),
program_id = table.Column<long>(nullable: true),
subject_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_program_subject", x => new { x.internship_program_id, x.internship_subject_id });
table.ForeignKey(
name: "fk_program_subject_internship_program_internship_program_id",
column: x => x.internship_program_id,
principalTable: "internship_program",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_program_subject_internship_subject_internship_subject_id",
column: x => x.internship_subject_id,
principalTable: "internship_subject",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_program_subject_internship_program_program_id",
column: x => x.program_id,
principalTable: "internship_program",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_program_subject_internship_subject_subject_id",
column: x => x.subject_id,
principalTable: "internship_subject",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "internship_registration",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
company_id = table.Column<long>(nullable: true),
branch_address_id = table.Column<long>(nullable: true),
start = table.Column<DateTime>(nullable: false),
end = table.Column<DateTime>(nullable: false),
type_id = table.Column<long>(nullable: true),
state = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_internship_registration", x => x.id);
table.ForeignKey(
name: "fk_internship_registration_branch_office_branch_address_id",
column: x => x.branch_address_id,
principalTable: "branch_office",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_internship_registration_companies_company_id",
column: x => x.company_id,
principalTable: "companies",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_internship_registration_internship_type_type_id",
column: x => x.type_id,
principalTable: "internship_type",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "edition_subject",
columns: table => new
{
edition_id = table.Column<long>(nullable: false),
internship_subject_id = table.Column<long>(nullable: false),
edition_id1 = table.Column<long>(nullable: true),
subject_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_edition_subject", x => new { x.edition_id, x.internship_subject_id });
table.ForeignKey(
name: "fk_edition_subject_editions_edition_id",
column: x => x.edition_id,
principalTable: "editions",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_edition_subject_editions_edition_id1",
column: x => x.edition_id1,
principalTable: "editions",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_edition_subject_internship_subject_internship_subject_id",
column: x => x.internship_subject_id,
principalTable: "internship_subject",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_edition_subject_internship_subject_subject_id",
column: x => x.subject_id,
principalTable: "internship_subject",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "internship",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
student_id = table.Column<long>(nullable: true),
internship_registration_id = table.Column<long>(nullable: true),
internship_program_id = table.Column<long>(nullable: true),
report_id = table.Column<long>(nullable: true),
edition_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_internship", x => x.id);
table.ForeignKey(
name: "fk_internship_editions_edition_id",
column: x => x.edition_id,
principalTable: "editions",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_internship_internship_program_internship_program_id",
column: x => x.internship_program_id,
principalTable: "internship_program",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_internship_internship_registration_internship_registration_",
column: x => x.internship_registration_id,
principalTable: "internship_registration",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_internship_report_report_id",
column: x => x.report_id,
principalTable: "report",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_internship_student_student_id",
column: x => x.student_id,
principalTable: "student",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "approval",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
scan = table.Column<byte[]>(nullable: true),
state = table.Column<int>(nullable: false),
internship_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_approval", x => x.id);
table.ForeignKey(
name: "fk_approval_internship_internship_id",
column: x => x.internship_id,
principalTable: "internship",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "document",
columns: table => new
{
id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
description = table.Column<string>(nullable: true),
state = table.Column<int>(nullable: false),
internship_id = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_document", x => x.id);
table.ForeignKey(
name: "fk_document_internship_internship_id",
column: x => x.internship_id,
principalTable: "internship",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "ix_approval_internship_id",
table: "approval",
column: "internship_id");
migrationBuilder.CreateIndex(
name: "ix_branch_office_company_id",
table: "branch_office",
column: "company_id");
migrationBuilder.CreateIndex(
name: "ix_document_internship_id",
table: "document",
column: "internship_id");
migrationBuilder.CreateIndex(
name: "ix_edition_subject_edition_id1",
table: "edition_subject",
column: "edition_id1");
migrationBuilder.CreateIndex(
name: "ix_edition_subject_internship_subject_id",
table: "edition_subject",
column: "internship_subject_id");
migrationBuilder.CreateIndex(
name: "ix_edition_subject_subject_id",
table: "edition_subject",
column: "subject_id");
migrationBuilder.CreateIndex(
name: "ix_editions_course_id",
table: "editions",
column: "course_id");
migrationBuilder.CreateIndex(
name: "ix_internship_edition_id",
table: "internship",
column: "edition_id");
migrationBuilder.CreateIndex(
name: "ix_internship_internship_program_id",
table: "internship",
column: "internship_program_id");
migrationBuilder.CreateIndex(
name: "ix_internship_internship_registration_id",
table: "internship",
column: "internship_registration_id");
migrationBuilder.CreateIndex(
name: "ix_internship_report_id",
table: "internship",
column: "report_id");
migrationBuilder.CreateIndex(
name: "ix_internship_student_id",
table: "internship",
column: "student_id");
migrationBuilder.CreateIndex(
name: "ix_internship_registration_branch_address_id",
table: "internship_registration",
column: "branch_address_id");
migrationBuilder.CreateIndex(
name: "ix_internship_registration_company_id",
table: "internship_registration",
column: "company_id");
migrationBuilder.CreateIndex(
name: "ix_internship_registration_type_id",
table: "internship_registration",
column: "type_id");
migrationBuilder.CreateIndex(
name: "ix_program_subject_internship_subject_id",
table: "program_subject",
column: "internship_subject_id");
migrationBuilder.CreateIndex(
name: "ix_program_subject_program_id",
table: "program_subject",
column: "program_id");
migrationBuilder.CreateIndex(
name: "ix_program_subject_subject_id",
table: "program_subject",
column: "subject_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "approval");
migrationBuilder.DropTable(
name: "document");
migrationBuilder.DropTable(
name: "edition_subject");
migrationBuilder.DropTable(
name: "program_subject");
migrationBuilder.DropTable(
name: "internship");
migrationBuilder.DropTable(
name: "internship_subject");
migrationBuilder.DropTable(
name: "editions");
migrationBuilder.DropTable(
name: "internship_program");
migrationBuilder.DropTable(
name: "internship_registration");
migrationBuilder.DropTable(
name: "report");
migrationBuilder.DropTable(
name: "student");
migrationBuilder.DropTable(
name: "course");
migrationBuilder.DropTable(
name: "branch_office");
migrationBuilder.DropTable(
name: "internship_type");
migrationBuilder.DropTable(
name: "companies");
}
}
}

View File

@ -0,0 +1,690 @@
// <auto-generated />
using System;
using InternshipSystem.Repository;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace InternshipSystem.Repository.Migrations
{
[DbContext(typeof(InternshipDbContext))]
partial class InternshipDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("InternshipSystem.Core.Approval", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("InternshipId")
.HasColumnName("internship_id")
.HasColumnType("bigint");
b.Property<byte[]>("Scan")
.HasColumnName("scan")
.HasColumnType("bytea");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_approval");
b.HasIndex("InternshipId")
.HasName("ix_approval_internship_id");
b.ToTable("approval");
});
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CompanyId")
.HasColumnName("company_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_branch_office");
b.HasIndex("CompanyId")
.HasName("ix_branch_office_company_id");
b.ToTable("branch_office");
});
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnName("name")
.HasColumnType("text");
b.Property<int>("Range")
.HasColumnName("range")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_companies");
b.ToTable("companies");
});
modelBuilder.Entity("InternshipSystem.Core.Course", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnName("name")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_course");
b.ToTable("course");
});
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.Property<long?>("InternshipId")
.HasColumnName("internship_id")
.HasColumnType("bigint");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_document");
b.HasIndex("InternshipId")
.HasName("ix_document_internship_id");
b.ToTable("document");
});
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CourseId")
.HasColumnName("course_id")
.HasColumnType("bigint");
b.Property<DateTime>("EditionFinish")
.HasColumnName("edition_finish")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("EditionStart")
.HasColumnName("edition_start")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("ReportingStart")
.HasColumnName("reporting_start")
.HasColumnType("timestamp without time zone");
b.HasKey("Id")
.HasName("pk_editions");
b.HasIndex("CourseId")
.HasName("ix_editions_course_id");
b.ToTable("editions");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipSubject", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_internship_subject");
b.ToTable("internship_subject");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipType", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnName("type")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_internship_type");
b.ToTable("internship_type");
});
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("EditionId")
.HasColumnName("edition_id")
.HasColumnType("bigint");
b.Property<long?>("InternshipProgramId")
.HasColumnName("internship_program_id")
.HasColumnType("bigint");
b.Property<long?>("InternshipRegistrationId")
.HasColumnName("internship_registration_id")
.HasColumnType("bigint");
b.Property<long?>("ReportId")
.HasColumnName("report_id")
.HasColumnType("bigint");
b.Property<long?>("StudentId")
.HasColumnName("student_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_internship");
b.HasIndex("EditionId")
.HasName("ix_internship_edition_id");
b.HasIndex("InternshipProgramId")
.HasName("ix_internship_internship_program_id");
b.HasIndex("InternshipRegistrationId")
.HasName("ix_internship_internship_registration_id");
b.HasIndex("ReportId")
.HasName("ix_internship_report_id");
b.HasIndex("StudentId")
.HasName("ix_internship_student_id");
b.ToTable("internship");
});
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_internship_program");
b.ToTable("internship_program");
});
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("BranchAddressId")
.HasColumnName("branch_address_id")
.HasColumnType("bigint");
b.Property<long?>("CompanyId")
.HasColumnName("company_id")
.HasColumnType("bigint");
b.Property<DateTime>("End")
.HasColumnName("end")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("Start")
.HasColumnName("start")
.HasColumnType("timestamp without time zone");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.Property<long?>("TypeId")
.HasColumnName("type_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_internship_registration");
b.HasIndex("BranchAddressId")
.HasName("ix_internship_registration_branch_address_id");
b.HasIndex("CompanyId")
.HasName("ix_internship_registration_company_id");
b.HasIndex("TypeId")
.HasName("ix_internship_registration_type_id");
b.ToTable("internship_registration");
});
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_report");
b.ToTable("report");
});
modelBuilder.Entity("InternshipSystem.Core.Student", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AlbumNumber")
.HasColumnName("album_number")
.HasColumnType("integer");
b.Property<string>("Email")
.HasColumnName("email")
.HasColumnType("text");
b.Property<string>("FirstName")
.HasColumnName("first_name")
.HasColumnType("text");
b.Property<string>("LastName")
.HasColumnName("last_name")
.HasColumnType("text");
b.Property<int>("Semester")
.HasColumnName("semester")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_student");
b.ToTable("student");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
{
b.Property<long>("EditionId")
.HasColumnName("edition_id")
.HasColumnType("bigint");
b.Property<long>("InternshipSubjectId")
.HasColumnName("internship_subject_id")
.HasColumnType("bigint");
b.Property<long?>("EditionId1")
.HasColumnName("edition_id1")
.HasColumnType("bigint");
b.Property<long?>("SubjectId")
.HasColumnName("subject_id")
.HasColumnType("bigint");
b.HasKey("EditionId", "InternshipSubjectId")
.HasName("pk_edition_subject");
b.HasIndex("EditionId1")
.HasName("ix_edition_subject_edition_id1");
b.HasIndex("InternshipSubjectId")
.HasName("ix_edition_subject_internship_subject_id");
b.HasIndex("SubjectId")
.HasName("ix_edition_subject_subject_id");
b.ToTable("edition_subject");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
{
b.Property<long>("InternshipProgramId")
.HasColumnName("internship_program_id")
.HasColumnType("bigint");
b.Property<long>("InternshipSubjectId")
.HasColumnName("internship_subject_id")
.HasColumnType("bigint");
b.Property<long?>("ProgramId")
.HasColumnName("program_id")
.HasColumnType("bigint");
b.Property<long?>("SubjectId")
.HasColumnName("subject_id")
.HasColumnType("bigint");
b.HasKey("InternshipProgramId", "InternshipSubjectId")
.HasName("pk_program_subject");
b.HasIndex("InternshipSubjectId")
.HasName("ix_program_subject_internship_subject_id");
b.HasIndex("ProgramId")
.HasName("ix_program_subject_program_id");
b.HasIndex("SubjectId")
.HasName("ix_program_subject_subject_id");
b.ToTable("program_subject");
});
modelBuilder.Entity("InternshipSystem.Core.Approval", b =>
{
b.HasOne("InternshipSystem.Core.Internship", null)
.WithMany("Approvals")
.HasForeignKey("InternshipId")
.HasConstraintName("fk_approval_internship_internship_id");
});
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
{
b.HasOne("InternshipSystem.Core.Company", null)
.WithMany("Branches")
.HasForeignKey("CompanyId")
.HasConstraintName("fk_branch_office_companies_company_id");
b.OwnsOne("InternshipSystem.Core.BranchAddress", "Address", b1 =>
{
b1.Property<long>("BranchOfficeId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.Property<string>("Building")
.HasColumnName("building")
.HasColumnType("text");
b1.Property<string>("City")
.HasColumnName("city")
.HasColumnType("text");
b1.Property<string>("Country")
.HasColumnName("country")
.HasColumnType("text");
b1.Property<string>("PostalCode")
.HasColumnName("postal_code")
.HasColumnType("text");
b1.Property<string>("Street")
.HasColumnName("street")
.HasColumnType("text");
b1.HasKey("BranchOfficeId")
.HasName("pk_branch_office");
b1.ToTable("branch_office");
b1.WithOwner()
.HasForeignKey("BranchOfficeId")
.HasConstraintName("fk_branch_address_branch_office_branch_office_id");
});
});
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
{
b.OwnsOne("InternshipSystem.Core.Nip", "Nip", b1 =>
{
b1.Property<long>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.HasKey("CompanyId")
.HasName("pk_companies");
b1.ToTable("companies");
b1.WithOwner()
.HasForeignKey("CompanyId")
.HasConstraintName("fk_nip_companies_company_id");
});
});
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
{
b.HasOne("InternshipSystem.Core.Internship", null)
.WithMany("Documents")
.HasForeignKey("InternshipId")
.HasConstraintName("fk_document_internship_internship_id");
});
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
{
b.HasOne("InternshipSystem.Core.Course", "Course")
.WithMany()
.HasForeignKey("CourseId")
.HasConstraintName("fk_editions_course_course_id");
});
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
{
b.HasOne("InternshipSystem.Core.Edition", null)
.WithMany("Internships")
.HasForeignKey("EditionId")
.HasConstraintName("fk_internship_editions_edition_id");
b.HasOne("InternshipSystem.Core.InternshipProgram", "InternshipProgram")
.WithMany()
.HasForeignKey("InternshipProgramId")
.HasConstraintName("fk_internship_internship_program_internship_program_id");
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
.WithMany()
.HasForeignKey("InternshipRegistrationId")
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
b.HasOne("InternshipSystem.Core.Report", "Report")
.WithMany()
.HasForeignKey("ReportId")
.HasConstraintName("fk_internship_report_report_id");
b.HasOne("InternshipSystem.Core.Student", "Student")
.WithMany()
.HasForeignKey("StudentId")
.HasConstraintName("fk_internship_student_student_id");
});
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
{
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
{
b1.Property<long>("InternshipProgramId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.Property<string>("Email")
.HasColumnName("email")
.HasColumnType("text");
b1.Property<string>("FirstName")
.HasColumnName("first_name")
.HasColumnType("text");
b1.Property<string>("LastName")
.HasColumnName("last_name")
.HasColumnType("text");
b1.HasKey("InternshipProgramId")
.HasName("pk_internship_program");
b1.ToTable("internship_program");
b1.WithOwner()
.HasForeignKey("InternshipProgramId")
.HasConstraintName("fk_mentor_internship_program_internship_program_id");
b1.OwnsOne("InternshipSystem.Core.PhoneNumber", "PhoneNumber", b2 =>
{
b2.Property<long>("MentorInternshipProgramId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b2.HasKey("MentorInternshipProgramId")
.HasName("pk_internship_program");
b2.ToTable("internship_program");
b2.WithOwner()
.HasForeignKey("MentorInternshipProgramId")
.HasConstraintName("fk_phone_number_internship_program_mentor_internship_program_id");
});
});
});
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
{
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
.WithMany()
.HasForeignKey("BranchAddressId")
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
b.HasOne("InternshipSystem.Core.Company", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.HasConstraintName("fk_internship_registration_companies_company_id");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.HasConstraintName("fk_internship_registration_internship_type_type_id");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
{
b.HasOne("InternshipSystem.Core.Edition", null)
.WithMany("AvailableSubjects")
.HasForeignKey("EditionId")
.HasConstraintName("fk_edition_subject_editions_edition_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId1")
.HasConstraintName("fk_edition_subject_editions_edition_id1");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", null)
.WithMany()
.HasForeignKey("InternshipSubjectId")
.HasConstraintName("fk_edition_subject_internship_subject_internship_subject_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
.WithMany()
.HasForeignKey("SubjectId")
.HasConstraintName("fk_edition_subject_internship_subject_subject_id");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
{
b.HasOne("InternshipSystem.Core.InternshipProgram", null)
.WithMany("ChosenSubjects")
.HasForeignKey("InternshipProgramId")
.HasConstraintName("fk_program_subject_internship_program_internship_program_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", null)
.WithMany()
.HasForeignKey("InternshipSubjectId")
.HasConstraintName("fk_program_subject_internship_subject_internship_subject_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("InternshipSystem.Core.InternshipProgram", "Program")
.WithMany()
.HasForeignKey("ProgramId")
.HasConstraintName("fk_program_subject_internship_program_program_id");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
.WithMany()
.HasForeignKey("SubjectId")
.HasConstraintName("fk_program_subject_internship_subject_subject_id");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,14 +0,0 @@
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class BranchOfficeReadModel
{
public long Id { get; set; }
public string Street { get; set; }
public string Building { get; set; }
public string City { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class CompanyReadModel
{
public long Id { get; set; }
public string Nip { get; set; }
public string Name { get; set; }
public Uri SiteAddress { get; set; }
public RangeOfActivity Range { get; set; }
public List<BranchOfficeReadModel> Branches { get; set; }
}
}

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class EditionReadModel
{
public long Id { get; set; }
public DateTime EditionStart { get; set; }
public DateTime EditionFinish { get; set; }
public DateTime ReportingStart { get; set; }
public Course Course { get; set; }
public ImmutableList<EditionSubject> AvailableSubjects { get; set; }
}
}

View File

@ -1,8 +0,0 @@
namespace InternshipSystem.Repository
{
public class EditionSubject
{
public long EditionId { get; set; }
public long InternshipId { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System.Collections.Generic;
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class InternshipProgramReadModel
{
public long Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public List<ProgramSubject> ChosenSubjects { get; set; }
public DocumentState State { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System.Collections.Generic;
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class InternshipReadModel
{
public long Id { get; set; }
public Student Student { get; set; }
public InternshipRegistrationReadModel InternshipRegistration { get; set; }
public InternshipProgramReadModel InternshipProgram { get; set; }
public Report Report { get; set; }
public List<Approval> Approvals { get; set; }
public List<Document> Documents { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System;
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class InternshipRegistrationReadModel
{
public long Id { get; set; }
public CompanyReadModel Company { get; set; }
public BranchOfficeReadModel BranchAddress { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public InternshipTypeReadModel Type { get; set; }
public DocumentState State { get; set; }
}
}

View File

@ -1,12 +0,0 @@
using System;
using InternshipSystem.Core;
namespace InternshipSystem.Repository.Model
{
public class InternshipSubjectReadModel
{
public long Id { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,8 +0,0 @@
namespace InternshipSystem.Repository.Model
{
public class ProgramSubject
{
public long InternshipProgramId { get; set; }
public long InternshipSubjectId { get; set; }
}
}