2016-05-27 08:03:30 +08:00
|
|
|
import Shapes from '/imports/api/shapes';
|
|
|
|
import Presentations from '/imports/api/presentations';
|
|
|
|
import Slides from '/imports/api/slides';
|
|
|
|
|
2016-05-10 07:54:53 +08:00
|
|
|
let getWhiteboardData = () => {
|
2016-05-10 06:06:03 +08:00
|
|
|
let currentPresentation, currentSlide, presentationId, shapes, ref;
|
2016-05-27 08:03:30 +08:00
|
|
|
currentPresentation = Presentations.findOne({
|
2016-05-10 06:06:03 +08:00
|
|
|
'presentation.current': true,
|
|
|
|
});
|
|
|
|
presentationId = currentPresentation != null ? (ref = currentPresentation.presentation) != null ? ref.id : void 0 : void 0;
|
2016-05-27 08:03:30 +08:00
|
|
|
currentSlide = Slides.findOne({
|
2016-05-21 02:28:52 +08:00
|
|
|
presentationId: presentationId,
|
|
|
|
'slide.current': true,
|
2016-05-10 07:54:53 +08:00
|
|
|
});
|
2016-05-10 06:06:03 +08:00
|
|
|
if (currentSlide != null) {
|
2016-05-27 08:03:30 +08:00
|
|
|
shapes = Shapes.find({
|
2016-05-10 06:06:03 +08:00
|
|
|
whiteboardId: currentSlide.slide.id,
|
|
|
|
}).fetch();
|
|
|
|
}
|
2016-05-21 02:28:52 +08:00
|
|
|
|
2016-05-10 07:54:53 +08:00
|
|
|
return {
|
|
|
|
current_slide: currentSlide,
|
|
|
|
shapes: shapes,
|
|
|
|
};
|
2016-05-10 06:06:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
2016-05-10 07:54:53 +08:00
|
|
|
getWhiteboardData,
|
2016-05-21 02:28:52 +08:00
|
|
|
};
|