Skip to content

Commit

Permalink
Move dashboard store and lpa link type (#1409)
Browse files Browse the repository at this point in the history
* Move dashboard store and lpa link type
* Move donordata task calculations to donordata package
  • Loading branch information
hawx authored Aug 8, 2024
1 parent fede2e9 commit 35c226f
Show file tree
Hide file tree
Showing 31 changed files with 1,193 additions and 172 deletions.
9 changes: 5 additions & 4 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ all: true
packages:
github.com/ministryofjustice/opg-modernising-lpa/cmd/event-received:
github.com/ministryofjustice/opg-modernising-lpa/internal/app:
github.com/ministryofjustice/opg-modernising-lpa/internal/attorney:
github.com/ministryofjustice/opg-modernising-lpa/internal/attorney/attorneydata:
github.com/ministryofjustice/opg-modernising-lpa/internal/attorney/attorneypage:
github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider:
github.com/ministryofjustice/opg-modernising-lpa/internal/attorney:
github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider/certificateproviderdata:
github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider/certificateproviderpage:
github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider:
github.com/ministryofjustice/opg-modernising-lpa/internal/dashboard:
github.com/ministryofjustice/opg-modernising-lpa/internal/document:
github.com/ministryofjustice/opg-modernising-lpa/internal/donor:
github.com/ministryofjustice/opg-modernising-lpa/internal/donor/donordata:
github.com/ministryofjustice/opg-modernising-lpa/internal/donor/donorpage:
github.com/ministryofjustice/opg-modernising-lpa/internal/donor:
github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo:
github.com/ministryofjustice/opg-modernising-lpa/internal/event:
github.com/ministryofjustice/opg-modernising-lpa/internal/lambda:
Expand All @@ -32,8 +33,8 @@ packages:
github.com/ministryofjustice/opg-modernising-lpa/internal/secrets:
github.com/ministryofjustice/opg-modernising-lpa/internal/sesh:
github.com/ministryofjustice/opg-modernising-lpa/internal/sharecode:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter/supporterdata:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter/supporterpage:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter:
github.com/ministryofjustice/opg-modernising-lpa/internal/uid:
github.com/ministryofjustice/opg-modernising-lpa/internal/validation:
3 changes: 2 additions & 1 deletion internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/attorney/attorneypage"
"github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider"
"github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider/certificateproviderpage"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dashboard"
"github.com/ministryofjustice/opg-modernising-lpa/internal/document"
"github.com/ministryofjustice/opg-modernising-lpa/internal/donor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/donor/donorpage"
Expand Down Expand Up @@ -98,7 +99,7 @@ func App(
certificateProviderStore := certificateprovider.NewStore(lpaDynamoClient)
attorneyStore := attorney.NewStore(lpaDynamoClient)
shareCodeStore := sharecode.NewStore(lpaDynamoClient)
dashboardStore := &dashboardStore{dynamoClient: lpaDynamoClient, lpaStoreResolvingService: lpastore.NewResolvingService(donorStore, lpaStoreClient)}
dashboardStore := dashboard.NewStore(lpaDynamoClient, lpastore.NewResolvingService(donorStore, lpaStoreClient))
evidenceReceivedStore := &evidenceReceivedStore{dynamoClient: lpaDynamoClient}
organisationStore := supporter.NewOrganisationStore(lpaDynamoClient)
memberStore := supporter.NewMemberStore(lpaDynamoClient)
Expand Down
3 changes: 2 additions & 1 deletion internal/attorney/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/attorney/attorneydata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dashboard/dashboarddata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/sharecode"
)
Expand Down Expand Up @@ -66,7 +67,7 @@ func (s *Store) Create(ctx context.Context, shareCode sharecode.Data, email stri

transaction := dynamo.NewTransaction().
Create(attorney).
Create(actor.LpaLink{
Create(dashboarddata.LpaLink{
PK: dynamo.LpaKey(data.LpaID),
SK: dynamo.SubKey(data.SessionID),
DonorKey: shareCode.LpaOwnerKey,
Expand Down
3 changes: 2 additions & 1 deletion internal/attorney/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/attorney/attorneydata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dashboard/dashboarddata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/sharecode"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -57,7 +58,7 @@ func TestAttorneyStoreCreate(t *testing.T) {
expectedTransaction := &dynamo.Transaction{
Creates: []any{
details,
actor.LpaLink{
dashboarddata.LpaLink{
PK: dynamo.LpaKey("123"),
SK: dynamo.SubKey("456"),
DonorKey: dynamo.LpaOwnerKey(dynamo.DonorKey("donor")),
Expand Down
3 changes: 2 additions & 1 deletion internal/certificateprovider/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider/certificateproviderdata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dashboard/dashboarddata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/sharecode"
)
Expand Down Expand Up @@ -64,7 +65,7 @@ func (s *Store) Create(ctx context.Context, shareCode sharecode.Data, email stri

transaction := dynamo.NewTransaction().
Create(certificateProvider).
Create(actor.LpaLink{
Create(dashboarddata.LpaLink{
PK: dynamo.LpaKey(data.LpaID),
SK: dynamo.SubKey(data.SessionID),
DonorKey: shareCode.LpaOwnerKey,
Expand Down
3 changes: 2 additions & 1 deletion internal/certificateprovider/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/certificateprovider/certificateproviderdata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dashboard/dashboarddata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/sharecode"
"github.com/stretchr/testify/assert"
Expand All @@ -32,7 +33,7 @@ func TestCertificateProviderStoreCreate(t *testing.T) {
expectedTransaction := &dynamo.Transaction{
Creates: []any{
details,
actor.LpaLink{
dashboarddata.LpaLink{
PK: dynamo.LpaKey("lpa-id"),
SK: dynamo.SubKey("session-id"),
DonorKey: shareCode.LpaOwnerKey,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package actor
package dashboarddata

import (
"strings"
"time"

"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
)

Expand All @@ -16,7 +17,7 @@ type LpaLink struct {
// DonorKey is the donorKey for the donor
DonorKey dynamo.LpaOwnerKeyType
// ActorType is the type for the current user
ActorType Type
ActorType actor.Type
// UpdatedAt is set to allow this data to be queried from SKUpdatedAtIndex
UpdatedAt time.Time
}
Expand Down
Loading

0 comments on commit 35c226f

Please sign in to comment.