Skip to content

Commit

Permalink
- storage.readallformultipledataelement parameter fix
Browse files Browse the repository at this point in the history
- telemetryClient nullability
- GetAllAppTitles TrimEnd
- DeleteAllInstanceEvents, changed from nonquery to scalar
- GetHardDeletedDataElements: made org test case insensitive
  • Loading branch information
HenningNormann committed Dec 5, 2023
1 parent d5033ab commit 5a46a0a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Storage/Migration/v0.00/03-setup-functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ RETURN QUERY
END;
$BODY$;

CREATE OR REPLACE FUNCTION storage.readallformultipledataelement(_instanceGuid UUID)
CREATE OR REPLACE FUNCTION storage.readallformultipledataelement(_instanceGuid UUID[])
RETURNS TABLE (element JSONB)
LANGUAGE 'plpgsql'

Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Repository/PgApplicationRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public PgApplicationRepository(
IOptions<GeneralSettings> generalSettings,
IMemoryCache memoryCache,
NpgsqlDataSource dataSource,
TelemetryClient telemetryClient)
TelemetryClient telemetryClient = null)
{
_dataSource = dataSource;
_telemetryClient = telemetryClient;
Expand Down Expand Up @@ -184,7 +184,7 @@ public async Task<Dictionary<string, string>> GetAllAppTitles()
}
}

appTitles.Add(item.Id, titles.ToString());
appTitles.Add(item.Id, titles.ToString().TrimEnd(';'));
}

_memoryCache.Set(_cacheKey, appTitles, _cacheEntryOptionsTitles);
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Repository/PgDataRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class PgDataRepository : IDataRepository
public PgDataRepository(
ILogger<PgDataRepository> logger,
NpgsqlDataSource dataSource,
TelemetryClient telemetryClient)
TelemetryClient telemetryClient = null)
{
_logger = logger;
_dataSource = dataSource;
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Repository/PgInstanceEventRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class PgInstanceEventRepository: IInstanceEventRepository
public PgInstanceEventRepository(
ILogger<PgInstanceEventRepository> logger,
NpgsqlDataSource dataSource,
TelemetryClient telemetryClient)
TelemetryClient telemetryClient = null)
{
_dataSource = dataSource;
_telemetryClient = telemetryClient;
Expand Down Expand Up @@ -113,7 +113,7 @@ public async Task<int> DeleteAllInstanceEvents(string instanceId)
using TelemetryTracker tracker = new(_telemetryClient, pgcom);
pgcom.Parameters.AddWithValue(NpgsqlDbType.Uuid, new Guid(instanceId.Split('/').Last()));

int rc = await pgcom.ExecuteNonQueryAsync();
int rc = (int)await pgcom.ExecuteScalarAsync();
tracker.Track();
return rc;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Repository/PgInstanceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static PgInstanceRepository()
public PgInstanceRepository(
ILogger<PgInstanceRepository> logger,
NpgsqlDataSource dataSource,
TelemetryClient telemetryClient)
TelemetryClient telemetryClient = null)
{
_logger = logger;
_dataSource = dataSource;
Expand Down Expand Up @@ -143,7 +143,7 @@ public async Task<List<DataElement>> GetHardDeletedDataElements()
// TODO move filter to db function

Check warning on line 143 in src/Storage/Repository/PgInstanceRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
currentInstanceAllowsDelete =
instance.CompleteConfirmations != null &&
instance.CompleteConfirmations.Any(c => c.StakeholderId.ToLower().Equals(instance.Org) &&
instance.CompleteConfirmations.Any(c => c.StakeholderId.Equals(instance.Org, StringComparison.OrdinalIgnoreCase) &&
c.ConfirmedOn <= DateTime.UtcNow.AddDays(-7));
previousId = id;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Repository/PgTextRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PgTextRepository(
IOptions<GeneralSettings> generalSettings,
IMemoryCache memoryCache,
NpgsqlDataSource dataSource,
TelemetryClient telemetryClient)
TelemetryClient telemetryClient = null)
{
_memoryCache = memoryCache;
_cacheEntryOptions = new MemoryCacheEntryOptions()
Expand Down

0 comments on commit 5a46a0a

Please sign in to comment.