rest
This commit is contained in:
parent
5318adcd2f
commit
2178cde4dd
10
src/InternshipSystem.Api/Result/EditionReportSchemaResult.cs
Normal file
10
src/InternshipSystem.Api/Result/EditionReportSchemaResult.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using InternshipSystem.Core.Entity;
|
||||||
|
|
||||||
|
namespace InternshipSystem.Api.Result
|
||||||
|
{
|
||||||
|
public class EditionReportSchemaResult
|
||||||
|
{
|
||||||
|
public List<ReportField> Fields { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -113,7 +113,9 @@ namespace InternshipSystem.Repository
|
|||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<ReportField>()
|
modelBuilder.Entity<ReportField>()
|
||||||
.HasDiscriminator(r => r.FieldType);
|
.HasDiscriminator<string>("field_discrimnator")
|
||||||
|
.HasValue<ReportField>("single")
|
||||||
|
.HasValue<ReportChoiceField>("choice");
|
||||||
|
|
||||||
modelBuilder.Entity<ReportChoiceField>()
|
modelBuilder.Entity<ReportChoiceField>()
|
||||||
.Property(r => r.Choices)
|
.Property(r => r.Choices)
|
||||||
|
@ -10,8 +10,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace InternshipSystem.Repository.Migrations
|
namespace InternshipSystem.Repository.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(InternshipDbContext))]
|
[DbContext(typeof(InternshipDbContext))]
|
||||||
[Migration("20210109193303_init")]
|
[Migration("20210110161858_Init")]
|
||||||
partial class init
|
partial class Init
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -344,6 +344,47 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship_types");
|
b.ToTable("internship_types");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportField", 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<int>("FieldType")
|
||||||
|
.HasColumnName("field_type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Label")
|
||||||
|
.HasColumnName("label")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("LabelEng")
|
||||||
|
.HasColumnName("label_eng")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("field_discrimnator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("field_discrimnator")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_report_fields");
|
||||||
|
|
||||||
|
b.ToTable("report_fields");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("field_discrimnator").HasValue("single");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -352,18 +393,14 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnType("bigint")
|
.HasColumnType("bigint")
|
||||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
.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")
|
b.Property<int>("State")
|
||||||
.HasColumnName("state")
|
.HasColumnName("state")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnName("value")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_report");
|
.HasName("pk_report");
|
||||||
|
|
||||||
@ -499,6 +536,36 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("program_subject");
|
b.ToTable("program_subject");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("EditionId")
|
||||||
|
.HasColumnName("edition_id")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("ReportFieldId")
|
||||||
|
.HasColumnName("report_field_id")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("EditionId", "ReportFieldId")
|
||||||
|
.HasName("pk_report_field_edition");
|
||||||
|
|
||||||
|
b.HasIndex("ReportFieldId")
|
||||||
|
.HasName("ix_report_field_edition_report_field_id");
|
||||||
|
|
||||||
|
b.ToTable("report_field_edition");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportChoiceField", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("InternshipSystem.Core.Entity.ReportField");
|
||||||
|
|
||||||
|
b.Property<string>("Choices")
|
||||||
|
.HasColumnName("choices")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("choice");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Company", null)
|
b.HasOne("InternshipSystem.Core.Company", null)
|
||||||
@ -696,6 +763,23 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
|
.WithMany("ReportSchema")
|
||||||
|
.HasForeignKey("EditionId")
|
||||||
|
.HasConstraintName("fk_report_field_edition_editions_edition_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Entity.ReportField", "Field")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ReportFieldId")
|
||||||
|
.HasConstraintName("fk_report_field_edition_report_fields_report_field_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
namespace InternshipSystem.Repository.Migrations
|
namespace InternshipSystem.Repository.Migrations
|
||||||
{
|
{
|
||||||
public partial class init : Migration
|
public partial class Init : Migration
|
||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
@ -74,14 +74,32 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
id = table.Column<long>(nullable: false)
|
id = table.Column<long>(nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
state = table.Column<int>(nullable: false),
|
state = table.Column<int>(nullable: false),
|
||||||
range = table.Column<int>(nullable: false),
|
value = table.Column<string>(type: "jsonb", nullable: true)
|
||||||
site_address = table.Column<string>(nullable: true)
|
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("pk_report", x => x.id);
|
table.PrimaryKey("pk_report", x => x.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "report_fields",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<long>(nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
label = table.Column<string>(nullable: true),
|
||||||
|
label_eng = table.Column<string>(nullable: true),
|
||||||
|
description = table.Column<string>(nullable: true),
|
||||||
|
description_eng = table.Column<string>(nullable: true),
|
||||||
|
field_type = table.Column<int>(nullable: false),
|
||||||
|
field_discrimnator = table.Column<string>(nullable: false),
|
||||||
|
choices = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_report_fields", x => x.id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "static_pages",
|
name: "static_pages",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -253,6 +271,30 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "report_field_edition",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
edition_id = table.Column<Guid>(nullable: false),
|
||||||
|
report_field_id = table.Column<long>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_report_field_edition", x => new { x.edition_id, x.report_field_id });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_report_field_edition_editions_edition_id",
|
||||||
|
column: x => x.edition_id,
|
||||||
|
principalTable: "editions",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_report_field_edition_report_fields_report_field_id",
|
||||||
|
column: x => x.report_field_id,
|
||||||
|
principalTable: "report_fields",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "internships",
|
name: "internships",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -426,6 +468,11 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
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.CreateIndex(
|
||||||
|
name: "ix_report_field_edition_report_field_id",
|
||||||
|
table: "report_field_edition",
|
||||||
|
column: "report_field_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
@ -442,6 +489,9 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "program_subject");
|
name: "program_subject");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "report_field_edition");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "static_pages");
|
name: "static_pages");
|
||||||
|
|
||||||
@ -451,6 +501,9 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internship_subject");
|
name: "internship_subject");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "report_fields");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internships");
|
name: "internships");
|
||||||
|
|
@ -342,6 +342,47 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship_types");
|
b.ToTable("internship_types");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportField", 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<int>("FieldType")
|
||||||
|
.HasColumnName("field_type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Label")
|
||||||
|
.HasColumnName("label")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("LabelEng")
|
||||||
|
.HasColumnName("label_eng")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("field_discrimnator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("field_discrimnator")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_report_fields");
|
||||||
|
|
||||||
|
b.ToTable("report_fields");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("field_discrimnator").HasValue("single");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -350,18 +391,14 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnType("bigint")
|
.HasColumnType("bigint")
|
||||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
.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")
|
b.Property<int>("State")
|
||||||
.HasColumnName("state")
|
.HasColumnName("state")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnName("value")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_report");
|
.HasName("pk_report");
|
||||||
|
|
||||||
@ -497,6 +534,36 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("program_subject");
|
b.ToTable("program_subject");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("EditionId")
|
||||||
|
.HasColumnName("edition_id")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<long>("ReportFieldId")
|
||||||
|
.HasColumnName("report_field_id")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("EditionId", "ReportFieldId")
|
||||||
|
.HasName("pk_report_field_edition");
|
||||||
|
|
||||||
|
b.HasIndex("ReportFieldId")
|
||||||
|
.HasName("ix_report_field_edition_report_field_id");
|
||||||
|
|
||||||
|
b.ToTable("report_field_edition");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportChoiceField", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("InternshipSystem.Core.Entity.ReportField");
|
||||||
|
|
||||||
|
b.Property<string>("Choices")
|
||||||
|
.HasColumnName("choices")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("choice");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Company", null)
|
b.HasOne("InternshipSystem.Core.Company", null)
|
||||||
@ -694,6 +761,23 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
|
.WithMany("ReportSchema")
|
||||||
|
.HasForeignKey("EditionId")
|
||||||
|
.HasConstraintName("fk_report_field_edition_editions_edition_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Entity.ReportField", "Field")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ReportFieldId")
|
||||||
|
.HasConstraintName("fk_report_field_edition_report_fields_report_field_id")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user