MVC: support business logic layer
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- graphql, python, sqlalchemy
- Domain
- api, backend-api-design
Research direction
Start with the SQLAlchemyObjectType example and its resolve_name1 and resolve_name2 entry points. Review how Graphene-SQLAlchemy currently handles resolvers and determine whether a business-logic layer fits the project. Done means an agreed design and documented scope for supporting this pattern; the issue names no files or tests.
Written by the indexing model from the issue text.
Description
We have Model and View aka Node, but we lack a way to write code between them.
class PetBusinessLogic:
def __init__(self, pet):
self.pet = pet
@property
def name1(self):
return self.pet.name + "!"
@property
def name2(self):
return self.pet.name + "!"
class Pet(SQLAlchemyObjectType):
class Meta:
model = PetModel
name = "Pet"
interfaces = (relay.Node,)
batching = True
def resolve_name1(node, info):
# write here application logic code for a large project is not good idea.
# so we need some controller aka PetBusinessLogic
return PetBusinessLogic(node).name1 # DRY and I would like to initialize it once
def resolve_name2(node, info):
return PetBusinessLogic(node).name2 # DRY and I would like to initialize it once
Any suggestions for this design problem?
*(put this PetBusinessLogic into model is also bad idea)
- Dominant language
- Python
- Stars
- 985
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from graphql-python/graphene-sqlalchemy
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
graphql-python/graphene-sqlalchemy#422 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
graphql-python/graphene-sqlalchemy#419 · 3 comments ·
All issues in graphql-python/graphene-sqlalchemy
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·