Skip to content

Commit c5b31d5

Browse files
MongoDB에 대한 type 정의 (#1)
* Add actions.. * Set minor release.. * Define type mongodb.. * Add release workflow.. Co-authored-by: NEONKID <contact@neonkid.xyz>
1 parent 2766d0a commit c5b31d5

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Python Micro Framework Data Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: rymndhng/release-on-push-action@master
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
with:
16+
bump_version_scheme: norelease
17+
tag_prefix: v

pymfdata/mongodb/repository.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from abc import ABC
22
from bson import ObjectId
3-
from typing import final, Optional
3+
from typing import final, List, Optional
44

55
from pymfdata.mongodb.connection import AsyncMotor
66

@@ -18,7 +18,7 @@ async def delete_by_id(self, item_id: str) -> bool:
1818
return True
1919

2020
@final
21-
async def find_all(self):
21+
async def find_all(self) -> List[dict]:
2222
cursor = self._collection.find()
2323
results = list(map(lambda item: item, await cursor.to_list(length=100)))
2424

@@ -33,10 +33,10 @@ async def find_by_id(self, item_id: str) -> Optional[dict]:
3333
return row
3434

3535
@final
36-
async def save(self, req: dict):
36+
async def save(self, req: dict) -> dict:
3737
return await self._collection.insert_one(req)
3838

3939
@final
40-
async def update_by_id(self, item_id: str, req: dict):
40+
async def update_by_id(self, item_id: str, req: dict) -> dict:
4141
await self._collection.update_one({"_id": ObjectId(item_id)}, req)
4242
return await self.find_by_id(item_id)

0 commit comments

Comments
 (0)