flow-db-admin icon indicating copy to clipboard operation
flow-db-admin copied to clipboard

Support for Meteor 1.3

Open bartspedden opened this issue 8 years ago • 3 comments

Is there a way to import AdminConfig so that I can use this with Meteor 1.3?

bartspedden avatar Jun 23 '16 13:06 bartspedden

AdminConfig is global in the "eager" folders like lib, client and server. It should work exactly the same way it always has.

CaptainN avatar Jun 23 '16 15:06 CaptainN

Thanks for getting me on the right path @CaptainN. But I have another question.

My schema looks like this

export const Companies = new Mongo.Collection('companies');

Companies.attachSchema(new SimpleSchema({
  name: {
    type: String,
    index: true,
    unique: true,
    max: 50,
  },
  member: {
    type: Boolean,
    defaultValue: false,
  },
  website: {
    type: String,
    unique: true,
    max: 200,
    regEx: SimpleSchema.RegEx.Url,
  },
  email: {
    type: String,
    unique: true,
    regEx: SimpleSchema.RegEx.Email,
  },
  phone: {
    type: String,
    max: 50,
  },
  adventures: {
    type: [String],
    minCount: 1,
  },
  'adventures.$.id': {
    type: String,
    regEx: SimpleSchema.RegEx.Id,
  },
  addresses: {
    type: [Object],
    minCount: 1,
    maxCount: 4,
  },
  'addresses.$.type': {
    type: String,
    defaultValue: 'location',
    allowedValues: ['location', 'mailing'],
  },
  'addresses.$.street1': {
    type: String,
  },
  'addresses.$.street2': {
    type: String,
    optional: true,
  },
  'addresses.$.city': {
    type: String,
  },
  'addresses.$.state': {
    type: String,
  },
  'addresses.$.zipcode': {
    type: String,
  },
  'addresses.$.country': {
    type: String,
  },
}));

I added the following to the lib/index.js

AdminConfig = {
  collections: {
    Companies: {},
  },
};

In this way, Companies is not really global, but instead needs to be imported like this to be used:

import { Companies } from '../imports/api/companies.js';

I'm new to meteor and learning, but I believe the above slows current best practices for 1.3. Let me know if I'm wrong.

If not, do you have any ideas for how to make this work?

Thanks!

bartspedden avatar Jun 24 '16 00:06 bartspedden

use this

AdminConfig = {
  name: 'Parser',
  adminEmails: ['[email protected]'],
  collections: {
    Feeds: {
      collectionObject: Feeds
    },
    Sources: {
      collectionObject: Sources
    }
  }
};

m-pokrovskii avatar Jun 06 '17 14:06 m-pokrovskii