Merge remote-tracking branch 'origin/1920-feature-create-contribution-link-table' into 1921-feature-contribution-link-crud-in-admin-resolver

This commit is contained in:
Claus-Peter Hübner 2022-06-07 23:01:16 +02:00
commit 10c8b51850
11 changed files with 240 additions and 3 deletions

View File

@ -0,0 +1,2 @@
'U<EFBFBD>[V<EFBFBD>$<EFBFBD><EFBFBD>8%<EFBFBD>k<EFBFBD>ِQN<EFBFBD><EFBFBD>,
<EFBFBD>ؤـ`W<EFBFBD>-T3NvU<EFBFBD><EFBFBD>ظ{<EFBFBD>ية<EFBFBD><EFBFBD><EFBFBD>هه<EFBFBD><EFBFBD><EFBFBD>HK­~ح,<EFBFBD><EFBFBD>DXدpX<EFBFBD><EFBFBD>.g/¤<EFBFBD>،:<EFBFBD>ِ?B9|<EFBFBD><EFBFBD>GZn>¤بؤ/

View File

@ -0,0 +1,33 @@
{
"folders": {},
"connections": {
"mariaDB-1813fbbc7bc-107c0b3aeaeb91ab": {
"provider": "mysql",
"driver": "mariaDB",
"name": "gradido",
"save-password": true,
"read-only": false,
"configuration": {
"host": "localhost",
"port": "3306",
"database": "gradido",
"url": "jdbc:mariadb://localhost:3306/gradido",
"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
}
}
}

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
}
}
}

2
.gitignore vendored
View File

@ -1,5 +1,3 @@
.dbeaver
.project
*.log
/node_modules/*
messages.pot

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 = {
DB_VERSION: '0036-unique_previous_in_transactions',
DB_VERSION: '0037-add_contribution_links_table/ContributionLinks',
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

@ -0,0 +1,29 @@
import { registerEnumType } from 'type-graphql'
export enum ContributionCycleType {
NONE = 'none',
ONCE = 'once',
HOUR = 'hour',
TWO_HOURS = 'two_hours',
FOUR_HOURS = 'four_hours',
EIGHT_HOURS = 'eight_hours',
HALF_DAY = 'half_day',
DAY = 'day',
TWO_DAYS = 'two_days',
THREE_DAYS = 'three_days',
FOUR_DAYS = 'four_days',
FIVE_DAYS = 'five_days',
SIX_DAYS = 'six_days',
WEEK = 'week',
TWO_WEEKS = 'two_weeks',
MONTH = 'month',
TWO_MONTH = 'two_month',
QUARTER = 'quarter',
HALF_YEAR = 'half_year',
YEAR = 'year',
}
registerEnumType(ContributionCycleType, {
name: 'ContributionCycleType', // this one is mandatory
description: 'Name of the Type of the ContributionCycle', // this one is optional
})

View File

@ -0,0 +1,86 @@
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 ContributionLinks 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' })
description: string
@Column({ name: 'valid_from', type: 'datetime', nullable: true, default: null })
validFrom: Date | null
@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
@Column({
name: 'total_max_count_of_contribution',
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
@Column({
name: 'min_gap_hours',
unsigned: true,
nullable: true,
default: null,
})
minGapHours: number | null
@Column({ name: 'created_at', type: 'datetime', nullable: true, default: null })
createdAt: Date | null
@DeleteDateColumn()
deletedAt: Date | null
@Column({ length: 24, nullable: true, collation: 'utf8mb4_unicode_ci' })
code: string
@Column({ name: 'link_enabled', type: 'boolean', nullable: true, default: null })
linkEnabled: boolean | null
}

View File

@ -0,0 +1 @@
export { ContributionLinks } from './0037-add_contribution_links_table/ContributionLinks'

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,
\`decsription\` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
\`valid_from\` datetime NULL,
\`valid_to\` datetime NULL,
\`amount\` bigint(20) NOT NULL,
\`cycle\` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NONE',
\`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 NULL DEFAULT NULL,
\`link_enabled\` tinyint(4) NOT NULL DEFAULT '0',
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\`;`)
}