body와 query 분리, 모듈 업데이트
This commit is contained in:
@ -302,13 +302,13 @@ func (gp *groupParty) JoinParty(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
if !ok {
|
||||
logger.Println("JoinParty failed. gid is missing :", r.Form)
|
||||
logger.Println("JoinParty failed. gid is missing :", r.URL.Query())
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
mid, midok := gocommon.ReadObjectIDFormValue(r.Form, "mid")
|
||||
mid, midok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "mid")
|
||||
if !midok {
|
||||
logger.Println("JoinParty failed. mid should be exist")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
@ -363,13 +363,13 @@ func (gp *groupParty) JoinParty(w http.ResponseWriter, r *http.Request) {
|
||||
// - timeout : 초대 유지시간(optional. 없으면 config 기본 값)
|
||||
// - (body) : 검색시 노출되는 document
|
||||
func (gp *groupParty) InviteToParty(w http.ResponseWriter, r *http.Request) {
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
if !ok {
|
||||
logger.Println("InviteToParty failed. gid is missing :", r)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
mid, ok := gocommon.ReadObjectIDFormValue(r.Form, "mid")
|
||||
mid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "mid")
|
||||
if !ok {
|
||||
logger.Println("InviteToParty failed. mid is missing :", r)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
@ -459,8 +459,8 @@ func (gp *groupParty) InviteToParty(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (gp *groupParty) AcceptPartyInvitation(w http.ResponseWriter, r *http.Request) {
|
||||
gid, _ := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
mid, _ := gocommon.ReadObjectIDFormValue(r.Form, "mid")
|
||||
gid, _ := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
mid, _ := gocommon.ReadObjectIDFormValue(r.URL.Query(), "mid")
|
||||
|
||||
var member bson.M
|
||||
if err := readBsonDoc(r.Body, &member); err != nil {
|
||||
@ -512,8 +512,8 @@ func (gp *groupParty) AcceptPartyInvitation(w http.ResponseWriter, r *http.Reque
|
||||
}
|
||||
|
||||
func (gp *groupParty) DenyPartyInvitation(w http.ResponseWriter, r *http.Request) {
|
||||
gid, _ := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
mid, _ := gocommon.ReadObjectIDFormValue(r.Form, "mid")
|
||||
gid, _ := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
mid, _ := gocommon.ReadObjectIDFormValue(r.URL.Query(), "mid")
|
||||
|
||||
gp.rh.Del(context.Background(), "inv."+mid.Hex()).Result()
|
||||
gd := groupDoc{
|
||||
@ -524,9 +524,9 @@ func (gp *groupParty) DenyPartyInvitation(w http.ResponseWriter, r *http.Request
|
||||
}
|
||||
|
||||
func (gp *groupParty) QueryPartyMemberState(w http.ResponseWriter, r *http.Request) {
|
||||
mid, ok := gocommon.ReadStringFormValue(r.Form, "mid")
|
||||
mid, ok := gocommon.ReadStringFormValue(r.URL.Query(), "mid")
|
||||
if !ok {
|
||||
logger.Println("IsOnline failed. mid is missing :", r.Form)
|
||||
logger.Println("IsOnline failed. mid is missing :", r.URL.Query())
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@ -545,19 +545,19 @@ func (gp *groupParty) QueryPartyMemberState(w http.ResponseWriter, r *http.Reque
|
||||
// - 그룹 타입에 맞는 키(주로 _id)
|
||||
// - member_id : 나갈 멤버의 아이디
|
||||
func (gp *groupParty) LeaveParty(w http.ResponseWriter, r *http.Request) {
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
if !ok {
|
||||
logger.Println("LeaveParty failed. gid is missing :", r.Form)
|
||||
logger.Println("LeaveParty failed. gid is missing :", r.URL.Query())
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
mid, midok := gocommon.ReadObjectIDFormValue(r.Form, "mid")
|
||||
mid, midok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "mid")
|
||||
if !midok {
|
||||
logger.Println("LeaveParty failed. mid is missing")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
tid, tidok := gocommon.ReadStringFormValue(r.Form, "tid")
|
||||
tid, tidok := gocommon.ReadStringFormValue(r.URL.Query(), "tid")
|
||||
gd := groupDoc{
|
||||
id: gid,
|
||||
rh: gp.rh,
|
||||
@ -638,14 +638,14 @@ func (gp *groupParty) updateMemberDocument(gid groupID, mid accountID, doc bson.
|
||||
}
|
||||
|
||||
func (gp *groupParty) UpdatePartyMemberDocument(w http.ResponseWriter, r *http.Request) {
|
||||
mid, ok := gocommon.ReadObjectIDFormValue(r.Form, "mid")
|
||||
mid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "mid")
|
||||
if !ok {
|
||||
logger.Println("UpdatePartyMemberDocument failed. member_id is missing")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
if !ok {
|
||||
logger.Println("UpdatePartyMemberDocument failed. _id is missing")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
@ -684,7 +684,7 @@ func (gp *groupParty) updatePartyDocument(gid groupID, frag bson.M) error {
|
||||
}
|
||||
|
||||
func (gp *groupParty) UpdatePartyDocument(w http.ResponseWriter, r *http.Request) {
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
if !ok {
|
||||
logger.Println("UpdatePartyDocument failed. gid is missing")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
@ -706,7 +706,7 @@ func (gp *groupParty) UpdatePartyDocument(w http.ResponseWriter, r *http.Request
|
||||
}
|
||||
|
||||
func (gp *groupParty) QueryPartyMembers(w http.ResponseWriter, r *http.Request) {
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.Form, "gid")
|
||||
gid, ok := gocommon.ReadObjectIDFormValue(r.URL.Query(), "gid")
|
||||
if !ok {
|
||||
logger.Println("QueryPartyMembers failed. gid is missing")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user