Skip to content

Commit ed25036

Browse files
committed
typed: minor update
1 parent 6fc81f7 commit ed25036

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

easy/domain/orm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Tuple
2+
from typing import Any, Tuple, Type
33

44
from django.db import models
55
from django.db.models.query import QuerySet
@@ -12,7 +12,7 @@
1212

1313

1414
class CrudModel(object):
15-
def __init__(self, model: models.Model):
15+
def __init__(self, model: Type[models.Model]):
1616
self.model = model
1717

1818
def __get_fields(self, payload: dict) -> Tuple[dict, dict]:

easy/services/base.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import logging
2-
from typing import Optional, Type
2+
from typing import Type
33

44
from django.db import models
55

6-
from easy.domain import BaseDomain
76
from easy.services.crud import CrudService
87
from easy.services.permission import PermissionService
98

@@ -13,12 +12,7 @@
1312
class BaseService(CrudService, PermissionService):
1413
def __init__(
1514
self,
16-
model: models.Model,
17-
biz: Optional[Type[BaseDomain]] = None,
15+
model: Type[models.Model],
1816
):
19-
self.biz = biz
20-
if self.biz:
21-
self.model = self.biz.model
22-
else:
23-
self.model = model
17+
self.model = model
2418
super().__init__(model=self.model)

easy/services/crud.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any
2+
from typing import Any, Type
33

44
from asgiref.sync import sync_to_async
55
from django.db import models
@@ -10,7 +10,7 @@
1010

1111

1212
class CrudService(CrudModel):
13-
def __init__(self, model: models.Model):
13+
def __init__(self, model: Type[models.Model]):
1414
super().__init__(model)
1515
self.model = model
1616

0 commit comments

Comments
 (0)