Merge branch 'master' into dissolve_admin_resolver

This commit is contained in:
Hannes Heine 2022-12-13 09:01:44 +01:00 committed by GitHub
commit 4be546c68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -10,7 +10,7 @@ Decimal.set({
})
const constants = {
DB_VERSION: '0054-recalculate_balance_and_decay',
DB_VERSION: '0055-consistent_deleted_users',
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
LOG4JS_CONFIG: 'log4js-config.json',
// default log level on production should be info

View File

@ -103,6 +103,9 @@ export const getUserCreation = async (
const getCreationMonths = (timezoneOffset: number): number[] => {
const clientNow = new Date()
clientNow.setTime(clientNow.getTime() - timezoneOffset * 60 * 1000)
logger.info(
`getCreationMonths -- offset: ${timezoneOffset} -- clientNow: ${clientNow.toISOString()}`,
)
return [
new Date(clientNow.getFullYear(), clientNow.getMonth() - 2, 1).getMonth() + 1,
new Date(clientNow.getFullYear(), clientNow.getMonth() - 1, 1).getMonth() + 1,

View File

@ -0,0 +1,16 @@
/* MIGRATION TO soft delete user contacts of soft deleted 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>>) {
await queryFn(`
UPDATE user_contacts LEFT JOIN users ON users.email_id = user_contacts.id
SET user_contacts.deleted_at = users.deleted_at
WHERE user_contacts.deleted_at IS NULL
AND users.deleted_at IS NOT NULL;`)
}
/* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {}