add more info to info for scope ()

This commit is contained in:
Raphael Darley 2024-04-18 21:35:38 +02:00 committed by GitHub
parent 49ad32f45e
commit 111f46581f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions
core/src/sql/statements

View file

@ -102,6 +102,7 @@ impl InfoStructure for DefineScopeStatement {
signup,
signin,
comment,
session,
..
} = self;
let mut acc = Object::default();
@ -120,6 +121,10 @@ impl InfoStructure for DefineScopeStatement {
acc.insert("comment".to_string(), comment.into());
}
if let Some(duration) = session {
acc.insert("duration".to_string(), duration.into());
}
Value::Object(acc)
}
}

View file

@ -348,6 +348,15 @@ impl InfoStatement {
"tokens".to_owned(),
process_arr(run.all_sc_tokens(opt.ns(), opt.db(), sc).await?),
);
let def = run.get_sc(opt.ns(), opt.db(), sc).await?;
let Value::Object(o) = def.structure() else {
return Err(Error::Thrown(
"InfoStructure should return Value::Object".to_string(),
));
};
res.extend(o);
// Ok all good
Value::from(res).ok()
}