forked from nixcn/nixcn-cms
Migrate checkin to user service
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
10
data/user.go
10
data/user.go
@@ -78,11 +78,11 @@ func (self *User) Create() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UserUpdateInput struct {
|
type UserUpdateInput struct {
|
||||||
Email *string
|
Email *string `json:"email"`
|
||||||
Nickname *string
|
Nickname *string `json:"nickname"`
|
||||||
Subtitle *string
|
Subtitle *string `json:"subtitle"`
|
||||||
Avatar *string
|
Avatar *string `json:"avatar"`
|
||||||
Type *string
|
Type *string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *User) UpdateByUserID(userID uuid.UUID, in *UserUpdateInput) error {
|
func (self *User) UpdateByUserID(userID uuid.UUID, in *UserUpdateInput) error {
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package checkin
|
|
||||||
|
|
||||||
import (
|
|
||||||
"nixcn-cms/middleware"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Handler(r *gin.RouterGroup) {
|
|
||||||
r.Use(middleware.JWTAuth())
|
|
||||||
r.POST("", Checkin)
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package checkin
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
7
service/user/create.go
Normal file
7
service/user/create.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
func Create(c *gin.Context) {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,5 +8,8 @@ import (
|
|||||||
|
|
||||||
func Handler(r *gin.RouterGroup) {
|
func Handler(r *gin.RouterGroup) {
|
||||||
r.Use(middleware.JWTAuth())
|
r.Use(middleware.JWTAuth())
|
||||||
r.GET("/info", UserInfo)
|
r.GET("/info", Info)
|
||||||
|
r.POST("/checkin", Checkin)
|
||||||
|
r.PATCH("/update", Update)
|
||||||
|
r.POST("/create", Create)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UserInfo(c *gin.Context) {
|
func Info(c *gin.Context) {
|
||||||
data := new(data.User)
|
data := new(data.User)
|
||||||
userId, ok := c.Get("user_id")
|
userId, ok := c.Get("user_id")
|
||||||
if !ok {
|
if !ok {
|
||||||
0
service/user/update.go
Normal file
0
service/user/update.go
Normal file
Reference in New Issue
Block a user