@@ -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{
|
||||
|
||||
@@ -205,6 +205,26 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
}
|
||||
attendenceData.SetRole("normal")
|
||||
|
||||
if payload.Data.KycId != "" {
|
||||
kycUUID, err := uuid.Parse(payload.Data.KycId)
|
||||
if err != nil {
|
||||
return &EventJoinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceJoin).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
SetError(err).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
}
|
||||
}
|
||||
attendenceData.SetKycId(kycUUID)
|
||||
}
|
||||
|
||||
attendanceId, err := attendenceData.Create(payload.Context)
|
||||
if err != nil {
|
||||
return &EventJoinResult{
|
||||
|
||||
Reference in New Issue
Block a user