added validation

This commit is contained in:
hannathkadher
2025-01-06 16:38:44 +04:00
parent a31eb27c92
commit 6ee650e9f8
6 changed files with 278 additions and 131 deletions

View File

@ -61,7 +61,6 @@ class SpaceTemplateModel {
}
}
class UpdateSubspaceTemplateModel {
final String uuid;
final Action action;
@ -133,3 +132,28 @@ class UpdateTagModel {
};
}
}
extension SpaceTemplateExtensions on SpaceTemplateModel {
List<String> listAllTagValues() {
final List<String> tagValues = [];
if (tags != null) {
tagValues.addAll(
tags!.map((tag) => tag.tag ?? '').where((tag) => tag.isNotEmpty));
}
if (subspaceModels != null) {
for (final subspace in subspaceModels!) {
if (subspace.tags != null) {
tagValues.addAll(
subspace.tags!
.map((tag) => tag.tag ?? '')
.where((tag) => tag.isNotEmpty),
);
}
}
}
return tagValues;
}
}