mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into test-softdeleted
This commit is contained in:
commit
b4d756d941
@ -11,7 +11,7 @@
|
||||
"serve": "vue-cli-service serve --open",
|
||||
"dev": "yarn run serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "eslint --ext .js,.vue .",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.vue .",
|
||||
"test": "TZ=UTC jest --coverage",
|
||||
"locales": "scripts/missing-keys.sh && scripts/sort.sh"
|
||||
},
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"clean": "tsc --build --clean",
|
||||
"start": "node build/src/index.js",
|
||||
"dev": "nodemon -w src --ext ts --exec ts-node src/index.ts",
|
||||
"lint": "eslint . --ext .js,.ts",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.ts .",
|
||||
"test": "TZ=UTC NODE_ENV=development jest --runInBand --coverage --forceExit --detectOpenHandles"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -54,6 +54,7 @@ async function calculateAndAddDecayTransactions(
|
||||
transactionIndiced[transaction.id] = transaction
|
||||
involvedUserIds.push(transaction.userId)
|
||||
if (transaction.transactionTypeId === TransactionTypeId.SEND) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
involvedUserIds.push(transaction.sendReceiverUserId!) // TODO ensure not null properly
|
||||
}
|
||||
})
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
/* FIRST MIGRATION
|
||||
*
|
||||
* This migration is special since it takes into account that
|
||||
@ -12,6 +9,9 @@
|
||||
* databases.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// write upgrade logic as parameter of queryFn
|
||||
await queryFn(`
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
/* MIGRATION TO ADD USER SETTINGS
|
||||
*
|
||||
* This migration adds the table `user_setting` in order to store all sorts of user configuration data
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`
|
||||
CREATE TABLE IF NOT EXISTS \`user_setting\` (
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
/* MIGRATION TO CREATE THE LOGIN_SERVER TABLES
|
||||
*
|
||||
* This migration creates the `login_server` tables in the `community_server` database (`gradido_community`).
|
||||
@ -8,6 +5,9 @@
|
||||
* `0004-login_server_data` which will fill the tables with the existing data
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`
|
||||
CREATE TABLE IF NOT EXISTS \`login_app_access_tokens\` (
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
/* MIGRATION TO COPY LOGIN_SERVER DATA
|
||||
*
|
||||
* This migration copies all existing data from the `login_server` database (`gradido_login`)
|
||||
@ -12,6 +9,9 @@
|
||||
* NOTE: This migration does not delete the data when downgrading!
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
const LOGIN_SERVER_DB = 'gradido_login'
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
@ -62,6 +62,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
`)
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// TODO NO EMPTY FUNCTION
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// EMPTY FUNCTION
|
||||
}
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
* This migration adds the table `login_pending_tasks_admin` to store pending creations
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`
|
||||
CREATE TABLE IF NOT EXISTS \`login_pending_tasks_admin\` (
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
* to also explicitly define it in the table
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Explicitly change the charset and collate to the one used to then change it
|
||||
await queryFn('ALTER TABLE `login_users` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;')
|
||||
|
||||
@ -6,10 +6,13 @@
|
||||
* and dead entries
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn('DELETE FROM `login_pending_tasks`;')
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
return [] // cannot undelete things
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// cannot undelete things
|
||||
}
|
||||
|
||||
@ -6,6 +6,9 @@
|
||||
* login_users.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Fill in missing emails from login_users
|
||||
await queryFn(
|
||||
@ -18,6 +21,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
await queryFn(`DELETE FROM state_users WHERE email = ''`)
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
return [] // cannot undelete things
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// cannot undelete things
|
||||
}
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
* account is set as not yet activated
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Generate a random private key where the required data is present (pubkey + password + passphrase).
|
||||
// Furthermore the email needs to be confirmed
|
||||
@ -23,6 +26,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
)
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
return [] // cannot undelete things
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// cannot undelete things
|
||||
}
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* Copy missing data from login_users to state_users.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Copy data with intact private key
|
||||
await queryFn(
|
||||
@ -40,6 +43,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
)
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
return [] // cannot undelete things
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// cannot undelete things
|
||||
}
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
* delete the right one of the duplicate keys
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Delete data with no reference in login_users table
|
||||
await queryFn(`DELETE FROM login_user_backups WHERE user_id NOT IN (SELECT id FROM login_users)`)
|
||||
@ -13,6 +16,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
await queryFn(`DELETE FROM login_user_backups WHERE id IN (21, 103, 313, 325, 726, 750, 1098)`)
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
return [] // cannot undelete things
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// cannot undelete things
|
||||
}
|
||||
|
||||
@ -4,6 +4,10 @@
|
||||
* we need to detect which word list was used and transform it accordingly.
|
||||
* This also removes the trailing space
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
@ -62,6 +66,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
})
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
return [] // cannot transform things back
|
||||
export async function downgrade(/* queryFn: (query: string, values?: any[]) => Promise<Array<any>> */) {
|
||||
// cannot transform things back
|
||||
}
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
* The migration reduces the amount of tables to 28
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`DROP TABLE \`login_app_access_tokens\`;`)
|
||||
await queryFn(`DROP TABLE \`pending_transactions\`;`)
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
* The migration reduces the amount of tables to 16
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(`DROP TABLE \`address_types\`;`)
|
||||
await queryFn(`DROP TABLE \`admin_errors\`;`)
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
* the new table to properly describe what it does
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// drop duplicate table, it was unused
|
||||
await queryFn('DROP TABLE `login_pending_tasks`;')
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* combines its data with transaction_signatures.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Drop column `state_group_id` since it only contains "0" as value, no variation.
|
||||
// Furthermore it was not present in our model itself (meaning that newly created )
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* the `state_users` table, where the later is the target.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Drop column `group_id` since it contains uniform data which is not the same as the uniform data
|
||||
// on login_users. Since we do not need this data anyway, we sjust throw it away.
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* the `state_users` table, where the later is the target.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// We only keep the passphrase, the mnemonic type is a constant,
|
||||
// since every passphrase was converted to mnemonic type 2
|
||||
|
||||
@ -5,6 +5,9 @@
|
||||
* The table affected is `login_email_opt_in`
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Delete email opt in codes which can not be linked to an user
|
||||
await queryFn(`
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* and removes columns with no meaningful value
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// rename `state_users` table to `users`
|
||||
await queryFn('RENAME TABLE `state_users` TO `users`;')
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* `publisher_id`, `order_id`. `product_id`.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn(
|
||||
'ALTER TABLE `login_elopage_buys` MODIFY COLUMN `affiliate_program_id` int(11) DEFAULT NULL;',
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* we can delete it from the database
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Remove transactions with type 9 (start decay block). This should affect exactly 1 row
|
||||
await queryFn(`DELETE FROM transactions WHERE transaction_type_id = 9;`)
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
* a date as it is standard for soft delete fields
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Create new `deletedAt` column
|
||||
await queryFn(
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
* Combine all transaction tables into one table with all data
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Create new `user_id` column (former `state_user_id`), with a temporary default of null
|
||||
await queryFn(
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
"dev_up": "ts-node src/index.ts up",
|
||||
"dev_down": "ts-node src/index.ts down",
|
||||
"dev_reset": "ts-node src/index.ts reset",
|
||||
"lint": "eslint . --ext .js,.ts",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.ts .",
|
||||
"seed:config": "ts-node ./node_modules/typeorm-seeding/dist/cli.js config",
|
||||
"seed": "ts-node src/index.ts seed"
|
||||
},
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"serve": "vue-cli-service serve --open",
|
||||
"build": "vue-cli-service build",
|
||||
"analyse-bundle": "yarn build && webpack-bundle-analyzer dist/webpack.stats.json",
|
||||
"lint": "eslint --ext .js,.vue .",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.vue .",
|
||||
"dev": "yarn run serve",
|
||||
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'",
|
||||
"test": "jest --coverage",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user