Accept/Reject document

This commit is contained in:
mborzyszkowski 2021-01-10 19:17:46 +01:00 committed by Gitea
parent d612e74e13
commit 2e1903429b
6 changed files with 842 additions and 5 deletions

View File

@ -0,0 +1,90 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using InternshipSystem.Api.Security;
using InternshipSystem.Core;
using InternshipSystem.Repository;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace InternshipSystem.Api.Controllers
{
[ApiController]
[Route("management/document")]
public class DocumentManagementController : ControllerBase
{
private InternshipDbContext Context { get; }
public DocumentManagementController(InternshipDbContext context)
{
Context = context;
}
[HttpPut("accept/{documentId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[Authorize(Policy = Policies.IsOverseer)]
public async Task<ActionResult> AcceptDocument(long documentId, [FromBody] string comment, CancellationToken token)
{
var internship = await Context.Internships
.Include(i => i.Documentation)
.FirstOrDefaultAsync(i => i.Documentation.Any(d => d.Id.Equals(documentId)), token);
if (internship == null)
{
return NotFound();
}
var document = internship.Documentation
.FirstOrDefault(d => d.Id.Equals(documentId));
if (document == null)
{
return NotFound();
}
document.State = DocumentState.Accepted;
document.ChangeStateComment = string.IsNullOrEmpty(comment) ? null : comment;
await Context.SaveChangesAsync(token);
return Ok();
}
[HttpPut("reject/{documentId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[Authorize(Policy = Policies.IsOverseer)]
public async Task<ActionResult> RejectInternship(long documentId, [FromBody] string comment, CancellationToken token)
{
var internship = await Context.Internships
.Include(i => i.Documentation)
.FirstOrDefaultAsync(i => i.Documentation.Any(d => d.Id.Equals(documentId)), token);
if (internship == null)
{
return NotFound();
}
var document = internship.Documentation
.FirstOrDefault(d => d.Id.Equals(documentId));
if (document == null)
{
return NotFound();
}
document.State = DocumentState.Rejected;
document.ChangeStateComment = string.IsNullOrEmpty(comment) ? null : comment;
await Context.SaveChangesAsync(token);
return Ok();
}
}
}

View File

@ -9,7 +9,7 @@ namespace InternshipSystem.Core
public DocumentScan Scan { get; set; }
public DocumentType Type { get; set; }
public DocumentState State { get; set; }
public string RejectionReason { get; set; }
public string ChangeStateComment { get; set; }
}
public class DocumentScan

View File

@ -6,6 +6,7 @@ using InternshipSystem.Core;
using InternshipSystem.Core.Entity;
using InternshipSystem.Core.Entity.Internship;
using InternshipSystem.Core.UglyOrmArtifacts;
using InternshipSystem.Core.ValueObject;
using Microsoft.EntityFrameworkCore;
namespace InternshipSystem.Repository
@ -294,6 +295,14 @@ namespace InternshipSystem.Repository
{
new Internship
{
Documentation = new List<Document>
{
new Document
{
Description = "doc",
Type = DocumentType.IppScan
}
},
Student = new Student
{
FirstName = "Jan",

View File

@ -0,0 +1,706 @@
// <auto-generated />
using System;
using InternshipSystem.Repository;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace InternshipSystem.Repository.Migrations
{
[DbContext(typeof(InternshipDbContext))]
[Migration("20210110181423_documentChangeStateComment")]
partial class documentChangeStateComment
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CompanyId")
.HasColumnName("company_id")
.HasColumnType("bigint");
b.Property<long>("Provider")
.HasColumnName("provider")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_branch_office");
b.HasIndex("CompanyId")
.HasName("ix_branch_office_company_id");
b.ToTable("branch_office");
});
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnName("name")
.HasColumnType("text");
b.Property<string>("Nip")
.HasColumnName("nip")
.HasColumnType("text");
b.Property<long>("Provider")
.HasColumnName("provider")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_companies");
b.ToTable("companies");
});
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ChangeStateComment")
.HasColumnName("change_state_comment")
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
b.Property<long?>("InternshipId")
.HasColumnName("internship_id")
.HasColumnType("bigint");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.Property<int>("Type")
.HasColumnName("type")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_document");
b.HasIndex("InternshipId")
.HasName("ix_document_internship_id");
b.ToTable("document");
});
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
{
b.Property<long>("DocumentId")
.HasColumnName("document_id")
.HasColumnType("bigint");
b.Property<byte[]>("File")
.HasColumnName("file")
.HasColumnType("bytea");
b.Property<string>("Filename")
.HasColumnName("filename")
.HasColumnType("text");
b.Property<string>("Mime")
.HasColumnName("mime")
.HasColumnType("text");
b.Property<long>("Size")
.HasColumnName("size")
.HasColumnType("bigint");
b.HasKey("DocumentId")
.HasName("pk_document_scan");
b.ToTable("document_scan");
});
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("uuid");
b.Property<long?>("CourseId")
.HasColumnName("course_id")
.HasColumnType("bigint");
b.Property<DateTime>("EditionFinish")
.HasColumnName("edition_finish")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("EditionStart")
.HasColumnName("edition_start")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("ReportingStart")
.HasColumnName("reporting_start")
.HasColumnType("timestamp without time zone");
b.HasKey("Id")
.HasName("pk_editions");
b.HasIndex("CourseId")
.HasName("ix_editions_course_id");
b.ToTable("editions");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Course", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnName("name")
.HasColumnType("text");
b.Property<string>("NameEng")
.HasColumnName("name_eng")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_courses");
b.ToTable("courses");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<Guid?>("EditionId")
.HasColumnName("edition_id")
.HasColumnType("uuid");
b.Property<float?>("Grade")
.HasColumnName("grade")
.HasColumnType("real");
b.Property<long?>("InternshipRegistrationId")
.HasColumnName("internship_registration_id")
.HasColumnType("bigint");
b.Property<long?>("ReportId")
.HasColumnName("report_id")
.HasColumnType("bigint");
b.Property<long?>("StudentId")
.HasColumnName("student_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_internships");
b.HasIndex("EditionId")
.HasName("ix_internships_edition_id");
b.HasIndex("InternshipRegistrationId")
.HasName("ix_internships_internship_registration_id");
b.HasIndex("ReportId")
.HasName("ix_internships_report_id");
b.HasIndex("StudentId")
.HasName("ix_internships_student_id");
b.ToTable("internships");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("BranchAddressId")
.HasColumnName("branch_address_id")
.HasColumnType("bigint");
b.Property<string>("ChangeStateComment")
.HasColumnName("change_state_comment")
.HasColumnType("text");
b.Property<long?>("CompanyId")
.HasColumnName("company_id")
.HasColumnType("bigint");
b.Property<int>("DeclaredHours")
.HasColumnName("declared_hours")
.HasColumnType("integer");
b.Property<DateTime>("End")
.HasColumnName("end")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("Start")
.HasColumnName("start")
.HasColumnType("timestamp without time zone");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.Property<DateTime>("SubmissionDate")
.HasColumnName("submission_date")
.HasColumnType("timestamp without time zone");
b.Property<long?>("TypeId")
.HasColumnName("type_id")
.HasColumnType("bigint");
b.HasKey("Id")
.HasName("pk_internship_registration");
b.HasIndex("BranchAddressId")
.HasName("ix_internship_registration_branch_address_id");
b.HasIndex("CompanyId")
.HasName("ix_internship_registration_company_id");
b.HasIndex("TypeId")
.HasName("ix_internship_registration_type_id");
b.ToTable("internship_registration");
});
modelBuilder.Entity("InternshipSystem.Core.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>("Label")
.HasColumnName("label")
.HasColumnType("text");
b.Property<string>("LabelEng")
.HasColumnName("label_eng")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_internship_types");
b.ToTable("internship_types");
});
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Range")
.HasColumnName("range")
.HasColumnType("integer");
b.Property<string>("SiteAddress")
.HasColumnName("site_address")
.HasColumnType("text");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_report");
b.ToTable("report");
});
modelBuilder.Entity("InternshipSystem.Core.StaticPage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AccessName")
.HasColumnName("access_name")
.HasColumnType("text");
b.Property<string>("Content")
.HasColumnName("content")
.HasColumnType("text");
b.Property<string>("ContentEng")
.HasColumnName("content_eng")
.HasColumnType("text");
b.Property<string>("Title")
.HasColumnName("title")
.HasColumnType("text");
b.Property<string>("TitleEng")
.HasColumnName("title_eng")
.HasColumnType("text");
b.HasKey("Id")
.HasName("pk_static_pages");
b.ToTable("static_pages");
});
modelBuilder.Entity("InternshipSystem.Core.Student", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AlbumNumber")
.HasColumnName("album_number")
.HasColumnType("integer");
b.Property<string>("Course")
.HasColumnName("course")
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnName("email")
.HasColumnType("text");
b.Property<string>("FirstName")
.HasColumnName("first_name")
.HasColumnType("text");
b.Property<string>("LastName")
.HasColumnName("last_name")
.HasColumnType("text");
b.Property<int?>("Semester")
.HasColumnName("semester")
.HasColumnType("integer");
b.HasKey("Id")
.HasName("pk_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 =>
{
b.Property<Guid>("EditionId")
.HasColumnName("edition_id")
.HasColumnType("uuid");
b.Property<long>("InternshipSubjectId")
.HasColumnName("internship_subject_id")
.HasColumnType("bigint");
b.HasKey("EditionId", "InternshipSubjectId")
.HasName("pk_edition_subject");
b.HasIndex("InternshipSubjectId")
.HasName("ix_edition_subject_internship_subject_id");
b.ToTable("edition_subject");
});
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
{
b.Property<long>("InternshipRegistrationId")
.HasColumnName("internship_registration_id")
.HasColumnType("bigint");
b.Property<long>("InternshipSubjectId")
.HasColumnName("internship_subject_id")
.HasColumnType("bigint");
b.HasKey("InternshipRegistrationId", "InternshipSubjectId")
.HasName("pk_program_subject");
b.HasIndex("InternshipSubjectId")
.HasName("ix_program_subject_internship_subject_id");
b.ToTable("program_subject");
});
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
{
b.HasOne("InternshipSystem.Core.Company", null)
.WithMany("Branches")
.HasForeignKey("CompanyId")
.HasConstraintName("fk_branch_office_companies_company_id");
b.OwnsOne("InternshipSystem.Core.BranchAddress", "Address", b1 =>
{
b1.Property<long>("BranchOfficeId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.Property<string>("Building")
.HasColumnName("building")
.HasColumnType("text");
b1.Property<string>("City")
.HasColumnName("city")
.HasColumnType("text");
b1.Property<string>("Country")
.HasColumnName("country")
.HasColumnType("text");
b1.Property<string>("PostalCode")
.HasColumnName("postal_code")
.HasColumnType("text");
b1.Property<string>("Street")
.HasColumnName("street")
.HasColumnType("text");
b1.HasKey("BranchOfficeId")
.HasName("pk_branch_office");
b1.ToTable("branch_office");
b1.WithOwner()
.HasForeignKey("BranchOfficeId")
.HasConstraintName("fk_branch_address_branch_office_branch_office_id");
});
});
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
{
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
.WithMany("Documentation")
.HasForeignKey("InternshipId")
.HasConstraintName("fk_document_internships_internship_id");
});
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
{
b.HasOne("InternshipSystem.Core.Document", "Document")
.WithOne("Scan")
.HasForeignKey("InternshipSystem.Core.DocumentScan", "DocumentId")
.HasConstraintName("fk_document_scan_document_document_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
{
b.HasOne("InternshipSystem.Core.Entity.Course", "Course")
.WithMany()
.HasForeignKey("CourseId")
.HasConstraintName("fk_editions_courses_course_id");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
{
b.HasOne("InternshipSystem.Core.Edition", "Edition")
.WithMany("Internships")
.HasForeignKey("EditionId")
.HasConstraintName("fk_internships_editions_edition_id");
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "InternshipRegistration")
.WithMany()
.HasForeignKey("InternshipRegistrationId")
.HasConstraintName("fk_internships_internship_registration_internship_registration");
b.HasOne("InternshipSystem.Core.Report", "Report")
.WithMany()
.HasForeignKey("ReportId")
.HasConstraintName("fk_internships_report_report_id");
b.HasOne("InternshipSystem.Core.Student", "Student")
.WithMany()
.HasForeignKey("StudentId")
.HasConstraintName("fk_internships_students_student_id");
});
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.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_types_type_id");
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
{
b1.Property<long>("InternshipRegistrationId")
.ValueGeneratedOnAdd()
.HasColumnName("id")
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b1.Property<string>("Email")
.HasColumnName("email")
.HasColumnType("text");
b1.Property<string>("FirstName")
.HasColumnName("first_name")
.HasColumnType("text");
b1.Property<string>("LastName")
.HasColumnName("last_name")
.HasColumnType("text");
b1.Property<string>("PhoneNumber")
.HasColumnName("phone_number")
.HasColumnType("text");
b1.HasKey("InternshipRegistrationId")
.HasName("pk_internship_registration");
b1.ToTable("internship_registration");
b1.WithOwner()
.HasForeignKey("InternshipRegistrationId")
.HasConstraintName("fk_mentor_internship_registration_internship_registration_id");
});
});
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 =>
{
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.Entity.Internship.InternshipRegistration", "Registration")
.WithMany("Subjects")
.HasForeignKey("InternshipRegistrationId")
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
.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
}
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace InternshipSystem.Repository.Migrations
{
public partial class documentChangeStateComment : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "rejection_reason",
table: "document");
migrationBuilder.AddColumn<string>(
name: "change_state_comment",
table: "document",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "change_state_comment",
table: "document");
migrationBuilder.AddColumn<string>(
name: "rejection_reason",
table: "document",
type: "text",
nullable: true);
}
}
}

View File

@ -78,6 +78,10 @@ namespace InternshipSystem.Repository.Migrations
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ChangeStateComment")
.HasColumnName("change_state_comment")
.HasColumnType("text");
b.Property<string>("Description")
.HasColumnName("description")
.HasColumnType("text");
@ -86,10 +90,6 @@ namespace InternshipSystem.Repository.Migrations
.HasColumnName("internship_id")
.HasColumnType("bigint");
b.Property<string>("RejectionReason")
.HasColumnName("rejection_reason")
.HasColumnType("text");
b.Property<int>("State")
.HasColumnName("state")
.HasColumnType("integer");