Skip to content

Commit 975912f

Browse files
heuveagithub-code-quality[bot]Copilot
authored
FUND-2402 NRC subscription zaken with filter on kenmerkbronnen (#156)
* initial version filter on zaakkenmerken * improved version * code made cleaner * code made cleaner * Potential fix for pull request finding 'Inefficient use of ContainsKey' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Update src/OneGround.ZGW.Zaken.Web/Handlers/ZaakKenmerkenResolver.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/OneGround.ZGW.Notificaties.Messaging/Consumers/SendNotificatiesConsumer.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * some co-pilot review points fixed * co-pilot, eg UnitTests added * added validation * Update src/OneGround.ZGW.Notificaties.Web/Validators/AbonnementRequestValidator.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * co-pilot review fix * added constants --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 669c3c9 commit 975912f

File tree

10 files changed

+1055
-118
lines changed

10 files changed

+1055
-118
lines changed

src/OneGround.ZGW.Besluiten.Web/Handlers/BesluitKenmerkenResolver.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ public async Task<Dictionary<string, string>> GetKenmerkenAsync(Besluit besluit,
2828
{
2929
return new Dictionary<string, string>
3030
{
31-
{ "besluittype", besluit.BesluitType },
32-
{ "verantwoordelijke_organisatie", besluit.VerantwoordelijkeOrganisatie },
33-
// Note: New fields that can be filtered on
34-
{ "besluittype_omschrijving", await GetBesluitTypeOmschrijvingFromBesluitAsync(besluit) },
35-
{ "catalogus", GetCatalogusUrlFromResource(besluit.BesluitType, besluit.CatalogusId) },
36-
{ "domein", await GetDomeinFromBesluitAsync(besluit) },
31+
{ Constants.BrcBesluittype, besluit.BesluitType },
32+
{ Constants.BrcVerantwoordelijkeOrganisatie, besluit.VerantwoordelijkeOrganisatie },
33+
{ Constants.BrcBesluittypeOmschrijving, await GetBesluitTypeOmschrijvingFromBesluitAsync(besluit) },
34+
{ Constants.BrcCatalogus, GetCatalogusUrlFromResource(besluit.BesluitType, besluit.CatalogusId) },
35+
{ Constants.BrcDomein, await GetDomeinFromBesluitAsync(besluit) },
3736
};
3837
}
3938

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
namespace OneGround.ZGW.Common.Web.Kenmerken;
2+
3+
public class Constants
4+
{
5+
// Generic constants notificatie kenmerken
6+
public const string NotificatieActie = "#actie";
7+
public const string NotificatieResource = "#resource";
8+
9+
// Zaak-kenmerken
10+
public const string ZrcBronorganisatie = "bronorganisatie";
11+
public const string ZrcZaaktype = "zaaktype";
12+
public const string ZrcVertrouwelijkheidaanduiding = "vertrouwelijkheidaanduiding";
13+
public const string ZrcZaaktypeIdentificatie = "zaaktype_identificatie";
14+
public const string ZrcArchiefstatus = "archiefstatus";
15+
public const string ZrcArchiefnominatie = "archiefnominatie";
16+
public const string ZrcOpdrachtgevendeOrganisatie = "opdrachtgevende_organisatie";
17+
public const string ZrcCatalogus = "catalogus";
18+
public const string ZrcDomein = "domein";
19+
public const string ZrcIsEindzaakstatus = "is_eindzaakstatus";
20+
public const string ZrcKenmerkBron = "kenmerk_bron";
21+
22+
// Document-kenmerken
23+
public const string DrcBronorganisatie = "bronorganisatie";
24+
public const string DrcInformatieobjecttype = "informatieobjecttype";
25+
public const string DrcVertrouwelijkheidaanduiding = "vertrouwelijkheidaanduiding";
26+
public const string DrcInformatieobjecttypeOmschrijving = "informatieobjecttype_omschrijving";
27+
public const string DrcCatalogus = "catalogus";
28+
public const string DrcDomein = "domein";
29+
public const string DrcStatus = "status";
30+
public const string DrcInhoudIsVervallen = "inhoud_is_vervallen";
31+
32+
// Besluit-kenmerken
33+
public const string BrcBesluittype = "besluittype";
34+
public const string BrcVerantwoordelijkeOrganisatie = "verantwoordelijke_organisatie";
35+
public const string BrcBesluittypeOmschrijving = "besluittype_omschrijving";
36+
public const string BrcCatalogus = "catalogus";
37+
public const string BrcDomein = "domein";
38+
}

src/OneGround.ZGW.Documenten.Jobs/Subscription/CreateOrPatchSubscriptionJob.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using OneGround.ZGW.Common.Services;
1010
using OneGround.ZGW.Notificaties.Contracts.v1;
1111
using OneGround.ZGW.Notificaties.ServiceAgent;
12+
using NotificatieConstants = OneGround.ZGW.Common.Web.Kenmerken.Constants;
1213

1314
namespace OneGround.ZGW.Documenten.Jobs.Subscription;
1415

@@ -106,8 +107,8 @@ public async Task ExecuteAsync(string rsin)
106107
Filters = new Dictionary<string, string>
107108
{
108109
// Note: define a filter to receive a notification only if resource is 'zaakinformatieobject' and actie is 'create'
109-
{ "#resource", "zaakinformatieobject" },
110-
{ "#actie", "create" },
110+
{ NotificatieConstants.NotificatieResource, "zaakinformatieobject" },
111+
{ NotificatieConstants.NotificatieActie, "create" },
111112
},
112113
},
113114
new AbonnementKanaalDto
@@ -116,8 +117,8 @@ public async Task ExecuteAsync(string rsin)
116117
Filters = new Dictionary<string, string>
117118
{
118119
// Note: define a filter to receive a notification only if resource is 'zaakinformatieobject' and actie is 'destroy'
119-
{ "#resource", "zaakinformatieobject" },
120-
{ "#actie", "destroy" },
120+
{ NotificatieConstants.NotificatieResource, "zaakinformatieobject" },
121+
{ NotificatieConstants.NotificatieActie, "destroy" },
121122
},
122123
},
123124
new AbonnementKanaalDto
@@ -126,8 +127,8 @@ public async Task ExecuteAsync(string rsin)
126127
Filters = new Dictionary<string, string>
127128
{
128129
// Note: define a filter to receive a notification only if resource is 'besluitinformatieobject' and actie is 'create'
129-
{ "#resource", "besluitinformatieobject" },
130-
{ "#actie", "create" },
130+
{ NotificatieConstants.NotificatieResource, "besluitinformatieobject" },
131+
{ NotificatieConstants.NotificatieActie, "create" },
131132
},
132133
},
133134
new AbonnementKanaalDto
@@ -136,8 +137,8 @@ public async Task ExecuteAsync(string rsin)
136137
Filters = new Dictionary<string, string>
137138
{
138139
// Note: define a filter to receive a notification only if resource is 'besluitinformatieobject' and actie is 'destroy'
139-
{ "#resource", "besluitinformatieobject" },
140-
{ "#actie", "destroy" },
140+
{ NotificatieConstants.NotificatieResource, "besluitinformatieobject" },
141+
{ NotificatieConstants.NotificatieActie, "destroy" },
141142
},
142143
},
143144
},

