Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ua-parser-js from 0.7.31 to 0.7.33 in /frontend #308

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:13.14.0
FROM node:16

RUN apt-get update && apt-get install -y nano tree tzdata

Expand Down
40 changes: 40 additions & 0 deletions api/controllers/ctsas.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const db = require('../config/database')
const {ParameterizedQuery: PQ} = require("pg-promise");

exports.list = (req, res) => {
const query = `SELECT * FROM "CTSAs";`
Expand All @@ -18,3 +19,42 @@ exports.list = (req, res) => {
})
}



exports.removeCTSA = (req, res) => {
const body = req.body
const ctsaId = body.ctsaId
const move1 = new PQ({
text: `INSERT into removeditems (created, tablename, item)
SELECT current_timestamp, 'CTSAs', to_jsonb(rows) FROM
(select * from "CTSAs" as ss where ss."ctsaId"=$1) rows;`,
values: [ctsaId]
})

const del1 = new PQ({
text: `DELETE from "CTSAs" as t where t."ctsaId" = $1;`,
values: [ctsaId]
})

let sites = 0

let q = db.any(new PQ({text: 'SELECT COUNT("ctsaId") FROM "Sites" where "ctsaId"=$1;', values:[body.ctsaId]}))
.then(data => sites = +data[0].count)
.then(d => {
if(sites < 1) {
db.any(move1)
.then(r=> db.any(del1)
.then(r => res.status(200).send('OK')))
}
else {
res.status(200).send('NOT REMOVED')
}
})
.catch(error => {
console.log('ERROR:', error)
res.status(500).send('There was an error fetching data.')
})

}


43 changes: 43 additions & 0 deletions api/controllers/sites.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const db = require('../config/database')
const {ParameterizedQuery: PQ} = require('pg-promise');

exports.list = (req, res) => {
const query = `SELECT * FROM "Sites";`
Expand All @@ -18,3 +19,45 @@ exports.list = (req, res) => {
res.status(500).send('There was an error fetching data.')
})
}

exports.removeSite = (req, res) => {
const body = req.body
let paramaters = [body.ctsaId, body.siteId, body.siteName];

const move1 = new PQ({
text: `INSERT into removeditems (created, tablename, item)
SELECT current_timestamp, 'StudySites', to_jsonb(rows) FROM
(select * from "StudySites" as ss where ss."ctsaId"=$1 and ss."siteId"=$2 and ss."siteName"=$3) rows;`,
values: paramaters
})

const move2 = new PQ({
text: `INSERT into removeditems (created, tablename, item)
SELECT current_timestamp, 'Sites', to_jsonb(rows) FROM
(select * from "Sites" as s where s."ctsaId"=$1 and s."siteId"=$2 and s."siteName"=$3) rows;`,
values: paramaters
})

const del1 = new PQ({
text: `DELETE from "StudySites" as ss where ss."ctsaId" = $1 and ss."siteId"=$2 and ss."siteName"=$3;`,
values: paramaters
})

const del2 = new PQ({
text: `DELETE from "Sites" as s where s."ctsaId" = $1 and s."siteId"=$2 and s."siteName"=$3;`,
values: paramaters
})

const r = db.any(move1)
.then(r => db.any(move2)
.then(r=> db.any(del1))
.then(r=> db.any(del2)
.then(r => res.status(200).send('OK'))))
.catch(error => {
console.log('ERROR:', error)
res.status(500).send('There was an error fetching data.')
})
Promise.all([r])
}


Loading