@@ -31,7 +31,7 @@ type CheckinResult struct {
|
||||
|
||||
func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinResult) {
|
||||
attendandeData, err := new(data.Attendance).
|
||||
GetAttendance(payload.Context, payload.Data.EventId, payload.UserId)
|
||||
GetAttendance(payload.Context, payload.UserId, payload.Data.EventId)
|
||||
if err != nil {
|
||||
result = &CheckinResult{
|
||||
Common: shared.CommonResult{
|
||||
@@ -49,9 +49,46 @@ func (self *EventServiceImpl) Checkin(payload *CheckinPayload) (result *CheckinR
|
||||
return
|
||||
}
|
||||
|
||||
if attendandeData == nil {
|
||||
result = &CheckinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 403,
|
||||
Exception: new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceCheckin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
eventData, err := new(data.Event).
|
||||
GetEventById(payload.Context, payload.Data.EventId)
|
||||
|
||||
if err != nil || eventData == nil {
|
||||
code := 500
|
||||
if eventData == nil {
|
||||
code = 404
|
||||
}
|
||||
result = &CheckinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: code,
|
||||
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
|
||||
}
|
||||
|
||||
if attendandeData.KycId == uuid.Nil && eventData.EnableKYC == true {
|
||||
result = &CheckinResult{
|
||||
Common: shared.CommonResult{
|
||||
|
||||
Reference in New Issue
Block a user