printDesign static method
void
printDesign()
Implementation
static void printDesign() async {
CappConsole.clear();
var json = <String, Object?>{};
for (var collection in _allCollectionFree) {
var jsonCollection = <String, Object?>{};
var fieldsJson = <String, Object?>{};
for (var field in collection.form.fields.entries) {
var fieldModel = field.value;
fieldsJson.addAll({
field.key: {
'type': fieldModel.type,
'default': fieldModel.defaultValue?.call(),
'readonly': fieldModel.readonly,
'searchable': fieldModel.searchable,
'filterable': fieldModel.filterable,
'validators': fieldModel.validators.length,
'isHiddenJson': fieldModel.hideJson,
},
});
}
jsonCollection.addAll({
'name': collection.name,
'db': collection.db.databaseName,
'count': await collection.collection.count(),
'fields': fieldsJson,
'events': {
'onInsert': collection.collectionEvent.onInsert._listeners.length,
'onUpdate': collection.collectionEvent.onUpdate._listeners.length,
'onDelete': collection.collectionEvent.onDelete._listeners.length,
},
'indexes': await collection.collection.getIndexes(),
});
json[collection.name] = jsonCollection;
}
Console.json(json);
}