Merge branch 'standalone_develop' into pm_project_develop

# Conflicts:
#	app/models/attachment.rb
#	app/views/api/v1/attachments/_simple_detail.json.jbuilder
This commit is contained in:
2024-04-29 09:11:08 +08:00
45 changed files with 344 additions and 52 deletions

View File

@@ -0,0 +1,11 @@
json.id attachment.uuid
json.title attachment.title
json.description attachment.description
json.filesize number_to_human_size(attachment.filesize)
json.is_pdf attachment.is_pdf?
json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
json.created_on attachment.created_on.strftime("%Y-%m-%d %H:%M:%S")
json.content_type attachment.content_type
json.creator do
json.partial! "api/v1/users/simple_user", locals: {user: attachment.author}
end

View File

@@ -1,5 +1,6 @@
json.id attachment.id
json.id attachment.uuid
json.title attachment.title
json.description attachment.description
json.filesize number_to_human_size(attachment.filesize)
json.is_pdf attachment.is_pdf?
json.url Rails.application.config_for(:configuration)['platform_url'] + (attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)).to_s

View File

@@ -0,0 +1,14 @@
json.total_count @project_datasets.total_count
json.project_datasets @project_datasets.each do |dataset|
json.(dataset, :id, :title, :description, :paper_content)
json.project do
json.partial! "api/v1/projects/simple_detail", project: dataset.project
end
if dataset.license.present?
json.license do
json.(dataset.license, :name, :content)
end
else
json.license nil
end
end

View File

@@ -1,7 +1,7 @@
if project.present?
json.type project.project_type
json.(project,
:description, :forked_count, :forked_from_project_id, :identifier,
:id, :description, :forked_count, :forked_from_project_id, :identifier,
:issues_count, :pull_requests_count, :invite_code, :website, :platform,
:name, :open_devops, :praises_count, :is_public, :status, :watchers_count,
:ignore_id, :license_id, :project_category_id, :project_language_id)

View File

@@ -1,4 +1,6 @@
json.total_count @result_object[:total_data].to_i
json.ssh_url @object_detail['ssh_url']
json.clone_url @object_detail['clone_url']
json.commits @result_object[:data].each do |commit|
json.sha commit['sha']
json.author do
@@ -9,5 +11,6 @@ json.commits @result_object[:data].each do |commit|
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['commit']['committer']), name: commit['commit']['committer']['name'] }
end
json.commit_message commit['commit']['message']
json.time_from_now time_from_now(commit['created'])
json.parent_shas commit['parents'].map{|x|x['sha']}
end

View File

@@ -0,0 +1,6 @@
json.(@project_dataset, :id, :title, :description, :license_id, :paper_content)
json.license_name @project_dataset&.license&.name
json.attachment_total_count @attachments.total_count
json.attachments @attachments do |at|
json.partial! "api/v1/attachments/detail", locals: {attachment: at}
end