src/OneGround.ZGW.Documenten.Web/Handlers/DocumentKenmerkenResolver.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ public async Task<Dictionary<string, string>> GetKenmerkenAsync(EnkelvoudigInfor
3131

3232
return new Dictionary<string, string>
3333
{
34-
{ "bronorganisatie", latestEnkelvoudigInformatieObjectVersie.Bronorganisatie },
35-
{ "informatieobjecttype", informatieobject.InformatieObjectType },
34+
{ Constants.DrcBronorganisatie, latestEnkelvoudigInformatieObjectVersie.Bronorganisatie },
35+
{ Constants.DrcInformatieobjecttype, informatieobject.InformatieObjectType },
3636
{
37-
"vertrouwelijkheidaanduiding",
37+
Constants.DrcVertrouwelijkheidaanduiding,
3838
latestEnkelvoudigInformatieObjectVersie.Vertrouwelijkheidaanduiding.HasValue
3939
? $"{latestEnkelvoudigInformatieObjectVersie.Vertrouwelijkheidaanduiding}"
4040
: null
4141
},
42-
// Note: New fields that can be filtered on
43-
{ "informatieobjecttype_omschrijving", await GetInformatieObjectTypeOmschrijvingFromInformatieObjectAsync(informatieobject) },
44-
{ "catalogus", GetCatalogusUrlFromResource(informatieobject.InformatieObjectType, informatieobject.CatalogusId) },
45-
{ "domein", await GetDomeinFromInformatieObjectAsync(informatieobject) },
46-
{ "status", latestEnkelvoudigInformatieObjectVersie.Status.ToString() },
47-
{ "inhoud_is_vervallen", latestEnkelvoudigInformatieObjectVersie.InhoudIsVervallen.ToString() },
42+
{ Constants.DrcInformatieobjecttypeOmschrijving, await GetInformatieObjectTypeOmschrijvingFromInformatieObjectAsync(informatieobject) },
43+
{ Constants.DrcCatalogus, GetCatalogusUrlFromResource(informatieobject.InformatieObjectType, informatieobject.CatalogusId) },
44+
{ Constants.DrcDomein, await GetDomeinFromInformatieObjectAsync(informatieobject) },
45+
{ Constants.DrcStatus, latestEnkelvoudigInformatieObjectVersie.Status.ToString() },
46+
{ Constants.DrcInhoudIsVervallen, latestEnkelvoudigInformatieObjectVersie.InhoudIsVervallen.ToString() },
4847
};
4948
}
5049

0 commit comments

Comments
 (0)