forked from ontoportal/ontologies_api
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: create graphs endpoints to list, create and delete (#115)
* fix: docker-compose app volume * fix ncbo_ontology_recommender version * add admin graphs controller to list triple store graphs and delete them * update gemfile * extract graph count path in a constant * add graphs admin action unit tests
- Loading branch information
1 parent
909a8aa
commit 07290db
Showing
8 changed files
with
151 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.6 | ||
2.7.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'ncbo_cron/graphs_counts' | ||
class AdminGraphsController < ApplicationController | ||
|
||
namespace '/admin' do | ||
GRAPH_COUNT_REPORT_PATH = NcboCron.settings.graphs_counts_report_path | ||
before do | ||
if LinkedData.settings.enable_security && (!env['REMOTE_USER'] || !env['REMOTE_USER'].admin?) | ||
error 403, 'Access denied' | ||
end | ||
end | ||
|
||
get '/graphs' do | ||
output = NcboCron::GraphsCounts.new(nil, GRAPH_COUNT_REPORT_PATH).read_graph_counts | ||
reply output | ||
end | ||
|
||
post '/graphs' do | ||
generate_graphs_counts | ||
reply({ message: 'Graph counts generated', status: 200 }) | ||
end | ||
|
||
delete '/graphs' do | ||
url = params['url'] | ||
error 400, 'You must provide a valid URL for the graph to delete' if url.blank? | ||
Goo.sparql_data_client.delete_graph(url) | ||
generate_graphs_counts | ||
reply({ message: "Graph #{url} deleted", status: 200 }) | ||
end | ||
|
||
def generate_graphs_counts | ||
NcboCron::GraphsCounts.new(nil, GRAPH_COUNT_REPORT_PATH).run | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[tools] | ||
ruby = "2.7.8" |
Oops, something went wrong.