apexdevkit 1.4.4__tar.gz → 1.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/PKG-INFO +1 -1
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/router.py +4 -2
- apexdevkit-1.5.1/apexdevkit/repository/base.py +29 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/repository/in_memory.py +6 -2
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/repository/interface.py +2 -2
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/pyproject.toml +1 -1
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/LICENSE +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/README.md +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/error.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.4.4 → apexdevkit-1.5.1}/apexdevkit/testing/rest.py +0 -0
|
@@ -458,8 +458,10 @@ class RestfulRouter:
|
|
|
458
458
|
return JSONResponse(
|
|
459
459
|
RestfulResponse(RestfulName(self.parent)).not_found(e), 404
|
|
460
460
|
)
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
try:
|
|
462
|
+
service.update_many(items)
|
|
463
|
+
except DoesNotExistError as e:
|
|
464
|
+
return JSONResponse(self.response.not_found(e), 404)
|
|
463
465
|
|
|
464
466
|
return self.response.ok()
|
|
465
467
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Iterator
|
|
2
|
+
|
|
3
|
+
from apexdevkit.repository.interface import IdT, ItemT, Repository
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RepositoryBase(Repository[IdT, ItemT]): # pragma: no cover
|
|
7
|
+
def create(self, item: ItemT) -> ItemT:
|
|
8
|
+
raise NotImplementedError
|
|
9
|
+
|
|
10
|
+
def create_many(self, items: list[ItemT]) -> list[ItemT]:
|
|
11
|
+
raise NotImplementedError
|
|
12
|
+
|
|
13
|
+
def read(self, item_id: IdT) -> ItemT:
|
|
14
|
+
raise NotImplementedError
|
|
15
|
+
|
|
16
|
+
def update(self, item: ItemT) -> None:
|
|
17
|
+
raise NotImplementedError
|
|
18
|
+
|
|
19
|
+
def update_many(self, items: list[ItemT]) -> None:
|
|
20
|
+
raise NotImplementedError
|
|
21
|
+
|
|
22
|
+
def delete(self, item_id: IdT) -> None:
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
|
|
25
|
+
def __iter__(self) -> Iterator[ItemT]:
|
|
26
|
+
raise NotImplementedError
|
|
27
|
+
|
|
28
|
+
def __len__(self) -> int:
|
|
29
|
+
raise NotImplementedError
|
|
@@ -63,14 +63,18 @@ class InMemoryRepository(Generic[ItemT]):
|
|
|
63
63
|
self.create(item)
|
|
64
64
|
return self
|
|
65
65
|
|
|
66
|
-
def create_many(self, items: list[ItemT]) ->
|
|
66
|
+
def create_many(self, items: list[ItemT]) -> list[ItemT]:
|
|
67
67
|
for item in items:
|
|
68
68
|
self.create(item)
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
return items
|
|
71
|
+
|
|
72
|
+
def create(self, item: ItemT) -> ItemT:
|
|
71
73
|
self._ensure_does_not_exist(item)
|
|
72
74
|
self.items[str(item.id)] = deepcopy(self.formatter.dump(item))
|
|
73
75
|
|
|
76
|
+
return item
|
|
77
|
+
|
|
74
78
|
def _ensure_does_not_exist(self, new: ItemT) -> None:
|
|
75
79
|
for existing in self:
|
|
76
80
|
error = ExistsError(existing)
|
|
@@ -5,10 +5,10 @@ IdT = TypeVar("IdT", contravariant=True)
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class Repository(Protocol[IdT, ItemT]):
|
|
8
|
-
def create(self, item: ItemT) ->
|
|
8
|
+
def create(self, item: ItemT) -> ItemT:
|
|
9
9
|
pass
|
|
10
10
|
|
|
11
|
-
def create_many(self, items: list[ItemT]) ->
|
|
11
|
+
def create_many(self, items: list[ItemT]) -> list[ItemT]:
|
|
12
12
|
pass
|
|
13
13
|
|
|
14
14
|
def read(self, item_id: IdT) -> ItemT:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|