-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71d8521
commit a83e48d
Showing
11 changed files
with
227 additions
and
108 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,18 @@ | ||
package common | ||
|
||
import "github.com/gin-gonic/gin" | ||
|
||
// NewHTTPError example | ||
func NewHTTPError(ctx *gin.Context, status int, err error) { | ||
er := HTTPError{ | ||
Code: status, | ||
Message: err.Error(), | ||
} | ||
ctx.JSON(status, er) | ||
} | ||
|
||
// HTTPError example | ||
type HTTPError struct { | ||
Code int `json:"code" example:"400"` | ||
Message string `json:"message" example:"Request Failure"` | ||
} |
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
Binary file not shown.
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 |
---|---|---|
@@ -1,11 +1,17 @@ | ||
package model | ||
|
||
// UserModel usermodel | ||
type UserModel struct { | ||
ID uint `gorm:"primary_key" json:"ID"` | ||
Username string `gorm:"column:username" json:"Username" ` | ||
Email string `gorm:"column:email;unique_index" json:"Email"` | ||
Bio string `gorm:"column:bio;size:1024" json:"Bio"` | ||
Image string `gorm:"column:image" json:"Image"` | ||
Password string `gorm:"column:password;not null" json:"Password"` | ||
// User usermodel | ||
type User struct { | ||
ID uint `json:"ID"` | ||
Username string `json:"Username"` | ||
Email string `json:"Email"` | ||
Bio string `json:"Bio"` | ||
Image string `json:"Image"` | ||
Password string `json:"Password" ` | ||
} | ||
|
||
// LoginUser userModel | ||
type LoginUser struct { | ||
Email string `json:"Email" example:"email" binding:"required"` | ||
Password string `json:"Password" example:"password" binding:"required"` | ||
} |
Oops, something went wrong.