Skip to content

Commit

Permalink
fix: fix minor issue in rqlite store
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnu-deepsource committed Oct 12, 2023
1 parent a42d69b commit 3cf6a5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions auth/oauth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewHandler(service *Service) *Handler {
func (h *Handler) HandleAuthorize(c echo.Context) error {
req, err := contract.NewAuthorizationRequest(c)
if err != nil {
return err
return httperror.ErrBadRequest(err)
}
url, err := h.service.GetAuthorizationURL(req)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func (h *Handler) HandleAuthorize(c echo.Context) error {
func (h *Handler) HandleCallback(c echo.Context) error {
req, err := NewCallbackRequest(c)
if err != nil {
return err
return httperror.ErrBadRequest(err)
}

session, err := h.service.CreateSession(req)
Expand Down
3 changes: 2 additions & 1 deletion auth/store/rqlite/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (s *SessionStore) Create(session *session.Session) error {
if err != nil {
return fmt.Errorf("persistence/rqlite: failed to build query for insert: %w", err)
}

_, err = s.db.WriteOneParameterized(
gorqlite.ParameterizedStatement{
Query: query,
Expand All @@ -44,7 +45,7 @@ func (s *SessionStore) Update(session *session.Session) error {
Set("code", session.Code).
Set("backend_token", session.BackendToken).
Set("runner_access_token", session.RunnerAccessToken).
Set("runner_access_token_expires_at", session.RunnerTokenExpiry).
Set("runner_token_expiry", session.RunnerTokenExpiry).
Set("runner_refresh_token", session.RunnerRefreshToken).
Where(squirrel.Eq{"id": session.ID})
query, args, err := builder.ToSql()
Expand Down

0 comments on commit 3cf6a5b

Please sign in to comment.