aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-12-01 22:35:11 +0200
committerGravatar GitHub <[email protected]>2020-12-01 22:35:11 +0200
commitac1661fcba10cb603a6527523632c8cce24523f8 (patch)
treeabda856c8a6001b74405422fcb343a4b4c48b762
parentDelete __init__.py (diff)
Delete object_id.py
-rw-r--r--backend/models/types/object_id.py23
1 files changed, 0 insertions, 23 deletions
diff --git a/backend/models/types/object_id.py b/backend/models/types/object_id.py
deleted file mode 100644
index f0e47cf..0000000
--- a/backend/models/types/object_id.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import typing as t
-from bson import ObjectId as OriginalObjectId
-
-
-class ObjectId(OriginalObjectId):
- """ObjectId implementation for Pydantic."""
-
- @classmethod
- def __get_validators__(cls) -> t.Generator[t.Callable, None, None]:
- """Get validators for Pydantic."""
- yield cls.validate
-
- @classmethod
- def validate(cls, value: t.Any) -> t.Optional["ObjectId"]:
- """Checks value validity to become ObjectId and if valid, return ObjectId."""
- if OriginalObjectId.is_valid(value):
- raise ValueError(f"Invalid value '{value}' for ObjectId.")
- return ObjectId(value)
-
- @classmethod
- def __modify_schema__(cls, field_schema: t.Dict[str, t.Any]) -> None:
- """Update data type to string."""
- field_schema.update(type="string")