-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bot Tags #1147
base: master
Are you sure you want to change the base?
Bot Tags #1147
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -16,7 +16,7 @@ | |||||||||
from kairon.shared.constants import UserActivityType | ||||||||||
from kairon.shared.data.audit.data_objects import Auditlog | ||||||||||
from kairon.shared.data.signals import push_notification, auditlogger | ||||||||||
from kairon.shared.data.constant import ACCESS_ROLES, ACTIVITY_STATUS | ||||||||||
from kairon.shared.data.constant import ACCESS_ROLES, ACTIVITY_STATUS, TagType | ||||||||||
from kairon.shared.utils import Utility | ||||||||||
|
||||||||||
|
||||||||||
|
@@ -68,12 +68,23 @@ class BotMetaData(EmbeddedDocument): | |||||||||
from_template = DynamicField(default=None) | ||||||||||
|
||||||||||
|
||||||||||
class Tagging(EmbeddedDocument): | ||||||||||
tag = StringField() | ||||||||||
type = StringField(choices=[TagType.ADMIN.value, TagType.USER.value], default=None) | ||||||||||
|
||||||||||
|
||||||||||
@auditlogger.log | ||||||||||
class Tags(Auditlog): | ||||||||||
tags = EmbeddedDocumentField(Tagging, default=None) | ||||||||||
Comment on lines
+77
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The modification of the - tags = EmbeddedDocumentField(Tagging, default=None)
+ tags = ListField(EmbeddedDocumentField(Tagging)) Committable suggestion
Suggested change
|
||||||||||
|
||||||||||
|
||||||||||
@auditlogger.log | ||||||||||
@push_notification.apply | ||||||||||
class Bot(Auditlog): | ||||||||||
name = StringField(required=True) | ||||||||||
account = LongField(required=True) | ||||||||||
user = StringField(required=True) | ||||||||||
tags = ListField(EmbeddedDocumentField(Tagging, default=None)) | ||||||||||
metadata = EmbeddedDocumentField(BotMetaData, default=BotMetaData()) | ||||||||||
timestamp = DateTimeField(default=datetime.utcnow) | ||||||||||
status = BooleanField(default=True) | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Tagging
embedded document class is well-defined with atag
field as aStringField
and atype
field that uses theTagType
enum for its choices. This design ensures that the tag type is restricted to the predefinedADMIN
andUSER
values, enhancing data integrity. However, consider setting arequired=True
constraint on thetag
field to ensure that every tag has a name.Committable suggestion