Giter VIP home page Giter VIP logo

Comments (5)

refack avatar refack commented on August 31, 2024

Can you provide minimal failing models code?

from formage.

skilesare avatar skilesare commented on August 31, 2024

This is what is failing:

@conn.chat = new BChattySchema
      mongoConnection: @conn.db
      accountConfig: @ac

adminModels = [
    @conn.chat.PostModel.model
    @conn.chat.ThreadModel.model
    @conn.chat.PageModel.model
    @conn.chat.AuthorModel.model
    @conn.chat.AccountModel.model
    @conn.chat.StarModel.model
    @conn.chat.MessageModel.model
    @conn.chat.MailBoxModel.model
    @conn.chat.TagModel.model
    @conn.chat.TagListModel.model
    @conn.chat.StreamModel.model
    @conn.chat.FollowAuthorModel.model
    @conn.chat.FollowStarModel.model
    @conn.chat.SettingModel.model
    @conn.chat.AccountSubModel.model
    @conn.chat.InstitutionModel.model
    @conn.chat.ContentModel.model
    @conn.chat.PFModel.model
    @conn.chat.FollowPFModel.model
    @conn.chat.EventModel.model
    @conn.chat.AttendingEventModel.model
    @conn.chat.InterestedEventModel.model

  ]

  #console.log @conn.chat
  @formage = require('formage')
  @formage.init @app, @express, adminModels,
    title: 'Admin'
    root: '/admin'
    default_section:'main'
    password: '***********'
    username: 'admin'
    admin_users_gui: true

