Add attendance id resp for event join api, set root api to /app/api/v1
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -24,8 +24,13 @@ type EventJoinPayload struct {
|
||||
Data *EventJoinData
|
||||
}
|
||||
|
||||
type EventJoinResponse struct {
|
||||
AttendanceId string `json:"attendance_id"`
|
||||
}
|
||||
|
||||
type EventJoinResult struct {
|
||||
Common shared.CommonResult
|
||||
Data *EventJoinResponse
|
||||
}
|
||||
|
||||
func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *EventJoinResult) {
|
||||
@@ -49,6 +54,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
HttpCode: 400,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -71,6 +77,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -91,6 +98,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
HttpCode: 400,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -112,6 +120,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
HttpCode: 400,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -132,6 +141,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
SetError(err).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +158,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
SetError(errors.New("user already joined this event")).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +178,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
SetError(err).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +196,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
SetError(errors.New("event limit exceeded")).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
attendenceData.SetState("out_of_limit")
|
||||
@@ -192,7 +205,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
}
|
||||
attendenceData.SetRole("normal")
|
||||
|
||||
err = attendenceData.Create(payload.Context)
|
||||
attendanceId, err := attendenceData.Create(payload.Context)
|
||||
if err != nil {
|
||||
return &EventJoinResult{
|
||||
Common: shared.CommonResult{
|
||||
@@ -206,6 +219,7 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
SetError(err).
|
||||
Throw(payload.Context),
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +237,9 @@ func (self *EventServiceImpl) JoinEvent(payload *EventJoinPayload) (result *Even
|
||||
HttpCode: 200,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: &EventJoinResponse{
|
||||
AttendanceId: attendanceId.String(),
|
||||
},
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user