Skip to content

Commit

Permalink
[ADD] <entity/request_club.go> Add ClubUUID field in RegisterRecruitm…
Browse files Browse the repository at this point in the history
…entRequest
  • Loading branch information
parkjinhong03 committed Oct 26, 2020
1 parent 352402b commit ac0c6a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions entity/request_club.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,21 @@ func (from ModifyClubInformRequest) GenerateGRPCRequest() (to *clubproto.ModifyC
return
}

// request entity for POST /v1/clubs/uuid/:club_uuid/recruitments
// request entity for POST /v1/recruitments
type RegisterRecruitmentRequest struct {
ClubUUID string `json:"club_uuid" validate:"required"`
RecruitConcept string `json:"recruit_concept" validate:"required,max=40"`
EndPeriod string `json:"end_period" validate:"time,len=10"`
EndPeriod string `json:"end_period" validate:"time,max=10"`
Members []struct {
Grade int `json:"grade" validate:"required,int_range=1~3"`
Grade int `json:"grade" validate:"required,int_range=1~3"`
Field string `json:"field" validate:"required,max=20"`
Number int `json:"number" validate:"required,int_range=1~10"`
Number int `json:"number" validate:"required,int_range=1~10"`
} `json:"members" validate:"required"`
}

func (from RegisterRecruitmentRequest) GenerateGRPCRequest() (to *clubproto.RegisterRecruitmentRequest) {
to = new(clubproto.RegisterRecruitmentRequest)
to.ClubUUID = from.ClubUUID
to.RecruitConcept = from.RecruitConcept
to.EndPeriod = from.EndPeriod
to.RecruitMembers = make([]*clubproto.RecruitMember, len(from.Members))
Expand Down
1 change: 0 additions & 1 deletion handler/default_club_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,6 @@ func (h *_default) RegisterRecruitment(c *gin.Context) {
ctxForReq = metadata.Set(ctxForReq, "Span-Context", authSrvSpan.Context().(jaeger.SpanContext).String())
rpcReq := receivedReq.GenerateGRPCRequest()
rpcReq.UUID = uuidClaims.UUID
rpcReq.ClubUUID = c.Param("club_uuid")
callOpts := append(h.DefaultCallOpts, client.WithAddress(selectedNode.Address))
rpcResp, rpcErr = h.clubService.RegisterRecruitment(ctxForReq, rpcReq, callOpts...)
authSrvSpan.SetTag("X-Request-Id", reqID).LogFields(log.Object("request", rpcReq), log.Object("response", rpcResp), log.Error(rpcErr))
Expand Down

0 comments on commit ac0c6a6

Please sign in to comment.