Add checkin count in attendance and event api
All checks were successful
Client CMS Check Build (NixCN CMS) TeamCity build finished
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-02-05 14:33:39 +08:00
parent 050504ade6
commit e8406f731e
3 changed files with 60 additions and 14 deletions

View File

@@ -45,6 +45,27 @@ func (self *EventServiceImpl) GetEventInfo(payload *EventInfoPayload) (result *E
return
}
checkinCount, err := new(data.Attendance).CountCheckedInUsersByEventID(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
}
result = &EventInfoResult{
Common: shared.CommonResult{
HttpCode: 200,
@@ -57,13 +78,14 @@ func (self *EventServiceImpl) GetEventInfo(payload *EventInfoPayload) (result *E
Throw(payload.Context),
},
Data: &data.EventIndexDoc{
EventId: event.EventId.String(),
Name: event.Name,
Type: event.Type,
Description: event.Description,
StartTime: event.StartTime,
EndTime: event.EndTime,
Thumbnail: event.Thumbnail,
EventId: event.EventId.String(),
Name: event.Name,
Type: event.Type,
Description: event.Description,
StartTime: event.StartTime,
EndTime: event.EndTime,
Thumbnail: event.Thumbnail,
CheckinCount: checkinCount,
},
}