test(server): fix bugs and tests

This commit is contained in:
hexxa 2022-09-03 23:32:32 +08:00 committed by Hexxa
parent 4265ab593e
commit ce77eb7534
13 changed files with 266 additions and 288 deletions

View file

@ -8,8 +8,8 @@ import (
"strconv"
"github.com/gin-gonic/gin"
"github.com/ihexxa/quickshare/src/cryptoutil"
"github.com/ihexxa/quickshare/src/db"
)
var (
@ -171,6 +171,8 @@ func GetUserId(ctx *gin.Context) (uint64, error) {
if !ok {
return 0, errors.New("user id not found")
}
if userID == "" {
return db.VisitorID, nil
}
return strconv.ParseUint(userID, 10, 64)
}