Skip to content

Commit

Permalink
Merge pull request #90 from CSCfi/qa
Browse files Browse the repository at this point in the history
Release 1.28
  • Loading branch information
sarkikos authored Oct 25, 2023
2 parents fcafb74 + 64b4c54 commit 8229f90
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 259 deletions.
2 changes: 1 addition & 1 deletion aspnetcore/src/ApiModels/CodeList/CountryCode.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace ResearchFi.CodeList;

/// <summary>
/// Countriy codes
/// Country codes
///
/// http://uri.suomi.fi/codelist/jhs/valtio_1_20120101
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/src/ApiModels/CodeList/FieldOfArt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
///
/// http://uri.suomi.fi/codelist/research/Taiteenala
/// </summary>
public class FieldOfArts : CodeList
public class FieldOfArt : CodeList
{
}
10 changes: 10 additions & 0 deletions aspnetcore/src/ApiModels/CodeList/ThesisType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ResearchFi.CodeList;

/// <summary>
/// Thesis types
///
/// http://uri.suomi.fi/codelist/research/Opinnaytetyyppi
/// </summary>
public class ThesisType : CodeList
{
}
24 changes: 12 additions & 12 deletions aspnetcore/src/ApiModels/Publication/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public class Publication
/// </summary>
public PublicationType? Type { get; set; }

/// <summary>
/// Thesis type
///
/// http://uri.suomi.fi/codelist/research/Opinnaytetyyppi
/// </summary>
public ThesisType? ThesisType { get; set; }

/// <summary>
/// Journal name
/// </summary>
Expand Down Expand Up @@ -179,11 +186,11 @@ public class Publication
public List<FieldOfScience>? FieldsOfScience { get; set; }

/// <summary>
/// Areas of guidance of the MEC
/// Fields of art
///
/// https://wiki.eduuni.fi/display/cscsuorat/7.2+OKM%3An+ohjauksen+alat+2022
/// http://uri.suomi.fi/codelist/research/Taiteenala
/// </summary>
public List<FieldOfEducation>? FieldsOfEducation { get; set; }
public List<FieldOfArt>? FieldsOfArt { get; set; }

/// <summary>
/// Keywords
Expand Down Expand Up @@ -250,13 +257,6 @@ public class Publication
/// </summary>
public License? License { get; set; }

/// <summary>
/// Field of art
///
/// http://uri.suomi.fi/codelist/research/Taiteenala
/// </summary>
public List<FieldOfArts>? FieldsOfArts { get; set; }

/// <summary>
/// Art publications type category
///
Expand All @@ -272,10 +272,10 @@ public class Publication
/// <summary>
/// Creation time
/// </summary>
public DateTime Created { get; set; }
public DateTime? Created { get; set; }

/// <summary>
/// Modification time
/// </summary>
public DateTime Modified { get; set; }
public DateTime? Modified { get; set; }
}
148 changes: 17 additions & 131 deletions aspnetcore/src/DatabaseContext/ApiDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public ApiDbContext(DbContextOptions<ApiDbContext> options)
public virtual DbSet<DimEvent> DimEvents { get; set; } = null!;
public virtual DbSet<DimExternalService> DimExternalServices { get; set; } = null!;
public virtual DbSet<DimFieldDisplaySetting> DimFieldDisplaySettings { get; set; } = null!;
public virtual DbSet<DimFieldOfArt> DimFieldOfArts { get; set; } = null!;
public virtual DbSet<DimFieldOfEducation> DimFieldOfEducations { get; set; } = null!;
public virtual DbSet<DimFundingDecision> DimFundingDecisions { get; set; } = null!;
public virtual DbSet<DimGeo> DimGeos { get; set; } = null!;
public virtual DbSet<DimIdentifierlessDatum> DimIdentifierlessData { get; set; } = null!;
Expand Down Expand Up @@ -1056,118 +1054,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
});
});

