@@ -5,6 +5,7 @@ import (
|
||||
"nixcn-cms/data"
|
||||
"nixcn-cms/internal/exception"
|
||||
"nixcn-cms/service/shared"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
@@ -29,6 +30,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
var err error
|
||||
|
||||
attendenceData := new(data.Attendance)
|
||||
eventData := new(data.Event)
|
||||
|
||||
eventId, err := uuid.Parse(payload.Data.EventId)
|
||||
if err != nil {
|
||||
@@ -51,6 +53,26 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
return
|
||||
}
|
||||
|
||||
if !eventData.EndTime.Before(time.Now()) {
|
||||
exception := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceEvent).
|
||||
SetEndpoint(exception.EndpointEventServiceJoin).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.EventJoinEventInvalid).
|
||||
SetError(err).
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &EventJoinResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 403,
|
||||
Exception: exception,
|
||||
},
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
userId, err := uuid.Parse(payload.Data.UserId)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
|
||||
Reference in New Issue
Block a user