@@ -30,6 +30,45 @@ type CheckinResult struct {
|
||||
}
|
||||
|
||||
func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinResult) {
|
||||
attendandeData, err := new(data.Attendance).
|
||||
GetAttendanceByEventIdAndUserId(payload.Context, payload.Data.EventId, payload.UserId)
|
||||
if err != nil {
|
||||
result = &CheckinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
SetError(err).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
eventData, err := new(data.Event).
|
||||
GetEventById(payload.Context, payload.Data.EventId)
|
||||
|
||||
if attendandeData.KycId == uuid.Nil && eventData.EnableKYC == true {
|
||||
result = &CheckinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
attendance := &data.Attendance{UserId: payload.UserId}
|
||||
code, err := attendance.GenCheckinCode(payload.Context, payload.Data.EventId)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user