feat: update quest schema

* files
* boolean operator
This commit is contained in:
Lin, Hung-Shin authored and wancat committed 2023-10-29 17:41:38 +08:00
1 parent 857e0e7f6a
commit 2f64175df2
2 files changed
+28 -25

No files matched your search

+20 -18
View File
@@ -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],
})
)