2016-05-31 06:07:02 +08:00
|
|
|
import Presentations from '/imports/api/presentations';
|
|
|
|
import Shapes from '/imports/api/shapes';
|
|
|
|
import Slides from '/imports/api/slides';
|
2016-07-16 04:45:54 +08:00
|
|
|
import Cursor from '/imports/api/cursor';
|
2016-08-06 02:39:24 +08:00
|
|
|
import Users from '/imports/api/users';
|
|
|
|
import AuthSingleton from '/imports/ui/services/auth/index.js';
|
2016-05-31 06:07:02 +08:00
|
|
|
|
|
|
|
let getWhiteboardData = () => {
|
|
|
|
let currentSlide;
|
|
|
|
let shapes;
|
2016-07-16 04:45:54 +08:00
|
|
|
let cursor;
|
2016-08-06 02:39:24 +08:00
|
|
|
let userIsPresenter;
|
2016-06-25 05:30:37 +08:00
|
|
|
let currentPresentation = Presentations.findOne({
|
2016-05-31 06:07:02 +08:00
|
|
|
'presentation.current': true,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (currentPresentation != null) {
|
|
|
|
currentSlide = Slides.findOne({
|
|
|
|
presentationId: currentPresentation.presentation.id,
|
|
|
|
'slide.current': true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentSlide != null) {
|
|
|
|
shapes = Shapes.find({
|
|
|
|
whiteboardId: currentSlide.slide.id,
|
|
|
|
}).fetch();
|
2016-07-16 04:45:54 +08:00
|
|
|
|
2016-08-21 10:59:32 +08:00
|
|
|
cursor = Cursor.findOne({
|
2016-07-16 04:45:54 +08:00
|
|
|
meetingId: currentSlide.meetingId,
|
2016-08-21 10:59:32 +08:00
|
|
|
});
|
2016-08-06 02:39:24 +08:00
|
|
|
|
|
|
|
// Get user to check if they are the presenter
|
|
|
|
userIsPresenter = Users.findOne({
|
|
|
|
meetingId: currentSlide.meetingId,
|
|
|
|
userId: AuthSingleton.getCredentials().requesterUserId,
|
|
|
|
}).user.presenter;
|
2016-05-31 06:07:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
2016-06-27 22:48:17 +08:00
|
|
|
currentSlide: currentSlide,
|
2016-05-31 06:07:02 +08:00
|
|
|
shapes: shapes,
|
2016-07-16 04:45:54 +08:00
|
|
|
cursor: cursor,
|
2016-08-06 02:39:24 +08:00
|
|
|
userIsPresenter: userIsPresenter,
|
2016-05-31 06:07:02 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
getWhiteboardData,
|
|
|
|
};
|