新增: 评论相关api根据需求重写

This commit is contained in:
2022-07-27 14:52:49 +08:00
parent a35db9fe80
commit d6b5dc326a
18 changed files with 432 additions and 17 deletions

View File

@@ -0,0 +1,21 @@
json.(journal, :id, :notes, :commit_id, :line_code, :path, :diff, :need_respond, :state)
json.user do
json.partial! 'api/v1/users/simple_user', user: journal.user
end
json.review do
if journal.review.present?
json.partial! 'api/v1/projects/pulls/reviews/simple_detail', review: journal.review
else
json.nil!
end
end
json.resolveer do
if journal.resolveer.present?
json.partial! 'api/v1/users/simple_user', user: journal.resolveer
else
json.nil!
end
end
json.resolve_at format_time(journal.resolve_at)
json.created_at format_time(journal.created_on)
json.updated_at format_time(journal.updated_on)

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/projects/pulls/journals/simple_detail', journal: @journal

View File

@@ -0,0 +1,4 @@
json.total_count @journals.total_count
json.journals @journals.each do |journal|
json.partial! 'api/v1/projects/pulls/journals/simple_detail', journal: journal
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/projects/pulls/journals/simple_detail', journal: @journal

View File

@@ -0,0 +1,8 @@
json.reviewer do
json.partial! "api/v1/users/simple_user", user: review.reviewer
end
json.pull_request do
json.partial! "api/v1/projects/pulls/simple_detail", pull: review.pull_request
end
json.(review, :id, :commit_id, :content, :status)
json.created_at format_time(review.created_at)