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:
50
app/imports/api/icons/Icons.js
Normal file
50
app/imports/api/icons/Icons.js
Normal 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;
|
||||
Reference in New Issue
Block a user