Skip to content

Commit

Permalink
Merge pull request #52 from ravendb/feature/#51
Browse files Browse the repository at this point in the history
  • Loading branch information
AKlaus authored Jul 27, 2022
2 parents 8a26042 + c60a88f commit 5e8a9b5
Show file tree
Hide file tree
Showing 223 changed files with 7,394 additions and 7,632 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_back-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.404
dotnet-version: 6.0.302
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/db_migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.404
dotnet-version: 6.0.302

- name: Build
run: dotnet build tools/Database.Migration/Database.Migration.csproj --configuration Release

- name: Run migration
run: dotnet tools/Database.Migration/bin/Release/net5.0/Database.Migration.dll
run: dotnet tools/Database.Migration/bin/Release/net6.0/Database.Migration.dll
env:
Database__RavenDbUrls__0: ${{secrets.RavenDB_URL}}
Database__DbName: ${{secrets.RavenDB_DB_Name}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.404
dotnet-version: 6.0.302

- name: Build
run: dotnet build tools/Database.Migration/Database.Migration.csproj --configuration Release

- name: Run migration
run: dotnet tools/Database.Migration/bin/Release/net5.0/Database.Migration.dll
run: dotnet tools/Database.Migration/bin/Release/net6.0/Database.Migration.dll
env:
Database__RavenDbUrls__0: ${{secrets.RavenDB_URL}}
Database__DbName: ${{secrets.RavenDB_DB_Name}}
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Features>strict</Features>
Expand Down
25 changes: 12 additions & 13 deletions back-end/Database.Common/BacklogItem/BacklogItemHistoryRecord.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using Raven.Yabt.Database.Common.References;

namespace Raven.Yabt.Database.Common.BacklogItem
namespace Raven.Yabt.Database.Common.BacklogItem;

public record BacklogItemHistoryRecord : ChangedByUserReference
{
public record BacklogItemHistoryRecord : ChangedByUserReference
{
/// <summary>
/// Brief summary of the change
/// </summary>
public string? Summary { get; init; }
/// <summary>
/// Brief summary of the change
/// </summary>
public string? Summary { get; init; }

public BacklogItemHistoryRecord() {}
public BacklogItemHistoryRecord() {}

public BacklogItemHistoryRecord(UserReference actionedBy, string? summary = null) : base(actionedBy)
{
Summary = summary;
}
public BacklogItemHistoryRecord(UserReference actionedBy, string? summary = null) : base(actionedBy)
{
Summary = summary;
}
}
}
13 changes: 6 additions & 7 deletions back-end/Database.Common/BacklogItem/BacklogItemRelatedItem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Raven.Yabt.Database.Common.References;

namespace Raven.Yabt.Database.Common.BacklogItem
namespace Raven.Yabt.Database.Common.BacklogItem;

public record BacklogItemRelatedItem
{
public record BacklogItemRelatedItem
{
public BacklogItemReference RelatedTo { get; set; } = null!;
public BacklogItemReference RelatedTo { get; set; } = null!;

public BacklogRelationshipType LinkType { get; set; }
}
}
public BacklogRelationshipType LinkType { get; set; }
}
49 changes: 24 additions & 25 deletions back-end/Database.Common/BacklogItem/BacklogItemRelationshipType.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
using System;

