Added A way to get Game-icons.net icons into the database (it's not secure yet), plus some icon ui

This commit is contained in:
Stefan Zermatten
2019-01-28 16:26:39 +02:00
parent 77d2f87373
commit 4584499019
13 changed files with 302 additions and 7 deletions

View File

@@ -0,0 +1,50 @@
import SimpleSchema from 'simpl-schema';
let Icons = new Mongo.Collection('icons');
iconsSchema = new SimpleSchema({
name: {
type: String,
unique: true,
index: 1,
},
description: {
type: String,
optional: true,
},
tags: {
type: Array,
optional: true,
index: 1,
},
'tags.$': {
type: String,
},
shape: {
type: String,
},
});
if (Meteor.isServer) {
Icons._ensureIndex({
'name': 'text',
'description': 'text',
'tags': 'text',
});
}
Icons.attachSchema(iconsSchema);
const writeIcons = new ValidatedMethod({
name: 'writeIcons',
validate: null,
run(icons){
if (Meteor.isServer){
this.unblock();
Icons.rawCollection().insert(icons, {ordered: false});
}
}
});
export { writeIcons };
export default Icons;