add library tag && library tag list api

dev_newshixunModel
p31729568 5 years ago
parent 3521fbeff9
commit 82d80edaca

@ -0,0 +1,6 @@
class LibraryTagsController < ApplicationController
def index
library_tags = LibraryTag.all
render_ok(library_tags: library_tags.as_json(only: %i[id name]), count: library_tags.size)
end
end

@ -791,6 +791,7 @@ Rails.application.routes.draw do
end
resources :libraries, only: [:index, :show, :create, :update, :destroy]
resources :library_tags, only: [:index]
scope module: :projects do
resources :project_applies, only: [:create]

@ -0,0 +1,9 @@
class AddLibraryTagData < ActiveRecord::Migration[5.2]
def up
execute 'INSERT INTO library_tags(id, name) VALUES(4, "高校案例")'
end
def down
execute 'DELETE FROM library_tags WHERE id = 4 and name = "高校案例"'
end
end
Loading…
Cancel
Save