namespace Raven.Yabt.Database.Common.BacklogItem
{
public enum BacklogRelationshipType
{
Duplicate,
Related,
BlockedBy,
Blocks,
CausedBy,
Causes
}
namespace Raven.Yabt.Database.Common.BacklogItem;

public static class BacklogRelationshipTypeExtension
{
public static BacklogRelationshipType GetMirroredType(this BacklogRelationshipType type)
=> type switch
{
BacklogRelationshipType.Duplicate => BacklogRelationshipType.Duplicate,
BacklogRelationshipType.Related => BacklogRelationshipType.Related,
BacklogRelationshipType.BlockedBy => BacklogRelationshipType.Blocks,
BacklogRelationshipType.Blocks => BacklogRelationshipType.BlockedBy,
BacklogRelationshipType.Causes => BacklogRelationshipType.CausedBy,
BacklogRelationshipType.CausedBy => BacklogRelationshipType.Causes,
_ => throw new NotImplementedException($"Type {type} not supported"),
};
}
public enum BacklogRelationshipType
{
Duplicate,
Related,
BlockedBy,
Blocks,
CausedBy,
Causes
}

public static class BacklogRelationshipTypeExtension
{
public static BacklogRelationshipType GetMirroredType(this BacklogRelationshipType type)
=> type switch
{
BacklogRelationshipType.Duplicate => BacklogRelationshipType.Duplicate,
BacklogRelationshipType.Related => BacklogRelationshipType.Related,
BacklogRelationshipType.BlockedBy => BacklogRelationshipType.Blocks,
BacklogRelationshipType.Blocks => BacklogRelationshipType.BlockedBy,
BacklogRelationshipType.Causes => BacklogRelationshipType.CausedBy,
BacklogRelationshipType.CausedBy => BacklogRelationshipType.Causes,
_ => throw new NotImplementedException($"Type {type} not supported"),
};
}
17 changes: 8 additions & 9 deletions back-end/Database.Common/BacklogItem/BacklogItemState.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace Raven.Yabt.Database.Common.BacklogItem
namespace Raven.Yabt.Database.Common.BacklogItem;

public enum BacklogItemState
{
public enum BacklogItemState
{
New,
InProgress,
Testing,
Closed
}
}
New,
InProgress,
Testing,
Closed
}
17 changes: 8 additions & 9 deletions back-end/Database.Common/BacklogItem/BacklogItemType.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace Raven.Yabt.Database.Common.BacklogItem
namespace Raven.Yabt.Database.Common.BacklogItem;

public enum BacklogItemType
{
public enum BacklogItemType
{
Feature = 2^1,
Bug = 2^2,
UserStory = 2^3,
Task = 2^4
}
}
Feature = 2^1,
Bug = 2^2,
UserStory = 2^3,
Task = 2^4
}
11 changes: 5 additions & 6 deletions back-end/Database.Common/BacklogItem/BugPriority.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Raven.Yabt.Database.Common.BacklogItem
namespace Raven.Yabt.Database.Common.BacklogItem;

public enum BugPriority
{
public enum BugPriority
{
P1, P2, P3, P4
}
}
P1, P2, P3, P4
}
17 changes: 8 additions & 9 deletions back-end/Database.Common/BacklogItem/BugSeverity.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace Raven.Yabt.Database.Common.BacklogItem
namespace Raven.Yabt.Database.Common.BacklogItem;

public enum BugSeverity
{
public enum BugSeverity
{
Critical,
High,
Medium,
Low
}
}
Critical,
High,
Medium,
Low
}
19 changes: 9 additions & 10 deletions back-end/Database.Common/Configuration/AppSettingsConstraints.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
namespace Raven.Yabt.Database.Common.Configuration
namespace Raven.Yabt.Database.Common.Configuration;

/// <summary>
/// Constraint on naming RavenDB connection parameters
/// </summary>
public interface IAppSettingsWithDatabase
{
/// <summary>
/// Constraint on naming RavenDB connection parameters
/// RavenDB connection parameters
/// </summary>
public interface IAppSettingsWithDatabase
{
/// <summary>
/// RavenDB connection parameters
/// </summary>
DatabaseSettings Database { get; }
}
}
DatabaseSettings Database { get; }
}
49 changes: 24 additions & 25 deletions back-end/Database.Common/Configuration/DatabaseSessionSettings.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
// ReSharper disable ClassNeverInstantiated.Global
namespace Raven.Yabt.Database.Common.Configuration
namespace Raven.Yabt.Database.Common.Configuration;

