diff --git a/backend/Infrastructure/Repositories/ContexRepository.cs b/backend/Infrastructure/Repositories/ContexRepository.cs index fbdc91e..5b01a14 100644 --- a/backend/Infrastructure/Repositories/ContexRepository.cs +++ b/backend/Infrastructure/Repositories/ContexRepository.cs @@ -26,6 +26,7 @@ public class ContexRepository : DbContext public DbSet StudentCourses { get; set; } = null!; public DbSet Orientations { get; set; } = null!; public DbSet ResearchLines { get; set; } = null!; + public DbSet Qualis { get; set; } = null!; /// /// Initializes a new instance of the class with the specified options. @@ -33,8 +34,7 @@ public class ContexRepository : DbContext /// The options for configuring the database context. public ContexRepository(DbContextOptions options) : base(options) - { - } + { } /// protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/backend/Infrastructure/Repositories/IRepository.cs b/backend/Infrastructure/Repositories/IRepository.cs index c280100..3272ce5 100644 --- a/backend/Infrastructure/Repositories/IRepository.cs +++ b/backend/Infrastructure/Repositories/IRepository.cs @@ -9,6 +9,8 @@ using saga.Infrastructure.Repositories.Student; using saga.Infrastructure.Repositories.StudentCourse; using saga.Infrastructure.Repositories.User; +using saga.Infrastructure.Repositories.PondocQualis; + namespace saga.Infrastructure.Repositories { @@ -72,6 +74,11 @@ public interface IRepository /// IResearchLineRepository ResearchLine { get; } + /// + /// Gets the repository for Pondoc Qualis entities. + /// + IPondocQualisRepository PondocQualis { get; } + /// /// Commits the pending changes asynchronously. /// diff --git a/backend/Infrastructure/Repositories/PondocQualis/IPondocQualisRepository.cs b/backend/Infrastructure/Repositories/PondocQualis/IPondocQualisRepository.cs new file mode 100644 index 0000000..1f2d9bc --- /dev/null +++ b/backend/Infrastructure/Repositories/PondocQualis/IPondocQualisRepository.cs @@ -0,0 +1,8 @@ +using saga.Models.Entities; + +namespace saga.Infrastructure.Repositories.PondocQualis +{ + /// + public interface IPondocQualisRepository : IBaseRepository + { } +} diff --git a/backend/Infrastructure/Repositories/PondocQualis/PondocQualisRepository.cs b/backend/Infrastructure/Repositories/PondocQualis/PondocQualisRepository.cs new file mode 100644 index 0000000..5f728e3 --- /dev/null +++ b/backend/Infrastructure/Repositories/PondocQualis/PondocQualisRepository.cs @@ -0,0 +1,14 @@ +using System.Linq.Expressions; +using saga.Infrastructure.Extensions; +using saga.Models.Entities; +using Microsoft.EntityFrameworkCore; + +namespace saga.Infrastructure.Repositories.PondocQualis +{ + /// + public class PondocQualisRepository : BaseRepository, IPondocQualisRepository + { + public PondocQualisRepository(ContexRepository dbContext) : base(dbContext) + { } + } +} diff --git a/backend/Infrastructure/Repositories/Repository.cs b/backend/Infrastructure/Repositories/Repository.cs index 07b8c38..c49e513 100644 --- a/backend/Infrastructure/Repositories/Repository.cs +++ b/backend/Infrastructure/Repositories/Repository.cs @@ -10,6 +10,7 @@ using saga.Infrastructure.Repositories.Student; using saga.Infrastructure.Repositories.StudentCourse; using saga.Infrastructure.Repositories.User; +using saga.Infrastructure.Repositories.PondocQualis; namespace saga.Infrastructure.Repositories { @@ -73,8 +74,12 @@ public Repository(ContexRepository? dbContext, IUserContext userContext) /// public IOrientationRepository Orientation => new OrientationRepository(_dbContext, _userContext); + /// public IResearchLineRepository ResearchLine => new ResearchLineRepository(_dbContext); + /// + public IPondocQualisRepository PondocQualis => new PondocQualisRepository(_dbContext); + /// public async Task CommitAsync() { diff --git a/backend/Migrations/20230930000630_PondocQualis.Designer.cs b/backend/Migrations/20230930000630_PondocQualis.Designer.cs new file mode 100644 index 0000000..88cf643 --- /dev/null +++ b/backend/Migrations/20230930000630_PondocQualis.Designer.cs @@ -0,0 +1,571 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using saga.Infrastructure.Repositories; + +#nullable disable + +namespace saga.Migrations +{ + [DbContext(typeof(ContexRepository))] + [Migration("20230930000630_PondocQualis")] + partial class PondocQualis + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("saga.Models.Entities.CourseEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("Concept") + .HasColumnType("text"); + + b.Property("CourseUnique") + .IsRequired() + .HasColumnType("text"); + + b.Property("Credits") + .HasColumnType("integer"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsElective") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Courses"); + }); + + modelBuilder.Entity("saga.Models.Entities.ExtensionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("NumberOfDays") + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("uuid"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.ToTable("Extensions"); + }); + + modelBuilder.Entity("saga.Models.Entities.ExternalResearcherEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Institution") + .HasColumnType("text"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("ExternalResearchers"); + }); + + modelBuilder.Entity("saga.Models.Entities.OrientationEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CoorientatorId") + .HasColumnType("uuid"); + + b.Property("Dissertation") + .HasColumnType("text"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("ProfessorId") + .HasColumnType("uuid"); + + b.Property("ProjectId") + .HasColumnType("uuid"); + + b.Property("StudentId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CoorientatorId"); + + b.HasIndex("ProfessorId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("StudentId"); + + b.ToTable("Orientations"); + }); + + modelBuilder.Entity("saga.Models.Entities.PondocQualisEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("issn") + .HasColumnType("text"); + + b.Property("nome") + .HasColumnType("text"); + + b.Property("qualis") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Qualis"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProfessorEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Siape") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Professors"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProfessorProjectEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("ProfessorId") + .HasColumnType("uuid"); + + b.Property("ProjectId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProfessorId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProfessorProjects"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProjectEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ResearchLineId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ResearchLineId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("saga.Models.Entities.ResearchLineEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ResearchLines"); + }); + + modelBuilder.Entity("saga.Models.Entities.StudentCourseEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CourseId") + .HasColumnType("uuid"); + + b.Property("Grade") + .HasColumnType("character(1)"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StudentId") + .HasColumnType("uuid"); + + b.Property("Trimester") + .HasColumnType("integer"); + + b.Property("Year") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.HasIndex("StudentId"); + + b.ToTable("StudentCourses"); + }); + + modelBuilder.Entity("saga.Models.Entities.StudentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CPF") + .HasColumnType("text"); + + b.Property("DateOfBirth") + .HasColumnType("timestamp with time zone"); + + b.Property("EntryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("GraduationYear") + .HasColumnType("integer"); + + b.Property("InstitutionType") + .HasColumnType("integer"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LastNotification") + .HasColumnType("timestamp with time zone"); + + b.Property("OrientationId") + .HasColumnType("uuid"); + + b.Property("Proficiency") + .HasColumnType("boolean"); + + b.Property("ProjectDefenceDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ProjectId") + .HasColumnType("uuid"); + + b.Property("ProjectQualificationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Registration") + .IsRequired() + .HasColumnType("text"); + + b.Property("RegistrationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Scholarship") + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UndergraduateArea") + .HasColumnType("integer"); + + b.Property("UndergraduateCourse") + .HasColumnType("text"); + + b.Property("UndergraduateInstitution") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OrientationId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("saga.Models.Entities.UserEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Cpf") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("Role") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("saga.Models.Entities.ExtensionEntity", b => + { + b.HasOne("saga.Models.Entities.UserEntity", "Student") + .WithMany() + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("saga.Models.Entities.ExternalResearcherEntity", b => + { + b.HasOne("saga.Models.Entities.UserEntity", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("saga.Models.Entities.OrientationEntity", b => + { + b.HasOne("saga.Models.Entities.UserEntity", "Coorientator") + .WithMany() + .HasForeignKey("CoorientatorId"); + + b.HasOne("saga.Models.Entities.UserEntity", "Professor") + .WithMany() + .HasForeignKey("ProfessorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("saga.Models.Entities.ProjectEntity", "Project") + .WithMany("Orientations") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("saga.Models.Entities.UserEntity", "Student") + .WithMany() + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Coorientator"); + + b.Navigation("Professor"); + + b.Navigation("Project"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProfessorEntity", b => + { + b.HasOne("saga.Models.Entities.UserEntity", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProfessorProjectEntity", b => + { + b.HasOne("saga.Models.Entities.UserEntity", "Professor") + .WithMany() + .HasForeignKey("ProfessorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("saga.Models.Entities.ProjectEntity", "Project") + .WithMany("ProfessorProjects") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Professor"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProjectEntity", b => + { + b.HasOne("saga.Models.Entities.ResearchLineEntity", "ResearchLine") + .WithMany("Projects") + .HasForeignKey("ResearchLineId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ResearchLine"); + }); + + modelBuilder.Entity("saga.Models.Entities.StudentCourseEntity", b => + { + b.HasOne("saga.Models.Entities.CourseEntity", "Course") + .WithMany() + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("saga.Models.Entities.StudentEntity", "Student") + .WithMany("StudentCourses") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Course"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("saga.Models.Entities.StudentEntity", b => + { + b.HasOne("saga.Models.Entities.OrientationEntity", "Orientation") + .WithMany() + .HasForeignKey("OrientationId"); + + b.HasOne("saga.Models.Entities.ProjectEntity", "Project") + .WithMany("Students") + .HasForeignKey("ProjectId"); + + b.HasOne("saga.Models.Entities.UserEntity", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Orientation"); + + b.Navigation("Project"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("saga.Models.Entities.ProjectEntity", b => + { + b.Navigation("Orientations"); + + b.Navigation("ProfessorProjects"); + + b.Navigation("Students"); + }); + + modelBuilder.Entity("saga.Models.Entities.ResearchLineEntity", b => + { + b.Navigation("Projects"); + }); + + modelBuilder.Entity("saga.Models.Entities.StudentEntity", b => + { + b.Navigation("StudentCourses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/Migrations/20230930000630_PondocQualis.cs b/backend/Migrations/20230930000630_PondocQualis.cs new file mode 100644 index 0000000..367867d --- /dev/null +++ b/backend/Migrations/20230930000630_PondocQualis.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace saga.Migrations +{ + /// + public partial class PondocQualis : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Qualis", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + issn = table.Column(type: "text", nullable: true), + nome = table.Column(type: "text", nullable: true), + qualis = table.Column(type: "text", nullable: true), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Qualis", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Qualis"); + } + } +} diff --git a/backend/Migrations/ContexRepositoryModelSnapshot.cs b/backend/Migrations/ContexRepositoryModelSnapshot.cs index 632b38b..9f247c4 100644 --- a/backend/Migrations/ContexRepositoryModelSnapshot.cs +++ b/backend/Migrations/ContexRepositoryModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("ProductVersion", "7.0.11") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -143,6 +143,29 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Orientations"); }); + modelBuilder.Entity("saga.Models.Entities.PondocQualisEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("issn") + .HasColumnType("text"); + + b.Property("nome") + .HasColumnType("text"); + + b.Property("qualis") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Qualis"); + }); + modelBuilder.Entity("saga.Models.Entities.ProfessorEntity", b => { b.Property("Id") diff --git a/backend/Models/Entities/PondocQualisEntity.cs b/backend/Models/Entities/PondocQualisEntity.cs new file mode 100644 index 0000000..ab17fa2 --- /dev/null +++ b/backend/Models/Entities/PondocQualisEntity.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations.Schema; + + +namespace saga.Models.Entities; + +[Table("Qualis")] +public record PondocQualisEntity : BaseEntity +{ + /// + /// Periodical/conference document. + /// + public string? issn { get; set; } + + /// + /// Periodical/conference name. + /// + public string? nome { get; set; } + + /// + /// Brazilian periodical/conference classification. + /// + public string? qualis { get; set; } +} diff --git a/backend/saga.csproj b/backend/saga.csproj index e668523..6f52876 100644 --- a/backend/saga.csproj +++ b/backend/saga.csproj @@ -19,13 +19,14 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + - +