Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api viewset flow #56

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ broker/broker


dump.rdb
examples
examples
23 changes: 23 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 2020-12-9

## am

建立apiflow路径文件。

**TODO**

- 重写MetaConfig
- 重写ViewFlow


## pm

改写renderer 和 response 部分

# 2020-12-11

完成一个基本流程

# 2020-12-12

handler 负责分派请求到不同的流处理。
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -856,3 +856,12 @@ model类及meta文件的具体路径。
### 运行项目

python manage.py runserver


## 通过model_config生成models.py

在app(account)下新建model_config文件夹,里面放置model的config.json文件。

python manage.py gen_models --models account.model_config

可以获得**account/models.py**文件。
1 change: 1 addition & 0 deletions arkfbp/common/django/app/automation/flows/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
PaginationNode)

from arkfbp.utils.util import get_class_from_path, json_load
# import rest_framework

# ModelSerializerNode metadata
_AUTO_MODEL_SERIALIZER_NODE_NAME = 'auto_model_serializer'
Expand Down
Empty file.
Empty file.
41 changes: 41 additions & 0 deletions arkfbp/common/django/drf/flows/create_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
siteapi flow
"""
from arkfbp.node import StartNode, StopNode
from arkfbp.flow import Flow
from common.django.drf.nodes.create import CreateCore


class CreateHandler(Flow):
"""
Main FLow.
"""

def create_nodes(self):
"""
These nodes cannot be changed,if you are sure to do that,
you can initialize a new SerializerCore node.
"""
return [
{
'cls': StartNode,
'id': 'start',
'next': 'inter',
'x': None,
'y': None
},
{
'cls': CreateCore,
'id': 'inter',
'next': 'stop',
'x': None,
'y': None
},
{
'cls': StopNode,
'id': 'stop',
'next': None,
'x': None,
'y': None
}
]
42 changes: 42 additions & 0 deletions arkfbp/common/django/drf/flows/destroy_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
siteapi flow
"""
from arkfbp.node import StartNode, StopNode
from arkfbp.flow import Flow
from common.django.drf.nodes.destroy import DestroyCore
from common.django.drf.nodes.intermediate import InterMediateCore


class DestroyHandler(Flow):
"""
Main FLow.
"""

def create_nodes(self):
"""
These nodes cannot be changed,if you are sure to do that,
you can initialize a new SerializerCore node.
"""
return [
{
'cls': StartNode,
'id': 'start',
'next': 'destroy',
'x': None,
'y': None
},
{
'cls': DestroyCore,
'id': 'destroy',
'next': 'stop',
'x': None,
'y': None
},
{
'cls': StopNode,
'id': 'stop',
'next': None,
'x': None,
'y': None
}
]
58 changes: 58 additions & 0 deletions arkfbp/common/django/drf/flows/dispatch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""
siteapi flow
"""
from arkfbp.node import StartNode, StopNode
from common.django.drf.nodes.init_request import InitRequestCore
from common.django.drf.nodes.method_handler import HandlerCore
from common.django.drf.generics import ModelViewSet

from common.django.drf.nodes.renderer import RendererCore


class Main(ModelViewSet):
"""
Main FLow.
"""

def create_nodes(self):
"""
These nodes cannot be changed,if you are sure to do that,
you can initialize a new SerializerCore node.
"""
return [
{
'cls': StartNode,
'id': 'start',
'next': 'init',
'x': None,
'y': None
},
{
'cls': InitRequestCore,
'id': 'init',
'next': 'handler_core',
'x': None,
'y': None
},
{
'cls': HandlerCore,
'id': 'handler_core',
'next': 'renderer_core',
'x': None,
'y': None
},
{
'cls': RendererCore,
'id': 'renderer_core',
'next': 'stop',
'x': None,
'y': None
},
{
'cls': StopNode,
'id': 'stop',
'next': None,
'x': None,
'y': None
}
]
49 changes: 49 additions & 0 deletions arkfbp/common/django/drf/flows/list_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""
siteapi flow
"""
from arkfbp.node import StartNode, StopNode
from arkfbp.flow import Flow
from common.django.drf.nodes.get_queryset import QuerysetCore
from common.django.drf.nodes.many_serialize import ManySerializeCore


class ListHandler(Flow):
"""
Main FLow.
"""

def create_nodes(self):
"""
These nodes cannot be changed,if you are sure to do that,
you can initialize a new SerializerCore node.
"""
return [
{
'cls': StartNode,
'id': 'start',
'next': 'get_queryset',
'x': None,
'y': None
},
{
'cls': QuerysetCore,
'id': 'get_queryset',
'next': 'serialize',
'x': None,
'y': None
},
{
'cls': ManySerializeCore,
'id': 'serialize',
'next': 'stop',
'x': None,
'y': None
},
{
'cls': StopNode,
'id': 'stop',
'next': None,
'x': None,
'y': None
}
]
49 changes: 49 additions & 0 deletions arkfbp/common/django/drf/flows/retrieve_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""
siteapi flow
"""
from arkfbp.node import StartNode, StopNode
from arkfbp.flow import Flow
from common.django.drf.nodes.get_object import GetObjectCore
from common.django.drf.nodes.obj_serialize import ObjSerializeCore


class RetrieveHandler(Flow):
"""
Main FLow.
"""

def create_nodes(self):
"""
These nodes cannot be changed,if you are sure to do that,
you can initialize a new SerializerCore node.
"""
return [
{
'cls': StartNode,
'id': 'start',
'next': 'get_object',
'x': None,
'y': None
},
{
'cls': GetObjectCore,
'id': 'get_object',
'next': 'serialize',
'x': None,
'y': None
},
{
'cls': ObjSerializeCore,
'id': 'serialize',
'next': 'stop',
'x': None,
'y': None
},
{
'cls': StopNode,
'id': 'stop',
'next': None,
'x': None,
'y': None
}
]
49 changes: 49 additions & 0 deletions arkfbp/common/django/drf/flows/update_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""
siteapi flow
"""
from arkfbp.node import StartNode, StopNode
from arkfbp.flow import Flow
from common.django.drf.nodes.get_object import GetObjectCore
from common.django.drf.nodes.update_obj_serialize import UpdateObjSerializerCore


class UpdateHandler(Flow):
"""
Main FLow.
"""

def create_nodes(self):
"""
These nodes cannot be changed,if you are sure to do that,
you can initialize a new SerializerCore node.
"""
return [
{
'cls': StartNode,
'id': 'start',
'next': 'get_object',
'x': None,
'y': None
},
{
'cls': GetObjectCore,
'id': 'get_object',
'next': 'update',
'x': None,
'y': None
},
{
'cls': UpdateObjSerializerCore,
'id': 'update',
'next': 'stop',
'x': None,
'y': None
},
{
'cls': StopNode,
'id': 'stop',
'next': None,
'x': None,
'y': None
}
]
Loading