mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' of github.com:gradido/gradido into 1880-no-throw-when-register-with-existing-email
This commit is contained in:
commit
a3af34bd18
3
.dbeaver/credentials-config.json
Normal file
3
.dbeaver/credentials-config.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
4ƒk׀ךֻ1°,•<EFBFBD>fעbלAלqִ¬cי<EFBFBD>#¾›צ¾ר#s’8-ְ1‰&»;נצד"¢פשל7€d¥jM?‘bljfB¼ƒqֱ=
|
||||||
|
<EFBFBD>ײmyפ¿
|
||||||
|
vת·´V
|
||||||
32
.dbeaver/data-sources.json
Normal file
32
.dbeaver/data-sources.json
Normal 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
3
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
.dbeaver
|
|
||||||
.project
|
|
||||||
*.log
|
*.log
|
||||||
|
*.bak
|
||||||
/node_modules/*
|
/node_modules/*
|
||||||
messages.pot
|
messages.pot
|
||||||
nbproject
|
nbproject
|
||||||
|
|||||||
18
.project
Normal file
18
.project
Normal 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>
|
||||||
@ -10,7 +10,7 @@ Decimal.set({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const constants = {
|
const constants = {
|
||||||
DB_VERSION: '0036-unique_previous_in_transactions',
|
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
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
import { EntityRepository, Repository } from '@dbTools/typeorm'
|
|
||||||
import { UserSetting } from '@entity/UserSetting'
|
|
||||||
import { isStringBoolean } from '@/util/validate'
|
|
||||||
|
|
||||||
@EntityRepository(UserSetting)
|
|
||||||
export class UserSettingRepository extends Repository<UserSetting> {
|
|
||||||
async setOrUpdate(userId: number, value: string): Promise<UserSetting> {
|
|
||||||
let entity = await this.findOne({ userId: userId })
|
|
||||||
|
|
||||||
if (!entity) {
|
|
||||||
entity = new UserSetting()
|
|
||||||
entity.userId = userId
|
|
||||||
}
|
|
||||||
entity.value = value
|
|
||||||
return this.save(entity)
|
|
||||||
}
|
|
||||||
|
|
||||||
async readBoolean(userId: number): Promise<boolean> {
|
|
||||||
const entity = await this.findOne({ userId: userId })
|
|
||||||
if (!entity || !isStringBoolean(entity.value)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return entity.value.toLowerCase() === 'true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -20,7 +20,6 @@ const communityDbUser: dbUser = {
|
|||||||
isAdmin: null,
|
isAdmin: null,
|
||||||
publisherId: 0,
|
publisherId: 0,
|
||||||
passphrase: '',
|
passphrase: '',
|
||||||
settings: [],
|
|
||||||
hasId: function (): boolean {
|
hasId: function (): boolean {
|
||||||
throw new Error('Function not implemented.')
|
throw new Error('Function not implemented.')
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,32 +1,39 @@
|
|||||||
# database
|
# database
|
||||||
|
|
||||||
## Project setup
|
## Project setup
|
||||||
```
|
|
||||||
|
```bash
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Upgrade migrations production
|
## Upgrade migrations production
|
||||||
```
|
|
||||||
|
```bash
|
||||||
yarn up
|
yarn up
|
||||||
```
|
```
|
||||||
|
|
||||||
## Upgrade migrations development
|
## Upgrade migrations development
|
||||||
```
|
|
||||||
|
```bash
|
||||||
yarn dev_up
|
yarn dev_up
|
||||||
```
|
```
|
||||||
|
|
||||||
## Downgrade migrations production
|
## Downgrade migrations production
|
||||||
```
|
|
||||||
|
```bash
|
||||||
yarn down
|
yarn down
|
||||||
```
|
```
|
||||||
|
|
||||||
## Downgrade migrations development
|
## Downgrade migrations development
|
||||||
```
|
|
||||||
|
```bash
|
||||||
yarn dev_down
|
yarn dev_down
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reset database
|
## Reset database
|
||||||
```
|
|
||||||
|
```bash
|
||||||
yarn dev_reset
|
yarn dev_reset
|
||||||
```
|
```
|
||||||
|
|
||||||
Runs all down migrations and after this all up migrations.
|
Runs all down migrations and after this all up migrations.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
// Moriz: I do not like the idea of having two user tables
|
// Moriz: I do not like the idea of having two user tables
|
||||||
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'
|
||||||
import { User } from '../User'
|
import { User } from '../0034-drop_server_user_table/User'
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class UserSetting extends BaseEntity {
|
export class UserSetting extends BaseEntity {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
OneToMany,
|
OneToMany,
|
||||||
DeleteDateColumn,
|
DeleteDateColumn,
|
||||||
} from 'typeorm'
|
} from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
OneToMany,
|
OneToMany,
|
||||||
DeleteDateColumn,
|
DeleteDateColumn,
|
||||||
} from 'typeorm'
|
} from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
OneToMany,
|
OneToMany,
|
||||||
DeleteDateColumn,
|
DeleteDateColumn,
|
||||||
} from 'typeorm'
|
} from 'typeorm'
|
||||||
import { UserSetting } from '../UserSetting'
|
import { UserSetting } from '../0002-add_settings/UserSetting'
|
||||||
|
|
||||||
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
export class User extends BaseEntity {
|
export class User extends BaseEntity {
|
||||||
|
|||||||
70
database/entity/0037-drop_user_setting_table/User.ts
Normal file
70
database/entity/0037-drop_user_setting_table/User.ts
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, DeleteDateColumn } from 'typeorm'
|
||||||
|
|
||||||
|
@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' })
|
||||||
|
export class User extends BaseEntity {
|
||||||
|
@PrimaryGeneratedColumn('increment', { unsigned: true })
|
||||||
|
id: number
|
||||||
|
|
||||||
|
@Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true })
|
||||||
|
pubKey: Buffer
|
||||||
|
|
||||||
|
@Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true })
|
||||||
|
privKey: Buffer
|
||||||
|
|
||||||
|
@Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' })
|
||||||
|
email: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
name: 'first_name',
|
||||||
|
length: 255,
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
collation: 'utf8mb4_unicode_ci',
|
||||||
|
})
|
||||||
|
firstName: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
name: 'last_name',
|
||||||
|
length: 255,
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
collation: 'utf8mb4_unicode_ci',
|
||||||
|
})
|
||||||
|
lastName: string
|
||||||
|
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deletedAt: Date | null
|
||||||
|
|
||||||
|
@Column({ type: 'bigint', default: 0, unsigned: true })
|
||||||
|
password: BigInt
|
||||||
|
|
||||||
|
@Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true })
|
||||||
|
emailHash: Buffer
|
||||||
|
|
||||||
|
@Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false })
|
||||||
|
createdAt: Date
|
||||||
|
|
||||||
|
@Column({ name: 'email_checked', type: 'bool', nullable: false, default: false })
|
||||||
|
emailChecked: boolean
|
||||||
|
|
||||||
|
@Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false })
|
||||||
|
language: string
|
||||||
|
|
||||||
|
@Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null })
|
||||||
|
isAdmin: Date | null
|
||||||
|
|
||||||
|
@Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null })
|
||||||
|
referrerId?: number | null
|
||||||
|
|
||||||
|
@Column({ name: 'publisher_id', default: 0 })
|
||||||
|
publisherId: number
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'text',
|
||||||
|
name: 'passphrase',
|
||||||
|
collation: 'utf8mb4_unicode_ci',
|
||||||
|
nullable: true,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
passphrase: string
|
||||||
|
}
|
||||||
@ -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
|
||||||
|
}
|
||||||
1
database/entity/ContributionLink.ts
Normal file
1
database/entity/ContributionLink.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { ContributionLink } from './0038-add_contribution_links_table/ContributionLink'
|
||||||
@ -1 +1 @@
|
|||||||
export { User } from './0034-drop_server_user_table/User'
|
export { User } from './0037-drop_user_setting_table/User'
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
export { UserSetting } from './0002-add_settings/UserSetting'
|
|
||||||
@ -1,19 +1,19 @@
|
|||||||
|
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'
|
||||||
import { Transaction } from './Transaction'
|
import { Transaction } from './Transaction'
|
||||||
import { TransactionLink } from './TransactionLink'
|
import { TransactionLink } from './TransactionLink'
|
||||||
import { User } from './User'
|
import { User } from './User'
|
||||||
import { UserSetting } from './UserSetting'
|
|
||||||
import { AdminPendingCreation } from './AdminPendingCreation'
|
import { AdminPendingCreation } from './AdminPendingCreation'
|
||||||
|
|
||||||
export const entities = [
|
export const entities = [
|
||||||
AdminPendingCreation,
|
AdminPendingCreation,
|
||||||
|
ContributionLink,
|
||||||
LoginElopageBuys,
|
LoginElopageBuys,
|
||||||
LoginEmailOptIn,
|
LoginEmailOptIn,
|
||||||
Migration,
|
Migration,
|
||||||
Transaction,
|
Transaction,
|
||||||
TransactionLink,
|
TransactionLink,
|
||||||
User,
|
User,
|
||||||
UserSetting,
|
|
||||||
]
|
]
|
||||||
|
|||||||
19
database/migrations/0037-drop_user_setting_table.ts
Normal file
19
database/migrations/0037-drop_user_setting_table.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* MIGRATION DROP user_setting 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>>) {
|
||||||
|
await queryFn('DROP TABLE `user_setting`;')
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||||
|
await queryFn(`
|
||||||
|
CREATE TABLE IF NOT EXISTS \`user_setting\` (
|
||||||
|
\`id\` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
\`userId\` int(11) NOT NULL,
|
||||||
|
\`key\` varchar(255) NOT NULL,
|
||||||
|
\`value\` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (\`id\`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`)
|
||||||
|
}
|
||||||
35
database/migrations/0038-add_contribution_links_table.ts
Normal file
35
database/migrations/0038-add_contribution_links_table.ts
Normal 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\`;`)
|
||||||
|
}
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<b-collapse id="nav-collapse" is-nav class="mt-5 mt-lg-0">
|
<b-collapse id="nav-collapse" is-nav class="mt-5 mt-lg-0">
|
||||||
<b-navbar-nav class="ml-auto" right>
|
<b-navbar-nav class="ml-auto" right>
|
||||||
<b-nav-item href="https://gradido.net/de/" target="_blank">
|
<b-nav-item :href="`https://gradido.net/${$i18n.locale}`" target="_blank">
|
||||||
{{ $t('auth.navbar.aboutGradido') }}
|
{{ $t('auth.navbar.aboutGradido') }}
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
<b-nav-item to="/register" class="authNavbar ml-lg-5">{{ $t('signup') }}</b-nav-item>
|
<b-nav-item to="/register" class="authNavbar ml-lg-5">{{ $t('signup') }}</b-nav-item>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user