package v1 import "git.zxq.co/ripple/rippleapi/common" type donorInfoResponse struct { common.ResponseBase HasDonor bool `json:"has_donor"` Expiration common.UnixTimestamp `json:"expiration"` } // UsersSelfDonorInfoGET returns information about the users' donor status func UsersSelfDonorInfoGET(md common.MethodData) common.CodeMessager { var r donorInfoResponse var privileges uint64 err := md.DB.QueryRow("SELECT privileges, donor_expire FROM users WHERE id = ?", md.ID()). Scan(&privileges, &r.Expiration) if err != nil { md.Err(err) return Err500 } r.HasDonor = common.UserPrivileges(privileges)&common.UserPrivilegeDonor > 0 r.Code = 200 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 }