Merge pull request 'nats model campaign admin' (#57) from feature/get-detail-social-post into feature/campaign
Reviewed-on: #57
This commit is contained in:
commit
cfa306d0fc
|
@ -39,3 +39,27 @@ func (s SocialPost) GetListSocialPostAppInfoByIDs(p model.GetListSocialPostAppBy
|
||||||
}
|
}
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetBriefDetailSocialPostAdminByIDsRequest ...
|
||||||
|
func (s SocialPost) GetBriefDetailSocialPostAdminByIDsRequest(p model.GetBriefInfoSocialPostAdminByIDsRequest) (*model.ResponseDetailSocialPostAdminInfo, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.SocialPost.GetBriefInfoSocialPostAdminByIDs, toBytes(p))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var r struct {
|
||||||
|
Data *model.ResponseDetailSocialPostAdminInfo `json:"data"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.Error != "" {
|
||||||
|
return nil, errors.New(r.Error)
|
||||||
|
|
||||||
|
}
|
||||||
|
return r.Data, nil
|
||||||
|
}
|
||||||
|
|
|
@ -6,3 +6,8 @@ import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
type GetListSocialPostAppByIDsRequest struct {
|
type GetListSocialPostAppByIDsRequest struct {
|
||||||
SocialPostIDs []primitive.ObjectID `json:"socialPostIDs"`
|
SocialPostIDs []primitive.ObjectID `json:"socialPostIDs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetBriefInfoSocialPostAdminByIDsRequest ...
|
||||||
|
type GetBriefInfoSocialPostAdminByIDsRequest struct {
|
||||||
|
SocialPostIDs []primitive.ObjectID `json:"socialPostIDs"`
|
||||||
|
}
|
||||||
|
|
|
@ -47,3 +47,14 @@ type SocialPostSellerInfo struct {
|
||||||
Logo *FilePhoto `json:"logo"`
|
Logo *FilePhoto `json:"logo"`
|
||||||
IsMine bool `json:"isMine"`
|
IsMine bool `json:"isMine"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResponseDetailSocialPostAdminInfo ...
|
||||||
|
type ResponseDetailSocialPostAdminInfo struct {
|
||||||
|
SocialPosts SocialPostAdminInfo `json:"socialPosts"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SocialPostAdminInfo struct {
|
||||||
|
ID primitive.ObjectID `json:"_id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ func getSocialPostValue(val string) string {
|
||||||
// SocialPost ...
|
// SocialPost ...
|
||||||
var SocialPost = struct {
|
var SocialPost = struct {
|
||||||
GetListSocialPostAppInfoByIDs string
|
GetListSocialPostAppInfoByIDs string
|
||||||
|
GetBriefInfoSocialPostAdminByIDs string
|
||||||
}{
|
}{
|
||||||
GetListSocialPostAppInfoByIDs: getSocialPostValue("get_list_social_post_app_info_by_ids"),
|
GetListSocialPostAppInfoByIDs: getSocialPostValue("get_list_social_post_app_info_by_ids"),
|
||||||
|
GetBriefInfoSocialPostAdminByIDs: getSocialPostValue("get_brief_info_social_post_admin_by_ids"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue