Skip to content

Commit

Permalink
feat: or-1759 remove redundant method
Browse files Browse the repository at this point in the history
  • Loading branch information
QuintenGreenstack committed Nov 14, 2023
1 parent 7c25c4b commit 67b1ae8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,59 +122,6 @@ public async Task AppendRelatie(string id, Relatie relatie)
if (!response.IsValid)
throw new IndexDocumentFailed(response.DebugInformation);
}

public async Task UpdateNaamInRelaties(VerenigingZoekDocument documentToUpdate)
{
var matches = _elasticClient.Search<VerenigingZoekDocument>(descriptor => descriptor.Query(
q => q
.Nested(n => n
.Path(document => document.Relaties)
.Query(nq => nq
.Nested(n => n
.Path(doc => doc.Relaties.First()
.AndereVereniging)
.Query(nq2 => nq2
.Term(m => m
.Field(
doc => doc
.Relaties
.First()
.AndereVereniging
.VCode)
.Value(
documentToUpdate
.VCode)))))
)
));

var response = await _elasticClient.UpdateByQueryAsync<VerenigingZoekDocument>(
u => u
.Query(
q => q
.Nested(n => n
.Path(document => document.Relaties)
.Query(nq => nq
.Nested(n => n
.Path(doc => doc.Relaties.First().AndereVereniging)
.Query(nq2 => nq2
.Term(m => m
.Field(doc => doc.Relaties.First().AndereVereniging.VCode)
.Value(documentToUpdate.VCode)))))
)
)
.Script(s => s
.Source("for(r in ctx._source.relaties){" +
" if(r.andereVereniging.vCode == params.gewijzigdeVereniging.vCode){" +
" r.andereVereniging.naam = params.gewijzigdeVereniging.naam" +
" }" +
"}")
.Params(objects => objects.Add(key: "gewijzigdeVereniging", documentToUpdate)))
);

if (!response.IsValid)
throw new IndexDocumentFailed(response.DebugInformation);
}

public async Task WijzigNaamAfdeling(string vCode, string nieuweNaam)
{
var afdeling = _elasticClient.Get<VerenigingZoekDocument>(vCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ Task IndexAsync<TDocument>(TDocument document)
Task UpdateLocatie(string id, VerenigingZoekDocument.Locatie locatie);
Task Remove(string id);
Task AppendRelatie(string id, Relatie relatie);
Task UpdateNaamInRelaties(VerenigingZoekDocument documentToUpdate);
Task WijzigNaamAfdeling(string vCode, string nieuweNaam);
}

0 comments on commit 67b1ae8

Please sign in to comment.