-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add dataloaders to TRB Feedback * convert slice to postgres array * use dataloaders in status calls * remove unnecessary no rows error check * add dataloaders to advice letter and finish refactoring statuses * sort mock users * nil check statuses
- Loading branch information
Showing
21 changed files
with
295 additions
and
222 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package dataloaders | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/google/uuid" | ||
|
||
"github.com/cms-enterprise/easi-app/pkg/helpers" | ||
"github.com/cms-enterprise/easi-app/pkg/models" | ||
) | ||
|
||
func (d *dataReader) batchTRBRequestAdviceLettersByTRBRequestIDs(ctx context.Context, trbRequestIDs []uuid.UUID) ([]*models.TRBAdviceLetter, []error) { | ||
data, err := d.db.GetTRBAdviceLettersByTRBRequestIDs(ctx, trbRequestIDs) | ||
if err != nil { | ||
return nil, []error{err} | ||
} | ||
|
||
return helpers.OneToOne(trbRequestIDs, data), nil | ||
} | ||
|
||
func GetTRBAdviceLetterByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) (*models.TRBAdviceLetter, error) { | ||
loaders, ok := loadersFromCTX(ctx) | ||
if !ok { | ||
return nil, errors.New("unexpected nil loaders in GetTRBRequestContractNumbersByTRBRequestID") | ||
} | ||
|
||
return loaders.TRBRequestAdviceLetter.Load(ctx, trbRequestID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.