start conference controller
parent
6cf627bf02
commit
8e89ec08a7
@ -0,0 +1,60 @@
|
|||||||
|
package ru.ulstu.activity.conference;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import ru.ulstu.activity.api.ActivityController;
|
||||||
|
import ru.ulstu.activity.conference.model.ConferenceDashboardDto;
|
||||||
|
import ru.ulstu.activity.conference.model.ConferenceDto;
|
||||||
|
import ru.ulstu.activity.conference.model.ConferenceListDto;
|
||||||
|
import ru.ulstu.activity.conference.service.ConferenceService;
|
||||||
|
import ru.ulstu.core.model.response.PageableItems;
|
||||||
|
import ru.ulstu.core.model.response.Response;
|
||||||
|
|
||||||
|
public class ConferenceController extends ActivityController<ConferenceListDto, ConferenceDashboardDto, ConferenceDto> {
|
||||||
|
|
||||||
|
private final ConferenceService conferenceService;
|
||||||
|
|
||||||
|
public ConferenceController(ConferenceService conferenceService) {
|
||||||
|
this.conferenceService = conferenceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("list")
|
||||||
|
public Response<PageableItems<ConferenceListDto>> getList(@RequestParam(value = "offset", defaultValue = "0") int offset,
|
||||||
|
@RequestParam(value = "count", defaultValue = "0") int count) {
|
||||||
|
return new Response<>(conferenceService.findAllDto(offset, count));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("dashboard")
|
||||||
|
public Response<PageableItems<ConferenceDashboardDto>> getDashboard(@RequestParam(value = "offset", defaultValue = "0") int offset,
|
||||||
|
@RequestParam(value = "count", defaultValue = "0") int count) {
|
||||||
|
return new Response<>(conferenceService.findAllActiveDto(offset, count));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response<ConferenceDto> get(@PathVariable("grant-id") Integer entityId) {
|
||||||
|
return new Response<>(conferenceService.findById(entityId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response<ConferenceDto> create(ConferenceDto entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response<ConferenceDto> update(ConferenceDto entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response<Boolean> delete(Integer entityId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ping(int entityId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package ru.ulstu.activity.conference.model;
|
||||||
|
|
||||||
|
import ru.ulstu.activity.api.model.ActivityDashboardDto;
|
||||||
|
import ru.ulstu.activity.common.model.ScienceGroupMemberDto;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||||
|
|
||||||
|
public class ConferenceDashboardDto extends ActivityDashboardDto {
|
||||||
|
private final Set<ScienceGroupMemberDto> members;
|
||||||
|
|
||||||
|
public ConferenceDashboardDto(Conference conference) {
|
||||||
|
super(conference.getId(), conference.getTitle());
|
||||||
|
this.members = convert(conference.getActivityMembers(), ScienceGroupMemberDto::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<ScienceGroupMemberDto> getAuthors() {
|
||||||
|
return members;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue