Add API handler for /users/self

This commit is contained in:
Howl
2016-04-05 22:38:33 +02:00
parent d02f3f9951
commit b484fe2761
2 changed files with 11 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import (
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/osuripple/api/common"
)
@@ -113,3 +114,12 @@ func userPuts(md common.MethodData, row *sql.Row) (r common.Response) {
r.Data = user
return
}
// UserSelfGET is a shortcut for /users/id/self. (/users/self)
func UserSelfGET(md common.MethodData) common.Response {
md.C.Params = append(md.C.Params, gin.Param{
Key: "id",
Value: "self",
})
return UserByIDGET(md)
}