-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update account username and email (#135)
* Adding update account handler * Adding update account feature * Fixing account controller interface * Fixing account controller mock * Fixing account update handler * Fixing lint * Adding handler test * Adding updation validate * Testing update account handler * Improving update account controller * Testing update account controller * Adding vuln as risk accepeted hash 45aa5c46df5ba51d7e59da826544412352c189a6acf5707f941922181c94f989
- Loading branch information
1 parent
562cd27
commit 1445845
Showing
12 changed files
with
234 additions
and
14 deletions.
There are no files selected for viewing
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 @@ | ||
// Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package dto | ||
|
||
import authEntities "github.com/ZupIT/horusec/development-kit/pkg/entities/auth" | ||
|
||
type UpdateAccount struct { | ||
Email string `json:"email"` | ||
Username string `json:"username"` | ||
} | ||
|
||
func (c *UpdateAccount) ToAccount() *authEntities.Account { | ||
return &authEntities.Account{ | ||
Email: c.Email, | ||
Username: c.Username, | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
development-kit/pkg/entities/auth/dto/update_account_test.go
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,30 @@ | ||
// Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package dto | ||
|
||
import ( | ||
"testing" | ||
|
||
authEntities "github.com/ZupIT/horusec/development-kit/pkg/entities/auth" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestToAccount_UpdateAccount(t *testing.T) { | ||
updateAccount := &UpdateAccount{} | ||
|
||
t.Run("should success parse update account to account", func(t *testing.T) { | ||
assert.IsType(t, &authEntities.Account{}, updateAccount.ToAccount()) | ||
}) | ||
} |
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
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.