-
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.
Add an endpoint to synchronize the KKR database with updates from the…
… change log (#221) Adding client code for integration with the contacts and reservations registry. Adding necessary code to store changed registry entries. Adding an endpoint for triggering a synchronization operation. --------- Co-authored-by: Hallgeir Garnes-Gutvik <hallgeir.garnes-gutvik@digdir.no> Co-authored-by: Terje Holene <terje.holene@gmail.com>
- Loading branch information
1 parent
da804fd
commit e75d02a
Showing
66 changed files
with
2,309 additions
and
1,571 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
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,13 @@ | ||
#!/bin/bash | ||
export PGPASSWORD=Password | ||
|
||
# alter max connections | ||
psql -h localhost -p 5432 -U platform_profile_admin -d profiledb \ | ||
-c "ALTER SYSTEM SET max_connections TO '200';" | ||
|
||
# set up platform_profile role | ||
psql -h localhost -p 5432 -U platform_profile_admin -d profiledb \ | ||
-c "DO \$\$ | ||
BEGIN CREATE ROLE platform_profile WITH LOGIN PASSWORD 'Password'; | ||
EXCEPTION WHEN duplicate_object THEN RAISE NOTICE '%, skipping', SQLERRM USING ERRCODE = SQLSTATE; | ||
END \$\$;" |
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
36 changes: 36 additions & 0 deletions
36
src/Altinn.Profile.Core/ContactRegister/ContactRegisterChangesLog.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,36 @@ | ||
using System.Collections.Immutable; | ||
using System.Text.Json.Serialization; | ||
|
||
using Altinn.Profile.Core.Person.ContactPreferences; | ||
|
||
namespace Altinn.Profile.Core.ContactRegister; | ||
|
||
/// <summary> | ||
/// Represents the changes to a person's contact preferences from the contact register. | ||
/// </summary> | ||
public record ContactRegisterChangesLog | ||
{ | ||
/// <summary> | ||
/// Gets the collection of snapshots representing the changes to a person's contact preferences. | ||
/// </summary> | ||
[JsonPropertyName("list")] | ||
public IImmutableList<PersonContactPreferencesSnapshot>? ContactPreferencesSnapshots { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the ending change identifier, which indicates the point at which the system should stop retrieving changes. | ||
/// </summary> | ||
[JsonPropertyName("tilEndringsId")] | ||
public long? EndingIdentifier { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the most recent change identifier, which represents the last change that was processed by the system. | ||
/// </summary> | ||
[JsonPropertyName("sisteEndringsId")] | ||
public long? LatestChangeIdentifier { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the starting change identifier indicating the point from which the system begins retrieving changes. | ||
/// </summary> | ||
[JsonPropertyName("fraEndringsId")] | ||
public long? StartingIdentifier { get; init; } | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Altinn.Profile.Core/ContactRegister/IContactRegisterHttpClient.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,19 @@ | ||
using Altinn.Profile.Core.ContactRegister; | ||
|
||
namespace Altinn.Profile.Integrations.ContactRegister; | ||
|
||
/// <summary> | ||
/// An HTTP client to interact with the contact register. | ||
/// </summary> | ||
public interface IContactRegisterHttpClient | ||
{ | ||
/// <summary> | ||
/// Retrieves the changes in persons' contact details from the specified endpoint. | ||
/// </summary> | ||
/// <param name="endpointUrl">The URL of the endpoint to retrieve contact details changes from.</param> | ||
/// <param name="startingIdentifier">The starting identifier for retrieving contact details changes.</param> | ||
/// <returns> | ||
/// A task that represents the asynchronous operation. | ||
/// </returns> | ||
Task<ContactRegisterChangesLog> GetContactDetailsChangesAsync(string endpointUrl, long startingIdentifier); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Altinn.Profile.Core/ContactRegister/IContactRegisterService.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,16 @@ | ||
namespace Altinn.Profile.Core.ContactRegister; | ||
|
||
/// <summary> | ||
/// Interface for handling changes in a person's contact preferences. | ||
/// </summary> | ||
public interface IContactRegisterService | ||
{ | ||
/// <summary> | ||
/// Asynchronously retrieves the changes in contact preferences for all persons starting from a given number. | ||
/// </summary> | ||
/// <param name="startingIdentifier">The identifier from which to start retrieving the data.</param> | ||
/// <returns> | ||
/// A task that represents the asynchronous operation. | ||
/// </returns> | ||
Task<ContactRegisterChangesLog> RetrieveContactDetailsChangesAsync(long startingIdentifier); | ||
} |
This file was deleted.
Oops, something went wrong.
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
21 changes: 10 additions & 11 deletions
21
src/Altinn.Profile.Core/Integrations/IUnitProfileRepository.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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
using Altinn.Profile.Core.Unit.ContactPoints; | ||
|
||
namespace Altinn.Profile.Core.Integrations | ||
namespace Altinn.Profile.Core.Integrations; | ||
|
||
/// <summary> | ||
/// Interface for accessing user profile services related to unit contact points. | ||
/// </summary> | ||
public interface IUnitProfileRepository | ||
{ | ||
/// <summary> | ||
/// Interface describing a client for the user profile service | ||
/// Retrieves a list of user-registered contact points based on the specified lookup criteria. | ||
/// </summary> | ||
public interface IUnitProfileRepository | ||
{ | ||
/// <summary> | ||
/// Provides a list of user registered contact points based on the lookup criteria | ||
/// </summary> | ||
/// <param name="lookup">Lookup object containing a list of organizations and a resource</param> | ||
/// <returns>A list of unit contact points</returns> | ||
Task<Result<UnitContactPointsList, bool>> GetUserRegisteredContactPoints(UnitContactPointLookup lookup); | ||
} | ||
/// <param name="lookup">An object containing a list of organization numbers and a resource ID to filter the contact points.</param> | ||
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="Result{TValue, TError}"/> object with a <see cref="UnitContactPointsList"/> on success, or a boolean indicating failure.</returns> | ||
Task<Result<UnitContactPointsList, bool>> GetUserRegisteredContactPoints(UnitContactPointLookup lookup); | ||
} |
Oops, something went wrong.