mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-02 04:08:54 +08:00
feat(iotapi): query relation
This commit is contained in:
parent
e435472a14
commit
bf5e980500
1
.gitignore
vendored
1
.gitignore
vendored
@ -59,6 +59,7 @@ ci.sh
|
||||
node_modules/
|
||||
apps/emqx_*
|
||||
apps/dgiot_parse/etc/dgiot_parse.conf
|
||||
*/dgiot_parse_temp.conf
|
||||
apps/dgiot_jieshun/
|
||||
apps/dgiot_mingcheng/
|
||||
apps/dgiot_xinchuangwei/
|
||||
|
@ -909,6 +909,61 @@
|
||||
"Data"
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"summary": "查询关联",
|
||||
"description": "查询关联",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "destClass",
|
||||
"in": "query",
|
||||
"type": "string",
|
||||
"example": "_Role",
|
||||
"default": "_Role",
|
||||
"description": "目标类名"
|
||||
},
|
||||
{
|
||||
"name": "destId",
|
||||
"in": "query",
|
||||
"type": "string",
|
||||
"example": "ccf5456562",
|
||||
"default": "ccf5456562",
|
||||
"description": "目标类对象"
|
||||
},
|
||||
{
|
||||
"name": "destField",
|
||||
"in": "query",
|
||||
"type": "string",
|
||||
"example": "views",
|
||||
"default": "views",
|
||||
"description": "目标关联字段"
|
||||
},
|
||||
{
|
||||
"name": "srcClass",
|
||||
"in": "query",
|
||||
"type": "string",
|
||||
"example": "View",
|
||||
"default": "View",
|
||||
"description": "源类名"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Returns success"
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Server Internal error"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Data"
|
||||
]
|
||||
},
|
||||
"delete": {
|
||||
"summary": "删除关联",
|
||||
"description": "删除关联",
|
||||
|
@ -400,6 +400,30 @@ do_request(post_relation, #{<<"destClass">> := DestClass, <<"destId">> := DestId
|
||||
},
|
||||
dgiot_parse:update_object(DestClass, DestId, Map);
|
||||
|
||||
|
||||
%% Relation 概要: 查询关系 描述:json文件导库
|
||||
%% OperationId:get_relation
|
||||
%% 请求:get /iotapi/relation
|
||||
do_request(get_relation, #{<<"destClass">> := DestClass, <<"destId">> := DestId, <<"destField">> := DestField, <<"srcClass">> := SrcClass} = _Args, _Context, _Req) ->
|
||||
io:format("~s ~p ~p ~n", [?FILE, ?LINE, _Args]),
|
||||
Where = #{
|
||||
<<"where">> => #{
|
||||
<<"$relatedTo">> => #{
|
||||
<<"object">> => #{
|
||||
<<"__type">> => <<"Pointer">>,
|
||||
<<"className">> => DestClass,
|
||||
<<"objectId">> => DestId
|
||||
},
|
||||
<<"key">> => DestField
|
||||
}
|
||||
},
|
||||
<<"order">> => <<"-updatedAt">>,
|
||||
<<"count">> => 1
|
||||
},
|
||||
io:format("~s ~p ~p ~n", [?FILE, ?LINE, Where]),
|
||||
dgiot_parse:query_object(SrcClass, Where);
|
||||
|
||||
|
||||
%% Relation 概要: 删除关系 描述:json文件导库
|
||||
%% OperationId:post_relation
|
||||
%% 请求:DELETE /iotapi/relation
|
||||
|
@ -7,12 +7,12 @@ parse.default_user = root,admin, dgiot_dev,dgiot_admin,guest
|
||||
##--------------------------------------------------------------------
|
||||
## parse config
|
||||
##--------------------------------------------------------------------
|
||||
parse.parse_server = http://prod.iotn2n.com:1337
|
||||
parse.parse_server = http://121.5.171.21:1337
|
||||
parse.parse_path = /parse/
|
||||
parse.parse_appid = d3300b6f53d7ee7da766142f2f7050eb
|
||||
parse.parse_master_key = 3d9707db9414c4e398c5036ddb1b2b62
|
||||
parse.parse_js_key = fc8f19e9dcc4b8b7848aed1f8dcda317
|
||||
parse.parse_rest_key = 7957b8a5923c8be145b317521b922b18
|
||||
parse.parse_appid = c73e0a99f70ee833f484705ea915d264
|
||||
parse.parse_master_key = 1fb04beba432da023507955baef040d7
|
||||
parse.parse_js_key = 80ba347026262c8910a3c2307bc175de
|
||||
parse.parse_rest_key = b242a85b9364657af6fc27ee5a90f748
|
||||
|
||||
##--------------------------------------------------------------------
|
||||
## parse cache
|
||||
|
27
apps/dgiot_parse/etc/dgiot_parse_temp.conf
Normal file
27
apps/dgiot_parse/etc/dgiot_parse_temp.conf
Normal file
@ -0,0 +1,27 @@
|
||||
##--------------------------------------------------------------------
|
||||
## delete field
|
||||
##--------------------------------------------------------------------
|
||||
parse.delete_field = ACL,objectId,updatedAt,createdAt
|
||||
parse.default_user = root,admin, dgiot_dev,dgiot_admin,guest
|
||||
|
||||
##--------------------------------------------------------------------
|
||||
## parse config
|
||||
##--------------------------------------------------------------------
|
||||
parse.parse_server = http://prod.iotn2n.com:1337
|
||||
parse.parse_path = /parse/
|
||||
parse.parse_appid = d3300b6f53d7ee7da766142f2f7050eb
|
||||
parse.parse_master_key = 3d9707db9414c4e398c5036ddb1b2b62
|
||||
parse.parse_js_key = fc8f19e9dcc4b8b7848aed1f8dcda317
|
||||
parse.parse_rest_key = 7957b8a5923c8be145b317521b922b18
|
||||
|
||||
##--------------------------------------------------------------------
|
||||
## parse cache
|
||||
##--------------------------------------------------------------------
|
||||
## auto_save自动坚持保存时间 单位 毫秒
|
||||
parse.cache.auto_save = 10000
|
||||
## max_size 最大存储数量
|
||||
parse.cache.max_size = 100000
|
||||
## max_memory 最大内存数,单位byte
|
||||
parse.cache.max_memory = 1024000
|
||||
## max_time 最大时间间隔,单位秒
|
||||
parse.cache.max_time = 60
|
Loading…
Reference in New Issue
Block a user