Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
inciner8r committed Apr 1, 2024
1 parent 981c4ef commit 6fb7891
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion api/projects/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ func ApplyRoutes(r *gin.RouterGroup) {

func AddProject(c *gin.Context) {
var req AddProjectRequest
if err := c.BindJSON(&req); err != nil {
if err := c.ShouldBind(&req); err != nil {
fmt.Println("error", err)
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
db := dbconfig.GetDb()
Expand All @@ -39,9 +40,11 @@ func AddProject(c *gin.Context) {
project.Twitter = req.Twitter
project.Linkedin = req.Linkedin
project.Owner = req.Owner
project.Image = req.Image
err := db.Create(&project).Error
if err != nil {
fmt.Println("error", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{
Expand Down
4 changes: 2 additions & 2 deletions api/user/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package user

type request struct {
username string `json:"username"`
walletAddress string `json:"username"`
Username string `json:"username"`
WalletAddress string `json:"walletAddress"`
}
2 changes: 1 addition & 1 deletion api/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func AssignWalletToUsername(c *gin.Context) {
"error": "bad request",
})
}
tx, err := instance.AssignAddressToUsername(auth, request.username, common.HexToAddress(request.walletAddress))
tx, err := instance.AssignAddressToUsername(auth, request.Username, common.HexToAddress(request.WalletAddress))
if err != nil {
logrus.Errorf("cannot assert type: publicKey is not of type *ecdsa.PublicKey")
c.JSON(http.StatusInternalServerError, gin.H{
Expand Down

0 comments on commit 6fb7891

Please sign in to comment.