I freely admit that I may be doing this completely wrong. The pattern of my project doesn't match up with the example at all. I can't just require('./models')...all my models (and schema0 are in the BChattySchema:

class BChattySchema
  constructor: (options)->
    @async = require('async')
    @options = options
    @conn = null
    @accontConfig = null
    if options?
      @accountConfig = options.accountConfig if @options.accountConfig?
      if options.mongoConnection?
        @conn = options.mongoConnection
        @defineSchema()


  defineSchema: =>
    $context = @
    @mongoose = require('mongoose')

    @PostSchema = new  PostSchema
      $context : $context

    @PostModel = new PostModel
      $context : $context
    @Posts = @PostModel.model


    @ThreadSchema = new ThreadSchema
      $context : $context

    @ThreadModel = new ThreadModel
      $context: $context

    @Threads = @ThreadModel.model


    @PageSchema = new PageSchema
      $context: $context

    @PageModel = new PageModel
      $context: $context


    @Pages = @PageModel.model


    @AuthorSchema = new AuthorSchema
      $context: $context

    @AuthorModel = new AuthorModel
      $context: $context


    @Authors = @AuthorModel.model



    @StarSchema = new StarSchema
      $context: $context

    @StarModel = new StarModel
      $context: $context


    @Stars = @StarModel.model



    @AccountSchema = new AccountSchema
      $context: $context

    @AccountModel = new AccountModel
      $context: $context


    @Accounts = @AccountModel.model

    @MessageSchema = new MessageSchema
      $context: $context

    @MessageModel = new MessageModel
      $context: $context


    @Messages = @MessageModel.model


    @MailBoxSchema = new MailBoxSchema
      $context: $context

    @MailBoxModel = new MailBoxModel
      $context: $context


    @MailBoxes = @MailBoxModel.model

    @TagSchema = new TagSchema
      $context: $context

    @TagModel = new TagModel
      $context: $context


    @Tags = @TagModel.model

    @TagListSchema = new TagListSchema
      $context: $context

    @TagListModel = new TagListModel
      $context: $context


    @TagLists = @TagListModel.model


    @StreamSchema = new StreamSchema
      $context: $context

    @StreamModel = new StreamModel
      $context: $context


    @Streams = @StreamModel.model


    @FollowAuthorSchema = new FollowAuthorSchema
      $context: $context

    @FollowAuthorModel = new FollowAuthorModel
      $context: $context


    @FollowAuthors = @FollowAuthorModel.model


    @FollowStarSchema = new FollowStarSchema
      $context: $context

    @FollowStarModel = new FollowStarModel
      $context: $context


    @FollowStars = @FollowStarModel.model


    @SettingSchema = new SettingSchema
      $context: $context

    @SettingModel = new SettingModel
      $context: $context


    @Settings = @SettingModel.model


    @AccountSubSchema = new AccountSubSchema
      $context: $context

    @AccountSubModel = new AccountSubModel
      $context: $context


    @AccountSubs = @AccountSubModel.model

    @ContentSchema = new ContentSchema
      $context: $context

    @ContentModel = new ContentModel
      $context: $context


    @Contents = @ContentModel.model

    @InstitutionSchema = new InstitutionSchema
      $context: $context

    @InstitutionModel = new InstitutionModel
      $context: $context


    @Institutions = @InstitutionModel.model



    @PFSchema = new PFSchema
      $context: $context

    @PFModel = new PFModel
      $context: $context


    @PFs = @PFModel.model



    @FollowPFSchema = new FollowPFSchema
      $context: $context

    @FollowPFModel = new FollowPFModel
      $context: $context


    @FollowPFs = @FollowPFModel.model


    @EventSchema = new EventSchema
      $context: $context

    @EventModel = new EventModel
      $context: $context


    @Events = @EventModel.model

    @AttendingEventSchema = new AttendingEventSchema
      $context: $context

    @AttendingEventModel = new AttendingEventModel
      $context: $context


    @AttendingEvents = @AttendingEventModel.model

    @InterestedEventSchema = new InterestedEventSchema
      $context: $context

    @InterestedEventModel = new InterestedEventModel
      $context: $context


    @InterestedEvents = @InterestedEventModel.model



    return
exports.BChattySchema = BChattySchema

from formage.

refack avatar refack commented on August 31, 2024

Basicly formage needs human names for you models. You could try and init adminModels like so:

adminModels =
    Post: @conn.chat.PostModel.model
    Thread: @conn.chat.ThreadModel.model
    Page: @conn.chat.PageModel.model
    Author: @conn.chat.AuthorModel.model
    Account: @conn.chat.AccountModel.model
    Star: @conn.chat.StarModel.model
    Message: @conn.chat.MessageModel.model
    MailBox: @conn.chat.MailBoxModel.model
    Tag: @conn.chat.TagModel.model
    TagList: @conn.chat.TagListModel.model
    Stream: @conn.chat.StreamModel.model
    FollowAuthor: @conn.chat.FollowAuthorModel.model
    FollowStar: @conn.chat.FollowStarModel.model
    Setting: @conn.chat.SettingModel.model
    AccountSub: @conn.chat.AccountSubModel.model
    Institution: @conn.chat.InstitutionModel.model
    Content: @conn.chat.ContentModel.model
    PF: @conn.chat.PFModel.model
    FollowPF: @conn.chat.FollowPFModel.model
    Event: @conn.chat.EventModel.model
    AttendingEvent: @conn.chat.AttendingEventModel.model
    InterestedEvent: @conn.chat.InterestedEventModel.model

P.S. it seems to me that you over normalized your data model. If for you that is more comfortable, you could use a relational DBMS like postgresSQL or MySQL, which have better back-office tools.

from formage.

skilesare avatar skilesare commented on August 31, 2024

Good news! I got past the first error and am on the next. Looks like I had a field in one of my Schemas that was just set to 'Array' and formage wasn't liking that. I changed it to [] and same issue. It was a placeholder anyway so commenting it out worked.

Now I'm getting:Fatal error: Most middleware (like urlencoded) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.

Which I guess relates to Express 4. I'm guessing formage isn't compatible? If so is there an upgrade guide? Please close this issue. Thanks for the help.

PS... most of these collections are just annotation of quick stream look up collections. Most of this started in a relational DB and I moved it to mongo because it was much better/faster at the clustered indexable tables I was using.

from formage.

jontonsoup avatar jontonsoup commented on August 31, 2024

@skilesare did you solve the connect middleware issue? I'm getting the same thing.

from formage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.