Skip to content

Commit

Permalink
merge hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Mar 1, 2023
2 parents 64a054a + 46b7563 commit 8ff8608
Show file tree
Hide file tree
Showing 55 changed files with 635 additions and 554 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/stable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: etherna/beehive-manager
tags: |
Expand All @@ -26,16 +26,16 @@ jobs:
type=semver,pattern=v{{version}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/unstable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: etherna/beehive-manager
tags: |
type=ref,event=branch
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand Down
9 changes: 1 addition & 8 deletions BeehiveManager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1CD13F83-9A79-4873-A8E3-77A2D432D706}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{9297C969-7E18-4B8E-831F-F770DA1805F4}"
ProjectSection(SolutionItems) = preProject
.github\workflows\stable-release.yml = .github\workflows\stable-release.yml
.github\workflows\unstable-release.yml = .github\workflows\unstable-release.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "domain", "domain", "{873FF005-8941-4971-A051-55D8434DC8F9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "infrastructure", "infrastructure", "{11FCB662-8945-484F-9459-C2C5823045E7}"
Expand All @@ -45,7 +39,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker-beehive-sample", "do
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CE10A1ED-2695-44EC-97F1-CB91FC5412D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeehiveManager.Persistence.Tests", "test\BeehiveManager.Persistence.Tests\BeehiveManager.Persistence.Tests.csproj", "{74F4D982-085D-42F4-9E61-C288B25E64CB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeehiveManager.Persistence.Tests", "test\BeehiveManager.Persistence.Tests\BeehiveManager.Persistence.Tests.csproj", "{74F4D982-085D-42F4-9E61-C288B25E64CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -79,7 +73,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E14D105A-A294-4F67-BC95-58C5178E2818} = {1CD13F83-9A79-4873-A8E3-77A2D432D706}
{9297C969-7E18-4B8E-831F-F770DA1805F4} = {61C3814F-A839-44D7-8335-0F365D3FFA8C}
{873FF005-8941-4971-A051-55D8434DC8F9} = {1CD13F83-9A79-4873-A8E3-77A2D432D706}
{11FCB662-8945-484F-9459-C2C5823045E7} = {1CD13F83-9A79-4873-A8E3-77A2D432D706}
{125AB1B7-31FD-4BA5-8282-6AC48C3522BB} = {873FF005-8941-4971-A051-55D8434DC8F9}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore "BeehiveManager.sln"
Expand Down
6 changes: 3 additions & 3 deletions src/BeehiveManager.Domain/BeehiveManager.Domain.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>net7.0</TargetFramework>
<RootNamespace>Etherna.BeehiveManager.Domain</RootNamespace>

<Authors>Etherna Sagl</Authors>
Expand All @@ -14,8 +14,8 @@

<ItemGroup>
<PackageReference Include="Etherna.DomainEvents" Version="1.4.0" />
<PackageReference Include="MongODM.Core" Version="0.23.1" />
<PackageReference Include="Nethereum.Accounts" Version="4.9.0" />
<PackageReference Include="MongODM.Core" Version="0.24.0-alpha.80" />
<PackageReference Include="Nethereum.Web3" Version="4.13.0" />
</ItemGroup>

</Project>
4 changes: 1 addition & 3 deletions src/BeehiveManager.Domain/IBeehiveDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ namespace Etherna.BeehiveManager.Domain
{
public interface IBeehiveDbContext : IDbContext
{
ICollectionRepository<BeeNode, string> BeeNodes { get; }
ICollectionRepository<EtherAddressConfig, string> EtherAddressConfigs { get; }
ICollectionRepository<NodeLogBase, string> NodeLogs { get; }
IRepository<BeeNode, string> BeeNodes { get; }

IEventDispatcher EventDispatcher { get; }
}
Expand Down
38 changes: 0 additions & 38 deletions src/BeehiveManager.Domain/Models/CashoutNodeLog.cs

This file was deleted.

38 changes: 0 additions & 38 deletions src/BeehiveManager.Domain/Models/EtherAddressConfig.cs

This file was deleted.

13 changes: 2 additions & 11 deletions src/BeehiveManager.Persistence/BeehiveDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public BeehiveDbContext(

// Properties.
//repositories
public ICollectionRepository<BeeNode, string> BeeNodes { get; } = new DomainCollectionRepository<BeeNode, string>(
new CollectionRepositoryOptions<BeeNode>("beeNodes")
public IRepository<BeeNode, string> BeeNodes { get; } = new DomainRepository<BeeNode, string>(
new RepositoryOptions<BeeNode>("beeNodes")
{
IndexBuilders = new[]
{
Expand All @@ -59,15 +59,6 @@ public BeehiveDbContext(
.Ascending(n => n.Hostname), new CreateIndexOptions<BeeNode> { Unique = true })
}
});
public ICollectionRepository<EtherAddressConfig, string> EtherAddressConfigs { get; } = new DomainCollectionRepository<EtherAddressConfig, string>(
new CollectionRepositoryOptions<EtherAddressConfig>("etherAddressConfigs")
{
IndexBuilders = new[]
{
(Builders<EtherAddressConfig>.IndexKeys.Ascending(a => a.Address), new CreateIndexOptions<EtherAddressConfig> { Unique = true }),
}
});
public ICollectionRepository<NodeLogBase, string> NodeLogs { get; } = new DomainCollectionRepository<NodeLogBase, string>("nodeLogs");

//other properties
public IEventDispatcher EventDispatcher { get; }
Expand Down
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>net7.0</TargetFramework>
<RootNamespace>Etherna.BeehiveManager.Persistence</RootNamespace>

<Authors>Etherna Sagl</Authors>
Expand Down
28 changes: 12 additions & 16 deletions src/BeehiveManager.Persistence/ModelMaps/BeeNodeMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,45 @@

namespace Etherna.BeehiveManager.Persistence.ModelMaps
{
class BeeNodeMap : IModelMapsCollector
internal sealed class BeeNodeMap : IModelMapsCollector
{
public void Register(IDbContext dbContext)
{
dbContext.SchemaRegistry.AddModelMapsSchema<BeeNode>("6b94df32-034f-46f9-a5c1-239905ad5d07");
dbContext.MapRegistry.AddModelMap<BeeNode>("6b94df32-034f-46f9-a5c1-239905ad5d07");
}

/// <summary>
/// A minimal serializer with only id
/// </summary>
public static ReferenceSerializer<BeeNode, string> ReferenceSerializer(
IDbContext dbContext,
bool useCascadeDelete = false) =>
IDbContext dbContext) =>
new(dbContext, config =>
{
config.UseCascadeDelete = useCascadeDelete;
config.AddModelMapsSchema<ModelBase>("e5d93371-e1a7-4ff3-b947-a4862c40d938");
config.AddModelMapsSchema<EntityModelBase>("a48cf8b2-1b18-450d-afc1-4094ce23ba78", mm => { });
config.AddModelMapsSchema<EntityModelBase<string>>("1a7fb389-fd58-4ad6-82b5-b687273bc5ab", mm =>
config.AddModelMap<ModelBase>("e5d93371-e1a7-4ff3-b947-a4862c40d938");
config.AddModelMap<EntityModelBase>("a48cf8b2-1b18-450d-afc1-4094ce23ba78", mm => { });
config.AddModelMap<EntityModelBase<string>>("1a7fb389-fd58-4ad6-82b5-b687273bc5ab", mm =>
{
mm.MapIdMember(m => m.Id);
mm.IdMemberMap.SetSerializer(new StringSerializer(BsonType.ObjectId));
});
config.AddModelMapsSchema<BeeNode>("28d5e30d-c205-4440-9ba6-80505409ef8d", mm => { });
config.AddModelMap<BeeNode>("28d5e30d-c205-4440-9ba6-80505409ef8d", mm => { });
});

/// <summary>
/// A serializer with connection info to node
/// </summary>
public static ReferenceSerializer<BeeNode, string> ConnectionInfoSerializer(
IDbContext dbContext,
bool useCascadeDelete = false) =>
IDbContext dbContext) =>
new(dbContext, config =>
{
config.UseCascadeDelete = useCascadeDelete;
config.AddModelMapsSchema<ModelBase>("148b3991-63da-4966-a781-30295c71fcae");
config.AddModelMapsSchema<EntityModelBase>("774d614c-2bd2-4a51-83a7-6d0df1942216", mm => { });
config.AddModelMapsSchema<EntityModelBase<string>>("959def90-ddab-48a7-9a0e-1917be419171", mm =>
config.AddModelMap<ModelBase>("148b3991-63da-4966-a781-30295c71fcae");
config.AddModelMap<EntityModelBase>("774d614c-2bd2-4a51-83a7-6d0df1942216", mm => { });
config.AddModelMap<EntityModelBase<string>>("959def90-ddab-48a7-9a0e-1917be419171", mm =>
{
mm.MapIdMember(n => n.Id);
mm.IdMemberMap.SetSerializer(new StringSerializer(BsonType.ObjectId));
});
config.AddModelMapsSchema<BeeNode>("a833d25f-4613-4cbc-b36a-4cdfa62501f4", mm =>
config.AddModelMap<BeeNode>("a833d25f-4613-4cbc-b36a-4cdfa62501f4", mm =>
{
mm.MapMember(n => n.ConnectionScheme);
mm.MapMember(n => n.DebugPort);
Expand Down
35 changes: 0 additions & 35 deletions src/BeehiveManager.Persistence/ModelMaps/EtherAddressConfigMap.cs

This file was deleted.

10 changes: 4 additions & 6 deletions src/BeehiveManager.Persistence/ModelMaps/ModelBaseMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

namespace Etherna.BeehiveManager.Persistence.ModelMaps
{
class ModelBaseMap : IModelMapsCollector
internal sealed class ModelBaseMap : IModelMapsCollector
{
public void Register(IDbContext dbContext)
{
dbContext.SchemaRegistry.AddModelMapsSchema<ModelBase>("7653dfab-f715-42d1-8d3d-bbca69755399");

dbContext.SchemaRegistry.AddModelMapsSchema<EntityModelBase>("5cddcc0c-1a61-443c-bb72-98d1344cafb4");

dbContext.SchemaRegistry.AddModelMapsSchema<EntityModelBase<string>>("3d7b0f5d-d490-495e-af05-6114e8f8d2f4", modelMap =>
dbContext.MapRegistry.AddModelMap<ModelBase>("7653dfab-f715-42d1-8d3d-bbca69755399");
dbContext.MapRegistry.AddModelMap<EntityModelBase>("5cddcc0c-1a61-443c-bb72-98d1344cafb4");
dbContext.MapRegistry.AddModelMap<EntityModelBase<string>>("3d7b0f5d-d490-495e-af05-6114e8f8d2f4", modelMap =>
{
modelMap.AutoMap();

Expand Down
Loading

0 comments on commit 8ff8608

Please sign in to comment.