mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: change to use commonjs output
This commit is contained in:
1 parent
2bdb804f24
commit
557af91d4b
24 files changed
+35
-18
No files matched your search
@@ -0,0 +1,72 @@
|
||||
import { model, Schema } from 'mongoose'
|
||||
|
||||
const nodeSchema = new Schema({
|
||||
path: String,
|
||||
type: String,
|
||||
discovered: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
nodeSchema.add({
|
||||
children: [nodeSchema],
|
||||
})
|
||||
|
||||
const taskSchema = new Schema({
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
completed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
const Session = model(
|
||||
'Session',
|
||||
new Schema(
|
||||
{
|
||||
user: {
|
||||
type: Schema.ObjectId,
|
||||
ref: 'User',
|
||||
required: true,
|
||||
},
|
||||
quest: {
|
||||
type: String,
|
||||
ref: 'Quest',
|
||||
required: true,
|
||||
},
|
||||
containerId: String,
|
||||
status: {
|
||||
type: String,
|
||||
enum: ['active', 'finished', 'inactive'],
|
||||
required: true,
|
||||
default: 'active',
|
||||
},
|
||||
finishedAt: Date,
|
||||
lastActivityAt: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
required: true,
|
||||
},
|
||||
tasks: [taskSchema],
|
||||
hints: [[String]],
|
||||
graph: {
|
||||
type: nodeSchema,
|
||||
default: {
|
||||
path: '/',
|
||||
type: 'folder',
|
||||
},
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
)
|
||||
)
|
||||
|
||||
export default Session
|
||||
Reference in new issue
Block a user