modelBuilder.Entity<DimFieldOfArt>(entity =>
{
entity.ToTable("dim_field_of_art");

entity.Property(e => e.Id).HasColumnName("id");

entity.Property(e => e.Created)
.HasColumnType("datetime")
.HasColumnName("created");

entity.Property(e => e.FieldId)
.HasMaxLength(255)
.HasColumnName("field_id");

entity.Property(e => e.Modified)
.HasColumnType("datetime")
.HasColumnName("modified");

entity.Property(e => e.NameEn)
.HasMaxLength(255)
.HasColumnName("name_en");

entity.Property(e => e.NameFi)
.HasMaxLength(255)
.HasColumnName("name_fi");

entity.Property(e => e.NameSv)
.HasMaxLength(255)
.HasColumnName("name_sv");

entity.Property(e => e.SourceDescription)
.HasMaxLength(255)
.HasColumnName("source_description");

entity.Property(e => e.SourceId)
.HasMaxLength(255)
.HasColumnName("source_id");

entity.HasMany(d => d.DimPublications)
.WithMany(p => p.DimFieldOfArts)
.UsingEntity<Dictionary<string, object>>(
"BrFieldOfArtDimPublication",
l => l.HasOne<DimPublication>().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o505394"),
r => r.HasOne<DimFieldOfArt>().WithMany().HasForeignKey("DimFieldOfArtId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o978876"),
j =>
{
j.HasKey("DimFieldOfArtId", "DimPublicationId").HasName("PK__br_field__809A87CDC51CB6D5");

j.ToTable("br_field_of_art_dim_publication");

j.IndexerProperty<int>("DimFieldOfArtId").HasColumnName("dim_field_of_art_id");

j.IndexerProperty<int>("DimPublicationId").HasColumnName("dim_publication_id");
});
});

modelBuilder.Entity<DimFieldOfEducation>(entity =>
{
entity.ToTable("dim_field_of_education");

entity.Property(e => e.Id).HasColumnName("id");

entity.Property(e => e.Created)
.HasColumnType("datetime")
.HasColumnName("created");

entity.Property(e => e.FieldId)
.HasMaxLength(255)
.HasColumnName("field_id");

entity.Property(e => e.Modified)
.HasColumnType("datetime")
.HasColumnName("modified");

entity.Property(e => e.NameEn)
.HasMaxLength(255)
.HasColumnName("name_en");

entity.Property(e => e.NameFi)
.HasMaxLength(255)
.HasColumnName("name_fi");

entity.Property(e => e.NameSv)
.HasMaxLength(255)
.HasColumnName("name_sv");

entity.Property(e => e.SourceDescription)
.HasMaxLength(255)
.HasColumnName("source_description");

entity.Property(e => e.SourceId)
.HasMaxLength(255)
.HasColumnName("source_id");

entity.HasMany(d => d.DimPublications)
.WithMany(p => p.DimFieldOfEducations)
.UsingEntity<Dictionary<string, object>>(
"BrFieldOfEducationDimPublication",
l => l.HasOne<DimPublication>().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o449658"),
r => r.HasOne<DimFieldOfEducation>().WithMany().HasForeignKey("DimFieldOfEducationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o983513"),
j =>
{
j.HasKey("DimFieldOfEducationId", "DimPublicationId").HasName("PK__br_field__6E377B2CD08233DA");

j.ToTable("br_field_of_education_dim_publication");

j.IndexerProperty<int>("DimFieldOfEducationId").HasColumnName("dim_field_of_education_id");

j.IndexerProperty<int>("DimPublicationId").HasColumnName("dim_publication_id");
});
});

