mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: update quest schema
* files * boolean operator
This commit is contained in:
1 parent
857e0e7f6a
commit
2f64175df2
2 files changed
+28
-25
No files matched your search
+20
-18
@@ -10,6 +10,25 @@ const responseSchema = new Schema({
|
||||
color: String,
|
||||
})
|
||||
|
||||
const fileConditionSchema = new Schema({
|
||||
path: String,
|
||||
type: String,
|
||||
exists: Boolean,
|
||||
})
|
||||
|
||||
const conditionSchema = new Schema({
|
||||
command: [String],
|
||||
output: [String],
|
||||
error: [String],
|
||||
pwd: [String],
|
||||
files: [fileConditionSchema],
|
||||
})
|
||||
|
||||
conditionSchema.add({
|
||||
OR: [conditionSchema],
|
||||
NOT: conditionSchema,
|
||||
})
|
||||
|
||||
const stageSchema = new Schema({
|
||||
id: {
|
||||
type: String,
|
||||
@@ -29,12 +48,7 @@ const stageSchema = new Schema({
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
condition: {
|
||||
command: [String],
|
||||
output: [String],
|
||||
error: [String],
|
||||
pwd: [String],
|
||||
},
|
||||
condition: conditionSchema,
|
||||
responses: {
|
||||
type: [responseSchema],
|
||||
required: true,
|
||||
@@ -52,18 +66,6 @@ const Quest = model(
|
||||
title: String,
|
||||
order: Number,
|
||||
instruction: String,
|
||||
tasks: {
|
||||
id: String,
|
||||
content: String,
|
||||
display: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
completed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
stages: [stageSchema],
|
||||
})
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user