@@ -32,6 +32,7 @@ type EventIndexDoc struct {
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime time.Time `json:"end_time"`
|
||||
Thumbnail string `json:"thumbnail"`
|
||||
JoinCount int64 `json:"join_count"`
|
||||
CheckinCount int64 `json:"checkin_count"`
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,27 @@ func (self *EventServiceImpl) GetEventInfo(payload *EventInfoPayload) (result *E
|
||||
return
|
||||
}
|
||||
|
||||
joinCount, err := new(data.Attendance).CountUsersByEventID(payload.Context, payload.Data.EventId)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceInfo).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
SetError(err).
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &EventInfoResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
checkinCount, err := new(data.Attendance).CountCheckedInUsersByEventID(payload.Context, payload.Data.EventId)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
@@ -85,6 +106,7 @@ func (self *EventServiceImpl) GetEventInfo(payload *EventInfoPayload) (result *E
|
||||
StartTime: event.StartTime,
|
||||
EndTime: event.EndTime,
|
||||
Thumbnail: event.Thumbnail,
|
||||
JoinCount: joinCount,
|
||||
CheckinCount: checkinCount,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user