Skip to content

Commit

Permalink
Fix branch (#60)
Browse files Browse the repository at this point in the history
* fix wrong import path in examples and documentations

* Module decorator is not creating the EXPORT metadata correctly. I believe it should be setting the attribute with self.exports instead of imports.
  • Loading branch information
ItayTheDar authored May 21, 2024
1 parent 21e6b04 commit 9ce6c1f
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/async_orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ There are two ways of creating service.
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession

from nest.core.decorators import async_db_request_handler
from nest.core.decorators.database import async_db_request_handler
from nest.core import Injectable

from .example_entity import Example as ExampleEntity
Expand Down
2 changes: 1 addition & 1 deletion docs/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Implement services to handle business logic.
```python
from .examples_model import Examples
from .examples_entity import Examples as ExamplesEntity
from nest.core.decorators import db_request_handler
from nest.core.decorators.database import db_request_handler
from nest.core import Injectable


Expand Down
3 changes: 2 additions & 1 deletion docs/sync_orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ Implement services to handle business logic.
from src.config import config
from .examples_model import Examples
from .examples_entity import Examples as ExamplesEntity
from nest.core.decorators import db_request_handler, Injectable
from nest.core.decorators.database import db_request_handler
from nest.core import Injectable


@Injectable
Expand Down
2 changes: 1 addition & 1 deletion examples/OrmAsyncApp/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uvicorn

if __name__ == "__main__":
uvicorn.run("src.app_module:http_server", host="0.0.0.0", port=8000, reload=True)
uvicorn.run("src.app_module:http_server", host="0.0.0.0", port=8001, reload=True)
2 changes: 1 addition & 1 deletion examples/OrmAsyncApp/src/example/example_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sqlalchemy.ext.asyncio import AsyncSession

from nest.core import Injectable
from nest.core.decorators import async_db_request_handler
from nest.core.decorators.database import async_db_request_handler

from .example_entity import Example as ExampleEntity
from .example_model import Example
Expand Down
2 changes: 1 addition & 1 deletion examples/OrmAsyncApp/src/product/product_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sqlalchemy.ext.asyncio import AsyncSession

from nest.core import Injectable
from nest.core.decorators import async_db_request_handler
from nest.core.decorators.database import async_db_request_handler

from .product_entity import Product as ProductEntity
from .product_model import Product
Expand Down
2 changes: 1 addition & 1 deletion examples/OrmAsyncApp/src/user/user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sqlalchemy.ext.asyncio import AsyncSession

from nest.core import Injectable
from nest.core.decorators import async_db_request_handler
from nest.core.decorators.database import async_db_request_handler

from .user_entity import User as UserEntity
from .user_model import User
Expand Down
2 changes: 1 addition & 1 deletion examples/OrmSyncApp/src/example/example_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from nest.core import Injectable
from nest.core.decorators import db_request_handler
from nest.core.decorators.database import db_request_handler

from ..config import config
from .example_entity import Example as ExampleEntity
Expand Down
2 changes: 1 addition & 1 deletion examples/OrmSyncApp/src/product/product_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from nest.core import Injectable
from nest.core.decorators import db_request_handler
from nest.core.decorators.database import db_request_handler

from ..config import config
from .product_entity import Product as ProductEntity
Expand Down
2 changes: 1 addition & 1 deletion examples/OrmSyncApp/src/user/user_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from nest.core import Injectable
from nest.core.decorators import db_request_handler
from nest.core.decorators.database import db_request_handler

from ..config import config
from .user_entity import User as UserEntity
Expand Down
4 changes: 2 additions & 2 deletions nest/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

class ModuleMetadata(str, Enum):
CONTROLLERS = "controllers"
IMPORT = "imports"
PROVIDER = "providers"
IMPORTS = "imports"
PROVIDERS = "providers"
EXPORTS = "exports"

def __str__(self):
Expand Down
6 changes: 3 additions & 3 deletions nest/core/decorators/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def __init__(

def __call__(self, cls):
setattr(cls, ModuleMetadata.CONTROLLERS, self.controllers)
setattr(cls, ModuleMetadata.PROVIDER, self.providers)
setattr(cls, ModuleMetadata.IMPORT, self.imports)
setattr(cls, ModuleMetadata.EXPORTS, self.imports)
setattr(cls, ModuleMetadata.PROVIDERS, self.providers)
setattr(cls, ModuleMetadata.IMPORTS, self.imports)
setattr(cls, ModuleMetadata.EXPORTS, self.exports)
setattr(cls, "__is_module__", True)
setattr(cls, "__is_global__", self.is_global)

Expand Down

0 comments on commit 9ce6c1f

Please sign in to comment.