Add users/self/favourite_mode
This commit is contained in:
parent
b0ffad5e76
commit
017421b232
|
@ -97,6 +97,7 @@ func Start(conf common.Conf, dbO *sqlx.DB) *gin.Engine {
|
||||||
gv1.GET("/friends", Method(v1.FriendsGET, common.PrivilegeReadConfidential))
|
gv1.GET("/friends", Method(v1.FriendsGET, common.PrivilegeReadConfidential))
|
||||||
gv1.GET("/friends/with", Method(v1.FriendsWithGET, common.PrivilegeReadConfidential))
|
gv1.GET("/friends/with", Method(v1.FriendsWithGET, common.PrivilegeReadConfidential))
|
||||||
gv1.GET("/users/self/donor_info", Method(v1.UsersSelfDonorInfoGET, common.PrivilegeReadConfidential))
|
gv1.GET("/users/self/donor_info", Method(v1.UsersSelfDonorInfoGET, common.PrivilegeReadConfidential))
|
||||||
|
gv1.GET("/users/self/favourite_mode", Method(v1.UsersSelfFavouriteModeGET, common.PrivilegeReadConfidential))
|
||||||
|
|
||||||
// Write privilege required
|
// Write privilege required
|
||||||
gv1.GET("/friends/add", Method(v1.FriendsAddGET, common.PrivilegeWrite))
|
gv1.GET("/friends/add", Method(v1.FriendsAddGET, common.PrivilegeWrite))
|
||||||
|
|
|
@ -22,3 +22,24 @@ func UsersSelfDonorInfoGET(md common.MethodData) common.CodeMessager {
|
||||||
r.Code = 200
|
r.Code = 200
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type favouriteModeResponse struct {
|
||||||
|
common.ResponseBase
|
||||||
|
FavouriteMode int `json:"favourite_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UsersSelfFavouriteModeGET gets the current user's favourite mode
|
||||||
|
func UsersSelfFavouriteModeGET(md common.MethodData) common.CodeMessager {
|
||||||
|
var f favouriteModeResponse
|
||||||
|
f.Code = 200
|
||||||
|
if md.ID() == 0 {
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
err := md.DB.QueryRow("SELECT users_stats.favourite_mode FROM users_stats WHERE id = ?", md.ID()).
|
||||||
|
Scan(&f.FavouriteMode)
|
||||||
|
if err != nil {
|
||||||
|
md.Err(err)
|
||||||
|
return Err500
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user