2014-01-22 17:57:41 -05:00
|
|
|
c = require '../../commons/schemas'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
LevelSessionPlayerSchema = c.object
|
|
|
|
id: c.objectId
|
|
|
|
links: [
|
|
|
|
{
|
|
|
|
rel: 'extra'
|
|
|
|
href: "/db/user/{($)}"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
time:
|
|
|
|
type: 'Number'
|
|
|
|
changes:
|
|
|
|
type: 'Number'
|
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
LevelSessionLevelSchema = c.object {required: ['original', 'majorVersion']},
|
2014-01-03 13:32:13 -05:00
|
|
|
original: c.objectId({})
|
2014-02-14 17:55:30 -05:00
|
|
|
majorVersion:
|
|
|
|
type: 'integer'
|
|
|
|
minimum: 0
|
|
|
|
default: 0
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
|
|
|
|
LevelSessionSchema = c.object
|
2014-01-03 13:32:13 -05:00
|
|
|
title: "Session"
|
|
|
|
description: "A single session for a given level."
|
2014-02-14 17:55:30 -05:00
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
_.extend LevelSessionSchema.properties,
|
|
|
|
# denormalization
|
2014-02-14 17:55:30 -05:00
|
|
|
creatorName:
|
|
|
|
type: 'string'
|
|
|
|
levelName:
|
|
|
|
type: 'string'
|
|
|
|
levelID:
|
|
|
|
type: 'string'
|
|
|
|
multiplayer:
|
|
|
|
type: 'boolean'
|
|
|
|
creator: c.objectId
|
|
|
|
links:
|
|
|
|
[
|
|
|
|
{
|
|
|
|
rel: 'extra'
|
|
|
|
href: "/db/user/{($)}"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
created: c.date
|
|
|
|
title: 'Created'
|
|
|
|
readOnly: true
|
|
|
|
|
|
|
|
changed: c.date
|
|
|
|
title: 'Changed'
|
|
|
|
readOnly: true
|
|
|
|
|
2014-02-07 14:49:37 -05:00
|
|
|
team: c.shortString()
|
2014-01-03 13:32:13 -05:00
|
|
|
level: LevelSessionLevelSchema
|
2014-02-14 17:55:30 -05:00
|
|
|
|
|
|
|
screenshot:
|
|
|
|
type: 'string'
|
|
|
|
|
|
|
|
state: c.object {},
|
|
|
|
complete:
|
|
|
|
type: 'boolean'
|
|
|
|
scripts: c.object {},
|
|
|
|
ended:
|
|
|
|
type: 'object'
|
|
|
|
additionalProperties:
|
|
|
|
type: 'number'
|
|
|
|
currentScript:
|
|
|
|
type: [
|
|
|
|
'null'
|
|
|
|
'string'
|
|
|
|
]
|
|
|
|
currentScriptOffset:
|
|
|
|
type: 'number'
|
|
|
|
|
|
|
|
selected:
|
|
|
|
type: [
|
|
|
|
'null'
|
|
|
|
'string'
|
|
|
|
]
|
|
|
|
playing:
|
|
|
|
type: 'boolean'
|
|
|
|
frame:
|
|
|
|
type: 'number'
|
|
|
|
thangs:
|
2014-01-03 13:32:13 -05:00
|
|
|
type: 'object'
|
2014-02-14 17:55:30 -05:00
|
|
|
additionalProperties:
|
|
|
|
title: 'Thang'
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
methods:
|
|
|
|
type: 'object'
|
|
|
|
additionalProperties:
|
|
|
|
title: 'Thang Method'
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
metrics:
|
|
|
|
type: 'object'
|
|
|
|
source:
|
|
|
|
type: 'string'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
# TODO: specify this more
|
2014-02-14 17:55:30 -05:00
|
|
|
code:
|
|
|
|
type: 'object'
|
|
|
|
|
2014-02-10 16:18:39 -05:00
|
|
|
teamSpells:
|
|
|
|
type: 'object'
|
|
|
|
additionalProperties:
|
|
|
|
type: 'array'
|
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
players:
|
|
|
|
type: 'object'
|
|
|
|
|
|
|
|
chat:
|
|
|
|
type: 'array'
|
|
|
|
|
|
|
|
meanStrength:
|
|
|
|
type: 'number'
|
|
|
|
default: 25
|
|
|
|
|
|
|
|
standardDeviation:
|
|
|
|
type:'number'
|
|
|
|
default:25/3
|
|
|
|
minimum: 0
|
2014-02-10 16:18:39 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
totalScore:
|
|
|
|
type: 'number'
|
|
|
|
default: 10
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-14 17:55:30 -05:00
|
|
|
submitted:
|
|
|
|
type: 'boolean'
|
|
|
|
default: false
|
|
|
|
index:true
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
c.extendBasicProperties LevelSessionSchema, 'level.session'
|
|
|
|
c.extendPermissionsProperties LevelSessionSchema, 'level.session'
|
|
|
|
|
|
|
|
module.exports = LevelSessionSchema
|