Skip to content

Commit

Permalink
Filter systems on IsVisible (#468)
Browse files Browse the repository at this point in the history
* Added isvisible to the registeredsystemdto

* filter systems with so only systems with IsVisible is returned from GET systemregister

---------

Co-authored-by: acn-dgopa <dhanasneham@gmail.com>
  • Loading branch information
mgunnerud and acn-dgopa authored Jan 3, 2025
1 parent c8754e1 commit 349f18d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ public record class RegisteredSystemDTO
/// The array of Rights versus System Provider's Resources needed to use this Registered System
/// </summary>
public List<Right> Rights { get; set; } = [];

/// <summary>
/// True if the registered system is visible to the user in the UI
/// </summary>
public bool IsVisible { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ public SystemRegisterService(
public async Task<List<RegisteredSystemDTO>> GetListRegSys(CancellationToken cancellationToken)
{
List<RegisteredSystemDTO> lista = await _systemRegisterClient.GetListRegSys(cancellationToken);

IEnumerable<string> orgNrs = lista.Select(x => x.SystemVendorOrgNumber);
IEnumerable<RegisteredSystemDTO> visibleSystems = lista.Where(system => system.IsVisible);

IEnumerable<string> orgNrs = visibleSystems.Select(x => x.SystemVendorOrgNumber);
var orgNames = await _registerClient.GetPartyNamesForOrganization(orgNrs, cancellationToken);
foreach (RegisteredSystemDTO response in lista)
foreach (RegisteredSystemDTO response in visibleSystems)
{
try
{
Expand All @@ -38,7 +39,7 @@ public async Task<List<RegisteredSystemDTO>> GetListRegSys(CancellationToken can
}
}

return lista;
return visibleSystems.ToList();
}

public async Task<List<ServiceResource>> GetSystemRights(string systemId, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ private static async Task<List<RegisteredSystemDTO>> MockTestHelper()
Rights =
[

]
],
IsVisible = true
};

RegisteredSystemDTO regsys2 = new()
Expand All @@ -52,7 +53,8 @@ private static async Task<List<RegisteredSystemDTO>> MockTestHelper()
Rights =
[

]
],
IsVisible = true
};

RegisteredSystemDTO regsys3 = new()
Expand All @@ -75,7 +77,8 @@ private static async Task<List<RegisteredSystemDTO>> MockTestHelper()
Rights =
[

]
],
IsVisible = true
};

RegisteredSystemDTO regsys4 = new()
Expand All @@ -97,7 +100,8 @@ private static async Task<List<RegisteredSystemDTO>> MockTestHelper()
},
Rights =
[
]
],
IsVisible = true

};

Expand All @@ -121,7 +125,33 @@ private static async Task<List<RegisteredSystemDTO>> MockTestHelper()
Rights =
[

]
],
IsVisible = true
};


RegisteredSystemDTO regsys6 = new()
{
SystemVendorOrgNumber = "314048435",
Description = new Dictionary<string, string>
{
{"nb", "Kult system som er usynlig." },
{"en", "Cool system that is not visible." },
{"nn", "Framifrå system som er usynlig." }
},
SystemId = "visma_skatt_totalpakke_usynlig",
SystemVendorOrgName = "Visma Not Visible",
Name = new Dictionary<string, string>
{
{"nb", "4Humans HR system 2024 versjon." },
{"en", "4Humans HR system 2024 versjon." },
{"nn", "4Humans HR system 2024 versjon." }
},
Rights =
[

],
IsVisible = false
};

List<RegisteredSystemDTO> theList = new()
Expand All @@ -130,7 +160,8 @@ private static async Task<List<RegisteredSystemDTO>> MockTestHelper()
regsys2,
regsys3,
regsys4,
regsys5
regsys5,
regsys6
};

return theList;
Expand Down

0 comments on commit 349f18d

Please sign in to comment.