This commit is contained in:
Steven Tracey 2025-07-10 15:47:37 -04:00
parent 97581703c1
commit 667b27f036

28
main.go
View File

@ -18,12 +18,12 @@ import (
type Address struct {
Id int64 `json:"-"`
Street1 string `json:"street1"`
Street2 *string `json:"street2,omitempty"`
City string `json:"city"`
State *string `json:"state,omitempty"`
PostalCode string `json:"postal_code"`
Country string `json:"country"`
Street1 string `json:"street1" form:"street1"`
Street2 *string `json:"street2,omitempty" form:"street2,omitempty"`
City string `json:"city" form:"city"`
State *string `json:"state,omitempty" form:"state,omitempty"`
PostalCode string `json:"postal_code" form:"postal_code"`
Country string `json:"country" form:"country"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
}
@ -31,12 +31,12 @@ type Address struct {
type User struct {
Status int32 `json:"status"`
Id int64 `json:"-"`
UserName string `json:"user_name"`
ContactName string `json:"contact_name"`
UserName string `json:"user_name" form:"user_name"`
ContactName string `json:"contact_name" form:"contact_name"`
SecretCodes string `json:"-"`
CurrentToken *string `json:"-"`
ContactNumber string `json:"contact_number"`
EmailAddress string `json:"email_address"`
ContactNumber string `json:"contact_number" form:"phone_number"`
EmailAddress string `json:"email_address" form:"email_address"`
MailingAddress Address `json:"mailing_address"`
}
@ -211,6 +211,14 @@ func main() {
}
}
})
api.POST("/register/:user", func(c *gin.Context) {
var newUser User
err := c.Bind(&newUser)
if err != nil {
fmt.Printf("Error: %v", err)
}
c.JSON(http.StatusOK, newUser)
})
user := r.Group("/u")
user.GET("/:user", func(c *gin.Context) {