mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
server reorganize files and folder by features
- move and rename files - use associative arrays which store handlers for 'dynamically' load module from de db route - store models_path in test/server/common, a global model variable has the same name that the filename of the model
This commit is contained in:
parent
771099d43e
commit
729cd300b7
49 changed files with 105 additions and 87 deletions
|
@ -13,8 +13,8 @@ auth = require './server/routes/auth'
|
||||||
db = require './server/routes/db'
|
db = require './server/routes/db'
|
||||||
file = require './server/routes/file'
|
file = require './server/routes/file'
|
||||||
folder = require './server/routes/folder'
|
folder = require './server/routes/folder'
|
||||||
user = require './server/handlers/user'
|
user = require './server/users/user_handler'
|
||||||
logging = require './server/logging'
|
logging = require './server/commons/logging'
|
||||||
sprites = require './server/routes/sprites'
|
sprites = require './server/routes/sprites'
|
||||||
contact = require './server/routes/contact'
|
contact = require './server/routes/contact'
|
||||||
languages = require './server/routes/languages'
|
languages = require './server/routes/languages'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../plugins/plugins')
|
||||||
|
|
||||||
ArticleSchema = new mongoose.Schema(
|
ArticleSchema = new mongoose.Schema(
|
||||||
body: String,
|
body: String,
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
Article = require('../models/Article')
|
Article = require('./Article')
|
||||||
Handler = require('./Handler')
|
Handler = require('../commons/Handler')
|
||||||
|
|
||||||
ArticleHandler = class ArticleHandler extends Handler
|
ArticleHandler = class ArticleHandler extends Handler
|
||||||
modelClass: Article
|
modelClass: Article
|
|
@ -1,4 +1,4 @@
|
||||||
c = require './common'
|
c = require '../commons/schemas'
|
||||||
|
|
||||||
ArticleSchema = c.object()
|
ArticleSchema = c.object()
|
||||||
c.extendNamedProperties ArticleSchema # name first
|
c.extendNamedProperties ArticleSchema # name first
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../plugins/plugins')
|
||||||
|
|
||||||
NestedLevelSchema = new mongoose.Schema(
|
NestedLevelSchema = new mongoose.Schema(
|
||||||
name: String
|
name: String
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
Campaign = require('../models/Campaign')
|
Campaign = require('./Campaign')
|
||||||
Handler = require('./Handler')
|
Handler = require('../commons/Handler')
|
||||||
|
|
||||||
CampaignHandler = class CampaignHandler extends Handler
|
CampaignHandler = class CampaignHandler extends Handler
|
||||||
modelClass: Campaign
|
modelClass: Campaign
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
CampaignStatus = require('../models/CampaignStatus')
|
CampaignStatus = require('./CampaignStatus')
|
||||||
Handler = require('./Handler')
|
Handler = require('../commons/Handler')
|
||||||
|
|
||||||
CampaignStatusHandler = class CampaignStatusHandler extends Handler
|
CampaignStatusHandler = class CampaignStatusHandler extends Handler
|
||||||
modelClass: CampaignStatus
|
modelClass: CampaignStatus
|
|
@ -1,7 +1,7 @@
|
||||||
async = require 'async'
|
async = require 'async'
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
Grid = require 'gridfs-stream'
|
Grid = require 'gridfs-stream'
|
||||||
errors = require '../errors'
|
errors = require './errors'
|
||||||
|
|
||||||
module.exports = class Handler
|
module.exports = class Handler
|
||||||
# subclasses should override these properties
|
# subclasses should override these properties
|
|
@ -1,5 +1,5 @@
|
||||||
#this file will hold the experimental JSON schema for i18n
|
#this file will hold the experimental JSON schema for i18n
|
||||||
c = require './common'
|
c = require './schemas'
|
||||||
|
|
||||||
languageCodeArrayRegex = c.generateLanguageCodeArrayRegex()
|
languageCodeArrayRegex = c.generateLanguageCodeArrayRegex()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../plugins/plugins')
|
||||||
|
|
||||||
FileSchema = new mongoose.Schema()
|
FileSchema = new mongoose.Schema()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
File = require('../models/File')
|
File = require('./File')
|
||||||
Handler = require('./Handler')
|
Handler = require('../commons/Handler')
|
||||||
|
|
||||||
FileHandler = class FileHandler extends Handler
|
FileHandler = class FileHandler extends Handler
|
||||||
modelClass: File
|
modelClass: File
|
|
@ -1,4 +1,4 @@
|
||||||
c = require './common'
|
c = require '../commons/schemas'
|
||||||
|
|
||||||
FileSchema = c.baseSchema()
|
FileSchema = c.baseSchema()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../plugins/plugins')
|
||||||
jsonschema = require('../schemas/level')
|
jsonschema = require('./level_schema')
|
||||||
|
|
||||||
LevelSchema = new mongoose.Schema({
|
LevelSchema = new mongoose.Schema({
|
||||||
description: String
|
description: String
|
|
@ -1,6 +1,6 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../../plugins/plugins')
|
||||||
jsonschema = require('../schemas/level_component')
|
jsonschema = require('./level_component_schema')
|
||||||
|
|
||||||
LevelComponentSchema = new mongoose.Schema {
|
LevelComponentSchema = new mongoose.Schema {
|
||||||
description: String
|
description: String
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
LevelComponent = require('../models/LevelComponent')
|
LevelComponent = require('./LevelComponent')
|
||||||
Handler = require('./Handler')
|
Handler = require('../../commons/Handler')
|
||||||
|
|
||||||
LevelComponentHandler = class LevelComponentHandler extends Handler
|
LevelComponentHandler = class LevelComponentHandler extends Handler
|
||||||
modelClass: LevelComponent
|
modelClass: LevelComponent
|
|
@ -1,5 +1,5 @@
|
||||||
c = require './common'
|
c = require '../../commons/schemas'
|
||||||
metaschema = require './metaschema'
|
metaschema = require '../../commons/metaschema'
|
||||||
|
|
||||||
attackSelfCode = """
|
attackSelfCode = """
|
||||||
class AttacksSelf extends Component
|
class AttacksSelf extends Component
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
Level = require('./Level')
|
Level = require('../Level')
|
||||||
|
|
||||||
LevelDraftSchema = new mongoose.Schema(
|
LevelDraftSchema = new mongoose.Schema(
|
||||||
user: {type: mongoose.Schema.ObjectId, ref: 'User'}
|
user: {type: mongoose.Schema.ObjectId, ref: 'User'}
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
LevelDraft = require('../models/LevelDraft')
|
LevelDraft = require('./LevelDraft')
|
||||||
Handler = require('./Handler')
|
Handler = require('../../commons/Handler')
|
||||||
|
|
||||||
LevelDraftHandler = class LevelDraftHandler extends Handler
|
LevelDraftHandler = class LevelDraftHandler extends Handler
|
||||||
modelClass: LevelDraft
|
modelClass: LevelDraft
|
|
@ -1,8 +1,8 @@
|
||||||
# TODO: not updated since rename from level_instance, or since we redid how all models are done; probably busted
|
# TODO: not updated since rename from level_instance, or since we redid how all models are done; probably busted
|
||||||
|
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../../plugins/plugins')
|
||||||
jsonschema = require('../schemas/level_feedback')
|
jsonschema = require('./level_feedback_schema')
|
||||||
|
|
||||||
LevelFeedbackSchema = new mongoose.Schema({
|
LevelFeedbackSchema = new mongoose.Schema({
|
||||||
created:
|
created:
|
|
@ -1,5 +1,5 @@
|
||||||
LevelFeedback = require('../models/LevelFeedback')
|
LevelFeedback = require('./LevelFeedback')
|
||||||
Handler = require('./Handler')
|
Handler = require('../../commons/Handler')
|
||||||
|
|
||||||
class LevelFeedbackHandler extends Handler
|
class LevelFeedbackHandler extends Handler
|
||||||
modelClass: LevelFeedback
|
modelClass: LevelFeedback
|
|
@ -1,4 +1,4 @@
|
||||||
c = require './common'
|
c = require '../../commons/schemas'
|
||||||
|
|
||||||
LevelFeedbackLevelSchema = c.object {required: ['original', 'majorVersion']}, {
|
LevelFeedbackLevelSchema = c.object {required: ['original', 'majorVersion']}, {
|
||||||
original: c.objectId({})
|
original: c.objectId({})
|
|
@ -1,10 +1,10 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
Level = require('../models/Level')
|
Level = require('./Level')
|
||||||
Session = require('../models/LevelSession')
|
Session = require('./sessions/LevelSession')
|
||||||
SessionHandler = require('./level_session')
|
SessionHandler = require('./sessions/level_session_handler')
|
||||||
Feedback = require('../models/LevelFeedback')
|
Feedback = require('./feedbacks/LevelFeedback')
|
||||||
Handler = require('./Handler')
|
Handler = require('../commons/Handler')
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
|
|
||||||
LevelHandler = class LevelHandler extends Handler
|
LevelHandler = class LevelHandler extends Handler
|
|
@ -1,5 +1,5 @@
|
||||||
c = require './common'
|
c = require '../commons/schemas'
|
||||||
ThangComponentSchema = require './thang_component'
|
ThangComponentSchema = require './thangs/thang_component_schema'
|
||||||
|
|
||||||
SpecificArticleSchema = c.object()
|
SpecificArticleSchema = c.object()
|
||||||
c.extendNamedProperties SpecificArticleSchema # name first
|
c.extendNamedProperties SpecificArticleSchema # name first
|
|
@ -1,8 +1,8 @@
|
||||||
# TODO: not updated since rename from level_instance, or since we redid how all models are done; probably busted
|
# TODO: not updated since rename from level_instance, or since we redid how all models are done; probably busted
|
||||||
|
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../../plugins/plugins')
|
||||||
jsonschema = require('../schemas/level_session')
|
jsonschema = require('./level_session_schema')
|
||||||
|
|
||||||
LevelSessionSchema = new mongoose.Schema({
|
LevelSessionSchema = new mongoose.Schema({
|
||||||
created:
|
created:
|
|
@ -1,5 +1,5 @@
|
||||||
LevelSession = require('../models/LevelSession')
|
LevelSession = require('./LevelSession')
|
||||||
Handler = require('./Handler')
|
Handler = require('../../commons/Handler')
|
||||||
|
|
||||||
TIMEOUT = 1000 * 30 # no activity for 30 seconds means it's not active
|
TIMEOUT = 1000 * 30 # no activity for 30 seconds means it's not active
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
c = require './common'
|
c = require '../../commons/schemas'
|
||||||
|
|
||||||
LevelSessionPlayerSchema = c.object {
|
LevelSessionPlayerSchema = c.object {
|
||||||
id: c.objectId(links: [{rel: 'extra', href: "/db/user/{($)}"}])
|
id: c.objectId(links: [{rel: 'extra', href: "/db/user/{($)}"}])
|
|
@ -1,6 +1,6 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../../plugins/plugins')
|
||||||
jsonschema = require('../schemas/level_system')
|
jsonschema = require('./level_system_schema')
|
||||||
|
|
||||||
LevelSystemSchema = new mongoose.Schema {
|
LevelSystemSchema = new mongoose.Schema {
|
||||||
description: String
|
description: String
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
LevelSystem = require('../models/LevelSystem')
|
LevelSystem = require('./LevelSystem')
|
||||||
Handler = require('./Handler')
|
Handler = require('../../commons/Handler')
|
||||||
|
|
||||||
LevelSystemHandler = class LevelSystemHandler extends Handler
|
LevelSystemHandler = class LevelSystemHandler extends Handler
|
||||||
modelClass: LevelSystem
|
modelClass: LevelSystem
|
|
@ -1,5 +1,5 @@
|
||||||
c = require './common'
|
c = require '../../commons/schemas'
|
||||||
metaschema = require './metaschema'
|
metaschema = require '../../commons/metaschema'
|
||||||
|
|
||||||
jitterSystemCode = """
|
jitterSystemCode = """
|
||||||
class Jitter extends System
|
class Jitter extends System
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../../plugins/plugins')
|
||||||
|
|
||||||
LevelComponentSchema = new mongoose.Schema(
|
LevelComponentSchema = new mongoose.Schema(
|
||||||
original: {type: mongoose.Schema.ObjectId, ref: 'level.session'}
|
original: {type: mongoose.Schema.ObjectId, ref: 'level.session'}
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
plugins = require('./plugins')
|
plugins = require('../../plugins/plugins')
|
||||||
|
|
||||||
ThangTypeSchema = new mongoose.Schema({
|
ThangTypeSchema = new mongoose.Schema({
|
||||||
body: String,
|
body: String,
|
|
@ -1,4 +1,4 @@
|
||||||
c = require './common'
|
c = require '../../commons/schemas'
|
||||||
|
|
||||||
module.exports = ThangComponentSchema = c.object {
|
module.exports = ThangComponentSchema = c.object {
|
||||||
title: "Component"
|
title: "Component"
|
|
@ -1,7 +1,7 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
ThangType = require('../models/ThangType')
|
ThangType = require('./ThangType')
|
||||||
Handler = require('./Handler')
|
Handler = require('../../commons/Handler')
|
||||||
|
|
||||||
ThangTypeHandler = class ThangTypeHandler extends Handler
|
ThangTypeHandler = class ThangTypeHandler extends Handler
|
||||||
modelClass: ThangType
|
modelClass: ThangType
|
|
@ -1,5 +1,5 @@
|
||||||
c = require './common'
|
c = require '../../commons/schemas'
|
||||||
ThangComponentSchema = require './thang_component'
|
ThangComponentSchema = require './thang_component_schema'
|
||||||
|
|
||||||
ThangTypeSchema = c.object()
|
ThangTypeSchema = c.object()
|
||||||
c.extendNamedProperties ThangTypeSchema # name first
|
c.extendNamedProperties ThangTypeSchema # name first
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
User = require('./User')
|
User = require('../users/User')
|
||||||
textSearch = require('mongoose-text-search')
|
textSearch = require('mongoose-text-search')
|
||||||
|
|
||||||
module.exports.NamedPlugin = (schema) ->
|
module.exports.NamedPlugin = (schema) ->
|
|
@ -1,11 +1,11 @@
|
||||||
passport = require('passport')
|
passport = require('passport')
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
LocalStrategy = require('passport-local').Strategy
|
LocalStrategy = require('passport-local').Strategy
|
||||||
User = require('./../models/User')
|
User = require('../users/User')
|
||||||
UserHandler = require('./../handlers/user')
|
UserHandler = require('../users/user_handler')
|
||||||
config = require '../../server_config'
|
config = require '../../server_config'
|
||||||
nodemailer = require 'nodemailer'
|
nodemailer = require 'nodemailer'
|
||||||
errors = require './../errors'
|
errors = require '../commons/errors'
|
||||||
|
|
||||||
module.exports.setupRoutes = (app) ->
|
module.exports.setupRoutes = (app) ->
|
||||||
passport.serializeUser((user, done) -> done(null, user._id))
|
passport.serializeUser((user, done) -> done(null, user._id))
|
||||||
|
|
|
@ -3,10 +3,26 @@ winston = require 'winston'
|
||||||
mongoose = require 'mongoose'
|
mongoose = require 'mongoose'
|
||||||
Grid = require 'gridfs-stream'
|
Grid = require 'gridfs-stream'
|
||||||
async = require 'async'
|
async = require 'async'
|
||||||
errors = require './../errors'
|
errors = require '../commons/errors'
|
||||||
|
|
||||||
testing = '--unittest' in process.argv
|
testing = '--unittest' in process.argv
|
||||||
|
|
||||||
|
|
||||||
|
handlers =
|
||||||
|
'article': '../../server/articles/article_handler'
|
||||||
|
'campaign': '../../server/campaigns/campaign_handler'
|
||||||
|
'campaign_status': '../../server/campaigns/campaign_status_handler'
|
||||||
|
'file': '../../server/files/file_handler'
|
||||||
|
'level': '../../server/levels/level_handler'
|
||||||
|
'level_component': '../../server/levels/components/level_component_handler'
|
||||||
|
'level_draft': '../../server/levels/drafts/level_draft_handler'
|
||||||
|
'level_feedback': '../../server/levels/feedbacks/level_feedback_handler'
|
||||||
|
'level_session': '../../server/levels/sessions/level_session_handler'
|
||||||
|
'level_system': '../../server/levels/systems/level_system_handler'
|
||||||
|
'level_thang_type': '../../server/levels/thangs/level_thangType_handler'
|
||||||
|
'user': '../../server/users/user_handler'
|
||||||
|
|
||||||
|
|
||||||
module.exports.connectDatabase = () ->
|
module.exports.connectDatabase = () ->
|
||||||
dbName = config.mongo.db
|
dbName = config.mongo.db
|
||||||
dbName += '_unittest' if testing
|
dbName += '_unittest' if testing
|
||||||
|
@ -30,7 +46,8 @@ module.exports.setupRoutes = (app) ->
|
||||||
return getSchema(req, res, module) if parts[1] is 'schema'
|
return getSchema(req, res, module) if parts[1] is 'schema'
|
||||||
|
|
||||||
try
|
try
|
||||||
name = "../handlers/#{module.replace '.', '_'}"
|
moduleName = module.replace '.', '_'
|
||||||
|
name = handlers[moduleName]
|
||||||
module = require(name)
|
module = require(name)
|
||||||
return module.getLatestVersion(req, res, parts[1], parts[3]) if parts[2] is 'version'
|
return module.getLatestVersion(req, res, parts[1], parts[3]) if parts[2] is 'version'
|
||||||
return module.versions(req, res, parts[1]) if parts[2] is 'versions'
|
return module.versions(req, res, parts[1]) if parts[2] is 'versions'
|
||||||
|
|
|
@ -3,7 +3,7 @@ Grid = require 'gridfs-stream'
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
request = require 'request'
|
request = require 'request'
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
errors = require './../errors'
|
errors = require '../commons/errors'
|
||||||
|
|
||||||
module.exports.setupRoutes = (app) ->
|
module.exports.setupRoutes = (app) ->
|
||||||
app.all '/file*', (req, res) ->
|
app.all '/file*', (req, res) ->
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
request = require 'request'
|
request = require 'request'
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
errors = require './../errors'
|
errors = require '../commons/errors'
|
||||||
|
|
||||||
module.exports.setupRoutes = (app) ->
|
module.exports.setupRoutes = (app) ->
|
||||||
app.all '/folder*', (req, res) ->
|
app.all '/folder*', (req, res) ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
errors = require './../errors'
|
errors = require '../commons/errors'
|
||||||
winston = require 'winston'
|
winston = require 'winston'
|
||||||
locale = require '../../app/locale/locale' # requiring from app; will break if we stop serving from where app lives
|
locale = require '../../app/locale/locale' # requiring from app; will break if we stop serving from where app lives
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
mongoose = require('mongoose')
|
mongoose = require('mongoose')
|
||||||
jsonschema = require('../schemas/user')
|
jsonschema = require('./user_schema')
|
||||||
crypto = require('crypto')
|
crypto = require('crypto')
|
||||||
{salt, isProduction} = require('../../server_config')
|
{salt, isProduction} = require('../../server_config')
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
winston = require('winston')
|
winston = require('winston')
|
||||||
schema = require('../schemas/user')
|
schema = require('./user_schema')
|
||||||
crypto = require('crypto')
|
crypto = require('crypto')
|
||||||
request = require('request')
|
request = require('request')
|
||||||
User = require('../models/User')
|
User = require('./User')
|
||||||
Handler = require('./Handler')
|
Handler = require('../commons/Handler')
|
||||||
languages = require '../routes/languages'
|
languages = require '../routes/languages'
|
||||||
mongoose = require 'mongoose'
|
mongoose = require 'mongoose'
|
||||||
config = require '../../server_config'
|
config = require '../../server_config'
|
|
@ -1,4 +1,4 @@
|
||||||
c = require './common'
|
c = require '../commons/schemas'
|
||||||
emailSubscriptions = ['announcement', 'tester', 'level_creator', 'developer', 'article_editor', 'translator', 'support', 'notification']
|
emailSubscriptions = ['announcement', 'tester', 'level_creator', 'developer', 'article_editor', 'translator', 'support', 'notification']
|
||||||
|
|
||||||
UserSchema = c.object {},
|
UserSchema = c.object {},
|
|
@ -6,24 +6,25 @@ _.str = require('underscore.string')
|
||||||
_.mixin(_.str.exports())
|
_.mixin(_.str.exports())
|
||||||
GLOBAL.mongoose = require 'mongoose'
|
GLOBAL.mongoose = require 'mongoose'
|
||||||
mongoose.connect('mongodb://localhost/coco_unittest')
|
mongoose.connect('mongodb://localhost/coco_unittest')
|
||||||
|
path = require('path')
|
||||||
|
|
||||||
models_path = '../../server/models/'
|
models_path = [
|
||||||
|
'../../server/articles/Article'
|
||||||
include_models = [
|
'../../server/campaigns/Campaign'
|
||||||
'Article'
|
'../../server/campaigns/CampaignStatus'
|
||||||
'Campaign'
|
'../../server/levels/Level'
|
||||||
'CampaignStatus'
|
'../../server/levels/components/LevelComponent'
|
||||||
'Level'
|
'../../server/levels/systems/LevelSystem'
|
||||||
'LevelComponent'
|
'../../server/levels/drafts/LevelDraft'
|
||||||
'LevelSystem'
|
'../../server/levels/sessions/LevelSession'
|
||||||
'LevelDraft'
|
'../../server/levels/thangs/LevelThangType'
|
||||||
'LevelSession'
|
'../../server/users/User'
|
||||||
'LevelThangType'
|
|
||||||
'User'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
for m in include_models
|
for m in models_path
|
||||||
GLOBAL[m] = require models_path+m
|
model = path.basename(m)
|
||||||
|
#console.log('model=' + model)
|
||||||
|
GLOBAL[model] = require m
|
||||||
|
|
||||||
async = require 'async'
|
async = require 'async'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue