Merge pull request 'InternshipRegistration - EndPoint implementation' (#34) from InternshipRegistration into master
This commit is contained in:
commit
d81ebc98fb
@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using AutoMapper;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Result;
|
||||
using InternshipSystem.Core;
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using InternshipSystem.Api.Queries;
|
||||
@ -42,24 +43,24 @@ namespace InternshipSystem.Api.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult> AddDocumentToInternship([FromBody] DocumentPublishRequest documentRequest, User user)
|
||||
public async Task<ActionResult> AddDocumentToInternship([FromBody] DocumentPublishRequest documentRequest, CancellationToken cancellationToken)
|
||||
{
|
||||
var validator = new DocumentPublishRequest.Validator();
|
||||
var validationResult = await validator.ValidateAsync(documentRequest);
|
||||
var validationResult = await validator.ValidateAsync(documentRequest, cancellationToken);
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
return BadRequest(validationResult.ToString());
|
||||
}
|
||||
|
||||
var edition =
|
||||
await Context.Editions
|
||||
.FindAsync(user.EditionId.Value);
|
||||
var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
|
||||
|
||||
var edition = await Context.Editions.FindAsync(personNumber);
|
||||
|
||||
var internship = await Context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.SingleAsync(i => i.Student.Id == user.PersonNumber);
|
||||
.SingleAsync(i => i.Student.Id == personNumber, cancellationToken);
|
||||
|
||||
var document = Mapper.Map<Document>(documentRequest);
|
||||
|
||||
|
@ -8,7 +8,6 @@ using AutoMapper.QueryableExtensions;
|
||||
using IdentityServer4.Extensions;
|
||||
using InternshipSystem.Api.Result;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@ -41,7 +40,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
[Authorize]
|
||||
public async Task<ActionResult<IList<EditionResult>>> GetAvailableEditions(CancellationToken token)
|
||||
{
|
||||
var personNumber = long.Parse(User.FindFirst("PersonNumber").Value);
|
||||
var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
|
||||
|
||||
var editions =
|
||||
await Context.Editions
|
||||
@ -69,11 +68,9 @@ namespace InternshipSystem.Api.Controllers
|
||||
[HttpGet("{id}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = "RegisteredForEditionOnly")]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult<EditionConfigurationResult>> GetEditionsConfiguration(Guid id, CancellationToken token)
|
||||
{
|
||||
var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
|
||||
|
||||
var edition =
|
||||
await Context.Editions
|
||||
.Include(e => e.AvailableSubjects)
|
||||
@ -88,6 +85,5 @@ namespace InternshipSystem.Api.Controllers
|
||||
|
||||
return Ok(edition);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,10 +1,16 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
@ -12,10 +18,12 @@ namespace InternshipSystem.Api.Controllers
|
||||
public class InternshipRegistrationController : ControllerBase
|
||||
{
|
||||
private InternshipDbContext Context { get; }
|
||||
private IMapper Mapper { get; }
|
||||
|
||||
public InternshipRegistrationController(InternshipDbContext context)
|
||||
public InternshipRegistrationController(InternshipDbContext context, IMapper mapper)
|
||||
{
|
||||
Context = context;
|
||||
Mapper = mapper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -29,7 +37,73 @@ namespace InternshipSystem.Api.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<ActionResult> SubmitRegistrationForm([FromBody] RegistrationFormQuery registrationQuery, CancellationToken cancellationToken) =>
|
||||
throw new NotImplementedException();
|
||||
[Authorize]
|
||||
public async Task<ActionResult> SubmitRegistrationForm([FromBody] RegistrationFormQuery registrationQuery,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var validator = new RegistrationFormQuery.Validator();
|
||||
var validationResult = await validator.ValidateAsync(registrationQuery, cancellationToken);
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
return BadRequest(validationResult.ToString());
|
||||
}
|
||||
|
||||
var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
|
||||
|
||||
var edition = await Context.Editions.FindAsync(personNumber);
|
||||
|
||||
var internship = await Context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.SingleAsync(i => i.Student.Id == personNumber, cancellationToken);
|
||||
|
||||
var internshipRegistration = internship.InternshipRegistration;
|
||||
|
||||
if (registrationQuery.Company != null)
|
||||
{
|
||||
var company = registrationQuery.Company.Id.HasValue
|
||||
? await Context.Companies.SingleAsync(c => c.Id == registrationQuery.Company.Id,
|
||||
cancellationToken: cancellationToken)
|
||||
: Company.CreateCompany(registrationQuery.Company.Nip, registrationQuery.Company.Name);
|
||||
|
||||
internshipRegistration.UpdateCompany(company);
|
||||
}
|
||||
|
||||
var officeForm = registrationQuery.BranchOffice;
|
||||
if (officeForm != null)
|
||||
{
|
||||
BranchOffice branch;
|
||||
|
||||
if (officeForm.Id.HasValue)
|
||||
{
|
||||
branch = await Context.Entry(internshipRegistration.Company)
|
||||
.Collection(c => c.Branches)
|
||||
.Query()
|
||||
.SingleAsync(o => o.Id == officeForm.Id, cancellationToken: cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
branch = BranchOffice.CreateBranch(officeForm.Country, officeForm.City, officeForm.PostalCode,
|
||||
officeForm.Street, officeForm.Building);
|
||||
internshipRegistration.Company.AddBranchOffice(branch);
|
||||
}
|
||||
|
||||
internshipRegistration.UpdateBranch(branch);
|
||||
}
|
||||
|
||||
internshipRegistration.Start = registrationQuery.Start ?? internshipRegistration.Start;
|
||||
internshipRegistration.End = registrationQuery.End ?? internshipRegistration.End;
|
||||
|
||||
if (registrationQuery.Type.HasValue && edition.IsInternshipTypeAllowed(registrationQuery.Type.Value))
|
||||
{
|
||||
return BadRequest("Edition doesn't have this type of employment in available employments type");
|
||||
}
|
||||
|
||||
internshipRegistration.Type = registrationQuery.Type ?? internshipRegistration.Type;
|
||||
|
||||
await Context.SaveChangesAsync(cancellationToken);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
@ -35,19 +35,21 @@ namespace InternshipSystem.Api.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> RegisterStudentForEdition([FromBody] Guid registrationCode, User user, CancellationToken token)
|
||||
public async Task<IActionResult> RegisterStudentForEdition([FromBody] Guid registrationCode, CancellationToken token)
|
||||
{
|
||||
var edition = await _context.Editions.FindAsync(registrationCode);
|
||||
var edition = await _context.Editions.FindAsync(registrationCode, token);
|
||||
|
||||
if (edition == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var student = await _context.Students.FindAsync(user.PersonNumber);
|
||||
|
||||
var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
|
||||
|
||||
var student = await _context.Students.FindAsync(personNumber, token);
|
||||
|
||||
edition.RegisterInternship(student);
|
||||
await _context.SaveChangesAsync();
|
||||
await _context.SaveChangesAsync(token);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
36
src/InternshipSystem.Api/Queries/BranchOfficeForm.cs
Normal file
36
src/InternshipSystem.Api/Queries/BranchOfficeForm.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace InternshipSystem.Api.Queries
|
||||
{
|
||||
public class BranchOfficeForm
|
||||
{
|
||||
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; }
|
||||
|
||||
public class Validator : AbstractValidator<BranchOfficeForm>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(b => b.Id).NotNull()
|
||||
.When(c =>
|
||||
!string.IsNullOrEmpty(c.Country) || !string.IsNullOrEmpty(c.City) ||
|
||||
!string.IsNullOrEmpty(c.PostalCode) || !string.IsNullOrEmpty(c.Street) ||
|
||||
!string.IsNullOrEmpty(c.Building));
|
||||
RuleFor(b => b.Country).NotNull()
|
||||
.When(b => !b.Id.HasValue);
|
||||
RuleFor(b => b.City).NotNull()
|
||||
.When(b => !b.Id.HasValue);
|
||||
RuleFor(b => b.PostalCode).NotNull()
|
||||
.When(b => !b.Id.HasValue);
|
||||
RuleFor(b => b.Street).NotNull()
|
||||
.When(b => !b.Id.HasValue);
|
||||
RuleFor(b => b.Building).NotNull()
|
||||
.When(b => !b.Id.HasValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
src/InternshipSystem.Api/Queries/CompanyForm.cs
Normal file
24
src/InternshipSystem.Api/Queries/CompanyForm.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace InternshipSystem.Api.Queries
|
||||
{
|
||||
public class CompanyForm
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string Nip { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public class Validator : AbstractValidator<CompanyForm>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(c => c.Id).NotNull()
|
||||
.When(c => !string.IsNullOrEmpty(c.Nip) || !string.IsNullOrEmpty(c.Name));
|
||||
RuleFor(c => c.Nip).NotEmpty()
|
||||
.When(c => !c.Id.HasValue);
|
||||
RuleFor(c => c.Name).NotEmpty()
|
||||
.When(c => !c.Id.HasValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,28 @@
|
||||
using System;
|
||||
using InternshipSystem.Core;
|
||||
using FluentValidation;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
|
||||
namespace InternshipSystem.Api.Queries
|
||||
{
|
||||
public class RegistrationFormQuery
|
||||
{
|
||||
public Company Company { get; set; }
|
||||
public BranchOffice BranchAddress { get; set; }
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public InternshipType Type { get; set; }
|
||||
public CompanyForm Company { get; set; }
|
||||
public BranchOfficeForm BranchOffice { get; set; }
|
||||
public DateTime? Start { get; set; }
|
||||
public DateTime? End { get; set; }
|
||||
public InternshipType? Type { get; set; }
|
||||
|
||||
public class Validator : AbstractValidator<RegistrationFormQuery>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(rfq => rfq.Company)
|
||||
.SetValidator(new CompanyForm.Validator());
|
||||
RuleFor(rfq => rfq.BranchOffice)
|
||||
.SetValidator(new BranchOfficeForm.Validator());
|
||||
RuleFor(rfq => rfq.BranchOffice).NotNull()
|
||||
.When(rfq => rfq.Company != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ namespace InternshipSystem.Api.Security
|
||||
{
|
||||
public long PersonNumber { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public Guid? EditionId { get; set; }
|
||||
}
|
||||
}
|
@ -2,8 +2,30 @@
|
||||
{
|
||||
public class BranchOffice
|
||||
{
|
||||
public BranchOffice()
|
||||
{
|
||||
}
|
||||
private BranchOffice(BranchAddress address)
|
||||
{
|
||||
Address = address;
|
||||
}
|
||||
|
||||
public long Id { get; set; }
|
||||
|
||||
public BranchAddress Address { get; set; }
|
||||
|
||||
public static BranchOffice CreateBranch(string country, string city, string postalCode, string street, string building)
|
||||
{
|
||||
var address = new BranchAddress
|
||||
{
|
||||
Building = building,
|
||||
City = city,
|
||||
Country = country,
|
||||
Street = street,
|
||||
PostalCode = postalCode
|
||||
};
|
||||
|
||||
return new BranchOffice(address);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,22 +8,22 @@ namespace InternshipSystem.Core
|
||||
public long Id { get; set; }
|
||||
public Nip Nip { get; set; }
|
||||
public string Name { get; set; }
|
||||
public RangeOfActivity Range { get; set; }
|
||||
public List<BranchOffice> Branches { get; set; }
|
||||
public Uri SiteAddress { get; set; }
|
||||
|
||||
public Company CreateCompany(string nip, RangeOfActivity range, string name)
|
||||
{
|
||||
return new Company
|
||||
public static Company CreateCompany(string nip, string name) =>
|
||||
new Company
|
||||
{
|
||||
Nip = nip,
|
||||
Range = range,
|
||||
Name = name
|
||||
};
|
||||
}
|
||||
|
||||
public void AddBranchAddress(BranchAddress branch)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddBranchOffice(BranchOffice createBranch)
|
||||
{
|
||||
Branches.Add(createBranch);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ namespace InternshipSystem.Core
|
||||
public Course Course { get; set; }
|
||||
public List<Internship> Internships { get; set; }
|
||||
public List<EditionSubject> AvailableSubjects { get; set; }
|
||||
public List<InternshipType> AvailableInternshipTypes { get; set; }
|
||||
|
||||
public bool IsOpen => EditionFinish < DateTime.Today;
|
||||
|
||||
@ -27,6 +28,11 @@ namespace InternshipSystem.Core
|
||||
};
|
||||
}
|
||||
|
||||
public bool IsInternshipTypeAllowed(InternshipType registrationQueryType)
|
||||
{
|
||||
return AvailableInternshipTypes.Contains(registrationQueryType);
|
||||
}
|
||||
|
||||
public void RegisterInternship(Student student)
|
||||
{
|
||||
var internship = Internship.CreateStudentsInternship(student);
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using InternshipSystem.Core.ValueObject;
|
||||
|
||||
namespace InternshipSystem.Core
|
||||
{
|
||||
@ -15,12 +14,14 @@ namespace InternshipSystem.Core
|
||||
public List<Document> Documentation { get; set; }
|
||||
public float? Grade { get; set; }
|
||||
|
||||
public Edition Edition { get; set; }
|
||||
|
||||
public void UpdateDocument(Document document)
|
||||
{
|
||||
var oldDocument = Documentation.First(d => d.Id == document.Id);
|
||||
|
||||
oldDocument.Description = document.Description;
|
||||
oldDocument.Scan = document.Scan;
|
||||
oldDocument.Description = document.Description ?? oldDocument.Description;
|
||||
oldDocument.Scan = document.Scan ?? oldDocument.Scan;
|
||||
oldDocument.Type = document.Type;
|
||||
oldDocument.State = DocumentState.Submitted;
|
||||
}
|
||||
|
@ -12,10 +12,20 @@ namespace InternshipSystem.Core
|
||||
public DateTime End { get; set; }
|
||||
public InternshipType Type { get; set; }
|
||||
public DocumentState State { get; set; }
|
||||
|
||||
|
||||
public static InternshipRegistration Create()
|
||||
{
|
||||
return new InternshipRegistration();
|
||||
}
|
||||
|
||||
public void UpdateCompany(Company newCompany)
|
||||
{
|
||||
Company = newCompany;
|
||||
}
|
||||
|
||||
public void UpdateBranch(BranchOffice branch)
|
||||
{
|
||||
BranchAddress = branch;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
namespace InternshipSystem.Core.Entity.Internship
|
||||
{
|
||||
public class InternshipType
|
||||
public enum InternshipType
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Description { get; set; }
|
||||
FreeInternship,
|
||||
GraduateInternship,
|
||||
FreeApprenticeship,
|
||||
PaidApprenticeship,
|
||||
ForeignInternship,
|
||||
UOP,
|
||||
UD,
|
||||
UZ
|
||||
}
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
namespace InternshipSystem.Core
|
||||
using System;
|
||||
|
||||
namespace InternshipSystem.Core
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DocumentState State { get; set; }
|
||||
public RangeOfActivity Range { get; set; }
|
||||
public Uri SiteAddress { get; set; }
|
||||
|
||||
public static Report Create()
|
||||
{
|
||||
|
@ -26,9 +26,8 @@ namespace InternshipSystem.Repository
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Intel",
|
||||
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",
|
||||
Range = RangeOfActivity.International,
|
||||
Branches = new List<BranchOffice>
|
||||
{
|
||||
new BranchOffice
|
||||
@ -70,9 +69,8 @@ namespace InternshipSystem.Repository
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Asseco Poland",
|
||||
SiteAddress = new Uri("http://pl.asseco.com"),
|
||||
// SiteAddress = new Uri("http://pl.asseco.com"),
|
||||
Nip = "5842068320",
|
||||
Range = RangeOfActivity.National,
|
||||
Branches = new List<BranchOffice>
|
||||
{
|
||||
new BranchOffice
|
||||
@ -141,6 +139,13 @@ namespace InternshipSystem.Repository
|
||||
{
|
||||
Name = "Informatyka",
|
||||
},
|
||||
AvailableInternshipTypes = new List<InternshipType>
|
||||
{
|
||||
InternshipType.UOP,
|
||||
InternshipType.UZ,
|
||||
InternshipType.UD,
|
||||
InternshipType.FreeInternship
|
||||
},
|
||||
Internships = new List<Internship>(),
|
||||
}
|
||||
};
|
||||
@ -162,10 +167,7 @@ namespace InternshipSystem.Repository
|
||||
InternshipRegistration = new InternshipRegistration
|
||||
{
|
||||
Company = Context.Companies.First(c => c.Id.Equals(1)), //Intel
|
||||
Type = new InternshipType
|
||||
{
|
||||
Type = "UOP"
|
||||
},
|
||||
Type = InternshipType.UOP,
|
||||
Start = new DateTime(2000, 7, 1),
|
||||
End = new DateTime(2000, 8, 30),
|
||||
State = DocumentState.Submitted,
|
||||
@ -215,10 +217,7 @@ namespace InternshipSystem.Repository
|
||||
InternshipRegistration = new InternshipRegistration
|
||||
{
|
||||
Company = Context.Companies.First(c => c.Id.Equals(2)), //Asseco
|
||||
Type = new InternshipType
|
||||
{
|
||||
Type = "UZ"
|
||||
},
|
||||
Type = InternshipType.UZ,
|
||||
Start = new DateTime(2000, 7, 1),
|
||||
End = new DateTime(2000, 8, 30),
|
||||
State = DocumentState.Submitted,
|
||||
|
@ -1,609 +0,0 @@
|
||||
// <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("20200828182238_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.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<string>("Nip")
|
||||
.IsRequired()
|
||||
.HasColumnName("nip")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Range")
|
||||
.HasColumnName("range")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SiteAddress")
|
||||
.HasColumnName("site_address")
|
||||
.HasColumnType("text");
|
||||
|
||||
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<long?>("InternshipId1")
|
||||
.HasColumnName("internship_id1")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("RejectionReason")
|
||||
.HasColumnName("rejection_reason")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<byte[]>("Scan")
|
||||
.HasColumnName("scan")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnName("type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_document");
|
||||
|
||||
b.HasIndex("InternshipId")
|
||||
.HasName("ix_document_internship_id");
|
||||
|
||||
b.HasIndex("InternshipId1")
|
||||
.HasName("ix_document_internship_id1");
|
||||
|
||||
b.ToTable("document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
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<Guid?>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<float>("Grade")
|
||||
.HasColumnName("grade")
|
||||
.HasColumnType("real");
|
||||
|
||||
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<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("InternshipSubjectId")
|
||||
.HasColumnName("internship_subject_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "InternshipSubjectId")
|
||||
.HasName("pk_edition_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_edition_subject_internship_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.HasKey("InternshipProgramId", "InternshipSubjectId")
|
||||
.HasName("pk_program_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_program_subject_internship_subject_id");
|
||||
|
||||
b.ToTable("program_subject");
|
||||
});
|
||||
|
||||
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.Document", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
||||
.WithMany("Approvals")
|
||||
.HasForeignKey("InternshipId")
|
||||
.HasConstraintName("fk_document_internship_internship_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
||||
.WithMany("Documentation")
|
||||
.HasForeignKey("InternshipId1")
|
||||
.HasConstraintName("fk_document_internship_internship_id1");
|
||||
});
|
||||
|
||||
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.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnName("mentor_phone_number")
|
||||
.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");
|
||||
});
|
||||
});
|
||||
|
||||
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", "Edition")
|
||||
.WithMany("AvailableSubjects")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_edition_subject_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_edition_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.InternshipProgram", "Program")
|
||||
.WithMany("ChosenSubjects")
|
||||
.HasForeignKey("InternshipProgramId")
|
||||
.HasConstraintName("fk_program_subject_internship_program_internship_program_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_program_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,438 +0,0 @@
|
||||
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),
|
||||
nip = table.Column<string>(nullable: false),
|
||||
name = table.Column<string>(nullable: true),
|
||||
range = table.Column<int>(nullable: false),
|
||||
site_address = table.Column<string>(nullable: true)
|
||||
},
|
||||
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),
|
||||
mentor_phone_number = 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<Guid>(nullable: false),
|
||||
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)
|
||||
},
|
||||
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);
|
||||
});
|
||||
|
||||
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<Guid>(nullable: false),
|
||||
internship_subject_id = table.Column<long>(nullable: false)
|
||||
},
|
||||
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_internship_subject_internship_subject_id",
|
||||
column: x => x.internship_subject_id,
|
||||
principalTable: "internship_subject",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
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),
|
||||
grade = table.Column<float>(nullable: false),
|
||||
edition_id = table.Column<Guid>(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: "document",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
description = table.Column<string>(nullable: true),
|
||||
scan = table.Column<byte[]>(nullable: true),
|
||||
type = table.Column<int>(nullable: false),
|
||||
state = table.Column<int>(nullable: false),
|
||||
rejection_reason = table.Column<string>(nullable: true),
|
||||
internship_id = table.Column<long>(nullable: true),
|
||||
internship_id1 = 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);
|
||||
table.ForeignKey(
|
||||
name: "fk_document_internship_internship_id1",
|
||||
column: x => x.internship_id1,
|
||||
principalTable: "internship",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
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_document_internship_id1",
|
||||
table: "document",
|
||||
column: "internship_id1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_edition_subject_internship_subject_id",
|
||||
table: "edition_subject",
|
||||
column: "internship_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");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,607 +0,0 @@
|
||||
// <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.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<string>("Nip")
|
||||
.IsRequired()
|
||||
.HasColumnName("nip")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Range")
|
||||
.HasColumnName("range")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SiteAddress")
|
||||
.HasColumnName("site_address")
|
||||
.HasColumnType("text");
|
||||
|
||||
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<long?>("InternshipId1")
|
||||
.HasColumnName("internship_id1")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("RejectionReason")
|
||||
.HasColumnName("rejection_reason")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<byte[]>("Scan")
|
||||
.HasColumnName("scan")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnName("type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_document");
|
||||
|
||||
b.HasIndex("InternshipId")
|
||||
.HasName("ix_document_internship_id");
|
||||
|
||||
b.HasIndex("InternshipId1")
|
||||
.HasName("ix_document_internship_id1");
|
||||
|
||||
b.ToTable("document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
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<Guid?>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<float>("Grade")
|
||||
.HasColumnName("grade")
|
||||
.HasColumnType("real");
|
||||
|
||||
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<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("InternshipSubjectId")
|
||||
.HasColumnName("internship_subject_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "InternshipSubjectId")
|
||||
.HasName("pk_edition_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_edition_subject_internship_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.HasKey("InternshipProgramId", "InternshipSubjectId")
|
||||
.HasName("pk_program_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_program_subject_internship_subject_id");
|
||||
|
||||
b.ToTable("program_subject");
|
||||
});
|
||||
|
||||
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.Document", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
||||
.WithMany("Approvals")
|
||||
.HasForeignKey("InternshipId")
|
||||
.HasConstraintName("fk_document_internship_internship_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
||||
.WithMany("Documentation")
|
||||
.HasForeignKey("InternshipId1")
|
||||
.HasConstraintName("fk_document_internship_internship_id1");
|
||||
});
|
||||
|
||||
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.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnName("mentor_phone_number")
|
||||
.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");
|
||||
});
|
||||
});
|
||||
|
||||
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", "Edition")
|
||||
.WithMany("AvailableSubjects")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_edition_subject_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_edition_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.InternshipProgram", "Program")
|
||||
.WithMany("ChosenSubjects")
|
||||
.HasForeignKey("InternshipProgramId")
|
||||
.HasConstraintName("fk_program_subject_internship_program_internship_program_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_program_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user