Separate Mentor and first full version of DatabaseFiller
This commit is contained in:
parent
9e9b12cdd6
commit
3e70d40ec8
@ -15,6 +15,17 @@ namespace Internship.Api.Controller
|
|||||||
|
|
||||||
public DatabaseFiller FillerService { get; }
|
public DatabaseFiller FillerService { get; }
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost("fill")]
|
||||||
|
public async Task<IActionResult> Fill() {
|
||||||
|
await FillerService.FillCompany();
|
||||||
|
await FillerService.FillInterns();
|
||||||
|
await FillerService.FillInternshipTypes();
|
||||||
|
await FillerService.FillEditions();
|
||||||
|
await FillerService.FillInternShips();
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost("fill/companies")]
|
[HttpPost("fill/companies")]
|
||||||
public async Task<IActionResult> FillCompaniesAsync()
|
public async Task<IActionResult> FillCompaniesAsync()
|
||||||
{
|
{
|
||||||
@ -32,19 +43,18 @@ namespace Internship.Api.Controller
|
|||||||
public async Task<IActionResult> FillInternshipTypesAsync() {
|
public async Task<IActionResult> FillInternshipTypesAsync() {
|
||||||
await FillerService.FillInternshipTypes();
|
await FillerService.FillInternshipTypes();
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
[HttpPost("fill/editions")]
|
||||||
// [HttpPost("fill/editions")]
|
public async Task<IActionResult> FillEditionsAsync() {
|
||||||
// public async Task<IActionResult> FillEditionsAsync() {
|
await FillerService.FillEditions();
|
||||||
// await FillerService.FillEditions();
|
return Ok();
|
||||||
// return Ok();
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
[HttpPost("fill/internships")]
|
[HttpPost("fill/internships")]
|
||||||
public async Task<IActionResult> FillInternShipsAsync() {
|
public async Task<IActionResult> FillInternShipsAsync() {
|
||||||
await FillerService.FillInternShips();
|
await FillerService.FillInternShips();
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,9 +4,9 @@ namespace InternshipSystem.Core
|
|||||||
{
|
{
|
||||||
public class DeanAcceptance
|
public class DeanAcceptance
|
||||||
{
|
{
|
||||||
public DateTime AcceptanceDate { get; set; }
|
public DateTime? AcceptanceDate { get; set; }
|
||||||
public bool IsDeansAcceptanceRequired { get; set; }
|
public bool IsDeansAcceptanceRequired { get; set; }
|
||||||
public DeanAcceptanceReason Reason { get; set; }
|
public DeanAcceptanceReason? Reason { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DeanAcceptanceReason
|
public enum DeanAcceptanceReason
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
namespace InternshipSystem.Core
|
namespace InternshipSystem.Core
|
||||||
{
|
{
|
||||||
public class Mentor {
|
public class Mentor {
|
||||||
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Surname { get; set; }
|
public string Surname { get; set; }
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
@ -25,11 +25,11 @@ namespace InternshipSystem.Repository
|
|||||||
SiteAddress = new Uri("https://www.intel.com/content/www/us/en/jobs/locations/poland.html"),
|
SiteAddress = new Uri("https://www.intel.com/content/www/us/en/jobs/locations/poland.html"),
|
||||||
Nip = "9570752316",
|
Nip = "9570752316",
|
||||||
Range = RangeOfActivities.International,
|
Range = RangeOfActivities.International,
|
||||||
Branches = new List<BranchOffice>()
|
Branches = new List<BranchOffice>
|
||||||
{
|
{
|
||||||
new BranchOffice()
|
new BranchOffice
|
||||||
{
|
{
|
||||||
Address = new Address()
|
Address = new Address
|
||||||
{
|
{
|
||||||
City = "Gdańsk",
|
City = "Gdańsk",
|
||||||
Street = "ul. Słowackiego",
|
Street = "ul. Słowackiego",
|
||||||
@ -38,9 +38,9 @@ namespace InternshipSystem.Repository
|
|||||||
Country = "Poland"
|
Country = "Poland"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new BranchOffice()
|
new BranchOffice
|
||||||
{
|
{
|
||||||
Address = new Address()
|
Address = new Address
|
||||||
{
|
{
|
||||||
City = "Gdańsk",
|
City = "Gdańsk",
|
||||||
Street = "Jana z Kolna",
|
Street = "Jana z Kolna",
|
||||||
@ -49,9 +49,9 @@ namespace InternshipSystem.Repository
|
|||||||
Country = "Poland"
|
Country = "Poland"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new BranchOffice()
|
new BranchOffice
|
||||||
{
|
{
|
||||||
Address = new Address()
|
Address = new Address
|
||||||
{
|
{
|
||||||
City = "Boston",
|
City = "Boston",
|
||||||
Street = "State St",
|
Street = "State St",
|
||||||
@ -108,10 +108,30 @@ namespace InternshipSystem.Repository
|
|||||||
Surname = "Kowalski",
|
Surname = "Kowalski",
|
||||||
AlbumNumber = "123456",
|
AlbumNumber = "123456",
|
||||||
Email = "s123456@student.pg.edu.pl",
|
Email = "s123456@student.pg.edu.pl",
|
||||||
|
Semester = 4,
|
||||||
Course = new Course
|
Course = new Course
|
||||||
{
|
{
|
||||||
Name = "Informatyka",
|
Name = "Informatyka",
|
||||||
DesiredSemesters = new List<int> { 4, 6 }
|
DesiredSemesters = new List<int> { 4, 6 },
|
||||||
|
ProgramEntries = new List<InternshipProgramEntry>
|
||||||
|
{
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Instalacja, konfiguracja i administracja niewielkich sieci komputerowych, w tym bezprzewodowych."
|
||||||
|
},
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Implementacja polityki bezpieczeństwa informacji w firmie lub instytucji, instalacja ochrony antywirusowej, konfiguracja zapór ogniowych."
|
||||||
|
},
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Instalacja, konfiguracja i administracja oprogramowania, w szczególnościsystemów operacyjnychiserwerów aplikacji."
|
||||||
|
},
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Projektowanie, implementacja i modyfikacjeoprogramowaniaw różnych technologiach i dla różnych zastosowań."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Intern {
|
new Intern {
|
||||||
@ -119,10 +139,30 @@ namespace InternshipSystem.Repository
|
|||||||
Surname = "Kołek",
|
Surname = "Kołek",
|
||||||
AlbumNumber = "102137",
|
AlbumNumber = "102137",
|
||||||
Email = "s102137@student.pg.edu.pl",
|
Email = "s102137@student.pg.edu.pl",
|
||||||
|
Semester = 6,
|
||||||
Course = new Course
|
Course = new Course
|
||||||
{
|
{
|
||||||
Name = "Robotyka",
|
Name = "Robotyka",
|
||||||
DesiredSemesters = new List<int> { 6 }
|
DesiredSemesters = new List<int> { 6 },
|
||||||
|
ProgramEntries = new List<InternshipProgramEntry>
|
||||||
|
{
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Testowanie oprogramowania, także z wykorzystaniem narzędzi do testowania automatycznego."
|
||||||
|
},
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Wykorzystanie otwartych komponentów programowych z uwzględnieniem prawnych zależności pomiędzy nimi a produktem wynikowym."
|
||||||
|
},
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Projektowanie i implementacja baz danych oraz badanie ich wydajności."
|
||||||
|
},
|
||||||
|
new InternshipProgramEntry
|
||||||
|
{
|
||||||
|
Description = "Projektowanie i prototypowaniezaawansowanychinterfejsów użytkownika."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -178,64 +218,45 @@ namespace InternshipSystem.Repository
|
|||||||
await Context.SaveChangesAsync();
|
await Context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rewrite later
|
public async Task FillEditions() {
|
||||||
// public async Task FillEditions() {
|
var editions = new List<Edition>
|
||||||
// var editions = new List<Edition>
|
{
|
||||||
// {
|
new Edition
|
||||||
// new Edition
|
{
|
||||||
// {
|
StartDate = new DateTime(2000, 5, 10),
|
||||||
// StartDate = new DateTime(2000, 5, 10),
|
EndDate = new DateTime(2000, 11, 10),
|
||||||
// EndDate = new DateTime(2000, 11, 10),
|
IPPDeadlineDate = new DateTime(2000, 9, 30),
|
||||||
// IPPDeadlineDate = new DateTime(2000, 9, 30),
|
Subjects = new List<InternshipProgramEntry>
|
||||||
// Subjects = new List<InternshipProgramSubject>
|
{
|
||||||
// {
|
Context.InternshipProgramEntries
|
||||||
// new InternshipProgramSubject
|
.Where(i => i.Description == "Instalacja, konfiguracja i administracja niewielkich sieci komputerowych, w tym bezprzewodowych.")
|
||||||
// {
|
.First(),
|
||||||
// Course = new Course
|
Context.InternshipProgramEntries
|
||||||
// {
|
.Where(i => i.Description == "Projektowanie, implementacja i modyfikacjeoprogramowaniaw różnych technologiach i dla różnych zastosowań.")
|
||||||
// Name = "Informatyka"
|
.First()
|
||||||
// }
|
}
|
||||||
// },
|
}
|
||||||
// new InternshipProgramSubject
|
};
|
||||||
// {
|
Context.Editions.AddRange(editions);
|
||||||
// Course = new Course
|
await Context.SaveChangesAsync();
|
||||||
// {
|
}
|
||||||
// Name = "Budowanie UI"
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// new InternshipProgramSubject
|
|
||||||
// {
|
|
||||||
// Course = new Course
|
|
||||||
// {
|
|
||||||
// Name = "Budowanie Back End"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// Context.Editions.AddRange(editions);
|
|
||||||
// await Context.SaveChangesAsync();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public async Task FillInternShips() {
|
public async Task FillInternShips() {
|
||||||
|
var edition = Context.Editions.First();
|
||||||
|
|
||||||
var intenrships = new List<Internship>
|
var intenrships = new List<Internship>
|
||||||
{
|
{
|
||||||
new Internship
|
new Internship
|
||||||
{
|
{
|
||||||
Intern = Context.Interns.Where(i => i.AlbumNumber == "123456").Single(),
|
Intern = Context.Interns.Where(i => i.AlbumNumber == "123456").First(),
|
||||||
Edition = null, //TODO: Context.Editions.Where(e => e.StartDate.Equals(new DateTime(2000, 5, 10))).Single(),
|
Edition = edition,
|
||||||
BranchOffice = new BranchOffice()
|
BranchOffice =
|
||||||
{
|
Context.Companies
|
||||||
Address = new Address()
|
.Where(c => c.Nip == "9570752316") //Intel
|
||||||
{
|
.First()
|
||||||
City = "Gdańsk",
|
.Branches
|
||||||
Street = "ul. Słowackiego",
|
.First(),
|
||||||
Building = "173",
|
Type = Context.InternshipTypes.Where(t => t.Type == "UOP").First(),
|
||||||
PostalCode = "80-298",
|
|
||||||
Country = "Poland"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Type = Context.InternshipTypes.Where(t => t.Type == "UOP").Single(),
|
|
||||||
StartDate = new DateTime(2000, 7, 1),
|
StartDate = new DateTime(2000, 7, 1),
|
||||||
EndDate = new DateTime(2000, 8, 30),
|
EndDate = new DateTime(2000, 8, 30),
|
||||||
IsAccepted = false,
|
IsAccepted = false,
|
||||||
@ -249,25 +270,49 @@ namespace InternshipSystem.Repository
|
|||||||
{
|
{
|
||||||
InsuranceDeliveryDate = new DateTime(2000, 6, 29),
|
InsuranceDeliveryDate = new DateTime(2000, 6, 29),
|
||||||
IsInsuranceRequired = true
|
IsInsuranceRequired = true
|
||||||
},
|
},
|
||||||
InternshipLengthInWeeks = 9,
|
LengthInWeeks = 9,
|
||||||
Grade = 0,
|
Grade = 0,
|
||||||
Program = new List<InternshipProgramSubject>
|
Program = new List<InternshipProgramEntry>
|
||||||
{
|
{
|
||||||
new InternshipProgramSubject
|
edition.Subjects.First()
|
||||||
{
|
},
|
||||||
Course = new Course
|
Mentor = new Mentor
|
||||||
{
|
{
|
||||||
Name = "Bazy Danych"
|
Name = "Horacy",
|
||||||
}
|
Surname = "Wościcki",
|
||||||
},
|
Email = "howos@intel.com",
|
||||||
new InternshipProgramSubject
|
Phone = "605-555-555"
|
||||||
{
|
}
|
||||||
Course = new Course
|
},
|
||||||
{
|
new Internship
|
||||||
Name = "Design UI"
|
{
|
||||||
}
|
Intern = Context.Interns.Where(i => i.AlbumNumber == "102137").First(),
|
||||||
}
|
Edition = edition,
|
||||||
|
BranchOffice =
|
||||||
|
Context.Companies
|
||||||
|
.Where(c => c.Nip == "5842068320") //Asseco
|
||||||
|
.First()
|
||||||
|
.Branches
|
||||||
|
.First(),
|
||||||
|
Type = Context.InternshipTypes.Where(t => t.Type == "UZ").First(),
|
||||||
|
StartDate = new DateTime(2000, 7, 1),
|
||||||
|
EndDate = new DateTime(2000, 8, 30),
|
||||||
|
IsAccepted = false,
|
||||||
|
DeanAcceptance = new DeanAcceptance
|
||||||
|
{
|
||||||
|
IsDeansAcceptanceRequired = false
|
||||||
|
},
|
||||||
|
Insurance = new Insurance
|
||||||
|
{
|
||||||
|
InsuranceDeliveryDate = new DateTime(2000, 6, 29),
|
||||||
|
IsInsuranceRequired = true
|
||||||
|
},
|
||||||
|
LengthInWeeks = 9,
|
||||||
|
Grade = 0,
|
||||||
|
Program = new List<InternshipProgramEntry>
|
||||||
|
{
|
||||||
|
edition.Subjects.First()
|
||||||
},
|
},
|
||||||
Mentor = new Mentor
|
Mentor = new Mentor
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@ namespace InternshipSystem.Repository
|
|||||||
public DbSet<Report> Reports { get; set; }
|
public DbSet<Report> Reports { get; set; }
|
||||||
public DbSet<Intern> Interns { get; set; }
|
public DbSet<Intern> Interns { get; set; }
|
||||||
public DbSet<InternshipType> InternshipTypes { get; set; }
|
public DbSet<InternshipType> InternshipTypes { get; set; }
|
||||||
|
public DbSet<Mentor> Mentors { get; set; }
|
||||||
|
public DbSet<InternshipProgramEntry> InternshipProgramEntries { get; set; }
|
||||||
public InternshipDbContext(DbContextOptions<InternshipDbContext> options)
|
public InternshipDbContext(DbContextOptions<InternshipDbContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
@ -25,7 +27,6 @@ namespace InternshipSystem.Repository
|
|||||||
.Entity<Internship>(ie => {
|
.Entity<Internship>(ie => {
|
||||||
ie.OwnsOne(i => i.DeanAcceptance);
|
ie.OwnsOne(i => i.DeanAcceptance);
|
||||||
ie.OwnsOne(i => i.Insurance);
|
ie.OwnsOne(i => i.Insurance);
|
||||||
ie.OwnsOne(i => i.Mentor);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder
|
modelBuilder
|
||||||
|
Loading…
Reference in New Issue
Block a user