mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-06 01:06:28 +08:00
Add session timeline logging and admin sessions view
This commit is contained in:
@@ -43,6 +43,9 @@ export default defineEventHandler(async (event) => {
|
||||
.filter((phase: string) => phase.length)
|
||||
: []
|
||||
|
||||
const entryMode = body.entryMode === 'linear' ? 'linear' : 'parallel'
|
||||
const isMain = body.isMain === true
|
||||
|
||||
const endStates = Array.isArray(body.endStates)
|
||||
? body.endStates
|
||||
.map((state: any) => (typeof state === 'string' ? state.trim() : ''))
|
||||
@@ -62,10 +65,19 @@ export default defineEventHandler(async (event) => {
|
||||
hooks: body.hooks && typeof body.hooks === 'object' ? body.hooks : {},
|
||||
roles,
|
||||
phases,
|
||||
entryMode,
|
||||
isMain,
|
||||
})
|
||||
|
||||
await flow.save()
|
||||
|
||||
if (isMain) {
|
||||
await DecisionFlow.updateMany(
|
||||
{ _id: { $ne: flow._id } },
|
||||
{ $set: { isMain: false } }
|
||||
)
|
||||
}
|
||||
|
||||
const { flow: serialized } = await getFlowWithNodes(slug)
|
||||
return serialized
|
||||
})
|
||||
|
||||
@@ -59,6 +59,14 @@ export default defineEventHandler(async (event) => {
|
||||
flow.phases = phases
|
||||
}
|
||||
|
||||
if (typeof body.entryMode === 'string') {
|
||||
flow.entryMode = body.entryMode === 'linear' ? 'linear' : 'parallel'
|
||||
}
|
||||
|
||||
if (typeof body.isMain === 'boolean') {
|
||||
flow.isMain = body.isMain
|
||||
}
|
||||
|
||||
if (body.variables && typeof body.variables === 'object') {
|
||||
flow.variables = body.variables
|
||||
flow.markModified('variables')
|
||||
@@ -145,6 +153,13 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
await flow.save()
|
||||
|
||||
if (flow.isMain) {
|
||||
await DecisionFlow.updateMany(
|
||||
{ _id: { $ne: flow._id } },
|
||||
{ $set: { isMain: false } }
|
||||
)
|
||||
}
|
||||
|
||||
const data = await getFlowWithNodes(slug)
|
||||
return data
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user