Merge branch 'master' into 1976-Customise-the-mobile-view

This commit is contained in:
Alexander Friedland 2022-06-14 15:59:20 +02:00 committed by GitHub
commit a5cbf35f42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 182 additions and 4 deletions

View File

@ -0,0 +1,3 @@
4ƒk׀ךֻ1°,<EFBFBD>fעbלAלqִ¬cי<EFBFBD>#¾צ¾ר#s8-ְ1&»;נצד"¢פשל7d¥jM?bljfB¼ƒqֱ=
<EFBFBD>ײmyפ¿
vת·´V 

View File

@ -0,0 +1,32 @@
{
"folders": {},
"connections": {
"mariaDB-1813fbbc7bc-107c0b3aeaeb91ab": {
"provider": "mysql",
"driver": "mariaDB",
"name": "gradido",
"save-password": true,
"read-only": false,
"configuration": {
"host": "localhost",
"port": "3306",
"url": "jdbc:mariadb://localhost:3306/",
"home": "mysql_client",
"type": "dev",
"auth-model": "native",
"handlers": {}
}
}
},
"connection-types": {
"dev": {
"name": "Development",
"color": "255,255,255",
"description": "Regular development database",
"auto-commit": true,
"confirm-execute": false,
"confirm-data-change": false,
"auto-close-transactions": false
}
}
}

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
.dbeaver
.project
*.log *.log
*.bak
/node_modules/* /node_modules/*
messages.pot messages.pot
nbproject nbproject

18
.project Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Gradido</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.jkiss.dbeaver.DBeaverNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

View File

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

View File

@ -0,0 +1,88 @@
import Decimal from 'decimal.js-light'
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, DeleteDateColumn } from 'typeorm'
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
@Entity('contribution_links')
export class ContributionLink extends BaseEntity {
@PrimaryGeneratedColumn('increment', { unsigned: true })
id: number
@Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' })
name: string
@Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' })
memo: string
@Column({ name: 'valid_from', type: 'datetime', nullable: false })
validFrom: Date
@Column({ name: 'valid_to', type: 'datetime', nullable: true, default: null })
validTo: Date | null
@Column({
type: 'decimal',
precision: 40,
scale: 20,
nullable: false,
transformer: DecimalTransformer,
})
amount: Decimal
@Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' })
cycle: string
@Column({ name: 'max_per_cycle', unsigned: true, nullable: false, default: 1 })
maxPerCycle: number
@Column({
name: 'max_amount_per_month',
type: 'decimal',
precision: 40,
scale: 20,
nullable: true,
default: null,
transformer: DecimalTransformer,
})
maxAmountPerMonth: Decimal | null
@Column({
name: 'total_max_count_of_contribution',
type: 'int',
unsigned: true,
nullable: true,
default: null,
})
totalMaxCountOfContribution: number | null
@Column({
name: 'max_account_balance',
type: 'decimal',
precision: 40,
scale: 20,
nullable: true,
default: null,
transformer: DecimalTransformer,
})
maxAccountBalance: Decimal | null
@Column({
name: 'min_gap_hours',
type: 'int',
unsigned: true,
nullable: true,
default: null,
})
minGapHours: number | null
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
createdAt: Date
@DeleteDateColumn({ name: 'deleted_at' })
deletedAt: Date | null
@Column({ length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' })
code: string
@Column({ name: 'link_enabled', type: 'boolean', default: true })
linkEnabled: boolean
}

View File

@ -0,0 +1 @@
export { ContributionLink } from './0038-add_contribution_links_table/ContributionLink'

View File

@ -1 +1 @@
export { User } from './0037-drop_server_user_table/User' export { User } from './0037-drop_user_setting_table/User'

View File

@ -1,3 +1,4 @@
import { ContributionLink } from './ContributionLink'
import { LoginElopageBuys } from './LoginElopageBuys' import { LoginElopageBuys } from './LoginElopageBuys'
import { LoginEmailOptIn } from './LoginEmailOptIn' import { LoginEmailOptIn } from './LoginEmailOptIn'
import { Migration } from './Migration' import { Migration } from './Migration'
@ -8,6 +9,7 @@ import { AdminPendingCreation } from './AdminPendingCreation'
export const entities = [ export const entities = [
AdminPendingCreation, AdminPendingCreation,
ContributionLink,
LoginElopageBuys, LoginElopageBuys,
LoginEmailOptIn, LoginEmailOptIn,
Migration, Migration,

View File

@ -0,0 +1,35 @@
/* MIGRATION TO ADD CONTRIBUTION_LINKS
*
* This migration adds the table `contribution_links` in order to store all sorts of contribution_links 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 \`contribution_links\` (
\`id\` int(10) unsigned NOT NULL AUTO_INCREMENT,
\`name\` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
\`memo\` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
\`valid_from\` datetime NOT NULL,
\`valid_to\` datetime NULL,
\`amount\` bigint(20) NOT NULL,
\`cycle\` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ONCE',
\`max_per_cycle\` int(10) unsigned NOT NULL DEFAULT '1',
\`max_amount_per_month\` bigint(20) NULL DEFAULT NULL,
\`total_max_count_of_contribution\` int(10) unsigned NULL DEFAULT NULL,
\`max_account_balance\` bigint(20) NULL DEFAULT NULL,
\`min_gap_hours\` int(10) unsigned NULL DEFAULT NULL,
\`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
\`deleted_at\` datetime NULL DEFAULT NULL,
\`code\` varchar(24) COLLATE utf8mb4_unicode_ci NOT NULL,
\`link_enabled\` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (\`id\`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`)
}
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
// write downgrade logic as parameter of queryFn
await queryFn(`DROP TABLE IF EXISTS \`contribution_links\`;`)
}