-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added repository for deployments. #30
- Loading branch information
Showing
7 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Contracts/IDeploymentUow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Baud.Deployment.BusinessLogic.Domain.Deployment.Contracts | ||
{ | ||
public interface IDeploymentUow : IUow | ||
{ | ||
IProjectsRepository Projects { get; } | ||
IInstallationsRepository Installations { get; } | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...DeploymentFramework/BusinessLogic/Domain/Deployment/Contracts/IInstallationsRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Entities; | ||
|
||
namespace Baud.Deployment.BusinessLogic.Domain.Deployment.Contracts | ||
{ | ||
public interface IInstallationsRepository | ||
{ | ||
IQueryable<Installation> GetWaitingInstallations(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Queries/InstallationQueries.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Entities; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Enums; | ||
|
||
namespace Baud.Deployment.BusinessLogic.Domain.Deployment.Queries | ||
{ | ||
public static class InstallationQueries | ||
{ | ||
public static IQueryable<Installation> OnlyWaiting(this IQueryable<Installation> query) | ||
{ | ||
return query.Where(x => x.State == InstallationState.Waiting); | ||
} | ||
|
||
public static IQueryable<Installation> OnlyPlannedBefore(this IQueryable<Installation> query, DateTime date) | ||
{ | ||
return query.Where(x => x.Planned <= date); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Server/DeploymentFramework/Database/Deployment/DeploymentUow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Baud.Deployment.BusinessLogic.Contracts; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Contracts; | ||
using Baud.Deployment.Database.Contracts; | ||
|
||
namespace Baud.Deployment.Database.Deployment | ||
{ | ||
public class DeploymentUow : UowBase<DeploymentDbContext>, IDeploymentUow | ||
{ | ||
public IProjectsRepository Projects | ||
{ | ||
get { return GetRepository<IProjectsRepository>(); } | ||
} | ||
|
||
public IInstallationsRepository Installations | ||
{ | ||
get { return GetRepository<IInstallationsRepository>(); } | ||
} | ||
|
||
public DeploymentUow(IDbContextProvider<DeploymentDbContext> contextProvider, IRepositoryProvider<DeploymentDbContext> repositoryProvider, ICurrentUserProvider currentUserProvider, IDateTimeProvider dateTimeProvider) | ||
: base(contextProvider, repositoryProvider, currentUserProvider, dateTimeProvider) | ||
{ | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Server/DeploymentFramework/Database/Deployment/InstallationsRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data.Entity; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Contracts; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Entities; | ||
using Baud.Deployment.BusinessLogic.Domain.Deployment.Queries; | ||
|
||
namespace Baud.Deployment.Database.Deployment | ||
{ | ||
public class InstallationsRepository : RepositoryBase<DeploymentDbContext>, IInstallationsRepository | ||
{ | ||
public InstallationsRepository(DeploymentDbContext context) | ||
: base(context) | ||
{ | ||
} | ||
|
||
public IQueryable<Installation> GetWaitingInstallations() | ||
{ | ||
var now = DateTime.Now; | ||
|
||
return Context.Installations | ||
.Include(x => x.DeployTarget.Application) | ||
.Include(x => x.DeployTarget.Server) | ||
.OnlyWaiting() | ||
.OnlyPlannedBefore(now); | ||
} | ||
} | ||
} |