mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 00:40:56 -05:00
More read nearests and changed redirection
This commit is contained in:
parent
d8c21771fc
commit
5a7666fca3
9 changed files with 9 additions and 9 deletions
|
@ -13,7 +13,7 @@ TreemaUtils = require '../../bower_components/treema/treema-utils.js'
|
|||
|
||||
AchievementSchema = new mongoose.Schema({
|
||||
userField: String
|
||||
}, {strict: false})
|
||||
}, {strict: false,read:'nearest'})
|
||||
|
||||
AchievementSchema.index(
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ LevelFeedbackSchema = new mongoose.Schema({
|
|||
created:
|
||||
type: Date
|
||||
'default': Date.now
|
||||
}, {strict: false})
|
||||
}, {strict: false,read:'nearest'})
|
||||
|
||||
LevelFeedbackSchema.index({created: 1})
|
||||
LevelFeedbackSchema.index({creator: 1})
|
||||
|
|
|
@ -3,7 +3,7 @@ deltas = require '../../app/core/deltas'
|
|||
log = require 'winston'
|
||||
{handlers} = require '../commons/mapping'
|
||||
|
||||
PatchSchema = new mongoose.Schema({status: String}, {strict: false})
|
||||
PatchSchema = new mongoose.Schema({status: String}, {strict: false,read:'nearest'})
|
||||
|
||||
PatchSchema.pre 'save', (next) ->
|
||||
return next() unless @isNew # patch can't be altered after creation, so only need to check data once
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
mongoose = require('mongoose')
|
||||
|
||||
PaymentSchema = new mongoose.Schema({}, {strict: false})
|
||||
PaymentSchema = new mongoose.Schema({}, {strict: false, read:'nearest'})
|
||||
PaymentSchema.index({recipient: 1, 'stripe.timestamp': 1, 'ios.transactionID'}, {unique: true, name: 'unique payment'})
|
||||
|
||||
module.exports = mongoose.model('payment', PaymentSchema)
|
||||
|
|
|
@ -7,7 +7,7 @@ PollSchema = new mongoose.Schema {
|
|||
created:
|
||||
type: Date
|
||||
'default': Date.now
|
||||
}, {strict: false, minimize: false}
|
||||
}, {strict: false, minimize: false,read:'nearest'}
|
||||
|
||||
PollSchema.index {priority: 1}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
mongoose = require 'mongoose'
|
||||
|
||||
PrepaidSchema = new mongoose.Schema {}, {strict: false, minimize: false}
|
||||
PrepaidSchema = new mongoose.Schema {}, {strict: false, minimize: false,read:'nearest'}
|
||||
|
||||
module.exports = Prepaid = mongoose.model('prepaid', PrepaidSchema)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
mongoose = require('mongoose')
|
||||
|
||||
PurchaseSchema = new mongoose.Schema({status: String}, {strict: false})
|
||||
PurchaseSchema = new mongoose.Schema({status: String}, {strict: false,read:'nearest'})
|
||||
PurchaseSchema.index({recipient: 1, 'purchased.original': 1}, {unique: true, name: 'unique purchase'})
|
||||
|
||||
module.exports = mongoose.model('purchase', PurchaseSchema)
|
||||
|
|
|
@ -5,6 +5,6 @@ UserCodeProblemSchema = new mongoose.Schema({
|
|||
created:
|
||||
type: Date
|
||||
'default': Date.now
|
||||
}, {strict: false})
|
||||
}, {strict: false,read:'nearest'})
|
||||
|
||||
module.exports = UserCodeProblem = mongoose.model('user.code.problem', UserCodeProblemSchema)
|
||||
|
|
|
@ -88,7 +88,7 @@ setupChinaRedirectMiddleware = (app) ->
|
|||
isChinese = firstAcceptedLanguage.indexOf? "zh"
|
||||
return isChinese? and isChinese isnt -1
|
||||
else
|
||||
return true
|
||||
return false #If the user is already redirected, don't redirect them!
|
||||
|
||||
app.use (req, res, next) ->
|
||||
if isInChina req
|
||||
|
|
Loading…
Reference in a new issue