/// <summary>
/// Raven database session settings
/// </summary>
public class DatabaseSessionSettings
{
/// <summary>
/// Raven database session settings
/// The default time interval in seconds for waiting for the indexes to catch up with the saved changes
/// after calling session.SaveChanges().
/// If `null` then doesn't wait.
/// The value must be ≥ <see cref="LogErrorIfSavingTakesMoreThan"/>
/// </summary>
public class DatabaseSessionSettings
{
/// <summary>
/// The default time interval in seconds for waiting for the indexes to catch up with the saved changes
/// after calling session.SaveChanges().
/// If `null` then doesn't wait.
/// The value must be ≥ <see cref="LogErrorIfSavingTakesMoreThan"/>
/// </summary>
public int? WaitForIndexesAfterSaveChanges { get; private set; } = null;
public int? WaitForIndexesAfterSaveChanges { get; private set; } = null;

/// <summary>
/// Log a trace warning if session.Save() takes more than specified in seconds,
/// but less than in <see cref="LogErrorIfSavingTakesMoreThan"/>.
/// It makes sense only if <see cref="WaitForIndexesAfterSaveChanges"/> is configured
/// </summary>
public int LogWarningIfSavingTakesMoreThan { get; private set; } = 15;
/// <summary>
/// Log a trace warning if session.Save() takes more than specified in seconds,
/// but less than in <see cref="LogErrorIfSavingTakesMoreThan"/>.
/// It makes sense only if <see cref="WaitForIndexesAfterSaveChanges"/> is configured
/// </summary>
public int LogWarningIfSavingTakesMoreThan { get; private set; } = 15;

/// <summary>
/// Log an error if session.Save() takes more than specified in seconds.
/// It makes sense only if <see cref="WaitForIndexesAfterSaveChanges"/> is configured.
/// The value must be ≥ <see cref="LogWarningIfSavingTakesMoreThan"/>.
/// </summary>
public int LogErrorIfSavingTakesMoreThan { get; private set; } = 30;
}
}
/// <summary>
/// Log an error if session.Save() takes more than specified in seconds.
/// It makes sense only if <see cref="WaitForIndexesAfterSaveChanges"/> is configured.
/// The value must be ≥ <see cref="LogWarningIfSavingTakesMoreThan"/>.
/// </summary>
public int LogErrorIfSavingTakesMoreThan { get; private set; } = 30;
}
51 changes: 25 additions & 26 deletions back-end/Database.Common/Configuration/DatabaseSettings.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
// ReSharper disable UnusedAutoPropertyAccessor.Local
// ReSharper disable ClassNeverInstantiated.Global
namespace Raven.Yabt.Database.Common.Configuration
{
namespace Raven.Yabt.Database.Common.Configuration;

#nullable disable
/// <summary>
/// Connection to the Raven database
/// </summary>
public class DatabaseSettings
{
/// <summary>
/// Connection to the Raven database
/// URL of the RavenDB API
/// </summary>
public class DatabaseSettings
{
/// <summary>
/// URL of the RavenDB API
/// </summary>
public string[] RavenDbUrls { get; private set; }
public string[] RavenDbUrls { get; private set; }

/// <summary>
/// The path for Base64-encoded RavenDB certificate.
/// Certificate is NOT required for non-secure connections (e.g. a local instance)
/// </summary>
public string Certificate { get; private set; }
/// <summary>
/// The path for Base64-encoded RavenDB certificate.
/// Certificate is NOT required for non-secure connections (e.g. a local instance)
/// </summary>
public string Certificate { get; private set; }

/// <summary>
/// The Database name
/// </summary>
public string DbName { get; private set; }
/// <summary>
/// The Database name
/// </summary>
public string DbName { get; private set; }

/// <summary>
/// Flag triggering updating the indexes if 'true'.
/// Ideally, it shouldn't be set in PROD as updating indexes is a migration concern,
/// but setting it in dev environment makes live a bit easier by applying index updates on a start-up
/// </summary>
public bool UpdateIndexes { get; private set; }
}
}
/// <summary>
/// Flag triggering updating the indexes if 'true'.
/// Ideally, it shouldn't be set in PROD as updating indexes is a migration concern,
/// but setting it in dev environment makes live a bit easier by applying index updates on a start-up
/// </summary>
public bool UpdateIndexes { get; private set; }
}
19 changes: 9 additions & 10 deletions back-end/Database.Common/CustomFieldType.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
namespace Raven.Yabt.Database.Common
namespace Raven.Yabt.Database.Common;

public enum CustomFieldType
{
public enum CustomFieldType
{
Text,
Date,
Checkbox,
Numeric,
Url
}
}
Text,
Date,
Checkbox,
Numeric,
Url
}
Loading

0 comments on commit 5e8a9b5

Please sign in to comment.