Unverified Commit b9131834 authored by Philipp Berger's avatar Philipp Berger
Browse files

chore: release v1.2.2

parent c01634c0
# Changelog
### 1.2.2 (2021-06-18)
* **health-department:** fix: fix trying to trim a non-string
* **health-department:** chore: upgrade xlsx package
* **backend:** feat: add expireAt functionality to test redeems
### 1.2.1 (2021-06-17)
* **backend:** feat: add v4 signed keys upload
......
{
"name": "e2e",
"version": "1.2.1",
"version": "1.2.2",
"main": "index.js",
"private": true,
"engines": {
......
{
"name": "@lucaapp/web",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......
......@@ -68,7 +68,8 @@ module.exports = {
maxAge: moment.duration(28, 'days').as('hours'),
},
testRedeems: {
maxAge: moment.duration(72, 'hours').as('hours'),
defaultMaxAge: moment.duration(72, 'hours').as('hours'),
maxAge: moment.duration(1, 'years').as('hours'),
},
},
emails: {
......
{
"name": "@lucaapp/backend",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn('TestRedeems', 'expireAt', {
type: Sequelize.DATE,
});
},
down: async queryInterface => {
await queryInterface.removeColumn('TestRedeems', 'expireAt');
},
};
......@@ -9,6 +9,9 @@ module.exports = (Sequelize, DataTypes) => {
type: DataTypes.STRING(24),
allowNull: false,
},
expireAt: {
type: DataTypes.DATE,
},
});
TestRedeem.associate = () => {};
......
/* eslint-disable max-lines */
const { performance } = require('perf_hooks');
const config = require('config');
const router = require('express').Router();
......@@ -246,12 +247,22 @@ router.post('/addDummyTraces', async (request, response) => {
router.post('/deleteOldTestRedeems', async (request, response) => {
const t0 = performance.now();
const maxAge = config.get('luca.testRedeems.maxAge');
const defaultMaxAge = config.get('luca.testRedeems.defaultMaxAge');
const affectedRows = await database.TestRedeem.destroy({
where: {
createdAt: {
[Op.lt]: moment().subtract(maxAge, 'hours'),
},
[Op.or]: [
{
expireAt: {
[Op.lt]: moment(),
},
},
{
expireAt: null,
createdAt: {
[Op.lt]: moment().subtract(defaultMaxAge, 'hours'),
},
},
],
},
});
response.send({ affectedRows, time: performance.now() - t0 });
......
const router = require('express').Router();
const status = require('http-status');
const moment = require('moment');
const config = require('config');
const database = require('../../database');
const { validateSchema } = require('../../middlewares/validateSchema');
......@@ -7,10 +9,19 @@ const { limitRequestsPerMinute } = require('../../middlewares/rateLimit');
const { redeemSchema } = require('./tests.schemas');
const REDEEM_MAX_EXPIRY = moment.duration(
config.get('luca.testRedeems.maxAge'),
'hours'
);
const REDEEM_DEFAULT_EXPIRY = moment.duration(
config.get('luca.testRedeems.defaultMaxAge'),
'hours'
);
// Redeem a test
router.post(
'/redeem',
limitRequestsPerMinute(10),
limitRequestsPerMinute(50),
validateSchema(redeemSchema),
async (request, response) => {
const testRedeem = await database.TestRedeem.findByPk(request.body.hash);
......@@ -19,6 +30,12 @@ router.post(
await database.TestRedeem.create({
hash: request.body.hash,
tag: request.body.tag,
expireAt: request.body.expireAt
? Math.min(
moment.unix(request.body.expireAt),
moment().add(REDEEM_MAX_EXPIRY)
)
: moment().add(REDEEM_DEFAULT_EXPIRY),
});
return response.sendStatus(status.NO_CONTENT);
}
......
......@@ -17,4 +17,9 @@ paths:
hash:
type: string
tag:
type: string
\ No newline at end of file
type: string
expireAt:
type: number
required:
- hash
- tag
......@@ -3,6 +3,7 @@ const { z } = require('../../middlewares/validateSchema');
const redeemSchema = z.object({
hash: z.string().length(44),
tag: z.string().length(24),
expireAt: z.number().int().positive().optional(),
});
module.exports = {
......
{
"name": "@lucaapp/contact-form",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......
{
"name": "@lucaapp/health-department",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......@@ -52,7 +52,7 @@
"styled-components": "5.2.1",
"ua-parser-js": "0.7.24",
"uuid": "^8.3.2",
"xlsx": "0.16.9"
"xlsx": "0.17.0"
},
"devDependencies": {
"@babel/preset-env": "7.14.2",
......
......@@ -38,20 +38,20 @@ export const formatTraceForSormas = (trace, locationUserProvided, intl) => {
additionalData,
intl
)}`.trim(),
'person.firstName': userData?.fn?.trim() ?? '',
'person.firstName': String(userData?.fn).trim() ?? '',
'person.lastName': userData
? userData.ln?.trim()
? String(userData?.ln).trim()
: intl.formatMessage({
id: 'contactPersonTable.unregistredBadgeUser',
}),
'person.sex': 'UNKNOWN',
'person.phone': userData?.pn?.trim() ?? '',
'person.address.city': userData?.c?.trim() ?? '',
'person.address.postalCode': userData?.pc?.trim() ?? '',
'person.address.street': userData?.st?.trim() ?? '',
'person.address.houseNumber': userData?.hn?.trim() ?? '',
'person.phone': String(userData?.pn).trim() ?? '',
'person.address.city': String(userData?.c).trim() ?? '',
'person.address.postalCode': String(userData?.pc).trim() ?? '',
'person.address.street': String(userData?.st).trim() ?? '',
'person.address.houseNumber': String(userData?.hn).trim() ?? '',
'person.address.addressType': 'HOME',
'person.emailAddress': userData?.e?.trim() ?? '',
'person.emailAddress': String(userData?.e).trim() ?? '',
};
};
......
This diff is collapsed.
{
"name": "@lucaapp/locations",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......
{
"name": "@lucaapp/scanner",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......
{
"name": "@lucaapp/webapp",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"license": "Apache-2.0",
"author": "Culture4Life <hello@luca-app.de> (https://www.luca-app.de/)",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment