Skip to content

Commit

Permalink
rename repositories and db models
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkoSekulic committed Jan 9, 2025
1 parent c091a31 commit 9192722
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions backend/src/Designer/Infrastructure/ServiceRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public static IServiceCollection RegisterServiceImplementations(this IServiceCol
options.UseNpgsql(postgresSettings.FormattedConnectionString());
});

services.AddScoped<IReleaseRepository, ORMReleaseRepository>();
services.AddScoped<IDeploymentRepository, ORMDeploymentRepository>();
services.AddScoped<IReleaseRepository, ReleaseRepository>();
services.AddScoped<IDeploymentRepository, DeploymentRepository>();
services.AddScoped<IAppScopesRepository, AppScopesRepository>();
services.AddTransient<IReleaseService, ReleaseService>();
services.AddTransient<IDeploymentService, DeploymentService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

namespace Altinn.Studio.Designer.Repository.ORMImplementation;

public class ORMDeploymentRepository : IDeploymentRepository
public class DeploymentRepository : IDeploymentRepository
{
private readonly DesignerdbContext _dbContext;

public ORMDeploymentRepository(DesignerdbContext dbContext)
public DeploymentRepository(DesignerdbContext dbContext)
{
_dbContext = dbContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

namespace Altinn.Studio.Designer.Repository.ORMImplementation;

public class ORMReleaseRepository : IReleaseRepository
public class ReleaseRepository : IReleaseRepository
{
private readonly DesignerdbContext _dbContext;

public ORMReleaseRepository(DesignerdbContext dbContext)
public ReleaseRepository(DesignerdbContext dbContext)
{
_dbContext = dbContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CreateIntegrationTests(DesignerDbFixture dbFixture) : base(dbFixture)
[InlineData("ttd")]
public async Task Create_ShouldInsertRecordInDatabase(string org)
{
var repository = new ORMDeploymentRepository(DbFixture.DbContext);
var repository = new DeploymentRepository(DbFixture.DbContext);
var buildId = Guid.NewGuid();
var deploymentEntity = EntityGenerationUtils.Deployment.GenerateDeploymentEntity(org, buildId: buildId.ToString());
await repository.Create(deploymentEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Get_ShouldReturnCorrectRecordsFromDatabase(string org, string
var deploymentEntities = EntityGenerationUtils.Deployment.GenerateDeploymentEntities(org, app, allEntitiesCount).ToList();
await PrepareEntitiesInDatabase(deploymentEntities);

var repository = new ORMDeploymentRepository(DbFixture.DbContext);
var repository = new DeploymentRepository(DbFixture.DbContext);
var query = new DocumentQueryModel { Top = top, SortDirection = sortDirection };
var result = (await repository.Get(org, app, query)).ToList();

Expand All @@ -52,7 +52,7 @@ public async Task Get_Without_TopDefined_ShouldReturnAllRecordsForGivenApp(strin
var deploymentEntities = EntityGenerationUtils.Deployment.GenerateDeploymentEntities(org, app, allEntitiesCount).ToList();
await PrepareEntitiesInDatabase(deploymentEntities);

var repository = new ORMDeploymentRepository(DbFixture.DbContext);
var repository = new DeploymentRepository(DbFixture.DbContext);
var query = new DocumentQueryModel
{
Top = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task Get_ShouldReturnRecordFromDatabase(string org)
var deploymentEntity = EntityGenerationUtils.Deployment.GenerateDeploymentEntity(org);
await PrepareEntityInDatabase(deploymentEntity);

var repository = new ORMDeploymentRepository(DbFixture.DbContext);
var repository = new DeploymentRepository(DbFixture.DbContext);
var result = await repository.Get(deploymentEntity.Org, deploymentEntity.Build.Id);

result.Should().BeEquivalentTo(deploymentEntity, options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public UpdateIntegrationTests(DesignerDbFixture dbFixture) : base(dbFixture)
[InlineData("ttd")]
public async Task Update_ShouldUpdateRecordInDatabase(string org)
{
var repository = new ORMDeploymentRepository(DbFixture.DbContext);
var repository = new DeploymentRepository(DbFixture.DbContext);
var buildId = Guid.NewGuid();
var deploymentEntity = EntityGenerationUtils.Deployment.GenerateDeploymentEntity(
org,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CreateIntegrationTests(DesignerDbFixture dbFixture) : base(dbFixture)
[InlineData("ttd")]
public async Task Create_ShouldInsertRecordInDatabase(string org)
{
var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var buildId = Guid.NewGuid();
var releaseEntity = EntityGenerationUtils.Release.GenerateReleaseEntity(org, buildId: buildId.ToString());
await repository.Create(releaseEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task Get_ShouldReturnCorrectRecordsFromDatabase(string org, string
{
int numberOfEntities = statusReleaseCombinationsInDb.Count;
string tagName = Guid.NewGuid().ToString();
var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var releaseEntities = EntityGenerationUtils.Release.GenerateReleaseEntities(org, app, numberOfEntities).ToList();
for (int i = 0; i < numberOfEntities; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public GetSingleIntegrationTests(DesignerDbFixture dbFixture) : base(dbFixture)
[InlineData("ttd")]
public async Task GetSingleAsync_WhenCalled_ShouldReturnSingleReleaseEntity(string releaseName)
{
var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var buildId = Guid.NewGuid();
var releaseEntity = EntityGenerationUtils.Release.GenerateReleaseEntity(releaseName, buildId: buildId.ToString());
await PrepareEntityInDatabase(releaseEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task Get_ShouldReturnCorrectRecordsFromDatabase(string org, string
{
int numberOfEntities = statusReleaseCombinationsInDb.Count;
string tagName = Guid.NewGuid().ToString();
var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var releaseEntities = EntityGenerationUtils.Release.GenerateReleaseEntities(org, app, numberOfEntities).ToList();
for (int i = 0; i < numberOfEntities; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Get_ShouldReturnCorrectRecordsFromDatabase(string org, string
var releaseEntities = EntityGenerationUtils.Release.GenerateReleaseEntities(org, app, allEntitiesCount).ToList();
await PrepareEntitiesInDatabase(releaseEntities);

var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var query = new DocumentQueryModel { Top = top, SortDirection = sortDirection };
var result = (await repository.Get(org, app, query)).ToList();

Expand All @@ -49,7 +49,7 @@ public async Task Get_Without_TopDefined_ShouldReturnAllRecordsForGivenApp(strin
var releaseEntities = EntityGenerationUtils.Release.GenerateReleaseEntities(org, app, allEntitiesCount).ToList();
await PrepareEntitiesInDatabase(releaseEntities);

var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var query = new DocumentQueryModel
{
Top = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public UpdateIntegrationTests(DesignerDbFixture dbFixture) : base(dbFixture)
[InlineData("ttd")]
public async Task UpdateReleaseEntityAsync_WhenCalled_ShouldUpdateReleaseEntity(string releaseName)
{
var repository = new ORMReleaseRepository(DbFixture.DbContext);
var repository = new ReleaseRepository(DbFixture.DbContext);
var buildId = Guid.NewGuid();
var releaseEntity = EntityGenerationUtils.Release.GenerateReleaseEntity(releaseName, buildId: buildId.ToString());
await PrepareEntityInDatabase(releaseEntity);
Expand Down

0 comments on commit 9192722

Please sign in to comment.