fix: change API design to be more RESTful
This commit is contained in:
@ -36,10 +36,8 @@ import (
|
||||
// User is the user controller interface, it describes all the handlers
|
||||
// that need to be implemented for the /user endpoint
|
||||
type User interface {
|
||||
Signup(core.Context)
|
||||
Create(core.Context)
|
||||
UpdateInfo(*gin.Context)
|
||||
Login(*gin.Context)
|
||||
Logout(*gin.Context)
|
||||
ChangePassword(*gin.Context)
|
||||
}
|
||||
|
||||
@ -59,7 +57,7 @@ func NewUserController(us usecase.User) User {
|
||||
}
|
||||
}
|
||||
|
||||
func (uc *UserController) Signup(ctx core.Context) {
|
||||
func (uc *UserController) Create(ctx core.Context) {
|
||||
var params model.User
|
||||
|
||||
if err := ctx.Bind(¶ms); err != nil {
|
||||
@ -87,11 +85,5 @@ func (uc *UserController) Signup(ctx core.Context) {
|
||||
func (uc *UserController) UpdateInfo(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
func (uc *UserController) Login(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
func (uc *UserController) Logout(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
func (uc *UserController) ChangePassword(ctx *gin.Context) {
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func Routes(engine *gin.Engine, c controller.AppController) *gin.Engine {
|
||||
{
|
||||
userV1 := v1.Group("/user")
|
||||
{
|
||||
userV1.POST("/signup", func(ctx *gin.Context) { c.User.Signup(ctx) })
|
||||
userV1.POST("/create", func(ctx *gin.Context) { c.User.Create(ctx) })
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user