mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-12 00:31:21 -05:00
d7cddcb136
Add a teacher survey form for applying for a free trial subscription for evaluation purposes. Add an admin trial requests review page, where admins can approve/deny requests.
14 lines
546 B
CoffeeScript
14 lines
546 B
CoffeeScript
mongoose = require 'mongoose'
|
|
config = require '../../server_config'
|
|
PrepaidSchema = new mongoose.Schema {}, {strict: false, minimize: false,read:config.mongo.readpref}
|
|
|
|
PrepaidSchema.statics.generateNewCode = (done) ->
|
|
tryCode = ->
|
|
code = _.sample("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 8).join('')
|
|
Prepaid.findOne code: code, (err, prepaid) ->
|
|
return done() if err
|
|
return done(code) unless prepaid
|
|
tryCode()
|
|
tryCode()
|
|
|
|
module.exports = Prepaid = mongoose.model('prepaid', PrepaidSchema)
|