#1241 REST API custom fields

This commit is contained in:
karel.picman@lbcfree.net 2021-04-22 10:44:45 +02:00
parent 77c1667835
commit 7a0a36c536
4 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,7 @@ api.dmsf do
api.found_folder do
api.id @folder.id
api.title @folder.title
render_api_custom_values @folder.visible_custom_field_values, api
end
end

View File

@ -29,6 +29,7 @@ api.dmsf_file do
api.dmsf_workflow_started_by_user_id r.dmsf_workflow_started_by_user_id
api.dmsf_workflow_started_at r.dmsf_workflow_started_at
api.digest r.digest
render_api_custom_values r.visible_custom_field_values, api
end
end
end

View File

@ -88,6 +88,11 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
# <dmsf_workflow_started_by_user_id>1</dmsf_workflow_started_by_user_id>
# <dmsf_workflow_started_at/>
# <digest>81dc9bdb52d04dc20036dbd8313ed055</digest>
# <custom_fields>
# <custom_field>
# ...
# <suctom_field>
# </custom_fields>
# </dmsf_file_revision>
# </dmsf_file_revisions>
# </dmsf_file>
@ -97,6 +102,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
assert_select 'dmsf_file > project_id', text: @file1.project_id.to_s
assert_select 'dmsf_file > content_url', text: "http://www.example.com/dmsf/files/#{@file1.id}/download"
assert_select 'dmsf_file > dmsf_file_revisions > dmsf_file_revision', @file1.dmsf_file_revisions.all.size
assert_select 'dmsf_file > dmsf_file_revisions > dmsf_file_revision > custom_fields > custom_field'
#curl -v -H "Content-Type: application/octet-stream" -X GET -u ${1}:${2} http://localhost:3000/dmsf/files/41532/download > file.txt
get "/dmsf/files/#{@file1.id}/download.xml?key=#{@token.value}"
assert_response :success

View File

@ -168,10 +168,16 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
# <found_folder>
# <id>1</id>
# <title>folder1</title>
# <custom_fields>
# <custom_field>
# ...
# <suctom_field>
# </custom_fields>
# </found_folder>
# </dmsf>
assert_select 'dmsf > found_folder > id', text: @folder1.id.to_s
assert_select 'dmsf > found_folder > title', text: @folder1.title
assert_select 'dmsf > found_folder > custom_fields > custom_field'
end
def test_find_folder_by_id_not_found