新增:数据集新字段license_id和paper_content
This commit is contained in:
parent
dbfbee78fa
commit
47c4af8ea1
|
@ -27,7 +27,7 @@ class Api::V1::Projects::DatasetsController < Api::V1::BaseController
|
|||
|
||||
private
|
||||
def dataset_params
|
||||
params.permit(:title, :description)
|
||||
params.permit(:title, :description, :license_id, :paper_content)
|
||||
end
|
||||
|
||||
def find_dataset
|
||||
|
|
|
@ -2,21 +2,25 @@
|
|||
#
|
||||
# Table name: project_datasets
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# description :text(65535)
|
||||
# project_id :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# description :text(65535)
|
||||
# project_id :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# license_id :integer
|
||||
# paper_content :text(65535)
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_project_datasets_on_license_id (license_id)
|
||||
# index_project_datasets_on_project_id (project_id)
|
||||
#
|
||||
|
||||
class ProjectDataset < ApplicationRecord
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :license, optional: true
|
||||
has_many :attachments, as: :container, dependent: :destroy
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
json.(@project_dataset, :id, :title, :description)
|
||||
json.(@project_dataset, :id, :title, :description, :license_id, :paper_content)
|
||||
json.license_name @project_dataset&.license&.name
|
||||
json.attachments @attachments do |at|
|
||||
json.partial! "api/v1/attachments/detail", locals: {attachment: at}
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddLicenseAndPaperContentToProjectDataset < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :project_datasets, :license
|
||||
add_column :project_datasets, :paper_content, :text
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue