Skip to content

Commit

Permalink
Merge pull request #673 from HDRUK/release-preprod/v2.7.0
Browse files Browse the repository at this point in the history
Release preprod/v2.7.0
  • Loading branch information
cdjreekie authored Mar 2, 2022
2 parents bd4da74 + ea47ab4 commit 903b191
Show file tree
Hide file tree
Showing 63 changed files with 3,233 additions and 372 deletions.
15 changes: 15 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:14

ENV GOOGLE_APPLICATION_CREDENTIALS="/usr/local/etc/gcloud/application_default_credentials.json"

WORKDIR /var/www

COPY package*.json ./

RUN npm install && npm cache clean --force

COPY . .

EXPOSE 3001

CMD ["npm", "run", "server"]
2 changes: 2 additions & 0 deletions docs/index.docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import tool from './resources/tool.docs';
import course from './resources/course.docs';
import collection from './resources/collections.docs';
import activitylog from './resources/activitylog.docs';
import spatialfilter from './resources/spatialfilter.docs';

import collectionsSchema from './schemas/collections.schema';

Expand Down Expand Up @@ -65,6 +66,7 @@ module.exports = {
...course,
...collection,
...activitylog,
...spatialfilter,
},
components: {
securitySchemes: {
Expand Down
100 changes: 100 additions & 0 deletions docs/resources/dataset.docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,106 @@ module.exports = {
},
},
},
'/api/v1/dataset-onboarding/publisher/{publisherID}': {
get: {
summary: 'Returns a list of datasets for a given publisher, or the admin team, as per the supplied query parameters.',
security: [
{
cookieAuth: [],
},
],
tags: ['Datasets'],
parameters: [
{
in: 'path',
name: 'publisherID',
required: true,
description: `The ID of the publisher, or 'admin' for the HDR UK admin team`,
schema: {
type: 'string',
example: '5f3f98068af2ef61552e1d75',
},
},
{
in: 'query',
name: 'search',
required: false,
description: `A search string used to filter the publisher's datasets. String is matched against the publisher name, dataset abstract and dataset title.`,
schema: {
type: 'string',
example: 'covid',
},
},
{
in: 'query',
name: 'status',
required: false,
description: `Filter the results by a given dataset status. Note that if the status parameter is not given, all dataset types are returned in the search results. If the publisherID is 'admin', only 'inReview' is an acceptable status.`,
schema: {
type: 'string',
example: 'inReview',
enum: ['active', 'rejected', 'inReview', 'draft', 'archive'],
},
},
{
in: 'query',
name: 'page',
required: false,
description:
'The page of results to return as set by the limit parameter. The totalPages count in the API response details the amount of results pages available for the given limit. Must ba positive integer greater than 1.',
schema: {
type: 'integer',
example: 1,
},
},
{
in: 'query',
name: 'limit',
required: false,
description:
'The maximum number of results (i.e., datasets) to return in the response per page. Defaults to 10 if the parameter is not given in the initial request. Must be a positive integer greater than 1.',
schema: {
type: 'integer',
example: 10,
},
},
{
in: 'query',
name: 'sortBy',
required: false,
description: `The parameter to sort the dataset results by. Links to the 'sortDirection' which controls whether the sort is ascending or descending. Note that sorting by popularity is only applicable when 'status=active.'. Defaults to 'latest' if no 'sortBy' parameter is given in the request.`,
schema: {
type: 'string',
example: 'latest',
enum: ['latest', 'alphabetic', 'recentlyadded', 'metadata', 'popularity'],
},
},
{
in: 'query',
name: 'sortDirection',
required: false,
description: `Controls the sort direction (i.e., ascending or descending). Defaults to 'desc' if no 'sortDirection' parameter is given in the initial request.`,
schema: {
type: 'string',
example: 'desc',
enum: ['asc', 'desc'],
},
},
],
description: `Returns a list of datasets for either a publisher team or the HDR administration team based on supplied query parameters. All query parameters are optional. If none are given, all datasets associated with the publisher team, regardless of the dataset status, are returned (sorted by latest, descending) One exception is for 'publisherID=admin', in which case only 'inReview' datasets are returned.`,
responses: {
200: {
description: 'Successful API response',
},
401: {
description: 'Unauthorised - see message in response',
},
500: {
description: 'Server error - see message in response',
},
},
},
},
'/api/v2/datasets': {
get: {
summary: 'Returns a list of dataset objects',
Expand Down
27 changes: 27 additions & 0 deletions docs/resources/spatialfilter.docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
'/api/v1/locations/{filter}': {
summary: 'summary',
get: {
summary: 'Returns a spatial location object',
description: 'Returns a spatial location object by matching unique filter parameters',
tags: ['Spatial Location'],
parameters: [
{
in: 'path',
name: 'filter',
required: true,
description: 'The filter location name',
schema: {
type: 'string',
example: 'london',
},
},
],
responses: {
200: {
description: 'Successful response containing a single course object',
}
},
},
},
};
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ module.exports = {
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],

testMatch: [
'**/+(*.)+(spec|test).[tj]s?(x)'
],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"version": "0.1.1",
"private": true,
"dependencies": {
"@google-cloud/bigquery": "^5.9.3",
"@google-cloud/monitoring": "^2.1.0",
"@google-cloud/storage": "^5.3.0",
"@hubspot/api-client": "^4.1.0",
Expand All @@ -30,6 +31,7 @@
"crypto-js": "^4.0.0",
"csurf": "^1.11.0",
"discourse-sso": "^1.0.3",
"docxtemplater": "^3.26.4",
"dotenv": "^8.2.0",
"escape-html": "^1.0.3",
"esm": "^3.2.25",
Expand Down Expand Up @@ -59,9 +61,11 @@
"passport-linkedin-oauth2": "^2.0.0",
"passport-openidconnect": "0.0.2",
"passport-orcid": "0.0.4",
"pizzip": "^3.1.1",
"prettier": "^2.2.1",
"query-string": "^6.12.1",
"randomstring": "^1.1.5",
"simple-gcp-logging": "git+https://github.com/HDRUK/simple-gcp-logging.git#main",
"sinon": "^9.2.4",
"snyk": "^1.334.0",
"swagger-ui-express": "^4.1.4",
Expand Down
3 changes: 2 additions & 1 deletion src/config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ app.use('/api/v1/collectioncounter', require('../resources/collections/collectio

app.use('/api/v1/discourse', require('../resources/discourse/discourse.route'));

app.use('/api/v1/dataset-onboarding', require('../resources/dataset/datasetonboarding.route'));
app.use('/api/v1/dataset-onboarding', require('../routes/datasetonboarding.route'));
app.use('/api/v1/datasets', require('../resources/dataset/v1/dataset.route'));
app.use('/api/v2/datasets', require('../resources/dataset/v2/dataset.route'));

Expand All @@ -255,6 +255,7 @@ app.use('/api/v1/global', require('../resources/global/global.route'));
app.use('/api/v1/search-preferences', require('../resources/searchpreferences/searchpreferences.route'));

app.use('/api/v2/data-use-registers', require('../resources/dataUseRegister/dataUseRegister.route'));
app.use('/api/v1/locations', require('../resources/spatialfilter/SpatialRouter'));

initialiseAuthentication(app);

Expand Down
Loading

0 comments on commit 903b191

Please sign in to comment.