-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d31396
commit fb8deb1
Showing
5 changed files
with
113 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import Dict, Any | ||
from bson import ObjectId | ||
from eve.mongo import Collection, Document | ||
|
||
|
||
@Collection("triggers") | ||
class Trigger(Document): | ||
trigger_id: str | ||
user: ObjectId | ||
agent: ObjectId | ||
schedule: Dict[str, Any] | ||
message: str | ||
update_config: Dict[str, Any] | ||
|
||
def __init__(self, **data): | ||
if isinstance(data.get("user"), str): | ||
data["user"] = ObjectId(data["user"]) | ||
if isinstance(data.get("agent"), str): | ||
data["agent"] = ObjectId(data["agent"]) | ||
super().__init__(**data) |