Skip to content

Commit

Permalink
Merge pull request #71 from Artsdatabanken/feature/netandnugets
Browse files Browse the repository at this point in the history
Feature/netandnugets
  • Loading branch information
steinho authored Mar 25, 2024
2 parents ffe3485 + 178bcc6 commit 8f27bf6
Show file tree
Hide file tree
Showing 30 changed files with 1,858 additions and 1,928 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
38 changes: 26 additions & 12 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,35 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
include-prerelease: false
dotnet-version: '8.0.x'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Run tests
run: dotnet test Nbic.References.Tests/Nbic.References.Tests.csproj -- MaxCpuCount=1
- name: Build and push Docker images
uses: docker/build-push-action@v1
run: dotnet test --no-restore --verbosity normal --logger "trx;LogFileName=test-results.trx" Nbic.References.Tests/Nbic.References.Tests.csproj -- MaxCpuCount=1 || True
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: Nbic.References/Dockerfile
repository: artsdatabanken/nbicreferences
tags: latest
name: DotNET Tests
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKER_USER }}
password: ${{ secrets.ORG_DOCKER_PASS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image api
uses: docker/build-push-action@v5
if: github.event.pull_request.merged == 'true' && ${{ github.actor != 'dependabot[bot]' }}
with:
# context: ./src
file: ./Nbic.References/Dockerfile
tags: artsdatabanken/nbicreferences:latest
push: true
2 changes: 1 addition & 1 deletion .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Analyze repositories source metrics:
# Create (or update) CODE_METRICS.md file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nbic.References.Core.Models;
using Nbic.References.Core.Models;

namespace Nbic.References.Core.Interfaces.Repositories
namespace Nbic.References.Core.Interfaces.Repositories;

public interface IReferenceUsageRepository : IRepository<ReferenceUsage>
{
public interface IReferenceUsageRepository : IRepository<ReferenceUsage>
{
Task<List<ReferenceUsage>> GetAll(int offset, int limit);
Task<List<ReferenceUsage>> GetFromReferenceId(Guid referenceId);
void DeleteForReference(Guid id);
void DeleteUsage(Guid id, int applicationId, Guid userId);
Task Add(ReferenceUsage referenceUsage);
Task<bool> AddRange(ReferenceUsage[] referenceUsages);
}
}
Task<List<ReferenceUsage>> GetAll(int offset, int limit);
Task<List<ReferenceUsage>> GetFromReferenceId(Guid referenceId);
void DeleteForReference(Guid id);
void DeleteUsage(Guid id, int applicationId, Guid userId);
Task Add(ReferenceUsage referenceUsage);
Task<bool> AddRange(IEnumerable<ReferenceUsage> referenceUsages);
}
2 changes: 1 addition & 1 deletion Nbic.References.Core/Nbic.References.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
<PackageReference Include="Lucene.Net.Analysis.Common" Version="4.8.0-beta00016" />
</ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,72 +1,70 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Nbic.References.EFCore.Migrations.SqlServerMigrations
namespace Nbic.References.Infrastructure.Repositories.DbContext.Migrations.SqlServerMigrations;

public partial class Initial : Migration
{
public partial class Initial : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Reference",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ApplicationId = table.Column<int>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
Author = table.Column<string>(unicode: false, nullable: true),
Year = table.Column<string>(unicode: false, nullable: true),
Title = table.Column<string>(unicode: false, nullable: true),
Summary = table.Column<string>(unicode: false, nullable: true),
Journal = table.Column<string>(unicode: false, nullable: true),
Volume = table.Column<string>(unicode: false, nullable: true),
Pages = table.Column<string>(unicode: false, nullable: true),
Bibliography = table.Column<string>(unicode: false, nullable: true),
Lastname = table.Column<string>(unicode: false, nullable: true),
Middlename = table.Column<string>(unicode: false, nullable: true),
Firstname = table.Column<string>(unicode: false, nullable: true),
Url = table.Column<string>(unicode: false, nullable: true),
Keywords = table.Column<string>(unicode: false, nullable: true),
ReferenceString = table.Column<string>(nullable: true),
EditDate = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "GetUtcDate()")
},
constraints: table =>
{
table.PrimaryKey("PK_Id", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Reference",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ApplicationId = table.Column<int>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
Author = table.Column<string>(unicode: false, nullable: true),
Year = table.Column<string>(unicode: false, nullable: true),
Title = table.Column<string>(unicode: false, nullable: true),
Summary = table.Column<string>(unicode: false, nullable: true),
Journal = table.Column<string>(unicode: false, nullable: true),
Volume = table.Column<string>(unicode: false, nullable: true),
Pages = table.Column<string>(unicode: false, nullable: true),
Bibliography = table.Column<string>(unicode: false, nullable: true),
Lastname = table.Column<string>(unicode: false, nullable: true),
Middlename = table.Column<string>(unicode: false, nullable: true),
Firstname = table.Column<string>(unicode: false, nullable: true),
Url = table.Column<string>(unicode: false, nullable: true),
Keywords = table.Column<string>(unicode: false, nullable: true),
ReferenceString = table.Column<string>(nullable: true),
EditDate = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "GetUtcDate()")
},
constraints: table =>
{
table.PrimaryKey("PK_Id", x => x.Id);
});

migrationBuilder.CreateTable(
name: "ReferenceUsage",
columns: table => new
{
ReferenceId = table.Column<Guid>(nullable: false),
ApplicationId = table.Column<int>(nullable: false),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ReferenceUsage", x => new { x.ReferenceId, x.ApplicationId, x.UserId });
table.ForeignKey(
name: "FK_ReferenceUsage_Reference",
column: x => x.ReferenceId,
principalTable: "Reference",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ReferenceUsage",
columns: table => new
{
ReferenceId = table.Column<Guid>(nullable: false),
ApplicationId = table.Column<int>(nullable: false),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ReferenceUsage", x => new { x.ReferenceId, x.ApplicationId, x.UserId });
table.ForeignKey(
name: "FK_ReferenceUsage_Reference",
column: x => x.ReferenceId,
principalTable: "Reference",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.CreateIndex(
name: "IX_UserId_ApplicationId",
table: "Reference",
columns: new[] { "UserId", "ApplicationId" });
}
migrationBuilder.CreateIndex(
name: "IX_UserId_ApplicationId",
table: "Reference",
columns: ["UserId", "ApplicationId"]);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ReferenceUsage");
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ReferenceUsage");

migrationBuilder.DropTable(
name: "Reference");
}
migrationBuilder.DropTable(
name: "Reference");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Nbic.References.EFCore;
using Nbic.References.Infrastructure.Repositories.DbContext;

namespace Nbic.References.EFCore.Migrations.SqlServerMigrations
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f27bf6

Please sign in to comment.