-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: description for apps and jobs #3668
Conversation
query := "SELECT cl.id AS cluster_id, cl.cluster_name AS cluster_name, cl.created_on AS cluster_created_on, cl.created_by AS cluster_created_by, gn.id AS note_id, gn.description, gn.created_by, gn.created_on, gn.updated_by, gn.updated_on FROM" + | ||
" cluster cl LEFT JOIN" + | ||
" generic_note gn " + | ||
" ON cl.id=gn.identifier AND gn.identifier_type = 0" + //0 is identifier type for cluster description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve this 0
in Sprintf
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
resp, err := noteHistoryService.Save(tx, testInput, testUserId) | ||
assert.Nil(tt, resp) | ||
assert.NotNil(tt, err) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we checking err != nil
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used assert.NotEqual
resp, err := noteHistoryService.Save(tx, testInput, testUserId) | ||
assert.Nil(tt, err) | ||
assert.NotNil(tt, resp) | ||
if resp == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use assert.NotEmpty
in which u can also pass your failure msg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
t.Run("Test Success Case", func(tt *testing.T) { | ||
genericNoteSvc, mockedNoteRepo, mockedHistorySvc, mockedUserRepo := initGenericNoteService(t) | ||
tx := &pg.Tx{} | ||
mockedNoteRepo.On("FindByIdentifier", mock.AnythingOfType("int"), mock.AnythingOfType("repository.NoteType")).Return(&repository3.GenericNote{}, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why aren't we using actual values in params ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if createRequest.Description != nil && createRequest.Description.Description != "" { | ||
descriptionObj := repository3.GenericNote{ | ||
Description: createRequest.Description.Description, | ||
IdentifierType: repository3.AppType, | ||
Identifier: app.Id, | ||
} | ||
note, err := impl.genericNoteService.Save(tx, &descriptionObj, createRequest.UserId) | ||
if err != nil { | ||
impl.logger.Errorw("error in saving description", "err", err, "descriptionObj", descriptionObj, "userId", createRequest.UserId) | ||
return nil, err | ||
} | ||
createRequest.Description = note | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this in func impl.storeDescription
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
scripts/sql/161_generic_note.up.sql
Outdated
AlTER TABLE cluster_note DROP CONSTRAINT cluster_note_cluster_id_fkey; | ||
ALTER TABLE cluster_note RENAME to generic_note; | ||
ALTER TABLE generic_note RENAME COLUMN cluster_id to identifier; | ||
ALTER TABLE generic_note ADD COLUMN identifier_type int4 DEFAULT 0 NOT NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't set Default values to existing tables, we should handle it through code.
api/restHandler/AppRestHandler.go
Outdated
common.WriteJsonResp(w, err, nil, http.StatusBadRequest) | ||
return | ||
} | ||
handler.logger.Infow("request payload, Update", "payload", bean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put its log level to debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
api/restHandler/AppRestHandler.go
Outdated
|
||
// RBAC enforcer ends | ||
|
||
clusterNoteResponseBean, err := handler.genericNoteService.Update(&bean, userId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename variable name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
SonarCloud Quality Gate failed.
|
Description
Added description for jobs and apps.
Fixes #3700
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist:
Does this PR introduce a user-facing change?