feat: combine task with stage

This commit is contained in:
wancat committed 2023-09-01 14:56:28 +08:00
1 parent de8d49aea3
commit dd7829b3e9
8 files changed
+127 -54

No files matched your search

+24 -16
View File
@@ -15,25 +15,25 @@ const stageSchema = new Schema({
type: String,
required: true,
},
task: {
type: String,
},
requirements: [
{
type: String,
required: true,
},
],
repeatable: {
type: Boolean,
required: true,
default: false,
},
condition: {
command: {
type: [String],
required: false,
},
output: {
type: [String],
required: false,
},
error: {
type: [String],
required: false,
},
command: [String],
output: [String],
error: [String],
pwd: [String],
},
responses: {
type: [responseSchema],
@@ -43,10 +43,6 @@ const stageSchema = new Schema({
type: [String],
required: true,
},
next: {
type: String,
required: true,
},
})
const Quest = model(
@@ -56,6 +52,18 @@ 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],
})
)
+16 -1
View File
@@ -14,6 +14,21 @@ 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(
@@ -39,7 +54,7 @@ const Session = model(
default: Date.now,
required: true,
},
completed: [String],
tasks: [taskSchema],
hints: [String],
graph: {
type: nodeSchema,