feat(handlers): replace boltdb with sqlite in handlers

This commit is contained in:
hexxa 2022-09-03 20:24:45 +08:00 committed by Hexxa
parent 791848f75c
commit 085a3e4e10
14 changed files with 342 additions and 307 deletions

View file

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"path/filepath"
"strconv"
"github.com/gin-gonic/gin"
@ -164,3 +165,12 @@ func GetUserInfo(tokenStr string, tokenEncDec cryptoutil.ITokenEncDec) (map[stri
return claims, nil
}
func GetUserId(ctx *gin.Context) (uint64, error) {
userID, ok := ctx.MustGet(UserIDParam).(string)
if !ok {
return 0, errors.New("user id not found")
}
return strconv.ParseUint(userID, 10, 64)
}