chore(cleanup) Remove Reviewers collection which is not being used
This commit is contained in:
parent
9780c67c4f
commit
f2c509b6af
@ -1,8 +0,0 @@
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { schema as ReviewerSchema } from 'meteor/ohif:user-management/both/schema/reviewers.js';
|
||||
|
||||
// Reviewers is used to determine which users already have a
|
||||
// Timepoint open
|
||||
Reviewers = new Mongo.Collection('reviewers');
|
||||
Reviewers.attachSchema(ReviewerSchema);
|
||||
Reviewers._debugName = 'Reviewers';
|
||||
@ -1,23 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
const ReviewingUserSchema = new SimpleSchema({
|
||||
userId: {
|
||||
type: String,
|
||||
label: 'User ID'
|
||||
},
|
||||
userName: { // TODO: Remove this
|
||||
type: String,
|
||||
label: 'Name'
|
||||
}
|
||||
});
|
||||
|
||||
export const schema = new SimpleSchema({
|
||||
timepointId: {
|
||||
type: String,
|
||||
label: 'Timepoint ID'
|
||||
},
|
||||
reviewers: {
|
||||
type: [ ReviewingUserSchema ],
|
||||
label: 'Reviewing Users'
|
||||
}
|
||||
});
|
||||
@ -20,20 +20,4 @@ Meteor.startup(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer){
|
||||
Accounts.emailTemplates.siteName = 'AwesomeSite';
|
||||
Accounts.emailTemplates.from = 'AwesomeSite Admin <accounts@example.com>';
|
||||
Accounts.emailTemplates.enrollAccount.subject = function(user) {
|
||||
return 'Welcome to Awesome Town, ' + user.profile.name;
|
||||
};
|
||||
|
||||
Accounts.emailTemplates.enrollAccount.text = function(user, url) {
|
||||
return 'You have been selected to participate in building a better future!'
|
||||
+ ' To activate your account, simply click the link below:\n\n'
|
||||
+ url;
|
||||
};
|
||||
|
||||
process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587';
|
||||
}
|
||||
});
|
||||
|
||||
@ -2,4 +2,3 @@ import './active-entry';
|
||||
import './components';
|
||||
import './lib';
|
||||
import './handlers';
|
||||
import './subscriptions';
|
||||
|
||||
@ -1 +0,0 @@
|
||||
Meteor.subscribe('reviewers');
|
||||
@ -26,15 +26,8 @@ Package.onUse(function(api) {
|
||||
api.use('ohif:user');
|
||||
api.use('ohif:study-list');
|
||||
|
||||
api.addFiles('both/collections.js', ['client', 'server']);
|
||||
//api.addFiles('both/schema/reviewers.js', ['client', 'server']);
|
||||
|
||||
// Client imports
|
||||
api.addFiles('client/index.js', 'client');
|
||||
|
||||
api.addFiles('server/createDemoUser.js', [ 'server' ]);
|
||||
api.addFiles('server/reviewers.js', [ 'server' ]);
|
||||
api.addFiles('server/publications.js', [ 'server' ]);
|
||||
|
||||
api.export('Reviewers', [ 'client', 'server' ]);
|
||||
});
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
Meteor.publish('reviewers', function() {
|
||||
return Reviewers.find();
|
||||
});
|
||||
@ -1,85 +0,0 @@
|
||||
//import { findTimepointFromStudyInstanceUid } from 'meteor/ohif:measurements/client/lib/findTimepointFromStudyInstanceUid';
|
||||
|
||||
Meteor.methods({
|
||||
setReviewer: function (studyInstanceUid) {
|
||||
const timepoint = findTimepointFromStudyInstanceUid(studyInstanceUid);
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
var reviewerTimepoint = Reviewers.findOne({timepointId: timepoint.timepointId});
|
||||
var user = Meteor.users.findOne(Meteor.userId());
|
||||
if (reviewerTimepoint) {
|
||||
if (reviewerTimepoint.reviewers) {
|
||||
|
||||
// Check whether the user exists
|
||||
var isReviewerFound = reviewerTimepoint.reviewers.filter(function ( reviewer ) {
|
||||
return reviewer.userId === user._id;
|
||||
})[0];
|
||||
|
||||
// Return if user exists for related timepoint
|
||||
if (isReviewerFound) {
|
||||
return;
|
||||
}
|
||||
var existedReviewers = reviewerTimepoint.reviewers;
|
||||
existedReviewers.push({userId: user._id, userName: user.profile.fullName});
|
||||
|
||||
// Update reviewers array after pushing the user
|
||||
Reviewers.update(reviewerTimepoint._id, {$set: {reviewers: existedReviewers}});
|
||||
|
||||
} else {
|
||||
Reviewers.update(reviewerTimepoint._id, {$set: {reviewers: [{userId: user._id, userName: user.profile.fullName}]}});
|
||||
}
|
||||
} else {
|
||||
Reviewers.insert({timepointId: timepoint.timepointId, reviewers: [{userId: user._id, userName: user.profile.fullName}]});
|
||||
}
|
||||
|
||||
// Log
|
||||
var hipaaEvent = {
|
||||
eventType: 'modify',
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
collectionName: "Measurements",
|
||||
recordId: study.studyInstanceUid,
|
||||
patientId: study.patientId,
|
||||
patientName: study.patientName
|
||||
};
|
||||
HipaaLogger.logEvent(hipaaEvent);
|
||||
},
|
||||
|
||||
removeReviewer: function (timepointId) {
|
||||
if (!timepointId) {
|
||||
return;
|
||||
}
|
||||
var reviewerTimepoint = Reviewers.findOne({timepointId: timepointId});
|
||||
if (!reviewerTimepoint || !reviewerTimepoint.reviewers) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Initalize a new array without the current user
|
||||
var reviewers = reviewerTimepoint.reviewers.filter(function ( reviewer ) {
|
||||
return reviewer.userId !== Meteor.userId();
|
||||
});
|
||||
Reviewers.update(reviewerTimepoint._id, {$set: {reviewers: reviewers}});
|
||||
},
|
||||
|
||||
removeUserFromReviewers: function(userId) {
|
||||
if (!userId) {
|
||||
return;
|
||||
}
|
||||
Reviewers.find().map(function (timepoint) {
|
||||
Reviewers.update({_id: timepoint._id}, {"$pull": {"reviewers": {"userId": userId}}});
|
||||
});
|
||||
},
|
||||
|
||||
getPriorLoginDate: function() {
|
||||
return Meteor.users.findOne({
|
||||
_id: Meteor.userId()
|
||||
}, {
|
||||
fields: {
|
||||
priorLoginDate: 1
|
||||
}
|
||||
}).priorLoginDate;
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user