2015-11-03 19:41:06 -05:00
|
|
|
CocoModel = require './CocoModel'
|
|
|
|
schema = require 'schemas/models/classroom.schema'
|
|
|
|
|
|
|
|
module.exports = class Classroom extends CocoModel
|
|
|
|
@className: 'Classroom'
|
|
|
|
@schema: schema
|
|
|
|
urlRoot: '/db/classroom'
|
2015-11-23 11:46:08 -05:00
|
|
|
|
|
|
|
joinWithCode: (code, opts) ->
|
|
|
|
options = {
|
|
|
|
url: _.result(@, 'url') + '/~/members'
|
|
|
|
type: 'POST'
|
|
|
|
data: { code: code }
|
|
|
|
}
|
|
|
|
_.extend options, opts
|
2015-12-02 14:56:38 -05:00
|
|
|
@fetch(options)
|
|
|
|
|
|
|
|
removeMember: (userID, opts) ->
|
|
|
|
options = {
|
|
|
|
url: _.result(@, 'url') + '/members'
|
|
|
|
type: 'DELETE'
|
|
|
|
data: { userID: userID }
|
|
|
|
}
|
|
|
|
_.extend options, opts
|
2015-11-23 11:46:08 -05:00
|
|
|
@fetch(options)
|