modelBuilder.Entity<DimFundingDecision>(entity =>
{
entity.ToTable("dim_funding_decision");
Expand Down Expand Up @@ -1312,23 +1198,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKdim_fundin974924");

entity.HasMany(d => d.DimFieldOfArts)
.WithMany(p => p.DimFundingDecisions)
.UsingEntity<Dictionary<string, object>>(
"BrFundingDecisionDimFieldOfArt",
l => l.HasOne<DimFieldOfArt>().WithMany().HasForeignKey("DimFieldOfArtId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_funding154428"),
r => r.HasOne<DimFundingDecision>().WithMany().HasForeignKey("DimFundingDecisionId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_funding281737"),
j =>
{
j.HasKey("DimFundingDecisionId", "DimFieldOfArtId").HasName("PK__br_fundi__07CB586D2869F096");

j.ToTable("br_funding_decision_dim_field_of_art");

j.IndexerProperty<int>("DimFundingDecisionId").HasColumnName("dim_funding_decision_id");

j.IndexerProperty<int>("DimFieldOfArtId").HasColumnName("dim_field_of_art_id");
});

entity.HasMany(d => d.DimFundingDecisionFroms)
.WithMany(p => p.DimFundingDecisionTos)
.UsingEntity<Dictionary<string, object>>(
Expand Down Expand Up @@ -3296,6 +3165,23 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasForeignKey(d => d.DimReferencedataId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_dim_referencedata_dim_referencedata");

entity.HasMany(d => d.DimPublicationsNavigation)
.WithMany(p => p.DimReferencedataNavigation)
.UsingEntity<Dictionary<string, object>>(
"FactDimReferencedataFieldOfArt",
l => l.HasOne<DimPublication>().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("field_of_art_code"),
r => r.HasOne<DimReferencedatum>().WithMany().HasForeignKey("DimReferencedataId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKfact_dim_r130466"),
j =>
{
j.HasKey("DimReferencedataId", "DimPublicationId").HasName("PK__fact_dim__FD761943629A8020");

j.ToTable("fact_dim_referencedata_field_of_art");

j.IndexerProperty<int>("DimReferencedataId").HasColumnName("dim_referencedata_id");

j.IndexerProperty<int>("DimPublicationId").HasColumnName("dim_publication_id");
});
});

modelBuilder.Entity<DimRegisteredDataSource>(entity =>
Expand Down
2 changes: 0 additions & 2 deletions aspnetcore/src/DatabaseContext/Entities/DimFundingDecision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public DimFundingDecision()
FactDimReferencedataFieldOfSciences = new HashSet<FactDimReferencedataFieldOfScience>();
FactFieldValues = new HashSet<FactFieldValue>();
InverseDimFundingDecisionIdParentDecisionNavigation = new HashSet<DimFundingDecision>();
DimFieldOfArts = new HashSet<DimFieldOfArt>();
DimFundingDecisionFroms = new HashSet<DimFundingDecision>();
DimFundingDecisionFromsNavigation = new HashSet<DimFundingDecision>();
DimFundingDecisionTos = new HashSet<DimFundingDecision>();
Expand Down Expand Up @@ -75,7 +74,6 @@ public DimFundingDecision()
public virtual ICollection<FactFieldValue> FactFieldValues { get; set; }
public virtual ICollection<DimFundingDecision> InverseDimFundingDecisionIdParentDecisionNavigation { get; set; }

public virtual ICollection<DimFieldOfArt> DimFieldOfArts { get; set; }
public virtual ICollection<DimFundingDecision> DimFundingDecisionFroms { get; set; }
public virtual ICollection<DimFundingDecision> DimFundingDecisionFromsNavigation { get; set; }
public virtual ICollection<DimFundingDecision> DimFundingDecisionTos { get; set; }
Expand Down
6 changes: 2 additions & 4 deletions aspnetcore/src/DatabaseContext/Entities/DimPublication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ public DimPublication()
FactContributions = new HashSet<FactContribution>();
FactDimReferencedataFieldOfSciences = new HashSet<FactDimReferencedataFieldOfScience>();
FactFieldValues = new HashSet<FactFieldValue>();
DimFieldOfArts = new HashSet<DimFieldOfArt>();
DimFieldOfEducations = new HashSet<DimFieldOfEducation>();
DimKeywords = new HashSet<DimKeyword>();
DimReferencedata = new HashSet<DimReferencedatum>();
DimReferencedataNavigation = new HashSet<DimReferencedatum>();
}

public int Id { get; set; }
Expand Down Expand Up @@ -94,9 +93,8 @@ public DimPublication()
public virtual ICollection<FactDimReferencedataFieldOfScience> FactDimReferencedataFieldOfSciences { get; set; }
public virtual ICollection<FactFieldValue> FactFieldValues { get; set; }

public virtual ICollection<DimFieldOfArt> DimFieldOfArts { get; set; }
public virtual ICollection<DimFieldOfEducation> DimFieldOfEducations { get; set; }
public virtual ICollection<DimKeyword> DimKeywords { get; set; }
public virtual ICollection<DimReferencedatum> DimReferencedata { get; set; }
public virtual ICollection<DimReferencedatum> DimReferencedataNavigation { get; set; }
}
}
2 changes: 2 additions & 0 deletions aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public DimReferencedatum()
InverseDimReferencedata = new HashSet<DimReferencedatum>();
DimCallProgrammes = new HashSet<DimCallProgramme>();
DimPublications = new HashSet<DimPublication>();
DimPublicationsNavigation = new HashSet<DimPublication>();
DimResearchDatasets = new HashSet<DimResearchDataset>();
}

Expand Down Expand Up @@ -96,6 +97,7 @@ public DimReferencedatum()

