mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
58 lines
858 B
JavaScript
58 lines
858 B
JavaScript
import { model, Schema } from 'mongoose'
|
|
|
|
const responseSchema = new Schema({
|
|
type: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
content: [String],
|
|
speaker: String,
|
|
color: String,
|
|
})
|
|
|
|
const stageSchema = new Schema({
|
|
id: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
condition: {
|
|
command: {
|
|
type: [String],
|
|
required: false,
|
|
},
|
|
output: {
|
|
type: [String],
|
|
required: false,
|
|
},
|
|
error: {
|
|
type: [String],
|
|
required: false,
|
|
},
|
|
},
|
|
responses: {
|
|
type: [responseSchema],
|
|
required: true,
|
|
},
|
|
hints: {
|
|
type: [String],
|
|
required: true,
|
|
},
|
|
next: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
})
|
|
|
|
const Quest = model(
|
|
'Quest',
|
|
new Schema({
|
|
_id: String,
|
|
title: String,
|
|
order: Number,
|
|
instruction: String,
|
|
stages: [stageSchema],
|
|
})
|
|
)
|
|
|
|
export default Quest
|