EkloreQuestions = new Mongo.Collection('ekloreQuestions');

var Schemas = {};

UniverseSchema = new SimpleSchema({
	universeId: {
		type: String,
		label: 'Univers ID'
	},
	matchingPower: {
		type: Number,
		decimal: true,
		label: 'Matching power or the universe against the question or choice'
	}
});

WorkshopSchema = new SimpleSchema({
	workshopId: {
		type: String,
		label: 'Workshop ID'
	},
	matchingPower: {
		type: Number,
		decimal: true,
		label: 'Matching power or the workshop against the question or choice'
	}
});

ChoiceSchema = new SimpleSchema({
	choiceId: {
		type: String,
		label: 'Choice ID'
	},
	label: {
		type: String,
		label: 'tradID via i18n'
	},
	pictureSource: {
		type: String,
		label: 'Url or image path',
		optional: true
	},
	universesLinked: {
		type: [UniverseSchema],
		label: 'List of the linked universes to the choice'
	},
	workshopsLinked: {
		type: [WorkshopSchema],
		label: 'List of the linked workshops to the choice'
	}
});

Schemas.EkloreQuestions = new SimpleSchema({
	level: {
		type: Number,
		label: 'Question level'
	},
	version: {
		type: Number,
		label: 'Question version'
	},
	choices: {
		type: [ChoiceSchema],
		label: 'Choices list',
		optional: true
	},
	deprecated: {
		type: Boolean,
		label: 'Is the question deprecated or not'
	},
	universesLinked: {
		type: [UniverseSchema],
		label: 'List of the linked universe to the question',
		optional: true
	},
	workshopsLinked: {
		type: [WorkshopSchema],
		label: 'List of the linked workshops to the question',
		optional: true
	},
	questionGroupId: {
		type: String,
		label: 'Question group ID',
		optional: true
	},
	displayType: {
		type: String,
		label: 'Question display',
		allowedValues: ['text', 'picture']
	},
	title: {
		type: String,
		label: 'Question title'
	},
	createdAt: {
		type: Date,
		label: 'Question creation date'
	}
});

EkloreQuestions.attachSchema(Schemas.EkloreQuestions);

Meteor.methods({
	addAnEkloreQuestion(ekloreQuestion) {
		check(ekloreQuestion.title, String);
		check(ekloreQuestion.level, Number);
		check(ekloreQuestion.displayType, String);
		ekloreQuestion.version = 1;
		ekloreQuestion.deprecated = false;
		ekloreQuestion.createdAt = new Date();
		return EkloreQuestions.insert(ekloreQuestion);
	}
});

@@ -2243,15 +2243,296 @@
 stion);%0A
+%09%7D,%0A%09linkQuestionGroupToAnEkloreQuestion(data) %7B%0A%09%09check(data, Object);%0A%09%09check(data.questionGroupId, String);%0A%09%09check(data.ekloreQuestionId, String);%0A%09%09return EkloreQuestions.update(%7B _id: data.ekloreQuestionId %7D, %7B%0A%09%09%09$set: %7B%0A%09%09%09%09questionGroupId: data.questionGroupId%0A%09%09%09%7D%0A%09%09%7D);%0A
 %09%7D%0A%7D);%0A

Add new method