From ea5265694f52662662264d161336f37afc2c0d60 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Mar 2019 12:41:50 -0400 Subject: [PATCH] fields renamed --- api/controllers/BooksController.js | 2 +- api/controllers/CatalogController.js | 8 ++++---- api/models/Book.js | 4 ++-- assets/styles/index.scss | 4 ++-- config/http.js | 12 ++++++------ migrations/20190314123654_remove_book_source.js | 15 +++++++++++++++ views/pages/index.ejs | 4 ++-- 7 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 migrations/20190314123654_remove_book_source.js diff --git a/api/controllers/BooksController.js b/api/controllers/BooksController.js index b20038f..e60a688 100644 --- a/api/controllers/BooksController.js +++ b/api/controllers/BooksController.js @@ -23,7 +23,7 @@ module.exports = { if (!body.metadata['@type'] || body.metadata['@type'] !== 'http://schema.org/Book') throw new HttpError(400, 'Invalid \'@type\': expected \'http://schema.org/Book\'') const query = { - source: host, + hostname: host, title: body.metadata.title, author: body.metadata.author, publisher: body.metadata.publisher, diff --git a/api/controllers/CatalogController.js b/api/controllers/CatalogController.js index 7ec3f09..bf1a82a 100644 --- a/api/controllers/CatalogController.js +++ b/api/controllers/CatalogController.js @@ -57,10 +57,10 @@ module.exports = { currentPage: page }, links: [ - { rel: 'self', href: `new?page=${page}`, type: 'application/opds+json' }, - { rel: 'prev', href: `new?page=${page > 1 ? page - 1 : page}`, type: 'application/opds+json' }, - { rel: 'next', href: `new?page=${page + 1}`, type: 'application/opds+json' }, - { 'rel': 'search', 'href': 'all{?title,author,version,isbn}', 'type': 'application/opds+json', 'templated': true } + { rel: 'self', href: `all?page=${page}`, type: 'application/opds+json' }, + { rel: 'prev', href: `all?page=${page > 1 ? page - 1 : page}`, type: 'application/opds+json' }, + { rel: 'next', href: `all?page=${page + 1}`, type: 'application/opds+json' }, + { rel: 'search', href: 'all{?title,author,version,isbn}', type: 'application/opds+json', templated: true } ], publications: books }) diff --git a/api/models/Book.js b/api/models/Book.js index a733cc7..7b360c1 100644 --- a/api/models/Book.js +++ b/api/models/Book.js @@ -20,10 +20,10 @@ module.exports = { title: { type: 'string', required: true }, author: { type: 'string' }, publisher: { type: 'string' }, - isbn: { type: 'string' }, + identifier: { type: 'string' }, version: { type: 'string' }, hostname: { type: 'string' }, - storage: { type: 'string' } + opds: { type: 'json' } // ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗ // ║╣ ║║║╠╩╗║╣ ║║╚═╗ diff --git a/assets/styles/index.scss b/assets/styles/index.scss index e3e9d1b..9c17d34 100644 --- a/assets/styles/index.scss +++ b/assets/styles/index.scss @@ -107,7 +107,7 @@ line-height: 40px; height: 40px; margin: 5px 20px 5px 0; - background: $accent-1; + background: $accent-2; color: $text-light-1; border-radius: 3px; } @@ -131,7 +131,7 @@ } } } - main { + .paper { background: white; width: 85%; max-width: 900px; diff --git a/config/http.js b/config/http.js index 7228ecf..0ca199b 100644 --- a/config/http.js +++ b/config/http.js @@ -73,7 +73,7 @@ module.exports.http = { publishLimit: publishLimiter, passportInit: require('passport').initialize(), passportSession: require('passport').session(), - allowCrossDomain: allowCrossDomain + allowCrossDomain: allowCrossDomain, /*************************************************************************** * * @@ -83,10 +83,10 @@ module.exports.http = { * * ***************************************************************************/ - // bodyParser: (function _configureBodyParser(){ - // var skipper = require('skipper'); - // var middlewareFn = skipper({ strict: true }); - // return middlewareFn; - // })(), + bodyParser: (function _configureBodyParser () { + const skipper = require('skipper') + const middlewareFn = skipper({ strict: true }) + return middlewareFn + })() } } diff --git a/migrations/20190314123654_remove_book_source.js b/migrations/20190314123654_remove_book_source.js new file mode 100644 index 0000000..5a91928 --- /dev/null +++ b/migrations/20190314123654_remove_book_source.js @@ -0,0 +1,15 @@ +exports.up = function (knex, Promise) { + return Promise.all([ + knex.schema.table('book', t => { + t.dropColumns('source') + }) + ]) +} + +exports.down = function (knex, Promise) { + return Promise.all([ + knex.schema.table('book', t => { + t.string('source') + }) + ]) +} diff --git a/views/pages/index.ejs b/views/pages/index.ejs index 6aad79f..3d53010 100644 --- a/views/pages/index.ejs +++ b/views/pages/index.ejs @@ -10,9 +10,9 @@ <%- partial('../shared/header.html') %>
- <% if (content) { %> +
<%- content %> - <% } %> +
<%- partial('../shared/footer.html') %>