diff --git a/src/InternshipSystem.Api/ApiProfile.cs b/src/InternshipSystem.Api/ApiProfile.cs
index 7bb6c8e..e28ca30 100644
--- a/src/InternshipSystem.Api/ApiProfile.cs
+++ b/src/InternshipSystem.Api/ApiProfile.cs
@@ -1,4 +1,5 @@
-using AutoMapper;
+using System;
+using AutoMapper;
using InternshipSystem.Api.Queries;
using InternshipSystem.Api.Result;
using InternshipSystem.Core;
diff --git a/src/InternshipSystem.Api/Controllers/AdminController.cs b/src/InternshipSystem.Api/Controllers/AdminController.cs
index 3fbb0ef..6a153f8 100644
--- a/src/InternshipSystem.Api/Controllers/AdminController.cs
+++ b/src/InternshipSystem.Api/Controllers/AdminController.cs
@@ -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
diff --git a/src/InternshipSystem.Api/Controllers/CompaniesController.cs b/src/InternshipSystem.Api/Controllers/CompaniesController.cs
index 430e81d..b23aaef 100644
--- a/src/InternshipSystem.Api/Controllers/CompaniesController.cs
+++ b/src/InternshipSystem.Api/Controllers/CompaniesController.cs
@@ -38,7 +38,7 @@ namespace InternshipSystem.Api.Controllers
.ToListAsync(cancellationToken);
///
- /// Get companies matching provided paginated query
+ /// Get company branches matching provided paginated query
///
/// Paginated query description
///
diff --git a/src/InternshipSystem.Api/Controllers/DocumentsController.cs b/src/InternshipSystem.Api/Controllers/DocumentsController.cs
index 9350e02..3406f9b 100644
--- a/src/InternshipSystem.Api/Controllers/DocumentsController.cs
+++ b/src/InternshipSystem.Api/Controllers/DocumentsController.cs
@@ -1,16 +1,11 @@
-using System;
-using System.Diagnostics;
-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 InternshipSystem.Api.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
namespace InternshipSystem.Api.Controllers
{
@@ -18,13 +13,11 @@ namespace InternshipSystem.Api.Controllers
[Route("document")]
public class DocumentsController : ControllerBase
{
- private InternshipDbContext Context { get; }
- private IMapper Mapper { get; }
+ private readonly IInternshipService _internshipService;
- public DocumentsController(InternshipDbContext context, IMapper mapper)
+ public DocumentsController(IInternshipService internshipService)
{
- Context = context;
- Mapper = mapper;
+ _internshipService = internshipService;
}
///
@@ -42,45 +35,19 @@ namespace InternshipSystem.Api.Controllers
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[Authorize(Policy = Policies.RegisteredOnly)]
- public async Task AddDocumentToInternship([FromBody] DocumentPublishRequest documentRequest, User user)
+ public async Task 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 internship = await Context.Entry(edition)
- .Collection(e => e.Internships)
- .Query()
- .SingleAsync(i => i.Student.Id == user.PersonNumber);
-
- var document = Mapper.Map(documentRequest);
-
- if (documentRequest.Id.HasValue)
- {
- try
- {
- internship.UpdateDocument(document);
- }
- catch (InvalidOperationException)
- {
- return NotFound();
- }
- }
- else
- {
- internship.AddNewDocument(document);
- }
-
- await Context.SaveChangesAsync();
- return Ok();
+ return await _internshipService.AddDocumentToInternship(documentRequest, personNumber, cancellationToken);
}
}
}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Controllers/EditionController.cs b/src/InternshipSystem.Api/Controllers/EditionController.cs
index b592984..f9e6774 100644
--- a/src/InternshipSystem.Api/Controllers/EditionController.cs
+++ b/src/InternshipSystem.Api/Controllers/EditionController.cs
@@ -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>> 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> GetEditionsConfiguration(Guid id, CancellationToken token)
{
- var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
-
var edition =
await Context.Editions
.Include(e => e.AvailableSubjects)
diff --git a/src/InternshipSystem.Api/Controllers/InternshipRegistrationController.cs b/src/InternshipSystem.Api/Controllers/InternshipRegistrationController.cs
index 1d06be1..a521e83 100644
--- a/src/InternshipSystem.Api/Controllers/InternshipRegistrationController.cs
+++ b/src/InternshipSystem.Api/Controllers/InternshipRegistrationController.cs
@@ -1,11 +1,13 @@
-using System;
-using System.Threading;
+using System.Threading;
using System.Threading.Tasks;
using InternshipSystem.Api.Queries;
using InternshipSystem.Api.Security;
using InternshipSystem.Core.Commands;
using InternshipSystem.Repository;
using Microsoft.AspNetCore.Authorization;
+using InternshipSystem.Api.Security;
+using InternshipSystem.Api.Services;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -15,11 +17,11 @@ namespace InternshipSystem.Api.Controllers
[Route("internshipRegistration")]
public class InternshipRegistrationController : ControllerBase
{
- private InternshipDbContext Context { get; }
+ private readonly IInternshipService _internshipService;
- public InternshipRegistrationController(InternshipDbContext context)
+ public InternshipRegistrationController(IInternshipService internshipService)
{
- Context = context;
+ _internshipService = internshipService;
}
///
@@ -33,21 +35,21 @@ namespace InternshipSystem.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [Authorize(Policy = Policies.RegisteredOnly)]
- public async Task SubmitRegistrationForm(
- [FromBody] UpdateRegistrationForm updateRegistration,
- User user,
+ [Authorize]
+ public async Task SubmitRegistrationForm([FromBody] RegistrationFormQuery registrationQuery,
CancellationToken cancellationToken)
{
- var edition = await Context.Editions.FindAsync(user.EditionId.Value);
+ var validator = new RegistrationFormQuery.Validator();
+ var validationResult = await validator.ValidateAsync(registrationQuery, cancellationToken);
- var internship = await Context
- .Entry(edition)
- .Collection(e => e.Internships)
- .Query()
- .FirstAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
+ if (!validationResult.IsValid)
+ {
+ return BadRequest(validationResult.ToString());
+ }
+
+ var personNumber = long.Parse(User.FindFirst(InternshipClaims.PersonNumber).Value);
- internship.UpdateInternshipRegistration(updateRegistration);
+ return await _internshipService.SubmitRegistration(registrationQuery, personNumber, cancellationToken);
}
}
}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Controllers/RegistrationController.cs b/src/InternshipSystem.Api/Controllers/RegistrationController.cs
index 3991b51..89d2cb2 100644
--- a/src/InternshipSystem.Api/Controllers/RegistrationController.cs
+++ b/src/InternshipSystem.Api/Controllers/RegistrationController.cs
@@ -1,9 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
-using InternshipSystem.Api.Result;
using InternshipSystem.Api.Security;
-using InternshipSystem.Core;
using InternshipSystem.Repository;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@@ -35,16 +33,18 @@ namespace InternshipSystem.Api.Controllers
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[Authorize]
- public async Task RegisterStudentForEdition([FromBody] Guid registrationCode, User user, CancellationToken token)
+ public async Task 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(token);
diff --git a/src/InternshipSystem.Api/Queries/BranchOfficeForm.cs b/src/InternshipSystem.Api/Queries/BranchOfficeForm.cs
new file mode 100644
index 0000000..5fbbafc
--- /dev/null
+++ b/src/InternshipSystem.Api/Queries/BranchOfficeForm.cs
@@ -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
+ {
+ 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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Queries/CompanyForm.cs b/src/InternshipSystem.Api/Queries/CompanyForm.cs
new file mode 100644
index 0000000..330a8f5
--- /dev/null
+++ b/src/InternshipSystem.Api/Queries/CompanyForm.cs
@@ -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
+ {
+ 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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Queries/RegistrationFormQuery.cs b/src/InternshipSystem.Api/Queries/RegistrationFormQuery.cs
new file mode 100644
index 0000000..77122c9
--- /dev/null
+++ b/src/InternshipSystem.Api/Queries/RegistrationFormQuery.cs
@@ -0,0 +1,28 @@
+using System;
+using FluentValidation;
+using InternshipSystem.Core.Entity.Internship;
+
+namespace InternshipSystem.Api.Queries
+{
+ public class RegistrationFormQuery
+ {
+ 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
+ {
+ 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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Security/User.cs b/src/InternshipSystem.Api/Security/User.cs
index b569d6f..326547a 100644
--- a/src/InternshipSystem.Api/Security/User.cs
+++ b/src/InternshipSystem.Api/Security/User.cs
@@ -6,7 +6,6 @@ namespace InternshipSystem.Api.Security
{
public long PersonNumber { get; set; }
public string Name { get; set; }
-
public Guid? EditionId { get; set; }
}
}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Services/IInternshipService.cs b/src/InternshipSystem.Api/Services/IInternshipService.cs
new file mode 100644
index 0000000..614e053
--- /dev/null
+++ b/src/InternshipSystem.Api/Services/IInternshipService.cs
@@ -0,0 +1,16 @@
+using System.Threading;
+using System.Threading.Tasks;
+using InternshipSystem.Api.Queries;
+using Microsoft.AspNetCore.Mvc;
+
+namespace InternshipSystem.Api.Services
+{
+ public interface IInternshipService
+ {
+ Task SubmitRegistration(RegistrationFormQuery registrationQuery, long personNumber,
+ CancellationToken cancellationToken);
+
+ Task AddDocumentToInternship(DocumentPublishRequest documentRequest, long personNumber,
+ CancellationToken cancellationToken);
+ }
+}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Services/InternshipService.cs b/src/InternshipSystem.Api/Services/InternshipService.cs
new file mode 100644
index 0000000..4bcaa03
--- /dev/null
+++ b/src/InternshipSystem.Api/Services/InternshipService.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using AutoMapper;
+using InternshipSystem.Api.Queries;
+using InternshipSystem.Core;
+using InternshipSystem.Repository;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+
+namespace InternshipSystem.Api.Services
+{
+ public class InternshipService : IInternshipService
+ {
+ private readonly InternshipDbContext _context;
+ private IMapper Mapper { get; }
+
+ public InternshipService(InternshipDbContext context, IMapper mapper)
+ {
+ _context = context;
+ Mapper = mapper;
+ }
+
+ public async Task SubmitRegistration(RegistrationFormQuery registrationQuery, long personNumber,
+ CancellationToken cancellationToken)
+ {
+ 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 new BadRequestObjectResult("Edition doesn't have this type of employment in available employments type");
+ }
+
+ internshipRegistration.Type = registrationQuery.Type ?? internshipRegistration.Type;
+
+ await _context.SaveChangesAsync(cancellationToken);
+ return new OkResult();
+ }
+
+ public async Task AddDocumentToInternship(DocumentPublishRequest documentRequest, long personNumber,
+ CancellationToken cancellationToken)
+ {
+ 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 document = Mapper.Map(documentRequest);
+
+ if (documentRequest.Id.HasValue)
+ {
+ try
+ {
+ internship.UpdateDocument(document);
+ }
+ catch (InvalidOperationException)
+ {
+ return new NotFoundResult();
+ }
+ }
+ else
+ {
+ internship.AddNewDocument(document);
+ }
+
+ await _context.SaveChangesAsync(cancellationToken);
+ return new OkResult();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/InternshipSystem.Api/Startup.cs b/src/InternshipSystem.Api/Startup.cs
index af8297f..ab34720 100644
--- a/src/InternshipSystem.Api/Startup.cs
+++ b/src/InternshipSystem.Api/Startup.cs
@@ -6,6 +6,8 @@ using InternshipSystem.Api.Extensions;
using InternshipSystem.Api.ModelBinders;
using InternshipSystem.Api.Options;
using InternshipSystem.Api.Security;
+using InternshipSystem.Api.Services;
+using InternshipSystem.Core;
using InternshipSystem.Repository;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -36,6 +38,7 @@ namespace InternshipSystem.Api
options.IncludeXmlComments(xmlPath);
})
.AddScoped()
+ .AddScoped()
.AddScoped()
.AddAutoMapper(cfg => cfg.AddProfile())
.AddStudentAuthentication()
diff --git a/src/InternshipSystem.Core/Entity/BranchOffice.cs b/src/InternshipSystem.Core/Entity/BranchOffice.cs
index 9f3dac9..78e41c8 100644
--- a/src/InternshipSystem.Core/Entity/BranchOffice.cs
+++ b/src/InternshipSystem.Core/Entity/BranchOffice.cs
@@ -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);
+ }
}
}
\ No newline at end of file
diff --git a/src/InternshipSystem.Core/Entity/Company.cs b/src/InternshipSystem.Core/Entity/Company.cs
index 12a9168..15c3843 100644
--- a/src/InternshipSystem.Core/Entity/Company.cs
+++ b/src/InternshipSystem.Core/Entity/Company.cs
@@ -10,19 +10,22 @@ namespace InternshipSystem.Core
public string Name { get; set; }
public List Branches { get; set; }
- public Company CreateCompany(string nip, string name)
- {
- return new Company
+ public static Company CreateCompany(string nip, string name) =>
+ new Company
{
Nip = nip,
Name = name
};
- }
public void AddBranchAddress(BranchAddress branch)
{
}
+ public void AddBranchOffice(BranchOffice createBranch)
+ {
+ Branches.Add(createBranch);
+ }
+
public static Company CreateCompany(UpdateCompany updateCompany)
{
}
diff --git a/src/InternshipSystem.Core/Entity/Edition.cs b/src/InternshipSystem.Core/Entity/Edition.cs
index 3c28a4b..a0f51a6 100644
--- a/src/InternshipSystem.Core/Entity/Edition.cs
+++ b/src/InternshipSystem.Core/Entity/Edition.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using InternshipSystem.Core.Entity.Internship;
using InternshipSystem.Core.UglyOrmArtifacts;
@@ -17,6 +18,7 @@ namespace InternshipSystem.Core
public InternshipType AllowedInternshipTypes { get; set; }
public List AvailableSubjects { get; set; }
+ public List AvailableInternshipTypes { get; set; }
public bool IsOpen => EditionFinish < DateTime.Today;
@@ -30,6 +32,11 @@ namespace InternshipSystem.Core
};
}
+ public bool IsInternshipTypeAllowed(InternshipType registrationQueryType)
+ {
+ return AvailableInternshipTypes.Select(it => it.InternshipType).Contains(registrationQueryType);
+ }
+
public void RegisterInternship(Student student)
{
var internship = Internship.CreateStudentsInternship(student);
diff --git a/src/InternshipSystem.Core/Entity/Internship/Internship.cs b/src/InternshipSystem.Core/Entity/Internship/Internship.cs
index 15c5272..965835b 100644
--- a/src/InternshipSystem.Core/Entity/Internship/Internship.cs
+++ b/src/InternshipSystem.Core/Entity/Internship/Internship.cs
@@ -24,8 +24,8 @@ namespace InternshipSystem.Core
{
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;
}
diff --git a/src/InternshipSystem.Core/Entity/Internship/InternshipRegistration.cs b/src/InternshipSystem.Core/Entity/Internship/InternshipRegistration.cs
index b0b447a..dc4b68a 100644
--- a/src/InternshipSystem.Core/Entity/Internship/InternshipRegistration.cs
+++ b/src/InternshipSystem.Core/Entity/Internship/InternshipRegistration.cs
@@ -12,7 +12,7 @@ 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();
@@ -24,5 +24,15 @@ namespace InternshipSystem.Core
End = end;
Type = internshipType;
}
+
+ public void UpdateCompany(Company newCompany)
+ {
+ Company = newCompany;
+ }
+
+ public void UpdateBranch(BranchOffice branch)
+ {
+ BranchAddress = branch;
+ }
}
}
\ No newline at end of file
diff --git a/src/InternshipSystem.Core/Entity/Internship/InternshipType.cs b/src/InternshipSystem.Core/Entity/Internship/InternshipType.cs
index 5e85e23..0aadc21 100644
--- a/src/InternshipSystem.Core/Entity/Internship/InternshipType.cs
+++ b/src/InternshipSystem.Core/Entity/Internship/InternshipType.cs
@@ -5,8 +5,13 @@ namespace InternshipSystem.Core.Entity.Internship
[Flags]
public enum InternshipType : long
{
- None,
+ FreeInternship,
+ GraduateInternship,
+ FreeApprenticeship,
+ PaidApprenticeship,
+ ForeignInternship,
UOP,
- UOZ
+ UD,
+ UZ,
}
}
\ No newline at end of file
diff --git a/src/InternshipSystem.Core/UglyOrmArtifacts/EditionInternshipType.cs b/src/InternshipSystem.Core/UglyOrmArtifacts/EditionInternshipType.cs
new file mode 100644
index 0000000..f8c03c2
--- /dev/null
+++ b/src/InternshipSystem.Core/UglyOrmArtifacts/EditionInternshipType.cs
@@ -0,0 +1,11 @@
+using System;
+using InternshipSystem.Core.Entity.Internship;
+
+namespace InternshipSystem.Core.UglyOrmArtifacts
+{
+ public class EditionInternshipType
+ {
+ public long Id { get; set; }
+ public InternshipType InternshipType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/InternshipSystem.Repository/DatabaseFiller.cs b/src/InternshipSystem.Repository/DatabaseFiller.cs
index 99a270e..4751c2d 100644
--- a/src/InternshipSystem.Repository/DatabaseFiller.cs
+++ b/src/InternshipSystem.Repository/DatabaseFiller.cs
@@ -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
{
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
{
new BranchOffice
@@ -141,6 +139,13 @@ namespace InternshipSystem.Repository
{
Name = "Informatyka",
},
+ AvailableInternshipTypes = new List
+ {
+ new EditionInternshipType() { InternshipType = InternshipType.UOP },
+ new EditionInternshipType() { InternshipType = InternshipType.UZ },
+ new EditionInternshipType() { InternshipType = InternshipType.UD },
+ new EditionInternshipType() { InternshipType = InternshipType.FreeInternship },
+ },
Internships = new List(),
}
};
diff --git a/src/InternshipSystem.Repository/Migrations/20200828182238_Init.Designer.cs b/src/InternshipSystem.Repository/Migrations/20200828182238_Init.Designer.cs
deleted file mode 100644
index 0f84439..0000000
--- a/src/InternshipSystem.Repository/Migrations/20200828182238_Init.Designer.cs
+++ /dev/null
@@ -1,609 +0,0 @@
-//
-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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Name")
- .HasColumnName("name")
- .HasColumnType("text");
-
- b.Property("Nip")
- .IsRequired()
- .HasColumnName("nip")
- .HasColumnType("text");
-
- b.Property("Range")
- .HasColumnName("range")
- .HasColumnType("integer");
-
- b.Property("SiteAddress")
- .HasColumnName("site_address")
- .HasColumnType("text");
-
- b.HasKey("Id")
- .HasName("pk_companies");
-
- b.ToTable("companies");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Course", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Name")
- .HasColumnName("name")
- .HasColumnType("text");
-
- b.HasKey("Id")
- .HasName("pk_course");
-
- b.ToTable("course");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Document", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Description")
- .HasColumnName("description")
- .HasColumnType("text");
-
- b.Property("InternshipId")
- .HasColumnName("internship_id")
- .HasColumnType("bigint");
-
- b.Property("InternshipId1")
- .HasColumnName("internship_id1")
- .HasColumnType("bigint");
-
- b.Property("RejectionReason")
- .HasColumnName("rejection_reason")
- .HasColumnType("text");
-
- b.Property("Scan")
- .HasColumnName("scan")
- .HasColumnType("bytea");
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("uuid");
-
- b.Property("CourseId")
- .HasColumnName("course_id")
- .HasColumnType("bigint");
-
- b.Property("EditionFinish")
- .HasColumnName("edition_finish")
- .HasColumnType("timestamp without time zone");
-
- b.Property("EditionStart")
- .HasColumnName("edition_start")
- .HasColumnType("timestamp without time zone");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Description")
- .HasColumnName("description")
- .HasColumnType("text");
-
- b.Property("Type")
- .HasColumnName("type")
- .HasColumnType("text");
-
- b.HasKey("Id")
- .HasName("pk_internship_type");
-
- b.ToTable("internship_type");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("EditionId")
- .HasColumnName("edition_id")
- .HasColumnType("uuid");
-
- b.Property("Grade")
- .HasColumnName("grade")
- .HasColumnType("real");
-
- b.Property("InternshipProgramId")
- .HasColumnName("internship_program_id")
- .HasColumnType("bigint");
-
- b.Property("InternshipRegistrationId")
- .HasColumnName("internship_registration_id")
- .HasColumnType("bigint");
-
- b.Property("ReportId")
- .HasColumnName("report_id")
- .HasColumnType("bigint");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.HasKey("Id")
- .HasName("pk_internship_program");
-
- b.ToTable("internship_program");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("BranchAddressId")
- .HasColumnName("branch_address_id")
- .HasColumnType("bigint");
-
- b.Property("CompanyId")
- .HasColumnName("company_id")
- .HasColumnType("bigint");
-
- b.Property("End")
- .HasColumnName("end")
- .HasColumnType("timestamp without time zone");
-
- b.Property("Start")
- .HasColumnName("start")
- .HasColumnType("timestamp without time zone");
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.HasKey("Id")
- .HasName("pk_report");
-
- b.ToTable("report");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Student", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("AlbumNumber")
- .HasColumnName("album_number")
- .HasColumnType("integer");
-
- b.Property("Email")
- .HasColumnName("email")
- .HasColumnType("text");
-
- b.Property("FirstName")
- .HasColumnName("first_name")
- .HasColumnType("text");
-
- b.Property("LastName")
- .HasColumnName("last_name")
- .HasColumnType("text");
-
- b.Property("Semester")
- .HasColumnName("semester")
- .HasColumnType("integer");
-
- b.HasKey("Id")
- .HasName("pk_student");
-
- b.ToTable("student");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
- {
- b.Property("EditionId")
- .HasColumnName("edition_id")
- .HasColumnType("uuid");
-
- b.Property("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("InternshipProgramId")
- .HasColumnName("internship_program_id")
- .HasColumnType("bigint");
-
- b.Property("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("BranchOfficeId")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b1.Property("Building")
- .HasColumnName("building")
- .HasColumnType("text");
-
- b1.Property("City")
- .HasColumnName("city")
- .HasColumnType("text");
-
- b1.Property("Country")
- .HasColumnName("country")
- .HasColumnType("text");
-
- b1.Property("PostalCode")
- .HasColumnName("postal_code")
- .HasColumnType("text");
-
- b1.Property("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("InternshipProgramId")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b1.Property("Email")
- .HasColumnName("email")
- .HasColumnType("text");
-
- b1.Property("FirstName")
- .HasColumnName("first_name")
- .HasColumnType("text");
-
- b1.Property("LastName")
- .HasColumnName("last_name")
- .HasColumnType("text");
-
- b1.Property("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
- }
- }
-}
diff --git a/src/InternshipSystem.Repository/Migrations/20200828182238_Init.cs b/src/InternshipSystem.Repository/Migrations/20200828182238_Init.cs
deleted file mode 100644
index e1b6129..0000000
--- a/src/InternshipSystem.Repository/Migrations/20200828182238_Init.cs
+++ /dev/null
@@ -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(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- nip = table.Column(nullable: false),
- name = table.Column(nullable: true),
- range = table.Column(nullable: false),
- site_address = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_companies", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "course",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- name = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_course", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "internship_program",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- first_name = table.Column(nullable: true),
- last_name = table.Column(nullable: true),
- email = table.Column(nullable: true),
- mentor_phone_number = table.Column(nullable: true),
- state = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_internship_program", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "internship_subject",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- description = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_internship_subject", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "internship_type",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- type = table.Column(nullable: true),
- description = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_internship_type", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "report",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- state = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_report", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "student",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- album_number = table.Column(nullable: false),
- first_name = table.Column(nullable: true),
- last_name = table.Column(nullable: true),
- email = table.Column(nullable: true),
- semester = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_student", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "branch_office",
- columns: table => new
- {
- id = table.Column(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- street = table.Column(nullable: true),
- building = table.Column(nullable: true),
- city = table.Column(nullable: true),
- postal_code = table.Column(nullable: true),
- country = table.Column(nullable: true),
- company_id = table.Column(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(nullable: false),
- edition_start = table.Column(nullable: false),
- edition_finish = table.Column(nullable: false),
- reporting_start = table.Column(nullable: false),
- course_id = table.Column(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(nullable: false),
- internship_subject_id = table.Column(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(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- company_id = table.Column(nullable: true),
- branch_address_id = table.Column(nullable: true),
- start = table.Column(nullable: false),
- end = table.Column(nullable: false),
- type_id = table.Column(nullable: true),
- state = table.Column(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(nullable: false),
- internship_subject_id = table.Column(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(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- student_id = table.Column(nullable: true),
- internship_registration_id = table.Column(nullable: true),
- internship_program_id = table.Column(nullable: true),
- report_id = table.Column(nullable: true),
- grade = table.Column(nullable: false),
- edition_id = table.Column(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(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- description = table.Column(nullable: true),
- scan = table.Column(nullable: true),
- type = table.Column(nullable: false),
- state = table.Column(nullable: false),
- rejection_reason = table.Column(nullable: true),
- internship_id = table.Column(nullable: true),
- internship_id1 = table.Column(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");
- }
- }
-}
diff --git a/src/InternshipSystem.Repository/Migrations/InternshipDbContextModelSnapshot.cs b/src/InternshipSystem.Repository/Migrations/InternshipDbContextModelSnapshot.cs
deleted file mode 100644
index 59b3a8f..0000000
--- a/src/InternshipSystem.Repository/Migrations/InternshipDbContextModelSnapshot.cs
+++ /dev/null
@@ -1,607 +0,0 @@
-//
-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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Name")
- .HasColumnName("name")
- .HasColumnType("text");
-
- b.Property("Nip")
- .IsRequired()
- .HasColumnName("nip")
- .HasColumnType("text");
-
- b.Property("Range")
- .HasColumnName("range")
- .HasColumnType("integer");
-
- b.Property("SiteAddress")
- .HasColumnName("site_address")
- .HasColumnType("text");
-
- b.HasKey("Id")
- .HasName("pk_companies");
-
- b.ToTable("companies");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Course", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Name")
- .HasColumnName("name")
- .HasColumnType("text");
-
- b.HasKey("Id")
- .HasName("pk_course");
-
- b.ToTable("course");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Document", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Description")
- .HasColumnName("description")
- .HasColumnType("text");
-
- b.Property("InternshipId")
- .HasColumnName("internship_id")
- .HasColumnType("bigint");
-
- b.Property("InternshipId1")
- .HasColumnName("internship_id1")
- .HasColumnType("bigint");
-
- b.Property("RejectionReason")
- .HasColumnName("rejection_reason")
- .HasColumnType("text");
-
- b.Property("Scan")
- .HasColumnName("scan")
- .HasColumnType("bytea");
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("uuid");
-
- b.Property("CourseId")
- .HasColumnName("course_id")
- .HasColumnType("bigint");
-
- b.Property("EditionFinish")
- .HasColumnName("edition_finish")
- .HasColumnType("timestamp without time zone");
-
- b.Property("EditionStart")
- .HasColumnName("edition_start")
- .HasColumnType("timestamp without time zone");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("Description")
- .HasColumnName("description")
- .HasColumnType("text");
-
- b.Property("Type")
- .HasColumnName("type")
- .HasColumnType("text");
-
- b.HasKey("Id")
- .HasName("pk_internship_type");
-
- b.ToTable("internship_type");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("EditionId")
- .HasColumnName("edition_id")
- .HasColumnType("uuid");
-
- b.Property("Grade")
- .HasColumnName("grade")
- .HasColumnType("real");
-
- b.Property("InternshipProgramId")
- .HasColumnName("internship_program_id")
- .HasColumnType("bigint");
-
- b.Property("InternshipRegistrationId")
- .HasColumnName("internship_registration_id")
- .HasColumnType("bigint");
-
- b.Property("ReportId")
- .HasColumnName("report_id")
- .HasColumnType("bigint");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.HasKey("Id")
- .HasName("pk_internship_program");
-
- b.ToTable("internship_program");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("BranchAddressId")
- .HasColumnName("branch_address_id")
- .HasColumnType("bigint");
-
- b.Property("CompanyId")
- .HasColumnName("company_id")
- .HasColumnType("bigint");
-
- b.Property("End")
- .HasColumnName("end")
- .HasColumnType("timestamp without time zone");
-
- b.Property("Start")
- .HasColumnName("start")
- .HasColumnType("timestamp without time zone");
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("State")
- .HasColumnName("state")
- .HasColumnType("integer");
-
- b.HasKey("Id")
- .HasName("pk_report");
-
- b.ToTable("report");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.Student", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b.Property("AlbumNumber")
- .HasColumnName("album_number")
- .HasColumnType("integer");
-
- b.Property("Email")
- .HasColumnName("email")
- .HasColumnType("text");
-
- b.Property("FirstName")
- .HasColumnName("first_name")
- .HasColumnType("text");
-
- b.Property("LastName")
- .HasColumnName("last_name")
- .HasColumnType("text");
-
- b.Property("Semester")
- .HasColumnName("semester")
- .HasColumnType("integer");
-
- b.HasKey("Id")
- .HasName("pk_student");
-
- b.ToTable("student");
- });
-
- modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
- {
- b.Property("EditionId")
- .HasColumnName("edition_id")
- .HasColumnType("uuid");
-
- b.Property("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("InternshipProgramId")
- .HasColumnName("internship_program_id")
- .HasColumnType("bigint");
-
- b.Property("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("BranchOfficeId")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b1.Property("Building")
- .HasColumnName("building")
- .HasColumnType("text");
-
- b1.Property("City")
- .HasColumnName("city")
- .HasColumnType("text");
-
- b1.Property("Country")
- .HasColumnName("country")
- .HasColumnType("text");
-
- b1.Property("PostalCode")
- .HasColumnName("postal_code")
- .HasColumnType("text");
-
- b1.Property("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("InternshipProgramId")
- .ValueGeneratedOnAdd()
- .HasColumnName("id")
- .HasColumnType("bigint")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
-
- b1.Property("Email")
- .HasColumnName("email")
- .HasColumnType("text");
-
- b1.Property("FirstName")
- .HasColumnName("first_name")
- .HasColumnType("text");
-
- b1.Property("LastName")
- .HasColumnName("last_name")
- .HasColumnType("text");
-
- b1.Property("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
- }
- }
-}