public virtual ICollection<DimCallProgramme> DimCallProgrammes { get; set; }
public virtual ICollection<DimPublication> DimPublications { get; set; }
public virtual ICollection<DimPublication> DimPublicationsNavigation { get; set; }
public virtual ICollection<DimResearchDataset> DimResearchDatasets { get; set; }
}
}
2 changes: 1 addition & 1 deletion aspnetcore/src/Interface/Interface.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>fb1549e6-e7b1-45b6-91cb-dfebd31eadb8</UserSecretsId>
<UserSecretsId>b73bde99-06bf-406c-8e60-eb475cb00acc</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\src\Api</DockerfileContext>
<DockerfileFile>..\..\openshift\api\Dockerfile</DockerfileFile>
Expand Down
3 changes: 2 additions & 1 deletion aspnetcore/src/Interface/Maps/PublicationProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public PublicationProfile()
CreateMap<Service.Models.ReferenceData, JufoClass>();
CreateMap<Service.Models.ReferenceData, FieldOfScience>();
CreateMap<Service.Models.ReferenceData, FieldOfEducation>();
CreateMap<Service.Models.ReferenceData, FieldOfArts>();
CreateMap<Service.Models.ReferenceData, FieldOfArt>();
CreateMap<Service.Models.ReferenceData, ArticleType>();
CreateMap<Service.Models.ReferenceData, ArtPublicationTypeCategory>();
CreateMap<Service.Models.ReferenceData, PublicationStatus>();
Expand All @@ -49,6 +49,7 @@ public PublicationProfile()
CreateMap<Service.Models.ReferenceData, SelfArchiveVersion>();
CreateMap<Service.Models.ReferenceData, OpenAccess>();
CreateMap<Service.Models.ReferenceData, PublisherOpenAccess>();
CreateMap<Service.Models.ReferenceData, ThesisType>();
CreateMap<Service.Models.Keyword, Keyword>();
}
}
5 changes: 3 additions & 2 deletions aspnetcore/src/Repositories/Maps/PublicationProfile.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CSC.PublicApi.DatabaseContext.Entities;
using CSC.PublicApi.Service.Models;
using CSC.PublicApi.Service.Models.Publication;
using Microsoft.Data.SqlClient;
using FactContribution = CSC.PublicApi.Service.Models.Publication.FactContribution;
using Name = CSC.PublicApi.Service.Models.Publication.Name;
using Profile = AutoMapper.Profile;
Expand Down Expand Up @@ -32,6 +33,7 @@ public PublicationProfile()
.ForMember(dst => dst.DatabasePeerReviewed, opt => opt.MapFrom(src => src.PeerReviewed))
.ForMember(dst => dst.TargetAudience, opt => opt.MapFrom(src => src.TargetAudienceCodeNavigation))
.ForMember(dst => dst.Type, opt => opt.MapFrom(src => src.PublicationTypeCodeNavigation))
.ForMember(dst => dst.ThesisType, opt => opt.MapFrom(src => src.ThesisTypeCodeNavigation))
.ForMember(dst => dst.JournalName, opt => opt.MapFrom(src => src.JournalName))
.ForMember(dst => dst.IssueNumber, opt => opt.MapFrom(src => src.IssueNumber))
.ForMember(dst => dst.ConferenceName, opt => opt.MapFrom(src => src.ConferenceName))
Expand All @@ -53,7 +55,7 @@ public PublicationProfile()
.ForMember(dst => dst.Doi, opt => opt.MapFrom(src => src.Doi))
.ForMember(dst => dst.DoiHandle, opt => opt.MapFrom(src => src.DoiHandle))
.ForMember(dst => dst.FieldsOfScience, opt => opt.MapFrom(src => src.FactDimReferencedataFieldOfSciences.Select(f => f.DimReferencedata)))
.ForMember(dst => dst.FieldsOfEducation, opt => opt.MapFrom(src => src.DimFieldOfEducations))
.ForMember(dst => dst.FieldsOfArt, opt => opt.MapFrom(src => src.DimReferencedataNavigation))
.ForMember(dst => dst.Keywords, opt => opt.MapFrom(src => src.DimKeywords))
.ForMember(dst => dst.InternationalPublication, opt => opt.MapFrom(src => src.InternationalPublication != 9 ? src.InternationalPublication == 1 : (bool?)null)) // 0 = kotim. 1 ulkom. 9 = ei tietoa.
.ForMember(dst => dst.Country, opt => opt.MapFrom(src => src.PublicationCountryCodeNavigation))
Expand All @@ -66,7 +68,6 @@ public PublicationProfile()
.ForMember(dst => dst.License, opt => opt.MapFrom(src => src.LicenseCodeNavigation.Id != -1 ? src.LicenseCodeNavigation : null))
.ForMember(dst => dst.Preprint, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == PreprintType)))
.ForMember(dst => dst.SelfArchived, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == SelfArchivedType)))
.ForMember(dst => dst.FieldsOfArts, opt => opt.MapFrom(src => src.DimFieldOfArts))
.ForMember(dst => dst.ArtPublicationTypeCategory, opt => opt.MapFrom(src => src.DimReferencedata))
.ForMember(dst => dst.Abstract, opt => opt.MapFrom(src => src.Abstract))
.ForMember(dst => dst.Created, opt => opt.MapFrom(src => src.Created))
Expand Down
Loading

0 comments on commit 8229f90

Please sign in to comment.