File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
main/scala/hmda/query/view/institutions
test/scala/hmda/query/view/institutions Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ object InstitutionView {
19
19
val name = " institutions-view"
20
20
21
21
case class GetInstitutionById (institutionId : String ) extends Command
22
+ case class GetInstitutionByRespondentId (respondentId : String ) extends Command
22
23
case class GetInstitutionsById (ids : List [String ]) extends Command
23
24
case class FindInstitutionByPeriodAndDomain (domain : String ) extends Command
24
25
@@ -63,6 +64,12 @@ class InstitutionView extends HmdaPersistentActor {
63
64
val institution = state.institutions.find(i => i.id == institutionId).getOrElse(Institution .empty)
64
65
sender() ! institution
65
66
67
+ case GetInstitutionByRespondentId (respondentId) =>
68
+ val institution = state.institutions.find { i =>
69
+ i.respondent.externalId.value == respondentId
70
+ }.getOrElse(Institution .empty)
71
+ sender() ! institution
72
+
66
73
case GetInstitutionsById (ids) =>
67
74
val institutions = state.institutions.filter(i => ids.contains(i.id))
68
75
sender() ! institutions
Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ class InstitutionViewSpec extends ActorSpec {
56
56
probe.send(institutionQuery, GetProjectionActorRef )
57
57
probe.expectMsgType[ActorRef ]
58
58
}
59
+
60
+ " return institution by respondentId" in {
61
+ probe.send(institutionQuery, GetInstitutionByRespondentId (i1.respondent.externalId.value))
62
+ probe.expectMsg(i1)
63
+ }
59
64
}
60
65
61
66
}
You can’t perform that action at this time.
0 commit comments