Fix: return userID to client

This commit is contained in:
2020-04-21 16:17:11 +08:00
parent 3a4b2f8883
commit a0821dc137
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -16,6 +16,8 @@ func TestUserCreateHandler(t *testing.T) {
body, _ := json.Marshal(createUserMsg{
UserName: name,
Password: "qwer123",
Nickname: "Nick",
Gender: datamodel.Female,
})
req, err := http.NewRequest("POST", "/register/", bytes.NewReader(body))
if err != nil {
+8
View File
@@ -3,8 +3,16 @@ package datamodel
import "github.com/jinzhu/gorm"
import _ "github.com/jinzhu/gorm/dialects/postgres"
const (
Female = iota
Male
)
type User struct {
gorm.Model
UserName string `gorm:"UNIQUE;Column:username"`
Password string
NickName string
Gender int
}