parent
8514e593fa
commit
3a2b9b64d5
@ -13,7 +13,7 @@ namespace InternshipSystem.Api.Commands
|
|||||||
public DateTime? End { get; set; }
|
public DateTime? End { get; set; }
|
||||||
public UpdateMentor? Mentor { get; set; }
|
public UpdateMentor? Mentor { get; set; }
|
||||||
public List<long> Subjects { get; set; }
|
public List<long> Subjects { get; set; }
|
||||||
public InternshipType Type { get; set; }
|
public long? Type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct UpdateMentor
|
public struct UpdateMentor
|
||||||
|
@ -38,7 +38,7 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<ActionResult<IList<EditionResult>>> GetAvailableEditions([FromServices] User user, CancellationToken token)
|
public async Task<ActionResult<IEnumerable<EditionResult>>> GetAvailableEditions([FromServices] User user, CancellationToken token)
|
||||||
{
|
{
|
||||||
var editions =
|
var editions =
|
||||||
await Context.Editions
|
await Context.Editions
|
||||||
|
@ -6,9 +6,7 @@ using InternshipSystem.Api.Security;
|
|||||||
using InternshipSystem.Api.UseCases;
|
using InternshipSystem.Api.UseCases;
|
||||||
using InternshipSystem.Repository;
|
using InternshipSystem.Repository;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using InternshipSystem.Core.Entity.Internship;
|
||||||
using InternshipSystem.Api.Services;
|
|
||||||
using InternshipSystem.Core;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@ -41,7 +39,12 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
[FromServices] User user,
|
[FromServices] User user,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var edition = await _context.Editions.FirstAsync(e => e.Id == user.EditionId, cancellationToken);
|
var edition = await _context.Editions
|
||||||
|
.Include(e => e.AvailableInternshipTypes)
|
||||||
|
.ThenInclude(t => t.InternshipType)
|
||||||
|
.Include(e => e.AvailableSubjects)
|
||||||
|
.ThenInclude(t => t.Subject)
|
||||||
|
.FirstAsync(e => e.Id == user.EditionId, cancellationToken);
|
||||||
|
|
||||||
var internshipRegistration =
|
var internshipRegistration =
|
||||||
await _context
|
await _context
|
||||||
|
@ -33,7 +33,7 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||||
public async Task<ActionResult<IList<InternshipType>>> GetInternshipTypesForEdition([FromServices] User user, CancellationToken cancellationToken)
|
public async Task<ActionResult<IEnumerable<InternshipType>>> GetInternshipTypesForEdition([FromServices] User user, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var edition =
|
var edition =
|
||||||
await Context.Editions
|
await Context.Editions
|
||||||
@ -46,7 +46,7 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(edition.AvailableInternshipTypes);
|
return Ok(edition.AvailableInternshipTypes.Select(e => e.InternshipType));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{internshipTypeId}")]
|
[HttpGet("{internshipTypeId}")]
|
||||||
@ -64,7 +64,7 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<ActionResult<IList<InternshipType>>> SearchInternshipTypes([FromBody] InternshipTypeSearchQuery searchQuery, CancellationToken cancellationToken)
|
public async Task<ActionResult<IEnumerable<InternshipType>>> SearchInternshipTypes([FromBody] InternshipTypeSearchQuery searchQuery, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return await Context.InternshipTypes
|
return await Context.InternshipTypes
|
||||||
.Where(t => string.IsNullOrEmpty(searchQuery.Type) || t.Type.Contains(searchQuery.Type))
|
.Where(t => string.IsNullOrEmpty(searchQuery.Type) || t.Type.Contains(searchQuery.Type))
|
||||||
|
@ -6,6 +6,7 @@ using IdentityServer4.Extensions;
|
|||||||
using InternshipSystem.Api.Commands;
|
using InternshipSystem.Api.Commands;
|
||||||
using InternshipSystem.Api.Security;
|
using InternshipSystem.Api.Security;
|
||||||
using InternshipSystem.Core;
|
using InternshipSystem.Core;
|
||||||
|
using InternshipSystem.Core.Entity.Internship;
|
||||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||||
using InternshipSystem.Repository;
|
using InternshipSystem.Repository;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@ -34,8 +35,12 @@ namespace InternshipSystem.Api.UseCases
|
|||||||
{
|
{
|
||||||
subjectRegistration.Start = registrationCommand.Start ?? subjectRegistration.Start;
|
subjectRegistration.Start = registrationCommand.Start ?? subjectRegistration.Start;
|
||||||
subjectRegistration.End = registrationCommand.End ?? subjectRegistration.End;
|
subjectRegistration.End = registrationCommand.End ?? subjectRegistration.End;
|
||||||
subjectRegistration.Type = registrationCommand.Type ?? subjectRegistration.Type;
|
|
||||||
|
|
||||||
|
if (registrationCommand.Type.HasValue)
|
||||||
|
{
|
||||||
|
UpdateInternshipType(registrationCommand.Type.Value);
|
||||||
|
}
|
||||||
|
|
||||||
if (registrationCommand.Mentor.HasValue)
|
if (registrationCommand.Mentor.HasValue)
|
||||||
{
|
{
|
||||||
UpdateMentor(registrationCommand.Mentor.Value);
|
UpdateMentor(registrationCommand.Mentor.Value);
|
||||||
@ -54,6 +59,12 @@ namespace InternshipSystem.Api.UseCases
|
|||||||
return subjectRegistration.ValidateStatus(_edition);
|
return subjectRegistration.ValidateStatus(_edition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateInternshipType(long typeId)
|
||||||
|
{
|
||||||
|
var editionInternshipType = _edition.AvailableInternshipTypes.FirstOrDefault(i => i.InternshipTypeId == typeId);
|
||||||
|
subjectRegistration.Type = editionInternshipType?.InternshipType ?? subjectRegistration.Type;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task UpdateCompanyAndBranch(UpdateCompany companyUpdate, CancellationToken cancellationToken)
|
private async Task UpdateCompanyAndBranch(UpdateCompany companyUpdate, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var company = subjectRegistration.Company;
|
var company = subjectRegistration.Company;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using InternshipSystem.Core.Entity.Internship;
|
using InternshipSystem.Core.Entity.Internship;
|
||||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||||
|
|
||||||
@ -13,11 +14,8 @@ namespace InternshipSystem.Core
|
|||||||
public DateTime ReportingStart { get; set; }
|
public DateTime ReportingStart { get; set; }
|
||||||
public Course Course { get; set; }
|
public Course Course { get; set; }
|
||||||
public List<Internship> Internships { get; set; }
|
public List<Internship> Internships { get; set; }
|
||||||
|
|
||||||
public InternshipType AllowedInternshipTypes { get; set; }
|
|
||||||
|
|
||||||
public List<EditionSubject> AvailableSubjects { get; set; }
|
public List<EditionSubject> AvailableSubjects { get; set; }
|
||||||
public List<InternshipType> AvailableInternshipTypes { get; set; }
|
public List<EditionInternshipType> AvailableInternshipTypes { get; set; }
|
||||||
|
|
||||||
public bool IsOpen => EditionFinish < DateTime.Today;
|
public bool IsOpen => EditionFinish < DateTime.Today;
|
||||||
|
|
||||||
@ -31,11 +29,6 @@ namespace InternshipSystem.Core
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInternshipTypeAllowed(InternshipType registrationQueryType)
|
|
||||||
{
|
|
||||||
return AvailableInternshipTypes.Contains(registrationQueryType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RegisterInternship(Student student)
|
public void RegisterInternship(Student student)
|
||||||
{
|
{
|
||||||
var internship = Internship.CreateStudentsInternship(student);
|
var internship = Internship.CreateStudentsInternship(student);
|
||||||
@ -47,5 +40,15 @@ namespace InternshipSystem.Core
|
|||||||
{
|
{
|
||||||
return start >= EditionStart && end <= EditionFinish;
|
return start >= EditionStart && end <= EditionFinish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsTypeAvailable(InternshipType internshipType)
|
||||||
|
{
|
||||||
|
return AvailableInternshipTypes.Any(e => e.InternshipType == internshipType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AreSubjectsAvailable(IEnumerable<long> internshipSubjects)
|
||||||
|
{
|
||||||
|
return internshipSubjects.All(s => AvailableSubjects.Any(su => su.InternshipSubjectId == s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using InternshipSystem.Core.ValueObject;
|
|
||||||
|
|
||||||
namespace InternshipSystem.Core
|
namespace InternshipSystem.Core.Entity.Internship
|
||||||
{
|
{
|
||||||
public class Internship
|
public class Internship
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using FluentValidation.Results;
|
|
||||||
using InternshipSystem.Core.Entity.Internship;
|
|
||||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||||
|
|
||||||
namespace InternshipSystem.Core
|
namespace InternshipSystem.Core.Entity.Internship
|
||||||
{
|
{
|
||||||
public class InternshipRegistration
|
public class InternshipRegistration
|
||||||
{
|
{
|
||||||
@ -50,9 +49,11 @@ namespace InternshipSystem.Core
|
|||||||
.SetValidator(new Mentor.Validate())
|
.SetValidator(new Mentor.Validate())
|
||||||
.NotNull();
|
.NotNull();
|
||||||
RuleFor(x => x.Subjects)
|
RuleFor(x => x.Subjects)
|
||||||
.NotEmpty();
|
.NotEmpty()
|
||||||
|
.Must(s => edition.AreSubjectsAvailable(s.Select(su => su.InternshipSubjectId)));
|
||||||
RuleFor(x => x.Type)
|
RuleFor(x => x.Type)
|
||||||
.NotNull();
|
.NotNull()
|
||||||
|
.Must(edition.IsTypeAvailable);
|
||||||
RuleFor(x => x.Start)
|
RuleFor(x => x.Start)
|
||||||
.GreaterThanOrEqualTo(edition.EditionStart)
|
.GreaterThanOrEqualTo(edition.EditionStart)
|
||||||
.LessThan(x => x.End)
|
.LessThan(x => x.End)
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using InternshipSystem.Core.Entity.Internship;
|
||||||
|
|
||||||
|
namespace InternshipSystem.Core.UglyOrmArtifacts
|
||||||
|
{
|
||||||
|
public class EditionInternshipType
|
||||||
|
{
|
||||||
|
public Edition Edition { get; set; }
|
||||||
|
|
||||||
|
public Guid EditionId { get; set; }
|
||||||
|
|
||||||
|
public InternshipType InternshipType { get; set; }
|
||||||
|
|
||||||
|
public long InternshipTypeId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -208,12 +208,24 @@ namespace InternshipSystem.Repository
|
|||||||
{
|
{
|
||||||
Name = "Informatyka",
|
Name = "Informatyka",
|
||||||
},
|
},
|
||||||
AvailableInternshipTypes = new List<InternshipType>
|
AvailableInternshipTypes = new List<EditionInternshipType>
|
||||||
{
|
{
|
||||||
Context.InternshipTypes.First(t => t.Type.Equals("UOP")),
|
new EditionInternshipType
|
||||||
Context.InternshipTypes.First(t => t.Type.Equals("UZ")),
|
{
|
||||||
Context.InternshipTypes.First(t => t.Type.Equals("UD")),
|
InternshipType = Context.InternshipTypes.First(t => t.Type.Equals("UOP"))
|
||||||
Context.InternshipTypes.First(t => t.Type.Equals("FreeInternship")),
|
},
|
||||||
|
new EditionInternshipType
|
||||||
|
{
|
||||||
|
InternshipType = Context.InternshipTypes.First(t => t.Type.Equals("UZ"))
|
||||||
|
},
|
||||||
|
new EditionInternshipType
|
||||||
|
{
|
||||||
|
InternshipType = Context.InternshipTypes.First(t => t.Type.Equals("UD"))
|
||||||
|
},
|
||||||
|
new EditionInternshipType
|
||||||
|
{
|
||||||
|
InternshipType = Context.InternshipTypes.First(t => t.Type.Equals("FreeInternship"))
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Internships = new List<Internship>(),
|
Internships = new List<Internship>(),
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,22 @@ namespace InternshipSystem.Repository
|
|||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey(subject => subject.InternshipSubjectId);
|
.HasForeignKey(subject => subject.InternshipSubjectId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EditionInternshipType>(builder =>
|
||||||
|
{
|
||||||
|
builder
|
||||||
|
.HasKey(type => new { type.EditionId, type.InternshipTypeId});
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasOne(k => k.Edition)
|
||||||
|
.WithMany(model => model.AvailableInternshipTypes)
|
||||||
|
.HasForeignKey(p => p.EditionId);
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasOne(k => k.InternshipType)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(type => type.InternshipTypeId);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<EditionSubject>(builder =>
|
modelBuilder.Entity<EditionSubject>(builder =>
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace InternshipSystem.Repository.Migrations
|
namespace InternshipSystem.Repository.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(InternshipDbContext))]
|
[DbContext(typeof(InternshipDbContext))]
|
||||||
[Migration("20201002175217_Initial")]
|
[Migration("20201002185255_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -145,10 +145,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<long?>("AllowedInternshipTypesId")
|
|
||||||
.HasColumnName("allowed_internship_types_id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("CourseId")
|
b.Property<long?>("CourseId")
|
||||||
.HasColumnName("course_id")
|
.HasColumnName("course_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
@ -168,71 +164,13 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_editions");
|
.HasName("pk_editions");
|
||||||
|
|
||||||
b.HasIndex("AllowedInternshipTypesId")
|
|
||||||
.HasName("ix_editions_allowed_internship_types_id");
|
|
||||||
|
|
||||||
b.HasIndex("CourseId")
|
b.HasIndex("CourseId")
|
||||||
.HasName("ix_editions_course_id");
|
.HasName("ix_editions_course_id");
|
||||||
|
|
||||||
b.ToTable("editions");
|
b.ToTable("editions");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", 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>("DescriptionEng")
|
|
||||||
.HasColumnName("description_eng")
|
|
||||||
.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>("DescriptionEng")
|
|
||||||
.HasColumnName("description_eng")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid?>("EditionId")
|
|
||||||
.HasColumnName("edition_id")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.HasColumnName("type")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
|
||||||
.HasName("pk_internship_types");
|
|
||||||
|
|
||||||
b.HasIndex("EditionId")
|
|
||||||
.HasName("ix_internship_types_edition_id");
|
|
||||||
|
|
||||||
b.ToTable("internship_types");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
|
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -278,7 +216,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship");
|
b.ToTable("internship");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -325,6 +263,54 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship_registration");
|
b.ToTable("internship_registration");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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.Property<string>("DescriptionEng")
|
||||||
|
.HasColumnName("description_eng")
|
||||||
|
.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>("DescriptionEng")
|
||||||
|
.HasColumnName("description_eng")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.HasColumnName("type")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_internship_types");
|
||||||
|
|
||||||
|
b.ToTable("internship_types");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -423,6 +409,25 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("students");
|
b.ToTable("students");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("EditionId")
|
||||||
|
.HasColumnName("edition_id")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("InternshipTypeId")
|
||||||
|
.HasColumnName("internship_type_id")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("EditionId", "InternshipTypeId")
|
||||||
|
.HasName("pk_edition_internship_type");
|
||||||
|
|
||||||
|
b.HasIndex("InternshipTypeId")
|
||||||
|
.HasName("ix_edition_internship_type_internship_type_id");
|
||||||
|
|
||||||
|
b.ToTable("edition_internship_type");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("EditionId")
|
b.Property<Guid>("EditionId")
|
||||||
@ -509,12 +514,12 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||||
.WithMany("Approvals")
|
.WithMany("Approvals")
|
||||||
.HasForeignKey("InternshipId")
|
.HasForeignKey("InternshipId")
|
||||||
.HasConstraintName("fk_document_internship_internship_id");
|
.HasConstraintName("fk_document_internship_internship_id");
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||||
.WithMany("Documentation")
|
.WithMany("Documentation")
|
||||||
.HasForeignKey("InternshipId1")
|
.HasForeignKey("InternshipId1")
|
||||||
.HasConstraintName("fk_document_internship_internship_id1");
|
.HasConstraintName("fk_document_internship_internship_id1");
|
||||||
@ -522,33 +527,20 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "AllowedInternshipTypes")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AllowedInternshipTypesId")
|
|
||||||
.HasConstraintName("fk_editions_internship_types_allowed_internship_types_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Course", "Course")
|
b.HasOne("InternshipSystem.Core.Course", "Course")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CourseId")
|
.HasForeignKey("CourseId")
|
||||||
.HasConstraintName("fk_editions_course_course_id");
|
.HasConstraintName("fk_editions_course_course_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipType", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||||
{
|
|
||||||
b.HasOne("InternshipSystem.Core.Edition", null)
|
|
||||||
.WithMany("AvailableInternshipTypes")
|
|
||||||
.HasForeignKey("EditionId")
|
|
||||||
.HasConstraintName("fk_internship_types_editions_edition_id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
|
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
.WithMany("Internships")
|
.WithMany("Internships")
|
||||||
.HasForeignKey("EditionId")
|
.HasForeignKey("EditionId")
|
||||||
.HasConstraintName("fk_internship_editions_edition_id");
|
.HasConstraintName("fk_internship_editions_edition_id");
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "InternshipRegistration")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("InternshipRegistrationId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
|
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
|
||||||
@ -564,7 +556,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasConstraintName("fk_internship_students_student_id");
|
.HasConstraintName("fk_internship_students_student_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
@ -616,6 +608,23 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
|
.WithMany("AvailableInternshipTypes")
|
||||||
|
.HasForeignKey("EditionId")
|
||||||
|
.HasConstraintName("fk_edition_internship_type_editions_edition_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "InternshipType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("InternshipTypeId")
|
||||||
|
.HasConstraintName("fk_edition_internship_type_internship_types_internship_type_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
@ -635,7 +644,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.InternshipRegistration", "Registration")
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "Registration")
|
||||||
.WithMany("Subjects")
|
.WithMany("Subjects")
|
||||||
.HasForeignKey("InternshipRegistrationId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
@ -50,6 +50,21 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
table.PrimaryKey("pk_internship_subject", x => x.id);
|
table.PrimaryKey("pk_internship_subject", x => x.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "internship_types",
|
||||||
|
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),
|
||||||
|
description_eng = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_internship_types", x => x.id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "report",
|
name: "report",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -125,6 +140,27 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
onDelete: ReferentialAction.Restrict);
|
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(
|
migrationBuilder.CreateTable(
|
||||||
name: "internship_registration",
|
name: "internship_registration",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -157,54 +193,38 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
principalTable: "companies",
|
principalTable: "companies",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "program_subject",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
internship_registration_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_registration_id, x.internship_subject_id });
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_program_subject_internship_registration_internship_registrat",
|
name: "fk_internship_registration_internship_types_type_id",
|
||||||
column: x => x.internship_registration_id,
|
column: x => x.type_id,
|
||||||
principalTable: "internship_registration",
|
principalTable: "internship_types",
|
||||||
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: "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),
|
|
||||||
allowed_internship_types_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",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "edition_internship_type",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
edition_id = table.Column<Guid>(nullable: false),
|
||||||
|
internship_type_id = table.Column<long>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_edition_internship_type", x => new { x.edition_id, x.internship_type_id });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_edition_internship_type_editions_edition_id",
|
||||||
|
column: x => x.edition_id,
|
||||||
|
principalTable: "editions",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_edition_internship_type_internship_types_internship_type_id",
|
||||||
|
column: x => x.internship_type_id,
|
||||||
|
principalTable: "internship_types",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "edition_subject",
|
name: "edition_subject",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -271,25 +291,27 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "internship_types",
|
name: "program_subject",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
id = table.Column<long>(nullable: false)
|
internship_registration_id = table.Column<long>(nullable: false),
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
internship_subject_id = table.Column<long>(nullable: false)
|
||||||
type = table.Column<string>(nullable: true),
|
|
||||||
description = table.Column<string>(nullable: true),
|
|
||||||
description_eng = table.Column<string>(nullable: true),
|
|
||||||
edition_id = table.Column<Guid>(nullable: true)
|
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("pk_internship_types", x => x.id);
|
table.PrimaryKey("pk_program_subject", x => new { x.internship_registration_id, x.internship_subject_id });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_internship_types_editions_edition_id",
|
name: "fk_program_subject_internship_registration_internship_registrat",
|
||||||
column: x => x.edition_id,
|
column: x => x.internship_registration_id,
|
||||||
principalTable: "editions",
|
principalTable: "internship_registration",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
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(
|
migrationBuilder.CreateTable(
|
||||||
@ -338,16 +360,16 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
table: "document",
|
table: "document",
|
||||||
column: "internship_id1");
|
column: "internship_id1");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_edition_internship_type_internship_type_id",
|
||||||
|
table: "edition_internship_type",
|
||||||
|
column: "internship_type_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_edition_subject_internship_subject_id",
|
name: "ix_edition_subject_internship_subject_id",
|
||||||
table: "edition_subject",
|
table: "edition_subject",
|
||||||
column: "internship_subject_id");
|
column: "internship_subject_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "ix_editions_allowed_internship_types_id",
|
|
||||||
table: "editions",
|
|
||||||
column: "allowed_internship_types_id");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_editions_course_id",
|
name: "ix_editions_course_id",
|
||||||
table: "editions",
|
table: "editions",
|
||||||
@ -388,42 +410,20 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
table: "internship_registration",
|
table: "internship_registration",
|
||||||
column: "type_id");
|
column: "type_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "ix_internship_types_edition_id",
|
|
||||||
table: "internship_types",
|
|
||||||
column: "edition_id");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_program_subject_internship_subject_id",
|
name: "ix_program_subject_internship_subject_id",
|
||||||
table: "program_subject",
|
table: "program_subject",
|
||||||
column: "internship_subject_id");
|
column: "internship_subject_id");
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "fk_internship_registration_internship_types_type_id",
|
|
||||||
table: "internship_registration",
|
|
||||||
column: "type_id",
|
|
||||||
principalTable: "internship_types",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "fk_editions_internship_types_allowed_internship_types_id",
|
|
||||||
table: "editions",
|
|
||||||
column: "allowed_internship_types_id",
|
|
||||||
principalTable: "internship_types",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "fk_internship_types_editions_edition_id",
|
|
||||||
table: "internship_types");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "document");
|
name: "document");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "edition_internship_type");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "edition_subject");
|
name: "edition_subject");
|
||||||
|
|
||||||
@ -439,6 +439,9 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internship_subject");
|
name: "internship_subject");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "editions");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internship_registration");
|
name: "internship_registration");
|
||||||
|
|
||||||
@ -448,20 +451,17 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "students");
|
name: "students");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "course");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "branch_office");
|
name: "branch_office");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "companies");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "editions");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internship_types");
|
name: "internship_types");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "course");
|
name: "companies");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -143,10 +143,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<long?>("AllowedInternshipTypesId")
|
|
||||||
.HasColumnName("allowed_internship_types_id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("CourseId")
|
b.Property<long?>("CourseId")
|
||||||
.HasColumnName("course_id")
|
.HasColumnName("course_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
@ -166,71 +162,13 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_editions");
|
.HasName("pk_editions");
|
||||||
|
|
||||||
b.HasIndex("AllowedInternshipTypesId")
|
|
||||||
.HasName("ix_editions_allowed_internship_types_id");
|
|
||||||
|
|
||||||
b.HasIndex("CourseId")
|
b.HasIndex("CourseId")
|
||||||
.HasName("ix_editions_course_id");
|
.HasName("ix_editions_course_id");
|
||||||
|
|
||||||
b.ToTable("editions");
|
b.ToTable("editions");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", 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>("DescriptionEng")
|
|
||||||
.HasColumnName("description_eng")
|
|
||||||
.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>("DescriptionEng")
|
|
||||||
.HasColumnName("description_eng")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid?>("EditionId")
|
|
||||||
.HasColumnName("edition_id")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.HasColumnName("type")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
|
||||||
.HasName("pk_internship_types");
|
|
||||||
|
|
||||||
b.HasIndex("EditionId")
|
|
||||||
.HasName("ix_internship_types_edition_id");
|
|
||||||
|
|
||||||
b.ToTable("internship_types");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
|
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -276,7 +214,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship");
|
b.ToTable("internship");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -323,6 +261,54 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship_registration");
|
b.ToTable("internship_registration");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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.Property<string>("DescriptionEng")
|
||||||
|
.HasColumnName("description_eng")
|
||||||
|
.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>("DescriptionEng")
|
||||||
|
.HasColumnName("description_eng")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.HasColumnName("type")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_internship_types");
|
||||||
|
|
||||||
|
b.ToTable("internship_types");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -421,6 +407,25 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("students");
|
b.ToTable("students");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("EditionId")
|
||||||
|
.HasColumnName("edition_id")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("InternshipTypeId")
|
||||||
|
.HasColumnName("internship_type_id")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("EditionId", "InternshipTypeId")
|
||||||
|
.HasName("pk_edition_internship_type");
|
||||||
|
|
||||||
|
b.HasIndex("InternshipTypeId")
|
||||||
|
.HasName("ix_edition_internship_type_internship_type_id");
|
||||||
|
|
||||||
|
b.ToTable("edition_internship_type");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("EditionId")
|
b.Property<Guid>("EditionId")
|
||||||
@ -507,12 +512,12 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||||
.WithMany("Approvals")
|
.WithMany("Approvals")
|
||||||
.HasForeignKey("InternshipId")
|
.HasForeignKey("InternshipId")
|
||||||
.HasConstraintName("fk_document_internship_internship_id");
|
.HasConstraintName("fk_document_internship_internship_id");
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Internship", null)
|
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||||
.WithMany("Documentation")
|
.WithMany("Documentation")
|
||||||
.HasForeignKey("InternshipId1")
|
.HasForeignKey("InternshipId1")
|
||||||
.HasConstraintName("fk_document_internship_internship_id1");
|
.HasConstraintName("fk_document_internship_internship_id1");
|
||||||
@ -520,33 +525,20 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "AllowedInternshipTypes")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AllowedInternshipTypesId")
|
|
||||||
.HasConstraintName("fk_editions_internship_types_allowed_internship_types_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Course", "Course")
|
b.HasOne("InternshipSystem.Core.Course", "Course")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CourseId")
|
.HasForeignKey("CourseId")
|
||||||
.HasConstraintName("fk_editions_course_course_id");
|
.HasConstraintName("fk_editions_course_course_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipType", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||||
{
|
|
||||||
b.HasOne("InternshipSystem.Core.Edition", null)
|
|
||||||
.WithMany("AvailableInternshipTypes")
|
|
||||||
.HasForeignKey("EditionId")
|
|
||||||
.HasConstraintName("fk_internship_types_editions_edition_id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Internship", b =>
|
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
.WithMany("Internships")
|
.WithMany("Internships")
|
||||||
.HasForeignKey("EditionId")
|
.HasForeignKey("EditionId")
|
||||||
.HasConstraintName("fk_internship_editions_edition_id");
|
.HasConstraintName("fk_internship_editions_edition_id");
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "InternshipRegistration")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("InternshipRegistrationId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
|
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
|
||||||
@ -562,7 +554,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasConstraintName("fk_internship_students_student_id");
|
.HasConstraintName("fk_internship_students_student_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
@ -614,6 +606,23 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
|
.WithMany("AvailableInternshipTypes")
|
||||||
|
.HasForeignKey("EditionId")
|
||||||
|
.HasConstraintName("fk_edition_internship_type_editions_edition_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "InternshipType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("InternshipTypeId")
|
||||||
|
.HasConstraintName("fk_edition_internship_type_internship_types_internship_type_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
@ -633,7 +642,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.InternshipRegistration", "Registration")
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "Registration")
|
||||||
.WithMany("Subjects")
|
.WithMany("Subjects")
|
||||||
.HasForeignKey("InternshipRegistrationId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
||||||
|
@ -96,7 +96,12 @@ namespace InternshipSystem.Api.Test
|
|||||||
.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=szwoniu")
|
.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=szwoniu")
|
||||||
.Options);
|
.Options);
|
||||||
|
|
||||||
var ed = db.Editions.First();
|
var ed = db.Editions
|
||||||
|
.Include(e => e.AvailableInternshipTypes)
|
||||||
|
.ThenInclude(t => t.InternshipType)
|
||||||
|
.Include(e => e.AvailableSubjects)
|
||||||
|
.ThenInclude(t => t.Subject)
|
||||||
|
.First();
|
||||||
|
|
||||||
var user = new User
|
var user = new User
|
||||||
{
|
{
|
||||||
@ -124,25 +129,13 @@ namespace InternshipSystem.Api.Test
|
|||||||
|
|
||||||
var update = new UpdateRegistrationForm
|
var update = new UpdateRegistrationForm
|
||||||
{
|
{
|
||||||
Mentor = new UpdateMentor
|
|
||||||
{
|
|
||||||
FirstName = "Cwalina"
|
|
||||||
},
|
|
||||||
Subjects = new List<long>
|
Subjects = new List<long>
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
3
|
3
|
||||||
},
|
},
|
||||||
Company = new UpdateCompany
|
Type = 1
|
||||||
{
|
|
||||||
Name = "a",
|
|
||||||
BranchOffice = new UpdateBranchOffice
|
|
||||||
{
|
|
||||||
Street = "b"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = useCase.UpdateInternshipRegistration(update, CancellationToken.None);
|
var task = useCase.UpdateInternshipRegistration(update, CancellationToken.None);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using InternshipSystem.Core.Entity.Internship;
|
||||||
using Machine.Specifications;
|
using Machine.Specifications;
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user