Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions directory/api/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1153,15 +1153,9 @@ func (a ApiImpl) UpdateEntry(ctx context.Context, request UpdateEntryRequestObje
} else {
lmsConfig := request.Body.LmsConfig.MustGet()
originalLMSConfig, queryErr := qtx.GetLMSConfigByEntry(ctx, orig.ID)
if queryErr != nil {
if errors.Is(queryErr, pgx.ErrNoRows) {
if lmsConfig.Address == nil || lmsConfig.FromAgency == nil {
return UpdateEntry400TextResponse("lmsConfig.address and lmsConfig.fromAgency are required when creating lmsConfig"), nil
}
} else {
slog.ErrorContext(ctx, "unable to query original lmsConfig", "error", queryErr)
return UpdateEntry500TextResponse("Internal server error"), nil
}
if queryErr != nil && !errors.Is(queryErr, pgx.ErrNoRows) {
slog.ErrorContext(ctx, "unable to query original lmsConfig", "error", queryErr)
return UpdateEntry500TextResponse("Internal server error"), nil
}

_, err = qtx.UpsertLMSConfig(ctx, db.UpsertLMSConfigParams{
Expand Down
3 changes: 2 additions & 1 deletion directory/test/entries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ func TestEntryCases(t *testing.T) {
method: http.MethodPatch,
endpoint: "/entries/by-id/00000000-0000-0000-0000-000000000003",
bodyFile: "entry-new-lmsconfig-incomplete.patch.req.json",
status: http.StatusBadRequest,
status: http.StatusNoContent,
refetchFile: "entry-new-lmsconfig-incomplete.patch.refetch.json",
addlHeaders: consortiumPermissionHeaders,
},
{
Expand Down