mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
merge master
This commit is contained in:
commit
56411e897a
@ -14,7 +14,7 @@
|
||||
"analyse-bundle": "yarn build && webpack-bundle-analyzer dist/webpack.stats.json",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
||||
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
||||
"test": "TZ=UTC jest --coverage",
|
||||
"test": "cross-env TZ=UTC jest --coverage",
|
||||
"locales": "scripts/sort.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -57,6 +57,7 @@
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-plugin-transform-require-context": "^0.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "7.25.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-config-standard": "^16.0.3",
|
||||
|
||||
@ -49,6 +49,8 @@
|
||||
|
||||
<template #row-details="row">
|
||||
<b-card ref="rowDetails" class="shadow-lg pl-3 pr-3 mb-5 bg-white rounded">
|
||||
<b-tabs content-class="mt-3">
|
||||
<b-tab :title="$t('creation')" active :disabled="row.item.deletedAt !== null">
|
||||
<creation-formular
|
||||
v-if="!row.item.deletedAt"
|
||||
type="singleCreation"
|
||||
@ -58,7 +60,8 @@
|
||||
:creationUserData="creationUserData"
|
||||
@update-user-data="updateUserData"
|
||||
/>
|
||||
<div v-else>{{ $t('userIsDeleted') }}</div>
|
||||
</b-tab>
|
||||
<b-tab :title="$t('e_mail')" :disabled="row.item.deletedAt !== null">
|
||||
<confirm-register-mail-formular
|
||||
v-if="!row.item.deletedAt"
|
||||
:checked="row.item.emailChecked"
|
||||
@ -69,10 +72,17 @@
|
||||
: ''
|
||||
"
|
||||
/>
|
||||
</b-tab>
|
||||
<b-tab :title="$t('creationList')" :disabled="row.item.deletedAt !== null">
|
||||
<creation-transaction-list v-if="!row.item.deletedAt" :userId="row.item.userId" />
|
||||
<transaction-link-list :userId="row.item.userId" />
|
||||
|
||||
</b-tab>
|
||||
<b-tab :title="$t('transactionlink.name')" :disabled="row.item.deletedAt !== null">
|
||||
<transaction-link-list v-if="!row.item.deletedAt" :userId="row.item.userId" />
|
||||
</b-tab>
|
||||
<b-tab :title="$t('delete_user')">
|
||||
<deleted-user-formular :item="row.item" @updateDeletedAt="updateDeletedAt" />
|
||||
</b-tab>
|
||||
</b-tabs>
|
||||
</b-card>
|
||||
</template>
|
||||
</b-table>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="transaction-link-list">
|
||||
<div v-if="items.length > 0">
|
||||
<div class="h3">{{ $t('transactionlink.form_header') }}</div>
|
||||
<div class="h3">{{ $t('transactionlink.name') }}</div>
|
||||
<b-table striped hover :fields="fields" :items="items"></b-table>
|
||||
</div>
|
||||
<b-pagination
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
"all_emails": "Alle Nutzer",
|
||||
"back": "zurück",
|
||||
"creation": "Schöpfung",
|
||||
"creationList": "Schöpfungsliste",
|
||||
"creation_form": {
|
||||
"creation_failed": "Ausstehende Schöpfung für {email} konnte nicht erzeugt werden.",
|
||||
"creation_for": "Aktives Grundeinkommen für",
|
||||
@ -78,7 +79,7 @@
|
||||
"text": "Text",
|
||||
"transactionlink": {
|
||||
"created": "Erstellt",
|
||||
"form_header": "Transaktion-Links",
|
||||
"name": "Transaktion-Links",
|
||||
"valid_until": "Gültig bis"
|
||||
},
|
||||
"transactionlist": {
|
||||
@ -100,7 +101,6 @@
|
||||
"text_false": " Die letzte Email wurde am {date} Uhr an das Mitglied ({email}) gesendet.",
|
||||
"text_true": " Die Email wurde bestätigt."
|
||||
},
|
||||
"userIsDeleted": "Der Nutzer ist gelöscht. Es können keine GDD mehr geschöpft werden.",
|
||||
"user_deleted": "Nutzer ist gelöscht.",
|
||||
"user_recovered": "Nutzer ist wiederhergestellt.",
|
||||
"user_search": "Nutzer-Suche"
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
"all_emails": "All users",
|
||||
"back": "back",
|
||||
"creation": "Creation",
|
||||
"creationList": "Creation list",
|
||||
"creation_form": {
|
||||
"creation_failed": "Could not create pending creation for {email}",
|
||||
"creation_for": "Active Basic Income for",
|
||||
@ -78,7 +79,7 @@
|
||||
"text": "Text",
|
||||
"transactionlink": {
|
||||
"created": "Created",
|
||||
"form_header": "Transaction links",
|
||||
"name": "Transaction links",
|
||||
"valid_until": "Valid until"
|
||||
},
|
||||
"transactionlist": {
|
||||
@ -100,7 +101,6 @@
|
||||
"text_false": "The last email was sent to the member ({email}) on {date}.",
|
||||
"text_true": "The email was confirmed."
|
||||
},
|
||||
"userIsDeleted": "The user is deleted. No more GDD can be created.",
|
||||
"user_deleted": "User is deleted.",
|
||||
"user_recovered": "User is recovered.",
|
||||
"user_search": "User search"
|
||||
|
||||
@ -4688,6 +4688,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
|
||||
safe-buffer "^5.0.1"
|
||||
sha.js "^2.4.8"
|
||||
|
||||
cross-env@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
|
||||
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.1"
|
||||
|
||||
cross-spawn@^5.0.1:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
|
||||
@ -4708,7 +4715,7 @@ cross-spawn@^6.0.0:
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^7.0.0, cross-spawn@^7.0.2:
|
||||
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
CONFIG_VERSION=v4.2022-04-05
|
||||
CONFIG_VERSION=v6.2022-04-21
|
||||
|
||||
# Server
|
||||
PORT=4000
|
||||
@ -27,6 +27,7 @@ KLICKTIPP_APIKEY_EN=SomeFakeKeyEN
|
||||
COMMUNITY_NAME=Gradido Entwicklung
|
||||
COMMUNITY_URL=http://localhost/
|
||||
COMMUNITY_REGISTER_URL=http://localhost/register
|
||||
COMMUNITY_REDEEM_URL=http://localhost/redeem/{code}
|
||||
COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido.
|
||||
|
||||
# Login Server
|
||||
@ -43,6 +44,7 @@ EMAIL_SMTP_PORT=587
|
||||
EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/{optin}{code}
|
||||
EMAIL_LINK_SETPASSWORD=http://localhost/reset-password/{optin}
|
||||
EMAIL_LINK_FORGOTPASSWORD=http://localhost/forgot-password
|
||||
EMAIL_LINK_OVERVIEW=http://localhost/overview
|
||||
EMAIL_CODE_VALID_TIME=1440
|
||||
EMAIL_CODE_REQUEST_TIME=10
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ KLICKTIPP_APIKEY_EN=$KLICKTIPP_APIKEY_EN
|
||||
COMMUNITY_NAME=$COMMUNITY_NAME
|
||||
COMMUNITY_URL=$COMMUNITY_URL
|
||||
COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL
|
||||
COMMUNITY_REDEEM_URL=$COMMUNITY_REDEEM_URL
|
||||
COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION
|
||||
|
||||
# Login Server
|
||||
@ -41,6 +42,7 @@ EMAIL_SMTP_URL=$EMAIL_SMTP_URL
|
||||
EMAIL_SMTP_PORT=587
|
||||
EMAIL_LINK_VERIFICATION=$EMAIL_LINK_VERIFICATION
|
||||
EMAIL_LINK_SETPASSWORD=$EMAIL_LINK_SETPASSWORD
|
||||
EMAIL_LINK_OVERVIEW=$EMAIL_LINK_OVERVIEW
|
||||
EMAIL_CODE_VALID_TIME=$EMAIL_CODE_VALID_TIME
|
||||
EMAIL_CODE_REQUEST_TIME=$EMAIL_CODE_REQUEST_TIME
|
||||
|
||||
|
||||
24
backend/README.md
Normal file
24
backend/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# backend
|
||||
|
||||
## Project setup
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
## Seed DB
|
||||
```
|
||||
yarn seed
|
||||
```
|
||||
Deletes all data in database. Then seeds data in database.
|
||||
|
||||
|
||||
## Seeded Users
|
||||
|
||||
| email | password | admin | email checked | deleted |
|
||||
|------------------------|------------|---------|---------------|---------|
|
||||
| peter@lustig.de | `Aa12345_` | `true` | `true` | `false` |
|
||||
| bibi@bloxberg.de | `Aa12345_` | `false` | `true` | `false` |
|
||||
| raeuber@hotzenplotz.de | `Aa12345_` | `false` | `true` | `false` |
|
||||
| bob@baumeister.de | `Aa12345_` | `false` | `true` | `false` |
|
||||
| garrick@ollivander.com | | `false` | `false` | `false` |
|
||||
| stephen@hawking.uk | `Aa12345_` | `false` | `true` | `true` |
|
||||
@ -10,11 +10,11 @@
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"clean": "tsc --build --clean",
|
||||
"start": "TZ=UTC TS_NODE_BASEURL=./build node -r tsconfig-paths/register build/src/index.js",
|
||||
"dev": "TZ=UTC nodemon -w src --ext ts --exec ts-node -r tsconfig-paths/register src/index.ts",
|
||||
"start": "cross-env TZ=UTC TS_NODE_BASEURL=./build node -r tsconfig-paths/register build/src/index.js",
|
||||
"dev": "cross-env TZ=UTC nodemon -w src --ext ts --exec ts-node -r tsconfig-paths/register src/index.ts",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.ts .",
|
||||
"test": "TZ=UTC NODE_ENV=development jest --runInBand --coverage --forceExit --detectOpenHandles",
|
||||
"seed": "TZ=UTC ts-node -r tsconfig-paths/register src/seeds/index.ts"
|
||||
"test": "cross-env TZ=UTC NODE_ENV=development jest --runInBand --coverage --forceExit --detectOpenHandles",
|
||||
"seed": "cross-env TZ=UTC ts-node -r tsconfig-paths/register src/seeds/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
@ -25,6 +25,7 @@
|
||||
"axios": "^0.21.1",
|
||||
"class-validator": "^0.13.1",
|
||||
"cors": "^2.8.5",
|
||||
"cross-env": "^7.0.3",
|
||||
"decimal.js-light": "^2.5.1",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
|
||||
@ -14,7 +14,7 @@ const constants = {
|
||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0
|
||||
CONFIG_VERSION: {
|
||||
DEFAULT: 'DEFAULT',
|
||||
EXPECTED: 'v4.2022-04-05',
|
||||
EXPECTED: 'v6.2022-04-21',
|
||||
CURRENT: '',
|
||||
},
|
||||
}
|
||||
@ -50,6 +50,7 @@ const community = {
|
||||
COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung',
|
||||
COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/',
|
||||
COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register',
|
||||
COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/{code}',
|
||||
COMMUNITY_DESCRIPTION:
|
||||
process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||
}
|
||||
@ -72,6 +73,7 @@ const email = {
|
||||
process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset-password/{optin}',
|
||||
EMAIL_LINK_FORGOTPASSWORD:
|
||||
process.env.EMAIL_LINK_FORGOTPASSWORD || 'http://localhost/forgot-password',
|
||||
EMAIL_LINK_OVERVIEW: process.env.EMAIL_LINK_OVERVIEW || 'http://localhost/overview',
|
||||
// time in minutes a optin code is valid
|
||||
EMAIL_CODE_VALID_TIME: process.env.EMAIL_CODE_VALID_TIME
|
||||
? parseInt(process.env.EMAIL_CODE_VALID_TIME) || 1440
|
||||
|
||||
@ -1,40 +1,24 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
@ObjectType()
|
||||
export class Balance {
|
||||
constructor(data: {
|
||||
balance: Decimal
|
||||
decay: Decimal
|
||||
lastBookedBalance: Decimal
|
||||
balanceGDT: number | null
|
||||
count: number
|
||||
linkCount: number
|
||||
decayStartBlock?: Date
|
||||
lastBookedDate?: Date | null
|
||||
}) {
|
||||
this.balance = data.balance
|
||||
this.decay = data.decay
|
||||
this.lastBookedBalance = data.lastBookedBalance
|
||||
this.balanceGDT = data.balanceGDT || null
|
||||
this.count = data.count
|
||||
this.linkCount = data.linkCount
|
||||
this.decayStartBlock = data.decayStartBlock || CONFIG.DECAY_START_TIME
|
||||
this.lastBookedDate = data.lastBookedDate || null
|
||||
}
|
||||
|
||||
// the actual balance, decay included
|
||||
@Field(() => Decimal)
|
||||
balance: Decimal
|
||||
|
||||
// the decay since the last booked balance
|
||||
@Field(() => Decimal)
|
||||
decay: Decimal
|
||||
|
||||
@Field(() => Decimal)
|
||||
lastBookedBalance: Decimal
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
balanceGDT: number | null
|
||||
|
||||
@ -45,11 +29,4 @@ export class Balance {
|
||||
// the count of transaction links
|
||||
@Field(() => Number)
|
||||
linkCount: number
|
||||
|
||||
@Field(() => Date)
|
||||
decayStartBlock: Date
|
||||
|
||||
// may be null as there may be no transaction
|
||||
@Field(() => Date, { nullable: true })
|
||||
lastBookedDate: Date | null
|
||||
}
|
||||
|
||||
@ -1,17 +1,21 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
interface DecayInterface {
|
||||
balance: Decimal
|
||||
decay: Decimal
|
||||
roundedDecay: Decimal
|
||||
start: Date | null
|
||||
end: Date | null
|
||||
duration: number | null
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
export class Decay {
|
||||
constructor(
|
||||
balance: Decimal,
|
||||
decay: Decimal,
|
||||
start: Date | null,
|
||||
end: Date | null,
|
||||
duration: number | null,
|
||||
) {
|
||||
constructor({ balance, decay, roundedDecay, start, end, duration }: DecayInterface) {
|
||||
this.balance = balance
|
||||
this.decay = decay
|
||||
this.roundedDecay = roundedDecay
|
||||
this.start = start
|
||||
this.end = end
|
||||
this.duration = duration
|
||||
@ -23,6 +27,9 @@ export class Decay {
|
||||
@Field(() => Decimal)
|
||||
decay: Decimal
|
||||
|
||||
@Field(() => Decimal)
|
||||
roundedDecay: Decimal
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
start: Date | null
|
||||
|
||||
|
||||
@ -17,21 +17,26 @@ export class Transaction {
|
||||
this.balanceDate = transaction.balanceDate
|
||||
if (!transaction.decayStart) {
|
||||
// TODO: hot fix, we should separate decay calculation from decay graphql model
|
||||
this.decay = new Decay(
|
||||
transaction.balance.toDecimalPlaces(2, Decimal.ROUND_DOWN),
|
||||
new Decimal(0),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
)
|
||||
this.decay = new Decay({
|
||||
balance: transaction.balance.toDecimalPlaces(2, Decimal.ROUND_DOWN),
|
||||
decay: new Decimal(0),
|
||||
roundedDecay: new Decimal(0),
|
||||
start: null,
|
||||
end: null,
|
||||
duration: null,
|
||||
})
|
||||
} else {
|
||||
this.decay = new Decay(
|
||||
transaction.balance.toDecimalPlaces(2, Decimal.ROUND_DOWN),
|
||||
transaction.decay.toDecimalPlaces(2, Decimal.ROUND_FLOOR),
|
||||
transaction.decayStart,
|
||||
transaction.balanceDate,
|
||||
Math.round((transaction.balanceDate.getTime() - transaction.decayStart.getTime()) / 1000),
|
||||
)
|
||||
this.decay = new Decay({
|
||||
balance: transaction.balance.toDecimalPlaces(2, Decimal.ROUND_DOWN),
|
||||
decay: transaction.decay.toDecimalPlaces(2, Decimal.ROUND_FLOOR),
|
||||
// TODO: add correct value when decay must be rounded in transaction context
|
||||
roundedDecay: new Decimal(0),
|
||||
start: transaction.decayStart,
|
||||
end: transaction.balanceDate,
|
||||
duration: Math.round(
|
||||
(transaction.balanceDate.getTime() - transaction.decayStart.getTime()) / 1000,
|
||||
),
|
||||
})
|
||||
}
|
||||
this.memo = transaction.memo
|
||||
this.creationDate = transaction.creationDate
|
||||
|
||||
@ -2,6 +2,7 @@ import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
import { User } from './User'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
@ObjectType()
|
||||
export class TransactionLink {
|
||||
@ -17,6 +18,7 @@ export class TransactionLink {
|
||||
this.deletedAt = transactionLink.deletedAt
|
||||
this.redeemedAt = transactionLink.redeemedAt
|
||||
this.redeemedBy = redeemedBy
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code)
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@ -51,6 +53,9 @@ export class TransactionLink {
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
redeemedBy: User | null
|
||||
|
||||
@Field(() => String)
|
||||
link: string
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx, Int } from 'type-graphql'
|
||||
import {
|
||||
getCustomRepository,
|
||||
@ -137,7 +135,7 @@ export class AdminResolver {
|
||||
@Mutation(() => Date, { nullable: true })
|
||||
async deleteUser(
|
||||
@Arg('userId', () => Int) userId: number,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<Date | null> {
|
||||
const user = await dbUser.findOne({ id: userId })
|
||||
// user exists ?
|
||||
@ -145,7 +143,7 @@ export class AdminResolver {
|
||||
throw new Error(`Could not find user with userId: ${userId}`)
|
||||
}
|
||||
// moderator user disabled own account?
|
||||
const moderatorUser = context.user
|
||||
const moderatorUser = getUser(context)
|
||||
if (moderatorUser.id === userId) {
|
||||
throw new Error('Moderator can not delete his own account!')
|
||||
}
|
||||
@ -309,10 +307,10 @@ export class AdminResolver {
|
||||
@Mutation(() => Boolean)
|
||||
async confirmPendingCreation(
|
||||
@Arg('id', () => Int) id: number,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
const pendingCreation = await AdminPendingCreation.findOneOrFail(id)
|
||||
const moderatorUser = context.user
|
||||
const moderatorUser = getUser(context)
|
||||
if (moderatorUser.id === pendingCreation.userId)
|
||||
throw new Error('Moderator can not confirm own pending creation')
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Query, Ctx, Authorized } from 'type-graphql'
|
||||
import { Balance } from '@model/Balance'
|
||||
import { calculateDecay } from '@/util/decay'
|
||||
@ -16,8 +14,8 @@ import { TransactionLinkRepository } from '@repository/TransactionLink'
|
||||
export class BalanceResolver {
|
||||
@Authorized([RIGHTS.BALANCE])
|
||||
@Query(() => Balance)
|
||||
async balance(@Ctx() context: any): Promise<Balance> {
|
||||
const { user } = context
|
||||
async balance(@Ctx() context: Context): Promise<Balance> {
|
||||
const user = getUser(context)
|
||||
const now = new Date()
|
||||
|
||||
const gdtResolver = new GdtResolver()
|
||||
@ -31,8 +29,6 @@ export class BalanceResolver {
|
||||
if (!lastTransaction) {
|
||||
return new Balance({
|
||||
balance: new Decimal(0),
|
||||
decay: new Decimal(0),
|
||||
lastBookedBalance: new Decimal(0),
|
||||
balanceGDT,
|
||||
count: 0,
|
||||
linkCount: 0,
|
||||
@ -71,12 +67,9 @@ export class BalanceResolver {
|
||||
balance: calculatedDecay.balance
|
||||
.minus(sumHoldAvailableAmount.toString())
|
||||
.toDecimalPlaces(2, Decimal.ROUND_DOWN), // round towards zero
|
||||
decay: calculatedDecay.decay.toDecimalPlaces(2, Decimal.ROUND_FLOOR), // round towards - infinity
|
||||
lastBookedBalance: lastTransaction.balance.toDecimalPlaces(2, Decimal.ROUND_DOWN),
|
||||
balanceGDT,
|
||||
count,
|
||||
linkCount,
|
||||
lastBookedDate: lastTransaction.balanceDate,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Resolver, Query, Authorized } from 'type-graphql'
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Query, Args, Ctx, Authorized, Arg } from 'type-graphql'
|
||||
import CONFIG from '@/config'
|
||||
import { GdtEntryList } from '@model/GdtEntryList'
|
||||
@ -16,9 +14,9 @@ export class GdtResolver {
|
||||
async listGDTEntries(
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<GdtEntryList> {
|
||||
const userEntity = context.user
|
||||
const userEntity = getUser(context)
|
||||
|
||||
try {
|
||||
const resultGDT = await apiGet(
|
||||
@ -28,15 +26,15 @@ export class GdtResolver {
|
||||
throw new Error(resultGDT.data)
|
||||
}
|
||||
return new GdtEntryList(resultGDT.data)
|
||||
} catch (err: any) {
|
||||
} catch (err) {
|
||||
throw new Error('GDT Server is not reachable.')
|
||||
}
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.GDT_BALANCE])
|
||||
@Query(() => Number)
|
||||
async gdtBalance(@Ctx() context: any): Promise<number | null> {
|
||||
const { user } = context
|
||||
async gdtBalance(@Ctx() context: Context): Promise<number | null> {
|
||||
const user = getUser(context)
|
||||
try {
|
||||
const resultGDTSum = await apiPost(`${CONFIG.GDT_API_URL}/GdtEntries/sumPerEmailApi`, {
|
||||
email: user.email,
|
||||
@ -45,9 +43,9 @@ export class GdtResolver {
|
||||
throw new Error('Call not successful')
|
||||
}
|
||||
return Number(resultGDTSum.data.sum) || 0
|
||||
} catch (err: any) {
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Could not query GDT Server', err)
|
||||
console.log('Could not query GDT Server')
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Resolver, Query, Authorized, Arg, Mutation, Args } from 'type-graphql'
|
||||
import {
|
||||
getKlickTippUser,
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Args, Arg, Authorized, Ctx, Mutation, Query, Int } from 'type-graphql'
|
||||
import { TransactionLink } from '@model/TransactionLink'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
@ -38,9 +36,9 @@ export class TransactionLinkResolver {
|
||||
@Mutation(() => TransactionLink)
|
||||
async createTransactionLink(
|
||||
@Args() { amount, memo }: TransactionLinkArgs,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<TransactionLink> {
|
||||
const { user } = context
|
||||
const user = getUser(context)
|
||||
|
||||
const createdDate = new Date()
|
||||
const validUntil = transactionLinkExpireDate(createdDate)
|
||||
@ -72,9 +70,9 @@ export class TransactionLinkResolver {
|
||||
@Mutation(() => Boolean)
|
||||
async deleteTransactionLink(
|
||||
@Arg('id', () => Int) id: number,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
const { user } = context
|
||||
const user = getUser(context)
|
||||
|
||||
const transactionLink = await dbTransactionLink.findOne({ id })
|
||||
if (!transactionLink) {
|
||||
@ -113,9 +111,9 @@ export class TransactionLinkResolver {
|
||||
async listTransactionLinks(
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<TransactionLink[]> {
|
||||
const { user } = context
|
||||
const user = getUser(context)
|
||||
// const now = new Date()
|
||||
const transactionLinks = await dbTransactionLink.find({
|
||||
where: {
|
||||
@ -136,9 +134,9 @@ export class TransactionLinkResolver {
|
||||
@Mutation(() => Boolean)
|
||||
async redeemTransactionLink(
|
||||
@Arg('code', () => String) code: string,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
const { user } = context
|
||||
const user = getUser(context)
|
||||
const transactionLink = await dbTransactionLink.findOneOrFail({ code })
|
||||
const linkedUser = await dbUser.findOneOrFail({ id: transactionLink.userId })
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
/* eslint-disable new-cap */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import CONFIG from '@/config'
|
||||
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
||||
import { getCustomRepository, getConnection } from '@dbTools/typeorm'
|
||||
|
||||
@ -135,6 +136,7 @@ export const executeTransaction = async (
|
||||
senderEmail: sender.email,
|
||||
amount,
|
||||
memo,
|
||||
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
|
||||
})
|
||||
|
||||
return true
|
||||
@ -147,10 +149,10 @@ export class TransactionResolver {
|
||||
async transactionList(
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 25, order = Order.DESC }: Paginated,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<TransactionList> {
|
||||
const now = new Date()
|
||||
const user = context.user
|
||||
const user = getUser(context)
|
||||
|
||||
// find current balance
|
||||
const lastTransaction = await dbTransaction.findOne(
|
||||
@ -247,10 +249,10 @@ export class TransactionResolver {
|
||||
@Mutation(() => String)
|
||||
async sendCoins(
|
||||
@Args() { email, amount, memo }: TransactionSendArgs,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
// TODO this is subject to replay attacks
|
||||
const senderUser = context.user
|
||||
const senderUser = getUser(context)
|
||||
if (senderUser.pubKey.length !== 32) {
|
||||
throw new Error('invalid sender public key')
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import fs from 'fs'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql'
|
||||
import { getConnection, getCustomRepository } from '@dbTools/typeorm'
|
||||
import CONFIG from '@/config'
|
||||
@ -192,9 +190,9 @@ export class UserResolver {
|
||||
@Authorized([RIGHTS.VERIFY_LOGIN])
|
||||
@Query(() => User)
|
||||
@UseMiddleware(klicktippNewsletterStateMiddleware)
|
||||
async verifyLogin(@Ctx() context: any): Promise<User> {
|
||||
async verifyLogin(@Ctx() context: Context): Promise<User> {
|
||||
// TODO refactor and do not have duplicate code with login(see below)
|
||||
const userEntity = context.user
|
||||
const userEntity = getUser(context)
|
||||
const user = new User(userEntity)
|
||||
// user.pubkey = userEntity.pubKey.toString('hex')
|
||||
// Elopage Status & Stored PublisherId
|
||||
@ -218,7 +216,7 @@ export class UserResolver {
|
||||
@UseMiddleware(klicktippNewsletterStateMiddleware)
|
||||
async login(
|
||||
@Args() { email, password, publisherId }: UnsecureLoginArgs,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<User> {
|
||||
email = email.trim().toLowerCase()
|
||||
const dbUser = await DbUser.findOneOrFail({ email }, { withDeleted: true }).catch(() => {
|
||||
@ -250,7 +248,7 @@ export class UserResolver {
|
||||
user.language = dbUser.language
|
||||
|
||||
// Elopage Status & Stored PublisherId
|
||||
user.hasElopage = await this.hasElopage({ pubKey: dbUser.pubKey.toString('hex') })
|
||||
user.hasElopage = await this.hasElopage({ ...context, user: dbUser })
|
||||
if (!user.hasElopage && publisherId) {
|
||||
user.publisherId = publisherId
|
||||
// TODO: Check if we can use updateUserInfos
|
||||
@ -540,9 +538,9 @@ export class UserResolver {
|
||||
passwordNew,
|
||||
coinanimation,
|
||||
}: UpdateUserInfosArgs,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
const userEntity = context.user
|
||||
const userEntity = getUser(context)
|
||||
|
||||
if (firstName) {
|
||||
userEntity.firstName = firstName
|
||||
@ -619,7 +617,7 @@ export class UserResolver {
|
||||
|
||||
@Authorized([RIGHTS.HAS_ELOPAGE])
|
||||
@Query(() => Boolean)
|
||||
async hasElopage(@Ctx() context: any): Promise<boolean> {
|
||||
async hasElopage(@Ctx() context: Context): Promise<boolean> {
|
||||
const userEntity = context.user
|
||||
if (!userEntity) {
|
||||
return false
|
||||
|
||||
@ -20,6 +20,7 @@ describe('sendTransactionReceivedEmail', () => {
|
||||
senderEmail: 'bibi@bloxberg.de',
|
||||
amount: new Decimal(42.0),
|
||||
memo: 'Vielen herzlichen Dank für den neuen Hexenbesen!',
|
||||
overviewURL: 'http://localhost/overview',
|
||||
})
|
||||
})
|
||||
|
||||
@ -32,7 +33,8 @@ describe('sendTransactionReceivedEmail', () => {
|
||||
expect.stringContaining('42,00 GDD') &&
|
||||
expect.stringContaining('Bibi Bloxberg') &&
|
||||
expect.stringContaining('(bibi@bloxberg.de)') &&
|
||||
expect.stringContaining('Vielen herzlichen Dank für den neuen Hexenbesen!'),
|
||||
expect.stringContaining('Vielen herzlichen Dank für den neuen Hexenbesen!') &&
|
||||
expect.stringContaining('http://localhost/overview'),
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -11,6 +11,7 @@ export const sendTransactionReceivedEmail = (data: {
|
||||
senderEmail: string
|
||||
amount: Decimal
|
||||
memo: string
|
||||
overviewURL: string
|
||||
}): Promise<boolean> => {
|
||||
return sendEMail({
|
||||
to: `${data.recipientFirstName} ${data.recipientLastName} <${data.email}>`,
|
||||
|
||||
@ -12,6 +12,7 @@ export const transactionReceived = {
|
||||
senderEmail: string
|
||||
amount: Decimal
|
||||
memo: string
|
||||
overviewURL: string
|
||||
}): string =>
|
||||
`Hallo ${data.recipientFirstName} ${data.recipientLastName}
|
||||
|
||||
@ -25,6 +26,9 @@ ${data.memo}
|
||||
Bitte antworte nicht auf diese E-Mail!
|
||||
|
||||
Mit freundlichen Grüßen,
|
||||
dein Gradido-Team`,
|
||||
dein Gradido-Team
|
||||
|
||||
|
||||
Link zu deinem Konto: ${data.overviewURL}`,
|
||||
},
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ export const transactionsQuery = gql`
|
||||
balanceGDT
|
||||
count
|
||||
balance
|
||||
decayStartBlock
|
||||
transactions {
|
||||
id
|
||||
typeId
|
||||
|
||||
@ -1,9 +1,24 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { Role } from '@/auth/Role'
|
||||
import { User as dbUser } from '@entity/User'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ExpressContext } from 'apollo-server-express'
|
||||
|
||||
const context = (args: any) => {
|
||||
export interface Context {
|
||||
token: string | null
|
||||
setHeaders: { key: string; value: string }[]
|
||||
role?: Role
|
||||
user?: dbUser
|
||||
// hack to use less DB calls for Balance Resolver
|
||||
lastTransaction?: dbTransaction
|
||||
transactionCount?: number
|
||||
linkCount?: number
|
||||
sumHoldAvailableAmount?: Decimal
|
||||
}
|
||||
|
||||
const context = (args: ExpressContext): Context => {
|
||||
const authorization = args.req.headers.authorization
|
||||
let token = null
|
||||
let token: string | null = null
|
||||
if (authorization) {
|
||||
token = authorization.replace(/^Bearer /, '')
|
||||
}
|
||||
@ -14,4 +29,9 @@ const context = (args: any) => {
|
||||
return context
|
||||
}
|
||||
|
||||
export const getUser = (context: Context): dbUser => {
|
||||
if (context.user) return context.user
|
||||
throw new Error('No user given in context!')
|
||||
}
|
||||
|
||||
export default context
|
||||
|
||||
@ -29,6 +29,7 @@ function calculateDecay(
|
||||
const decay: Decay = {
|
||||
balance: amount,
|
||||
decay: new Decimal(0),
|
||||
roundedDecay: new Decimal(0),
|
||||
start: null,
|
||||
end: null,
|
||||
duration: null,
|
||||
@ -52,6 +53,10 @@ function calculateDecay(
|
||||
decay.end = to
|
||||
decay.balance = decayFormula(amount, decay.duration)
|
||||
decay.decay = decay.balance.minus(amount)
|
||||
decay.roundedDecay = amount
|
||||
.toDecimalPlaces(2, Decimal.ROUND_DOWN)
|
||||
.minus(decay.balance.toDecimalPlaces(2, Decimal.ROUND_DOWN).toString())
|
||||
.mul(-1)
|
||||
return decay
|
||||
}
|
||||
|
||||
|
||||
@ -68,12 +68,12 @@ const virtualDecayTransaction = (
|
||||
userId: -1,
|
||||
previous: -1,
|
||||
typeId: TransactionTypeId.DECAY,
|
||||
amount: decay.decay ? decay.decay.toDecimalPlaces(2, Decimal.ROUND_FLOOR) : new Decimal(0), // new Decimal(0), // this kinda is wrong, but helps with the frontend query
|
||||
amount: decay.decay ? decay.roundedDecay : new Decimal(0),
|
||||
balance: decay.balance
|
||||
.minus(holdAvailabeAmount.toString())
|
||||
.toDecimalPlaces(2, Decimal.ROUND_DOWN),
|
||||
balanceDate: time,
|
||||
decay: decay.decay ? decay.decay.toDecimalPlaces(2, Decimal.ROUND_FLOOR) : new Decimal(0),
|
||||
decay: decay.decay ? decay.roundedDecay : new Decimal(0),
|
||||
decayStart: decay.start,
|
||||
memo: '',
|
||||
creationDate: null,
|
||||
|
||||
@ -1704,9 +1704,9 @@ camelcase@^6.2.0:
|
||||
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
|
||||
|
||||
caniuse-lite@^1.0.30001264:
|
||||
version "1.0.30001265"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz#0613c9e6c922e422792e6fcefdf9a3afeee4f8c3"
|
||||
integrity sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==
|
||||
version "1.0.30001325"
|
||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001325.tgz"
|
||||
integrity sha512-sB1bZHjseSjDtijV1Hb7PB2Zd58Kyx+n/9EotvZ4Qcz2K3d0lWB8dB4nb8wN/TsOGFq3UuAm0zQZNQ4SoR7TrQ==
|
||||
|
||||
chalk@^2.0.0:
|
||||
version "2.4.2"
|
||||
@ -1900,7 +1900,14 @@ create-require@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
|
||||
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
|
||||
|
||||
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
|
||||
cross-env@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
|
||||
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.1"
|
||||
|
||||
cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||
|
||||
@ -25,23 +25,9 @@ yarn down
|
||||
yarn dev_down
|
||||
```
|
||||
|
||||
|
||||
## Reset DB
|
||||
## Reset database
|
||||
```
|
||||
yarn dev_reset
|
||||
```
|
||||
|
||||
## Seed DB
|
||||
```
|
||||
yarn seed
|
||||
```
|
||||
|
||||
## Seeded Users
|
||||
|
||||
| email | password | admin |
|
||||
|------------------------|------------|---------|
|
||||
| peter@lustig.de | `Aa12345_` | `true` |
|
||||
| bibi@bloxberg.de | `Aa12345_` | `false` |
|
||||
| raeuber@hotzenplotz.de | `Aa12345_` | `false` |
|
||||
| bob@baumeister.de | `Aa12345_` | `false` |
|
||||
Runs all down migrations and after this all up migrations.
|
||||
|
||||
|
||||
@ -10,15 +10,15 @@
|
||||
"scripts": {
|
||||
"build": "mkdir -p build/src/config/ && cp src/config/*.txt build/src/config/ && tsc --build",
|
||||
"clean": "tsc --build --clean",
|
||||
"up": "TZ=UTC node build/src/index.js up",
|
||||
"down": "TZ=UTC node build/src/index.js down",
|
||||
"reset": "TZ=UTC node build/src/index.js reset",
|
||||
"dev_up": "TZ=UTC ts-node src/index.ts up",
|
||||
"dev_down": "TZ=UTC ts-node src/index.ts down",
|
||||
"dev_reset": "TZ=UTC ts-node src/index.ts reset",
|
||||
"up": "cross-env TZ=UTC node build/src/index.js up",
|
||||
"down": "cross-env TZ=UTC node build/src/index.js down",
|
||||
"reset": "cross-env TZ=UTC node build/src/index.js reset",
|
||||
"dev_up": "cross-env TZ=UTC ts-node src/index.ts up",
|
||||
"dev_down": "cross-env TZ=UTC ts-node src/index.ts down",
|
||||
"dev_reset": "cross-env TZ=UTC ts-node src/index.ts reset",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.ts .",
|
||||
"seed:config": "ts-node ./node_modules/typeorm-seeding/dist/cli.js config",
|
||||
"seed": "TZ=UTC ts-node src/index.ts seed"
|
||||
"seed": "cross-env TZ=UTC ts-node src/index.ts seed"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/faker": "^5.5.9",
|
||||
@ -37,14 +37,13 @@
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"crypto": "^1.0.1",
|
||||
"decimal.js-light": "^2.5.1",
|
||||
"dotenv": "^10.0.0",
|
||||
"faker": "^5.5.3",
|
||||
"mysql2": "^2.3.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"ts-mysql-migrate": "^1.0.2",
|
||||
"typeorm": "^0.2.38",
|
||||
"typeorm-seeding": "^1.6.1"
|
||||
"typeorm": "^0.2.38"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
import Faker from 'faker'
|
||||
import { define } from 'typeorm-seeding'
|
||||
import { ServerUser } from '../../entity/ServerUser'
|
||||
import { ServerUserContext } from '../interface/UserContext'
|
||||
|
||||
define(ServerUser, (faker: typeof Faker, context?: ServerUserContext) => {
|
||||
if (!context) context = {}
|
||||
|
||||
const user = new ServerUser()
|
||||
user.username = context.username ? context.username : faker.internet.userName()
|
||||
user.password = context.password ? context.password : faker.internet.password()
|
||||
user.email = context.email ? context.email : faker.internet.email()
|
||||
user.role = context.role ? context.role : 'admin'
|
||||
user.activated = context.activated ? context.activated : 0
|
||||
user.lastLogin = context.lastLogin ? context.lastLogin : faker.date.recent()
|
||||
user.created = context.created ? context.created : faker.date.recent()
|
||||
user.modified = context.modified ? context.modified : faker.date.recent()
|
||||
|
||||
return user
|
||||
})
|
||||
@ -1,24 +0,0 @@
|
||||
import Faker from 'faker'
|
||||
import { define } from 'typeorm-seeding'
|
||||
import { Transaction } from '../../entity/Transaction'
|
||||
import { TransactionContext } from '../interface/TransactionContext'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
define(Transaction, (faker: typeof Faker, context?: TransactionContext) => {
|
||||
if (!context) {
|
||||
throw new Error('TransactionContext not well defined.')
|
||||
}
|
||||
|
||||
const transaction = new Transaction()
|
||||
transaction.typeId = context.typeId // || 2
|
||||
transaction.userId = context.userId
|
||||
transaction.amount = context.amount
|
||||
transaction.balance = context.balance
|
||||
transaction.decay = new Decimal(0) // context.decay
|
||||
transaction.memo = context.memo
|
||||
transaction.creationDate = context.creationDate || new Date()
|
||||
// transaction.sendReceiverPublicKey = context.sendReceiverPublicKey || null
|
||||
transaction.linkedUserId = context.sendReceiverUserId || null
|
||||
|
||||
return transaction
|
||||
})
|
||||
@ -1,27 +0,0 @@
|
||||
import Faker from 'faker'
|
||||
import { define } from 'typeorm-seeding'
|
||||
import { User } from '../../entity/User'
|
||||
import { randomBytes } from 'crypto'
|
||||
import { UserContext } from '../interface/UserContext'
|
||||
|
||||
define(User, (faker: typeof Faker, context?: UserContext) => {
|
||||
if (!context) context = {}
|
||||
|
||||
const user = new User()
|
||||
user.pubKey = context.pubKey ? context.pubKey : randomBytes(32)
|
||||
user.email = context.email ? context.email : faker.internet.email()
|
||||
user.firstName = context.firstName ? context.firstName : faker.name.firstName()
|
||||
user.lastName = context.lastName ? context.lastName : faker.name.lastName()
|
||||
user.deletedAt = context.deletedAt ? context.deletedAt : null
|
||||
// TODO Create real password and keys/hash
|
||||
user.password = context.password ? context.password : BigInt(0)
|
||||
user.privKey = context.privKey ? context.privKey : randomBytes(80)
|
||||
user.emailHash = context.emailHash ? context.emailHash : randomBytes(32)
|
||||
user.createdAt = context.createdAt ? context.createdAt : faker.date.recent()
|
||||
user.emailChecked = context.emailChecked === undefined ? false : context.emailChecked
|
||||
user.language = context.language ? context.language : 'en'
|
||||
user.publisherId = context.publisherId ? context.publisherId : 0
|
||||
user.passphrase = context.passphrase ? context.passphrase : faker.random.words(24)
|
||||
|
||||
return user
|
||||
})
|
||||
@ -1,6 +1,5 @@
|
||||
import CONFIG from './config'
|
||||
import { createPool, PoolConfig } from 'mysql'
|
||||
import { useSeeding, runSeeder } from 'typeorm-seeding'
|
||||
import { Migration } from 'ts-mysql-migrate'
|
||||
import path from 'path'
|
||||
|
||||
@ -32,17 +31,4 @@ const resetDB = async (closePool = false): Promise<void> => {
|
||||
if (closePool) pool.end()
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
const runSeeds = async (seeds: any[]): Promise<void> => {
|
||||
if (seeds.length > 0) {
|
||||
await useSeeding({
|
||||
root: process.cwd(),
|
||||
configName: 'ormconfig.js',
|
||||
})
|
||||
for (let i = 0; i < seeds.length; i++) {
|
||||
await runSeeder(seeds[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { resetDB, pool, migration, initialize, runSeeds }
|
||||
export { resetDB, pool, migration, initialize }
|
||||
|
||||
@ -1,14 +1,7 @@
|
||||
import 'reflect-metadata'
|
||||
import prepare from './prepare'
|
||||
import connection from './typeorm/connection'
|
||||
import { CreatePeterLustigSeed } from './seeds/users/peter-lustig.admin.seed'
|
||||
import { CreateBibiBloxbergSeed } from './seeds/users/bibi-bloxberg.seed'
|
||||
import { CreateRaeuberHotzenplotzSeed } from './seeds/users/raeuber-hotzenplotz.seed'
|
||||
import { CreateBobBaumeisterSeed } from './seeds/users/bob-baumeister.seed'
|
||||
import { CreateStephenHawkingSeed } from './seeds/users/stephen-hawking.seed'
|
||||
import { CreateGarrickOllivanderSeed } from './seeds/users/garrick-ollivander.seed'
|
||||
import { CreateUserSeed } from './seeds/create-user.seed'
|
||||
import { resetDB, pool, migration, runSeeds } from './helpers'
|
||||
import { resetDB, pool, migration } from './helpers'
|
||||
|
||||
const run = async (command: string) => {
|
||||
// Database actions not supported by our migration library
|
||||
@ -34,19 +27,6 @@ const run = async (command: string) => {
|
||||
// TODO protect from production
|
||||
await resetDB() // use for resetting database
|
||||
break
|
||||
case 'seed':
|
||||
// TODO protect from production
|
||||
// await runSeeder(CreatePeterLustigSeed)
|
||||
await runSeeds([
|
||||
CreatePeterLustigSeed,
|
||||
CreateBibiBloxbergSeed,
|
||||
CreateRaeuberHotzenplotzSeed,
|
||||
CreateBobBaumeisterSeed,
|
||||
CreateStephenHawkingSeed,
|
||||
CreateGarrickOllivanderSeed,
|
||||
...Array(96).fill(CreateUserSeed),
|
||||
])
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported command ${command}`)
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { userSeeder } from './helpers/user-helpers'
|
||||
|
||||
export class CreateUserSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, {})
|
||||
}
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
import { UserContext, ServerUserContext } from '../../interface/UserContext'
|
||||
import { TransactionContext } from '../../interface/TransactionContext'
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
import { User } from '../../../entity/User'
|
||||
import { ServerUser } from '../../../entity/ServerUser'
|
||||
import { Transaction } from '../../../entity/Transaction'
|
||||
import { Factory } from 'typeorm-seeding'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
export const userSeeder = async (factory: Factory, userData: UserInterface): Promise<void> => {
|
||||
const user = await factory(User)(createUserContext(userData)).create()
|
||||
|
||||
if (userData.isAdmin) {
|
||||
await factory(ServerUser)(createServerUserContext(userData)).create()
|
||||
}
|
||||
|
||||
if (userData.addBalance) {
|
||||
// create some GDD for the user
|
||||
await factory(Transaction)(
|
||||
createTransactionContext(userData, user, 1, 'Herzlich Willkommen bei Gradido!'),
|
||||
).create()
|
||||
}
|
||||
}
|
||||
|
||||
const createUserContext = (context: UserInterface): UserContext => {
|
||||
return {
|
||||
pubKey: context.pubKey,
|
||||
email: context.email,
|
||||
firstName: context.firstName,
|
||||
lastName: context.lastName,
|
||||
deletedAt: context.deletedAt,
|
||||
password: context.password,
|
||||
privKey: context.privKey,
|
||||
emailHash: context.emailHash,
|
||||
createdAt: context.createdAt,
|
||||
emailChecked: context.emailChecked,
|
||||
language: context.language,
|
||||
publisherId: context.publisherId,
|
||||
}
|
||||
}
|
||||
|
||||
const createServerUserContext = (context: UserInterface): ServerUserContext => {
|
||||
return {
|
||||
role: context.role,
|
||||
password: context.serverUserPassword,
|
||||
email: context.email,
|
||||
activated: context.activated,
|
||||
created: context.createdAt,
|
||||
lastLogin: context.lastLogin,
|
||||
modified: context.modified,
|
||||
}
|
||||
}
|
||||
|
||||
const createTransactionContext = (
|
||||
context: UserInterface,
|
||||
user: User,
|
||||
type: number,
|
||||
memo: string,
|
||||
): TransactionContext => {
|
||||
return {
|
||||
typeId: type,
|
||||
userId: user.id,
|
||||
amount: context.amount || new Decimal(1000),
|
||||
balance: context.amount || new Decimal(1000),
|
||||
balanceDate: new Date(context.recordDate || Date.now()),
|
||||
memo,
|
||||
creationDate: context.creationDate,
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { bibiBloxberg } from './bibi-bloxberg'
|
||||
import { userSeeder } from '../helpers/user-helpers'
|
||||
|
||||
export class CreateBibiBloxbergSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, bibiBloxberg)
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
|
||||
export const bibiBloxberg: UserInterface = {
|
||||
email: 'bibi@bloxberg.de',
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
// description: 'Hex Hex',
|
||||
password: BigInt('12825419584724616625'),
|
||||
pubKey: Buffer.from('42de7e4754625b730018c3b4ea745a4d043d9d867af352d0f08871793dfa6743', 'hex'),
|
||||
privKey: Buffer.from(
|
||||
'60681365b6ad6fd500eae09ac8df0de6beb7554226e0ca1049e957cc6f202205b86e258bbbe98561a86bd9b986ea8b2a6c60abdff8a745f73c8932d4b6545a8da09bbcd6e18ec61a2ef30bac85f83c5d',
|
||||
'hex',
|
||||
),
|
||||
emailHash: Buffer.from('38a0d8c8658a5681cc1180c5d9e2b2a18e4f611db8ab3ca61de4aa91ae94219b', 'hex'),
|
||||
createdAt: new Date('2021-11-26T11:32:16'),
|
||||
emailChecked: true,
|
||||
language: 'de',
|
||||
passphrase:
|
||||
'knife normal level all hurdle crucial color avoid warrior stadium road bachelor affair topple hawk pottery right afford immune two ceiling budget glance hour ',
|
||||
isAdmin: false,
|
||||
addBalance: true,
|
||||
recordDate: new Date('2021-11-30T10:37:11'),
|
||||
creationDate: new Date('2021-08-01 00:00:00'),
|
||||
amount: new Decimal(1000),
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { bobBaumeister } from './bob-baumeister'
|
||||
import { userSeeder } from '../helpers/user-helpers'
|
||||
|
||||
export class CreateBobBaumeisterSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, bobBaumeister)
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
|
||||
export const bobBaumeister: UserInterface = {
|
||||
email: 'bob@baumeister.de',
|
||||
firstName: 'Bob',
|
||||
lastName: 'der Baumeister',
|
||||
// description: 'Können wir das schaffen? Ja, wir schaffen das!',
|
||||
password: BigInt('3296644341468822636'),
|
||||
pubKey: Buffer.from('a509d9a146374fc975e3677db801ae8a4a83bff9dea96da64053ff6de6b2dd7e', 'hex'),
|
||||
privKey: Buffer.from(
|
||||
'd30606ac59c29058896180bebd6dcd1714dbdd697cc14b65eb4de9ef5241a5d5fc789eaab48957a887c45b7e71ab75c47fd132c14b99007891b5bdfb1026575009f0802b0126930803c113ab3f44e1be',
|
||||
'hex',
|
||||
),
|
||||
emailHash: Buffer.from('4b8ce4e175587aaf33da19e272719da1a547daff557820191fab0c65c5a3b7f1', 'hex'),
|
||||
createdAt: new Date('2021-11-26T11:36:31'),
|
||||
emailChecked: true,
|
||||
language: 'de',
|
||||
passphrase:
|
||||
'detail master source effort unable waste tilt flush domain orchard art truck hint barrel response gate impose peanut secret merry three uncle wink resource ',
|
||||
isAdmin: false,
|
||||
addBalance: true,
|
||||
recordDate: new Date('2021-11-30T10:37:14'),
|
||||
creationDate: new Date('2021-08-01 00:00:00'),
|
||||
amount: new Decimal(1000),
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { garrickOllivander } from './garrick-ollivander'
|
||||
import { userSeeder } from '../helpers/user-helpers'
|
||||
|
||||
export class CreateGarrickOllivanderSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, garrickOllivander)
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
|
||||
export const garrickOllivander: UserInterface = {
|
||||
email: 'garrick@ollivander.com',
|
||||
firstName: 'Garrick',
|
||||
lastName: 'Ollivander',
|
||||
// description: `Curious ... curious ...
|
||||
// Renowned wandmaker Mr Ollivander owns the wand shop Ollivanders: Makers of Fine Wands Since 382 BC in Diagon Alley. His shop is widely considered the best place to purchase a wand.`,
|
||||
password: BigInt('0'),
|
||||
emailHash: Buffer.from('91e358000e908146342789979d62a7255b2b88a71dad0c6a10e32af44be57886', 'hex'),
|
||||
createdAt: new Date('2022-01-10T10:23:17'),
|
||||
emailChecked: false,
|
||||
language: 'en',
|
||||
passphrase:
|
||||
'human glide theory clump wish history other duty door fringe neck industry ostrich equal plate diesel tornado neck people antenna door category moon hen ',
|
||||
isAdmin: false,
|
||||
addBalance: false,
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { peterLustig } from './peter-lustig'
|
||||
import { userSeeder } from '../helpers/user-helpers'
|
||||
|
||||
export class CreatePeterLustigSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, peterLustig)
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
|
||||
export const peterLustig: UserInterface = {
|
||||
email: 'peter@lustig.de',
|
||||
firstName: 'Peter',
|
||||
lastName: 'Lustig',
|
||||
// description: 'Latzhose und Nickelbrille',
|
||||
password: BigInt('3917921995996627700'),
|
||||
pubKey: Buffer.from('7281e0ee3258b08801f3ec73e431b4519677f65c03b0382c63a913b5784ee770', 'hex'),
|
||||
privKey: Buffer.from(
|
||||
'3c7c0253033212ed983f6bb10ce73362a99f0bd01d4d1b21ca702d532ca32710ba36abf72a22a963b9026e764e954f441f4905b87a66861bd6b9d9689b7f8aefea66cc493e21da4244e85be81660b9c4',
|
||||
'hex',
|
||||
),
|
||||
emailHash: Buffer.from('9f700e6f6ec351a140b674c0edd4479509697b023bd8bee8826915ef6c2af036', 'hex'),
|
||||
createdAt: new Date('2020-11-25T10:48:43'),
|
||||
emailChecked: true,
|
||||
language: 'de',
|
||||
passphrase:
|
||||
'okay property choice naive calm present weird increase stuff royal vibrant frame attend wood one else tribe pull hedgehog woman kitchen hawk snack smart ',
|
||||
role: 'admin',
|
||||
serverUserPassword: '$2y$10$TzIWLeZoKs251gwrhSQmHeKhKI/EQ4EV5ClfAT8Ufnb4lcUXPa5X.',
|
||||
activated: 1,
|
||||
lastLogin: new Date('2021-10-27T12:25:57'),
|
||||
modified: new Date('2021-09-27T12:25:57'),
|
||||
isAdmin: true,
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { raeuberHotzenplotz } from './raeuber-hotzenplotz'
|
||||
import { userSeeder } from '../helpers/user-helpers'
|
||||
|
||||
export class CreateRaeuberHotzenplotzSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, raeuberHotzenplotz)
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
|
||||
export const raeuberHotzenplotz: UserInterface = {
|
||||
email: 'raeuber@hotzenplotz.de',
|
||||
firstName: 'Räuber',
|
||||
lastName: 'Hotzenplotz',
|
||||
// description: 'Pfefferpistole',
|
||||
password: BigInt('12123692783243004812'),
|
||||
pubKey: Buffer.from('d7c70f94234dff071d982aa8f41583876c356599773b5911b39080da2b8c2d2b', 'hex'),
|
||||
privKey: Buffer.from(
|
||||
'c4ede7e7e65acd4cc0a2d91136ee8f753c6903b3594798afde341092b21a4c1589f296d43c6e7adcd7602fcc2a2bcbf74c9f42453ad49cc5186eadf654bbd2c5fa9aa027f152592819246da896ebfcd2',
|
||||
'hex',
|
||||
),
|
||||
emailHash: Buffer.from('ec8d34112adb40ff2f6538b05660b03440372690f034cd7d6322d17020233c77', 'hex'),
|
||||
createdAt: new Date('2021-11-26T11:32:16'),
|
||||
emailChecked: true,
|
||||
language: 'de',
|
||||
passphrase:
|
||||
'gospel trip tenant mouse spider skill auto curious man video chief response same little over expire drum display fancy clinic keen throw urge basket ',
|
||||
isAdmin: false,
|
||||
addBalance: true,
|
||||
recordDate: new Date('2021-11-30T10:37:13'),
|
||||
creationDate: new Date('2021-08-01 00:00:00'),
|
||||
amount: new Decimal(1000),
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { Factory, Seeder } from 'typeorm-seeding'
|
||||
import { stephenHawking } from './stephen-hawking'
|
||||
import { userSeeder } from '../helpers/user-helpers'
|
||||
|
||||
export class CreateStephenHawkingSeed implements Seeder {
|
||||
public async run(factory: Factory): Promise<void> {
|
||||
await userSeeder(factory, stephenHawking)
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
import { UserInterface } from '../../interface/UserInterface'
|
||||
|
||||
export const stephenHawking: UserInterface = {
|
||||
email: 'stephen@hawking.uk',
|
||||
firstName: 'Stephen',
|
||||
lastName: 'Hawking',
|
||||
// description: 'A Brief History of Time',
|
||||
password: BigInt('18075098469449931746'),
|
||||
pubKey: Buffer.from('19576a7aab8cd4ce683ed6735bba937d6bdbd08016568f730a385b6481241213', 'hex'),
|
||||
privKey: Buffer.from(
|
||||
'1d8ce9b5df086a713fee9eb562adc127073f3211a6214a54e53eb22c1249d49e1e94580ab00f25fd4b38808c1e31b41624ef627f277d21ef5d5717d4b81958f13dc2b257759caba07c6fdbc72f86ab0f',
|
||||
'hex',
|
||||
),
|
||||
emailHash: Buffer.from('71d4ed7a25d2130d445d6451135eefbbdd96c3105dd297783590ced0bf3116fd', 'hex'),
|
||||
createdAt: new Date('1942-01-08T09:17:52'),
|
||||
deletedAt: new Date('2018-03-14T09:17:52'),
|
||||
emailChecked: true,
|
||||
language: 'en',
|
||||
passphrase:
|
||||
'demise tree praise funny ignore despair vessel shop sorry try day peanut tongue toddler bone december inch chicken clump sheriff weasel rally check suggest ',
|
||||
isAdmin: false,
|
||||
addBalance: false,
|
||||
}
|
||||
@ -393,11 +393,6 @@ callsites@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
|
||||
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
|
||||
|
||||
camelcase@^5.0.0:
|
||||
version "5.3.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||
|
||||
chalk@^1.1.1:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
||||
@ -409,7 +404,7 @@ chalk@^1.1.1:
|
||||
strip-ansi "^3.0.0"
|
||||
supports-color "^2.0.0"
|
||||
|
||||
chalk@^2.0.0, chalk@^2.4.2:
|
||||
chalk@^2.0.0:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||
@ -418,14 +413,6 @@ chalk@^2.0.0, chalk@^2.4.2:
|
||||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
chalk@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
|
||||
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
|
||||
dependencies:
|
||||
ansi-styles "^4.1.0"
|
||||
supports-color "^7.1.0"
|
||||
|
||||
chalk@^4.0.0, chalk@^4.1.0:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||
@ -434,13 +421,6 @@ chalk@^4.0.0, chalk@^4.1.0:
|
||||
ansi-styles "^4.1.0"
|
||||
supports-color "^7.1.0"
|
||||
|
||||
cli-cursor@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307"
|
||||
integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==
|
||||
dependencies:
|
||||
restore-cursor "^3.1.0"
|
||||
|
||||
cli-highlight@^2.1.11:
|
||||
version "2.1.11"
|
||||
resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf"
|
||||
@ -453,20 +433,6 @@ cli-highlight@^2.1.11:
|
||||
parse5-htmlparser2-tree-adapter "^6.0.0"
|
||||
yargs "^16.0.0"
|
||||
|
||||
cli-spinners@^2.2.0:
|
||||
version "2.6.1"
|
||||
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.1.tgz#adc954ebe281c37a6319bfa401e6dd2488ffb70d"
|
||||
integrity sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==
|
||||
|
||||
cliui@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"
|
||||
integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
|
||||
dependencies:
|
||||
string-width "^4.2.0"
|
||||
strip-ansi "^6.0.0"
|
||||
wrap-ansi "^6.2.0"
|
||||
|
||||
cliui@^7.0.2:
|
||||
version "7.0.4"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
|
||||
@ -476,11 +442,6 @@ cliui@^7.0.2:
|
||||
strip-ansi "^6.0.0"
|
||||
wrap-ansi "^7.0.0"
|
||||
|
||||
clone@^1.0.2:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
||||
integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4=
|
||||
|
||||
color-convert@^1.9.0:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
||||
@ -520,7 +481,14 @@ create-require@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
|
||||
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
|
||||
|
||||
cross-spawn@^7.0.2:
|
||||
cross-env@^7.0.3:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
|
||||
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.1"
|
||||
|
||||
cross-spawn@^7.0.1, cross-spawn@^7.0.2:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||
@ -555,11 +523,6 @@ debug@^4.0.1, debug@^4.1.1, debug@^4.3.1:
|
||||
dependencies:
|
||||
ms "2.1.2"
|
||||
|
||||
decamelize@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||
|
||||
decimal.js-light@^2.5.1:
|
||||
version "2.5.1"
|
||||
resolved "https://registry.yarnpkg.com/decimal.js-light/-/decimal.js-light-2.5.1.tgz#134fd32508f19e208f4fb2f8dac0d2626a867934"
|
||||
@ -570,13 +533,6 @@ deep-is@^0.1.3:
|
||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
|
||||
|
||||
defaults@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
|
||||
integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=
|
||||
dependencies:
|
||||
clone "^1.0.2"
|
||||
|
||||
define-properties@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
|
||||
@ -891,16 +847,6 @@ esutils@^2.0.2:
|
||||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
|
||||
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==
|
||||
|
||||
faker@4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/faker/-/faker-4.1.0.tgz#1e45bbbecc6774b3c195fad2835109c6d748cc3f"
|
||||
integrity sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8=
|
||||
|
||||
faker@^5.5.3:
|
||||
version "5.5.3"
|
||||
resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e"
|
||||
integrity sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==
|
||||
|
||||
fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
||||
@ -965,14 +911,6 @@ find-up@^2.0.0, find-up@^2.1.0:
|
||||
dependencies:
|
||||
locate-path "^2.0.0"
|
||||
|
||||
find-up@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||
dependencies:
|
||||
locate-path "^5.0.0"
|
||||
path-exists "^4.0.0"
|
||||
|
||||
flat-cache@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
|
||||
@ -1008,7 +946,7 @@ generate-function@^2.3.1:
|
||||
dependencies:
|
||||
is-property "^1.0.2"
|
||||
|
||||
get-caller-file@^2.0.1, get-caller-file@^2.0.5:
|
||||
get-caller-file@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||
@ -1029,18 +967,6 @@ glob-parent@^5.1.2:
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
glob@7.1.6:
|
||||
version "7.1.6"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
||||
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.4"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^7.1.3:
|
||||
version "7.1.7"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
|
||||
@ -1253,11 +1179,6 @@ is-glob@^4.0.0, is-glob@^4.0.1:
|
||||
dependencies:
|
||||
is-extglob "^2.1.1"
|
||||
|
||||
is-interactive@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e"
|
||||
integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==
|
||||
|
||||
is-negative-zero@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24"
|
||||
@ -1385,13 +1306,6 @@ locate-path@^2.0.0:
|
||||
p-locate "^2.0.0"
|
||||
path-exists "^3.0.0"
|
||||
|
||||
locate-path@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||
dependencies:
|
||||
p-locate "^4.1.0"
|
||||
|
||||
lodash.clonedeep@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
|
||||
@ -1407,13 +1321,6 @@ lodash.truncate@^4.4.2:
|
||||
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
|
||||
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=
|
||||
|
||||
log-symbols@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4"
|
||||
integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==
|
||||
dependencies:
|
||||
chalk "^2.4.2"
|
||||
|
||||
long@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
|
||||
@ -1452,11 +1359,6 @@ micromatch@^4.0.4:
|
||||
braces "^3.0.1"
|
||||
picomatch "^2.2.3"
|
||||
|
||||
mimic-fn@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
@ -1489,11 +1391,6 @@ ms@^2.1.1:
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
|
||||
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
|
||||
|
||||
mute-stream@0.0.8:
|
||||
version "0.0.8"
|
||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
|
||||
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
|
||||
|
||||
mysql2@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/mysql2/-/mysql2-2.3.0.tgz#600f5cc27e397dfb77b59eac93666434f88e8079"
|
||||
@ -1590,13 +1487,6 @@ once@^1.3.0:
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
onetime@^5.1.0:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e"
|
||||
integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
|
||||
dependencies:
|
||||
mimic-fn "^2.1.0"
|
||||
|
||||
optionator@^0.9.1:
|
||||
version "0.9.1"
|
||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
|
||||
@ -1609,20 +1499,6 @@ optionator@^0.9.1:
|
||||
type-check "^0.4.0"
|
||||
word-wrap "^1.2.3"
|
||||
|
||||
ora@4.0.3:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/ora/-/ora-4.0.3.tgz#752a1b7b4be4825546a7a3d59256fa523b6b6d05"
|
||||
integrity sha512-fnDebVFyz309A73cqCipVL1fBZewq4vwgSHfxh43vVy31mbyoQ8sCH3Oeaog/owYOs/lLlGVPCISQonTneg6Pg==
|
||||
dependencies:
|
||||
chalk "^3.0.0"
|
||||
cli-cursor "^3.1.0"
|
||||
cli-spinners "^2.2.0"
|
||||
is-interactive "^1.0.0"
|
||||
log-symbols "^3.0.0"
|
||||
mute-stream "0.0.8"
|
||||
strip-ansi "^6.0.0"
|
||||
wcwidth "^1.0.1"
|
||||
|
||||
p-limit@^1.1.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"
|
||||
@ -1630,13 +1506,6 @@ p-limit@^1.1.0:
|
||||
dependencies:
|
||||
p-try "^1.0.0"
|
||||
|
||||
p-limit@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||
dependencies:
|
||||
p-try "^2.0.0"
|
||||
|
||||
p-locate@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
|
||||
@ -1644,23 +1513,11 @@ p-locate@^2.0.0:
|
||||
dependencies:
|
||||
p-limit "^1.1.0"
|
||||
|
||||
p-locate@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||
dependencies:
|
||||
p-limit "^2.2.0"
|
||||
|
||||
p-try@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
|
||||
integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=
|
||||
|
||||
p-try@^2.0.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||
|
||||
parent-module@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
|
||||
@ -1703,11 +1560,6 @@ path-exists@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
|
||||
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
|
||||
|
||||
path-exists@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||
|
||||
path-is-absolute@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||
@ -1831,7 +1683,7 @@ readable-stream@2.3.7:
|
||||
string_decoder "~1.1.1"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
reflect-metadata@0.1.13, reflect-metadata@^0.1.13:
|
||||
reflect-metadata@^0.1.13:
|
||||
version "0.1.13"
|
||||
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"
|
||||
integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==
|
||||
@ -1851,11 +1703,6 @@ require-from-string@^2.0.2:
|
||||
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
|
||||
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
|
||||
|
||||
require-main-filename@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||
|
||||
resolve-from@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
|
||||
@ -1869,14 +1716,6 @@ resolve@^1.10.0, resolve@^1.10.1, resolve@^1.20.0:
|
||||
is-core-module "^2.2.0"
|
||||
path-parse "^1.0.6"
|
||||
|
||||
restore-cursor@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e"
|
||||
integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==
|
||||
dependencies:
|
||||
onetime "^5.1.0"
|
||||
signal-exit "^3.0.2"
|
||||
|
||||
reusify@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
|
||||
@ -1938,11 +1777,6 @@ seq-queue@^0.0.5:
|
||||
resolved "https://registry.yarnpkg.com/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e"
|
||||
integrity sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=
|
||||
|
||||
set-blocking@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||
|
||||
sha.js@^2.4.11:
|
||||
version "2.4.11"
|
||||
resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7"
|
||||
@ -1972,11 +1806,6 @@ side-channel@^1.0.4:
|
||||
get-intrinsic "^1.0.2"
|
||||
object-inspect "^1.9.0"
|
||||
|
||||
signal-exit@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
||||
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
|
||||
|
||||
slash@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
|
||||
@ -2209,18 +2038,6 @@ type-fest@^0.20.2:
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
||||
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
|
||||
|
||||
typeorm-seeding@^1.6.1:
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/typeorm-seeding/-/typeorm-seeding-1.6.1.tgz#4fe3a1aec9a611007d1135419cde286cced8defd"
|
||||
integrity sha512-xJIW1pp72hv6npPqbQ7xDvawcDmS60EDUjK++UCfiqT0WE4xTzCn+QK1ZijLkD3GYCqFPuFt4nmeyRJn6VO2Vw==
|
||||
dependencies:
|
||||
chalk "^4.0.0"
|
||||
faker "4.1.0"
|
||||
glob "7.1.6"
|
||||
ora "4.0.3"
|
||||
reflect-metadata "0.1.13"
|
||||
yargs "15.3.1"
|
||||
|
||||
typeorm@^0.2.38:
|
||||
version "0.2.38"
|
||||
resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.38.tgz#2af08079919f6ab04cd17017f9faa2c8d5cd566f"
|
||||
@ -2284,13 +2101,6 @@ validate-npm-package-license@^3.0.1:
|
||||
spdx-correct "^3.0.0"
|
||||
spdx-expression-parse "^3.0.0"
|
||||
|
||||
wcwidth@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8"
|
||||
integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=
|
||||
dependencies:
|
||||
defaults "^1.0.3"
|
||||
|
||||
which-boxed-primitive@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6"
|
||||
@ -2302,11 +2112,6 @@ which-boxed-primitive@^1.0.2:
|
||||
is-string "^1.0.5"
|
||||
is-symbol "^1.0.3"
|
||||
|
||||
which-module@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||
|
||||
which@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
|
||||
@ -2319,15 +2124,6 @@ word-wrap@^1.2.3:
|
||||
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
|
||||
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
|
||||
|
||||
wrap-ansi@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||
dependencies:
|
||||
ansi-styles "^4.0.0"
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
wrap-ansi@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
@ -2355,11 +2151,6 @@ xmlbuilder@~11.0.0:
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
|
||||
integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
|
||||
|
||||
y18n@^4.0.0:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
||||
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
||||
|
||||
y18n@^5.0.5:
|
||||
version "5.0.8"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
|
||||
@ -2384,36 +2175,11 @@ yargonaut@^1.1.4:
|
||||
figlet "^1.1.1"
|
||||
parent-require "^1.0.0"
|
||||
|
||||
yargs-parser@^18.1.1:
|
||||
version "18.1.3"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
|
||||
dependencies:
|
||||
camelcase "^5.0.0"
|
||||
decamelize "^1.2.0"
|
||||
|
||||
yargs-parser@^20.2.2:
|
||||
version "20.2.9"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
|
||||
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
|
||||
|
||||
yargs@15.3.1:
|
||||
version "15.3.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b"
|
||||
integrity sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==
|
||||
dependencies:
|
||||
cliui "^6.0.0"
|
||||
decamelize "^1.2.0"
|
||||
find-up "^4.1.0"
|
||||
get-caller-file "^2.0.1"
|
||||
require-directory "^2.1.1"
|
||||
require-main-filename "^2.0.0"
|
||||
set-blocking "^2.0.0"
|
||||
string-width "^4.2.0"
|
||||
which-module "^2.0.0"
|
||||
y18n "^4.0.0"
|
||||
yargs-parser "^18.1.1"
|
||||
|
||||
yargs@^16.0.0:
|
||||
version "16.2.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
|
||||
|
||||
@ -17,8 +17,14 @@ NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-
|
||||
WEBHOOK_GITHUB_SECRET=secret
|
||||
WEBHOOK_GITHUB_BRANCH=master
|
||||
|
||||
# community
|
||||
COMMUNITY_NAME="Gradido Development Stage1"
|
||||
COMMUNITY_URL=https://stage1.gradido.net/
|
||||
COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register
|
||||
COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community"
|
||||
|
||||
# backend
|
||||
BACKEND_CONFIG_VERSION=v4.2022-04-05
|
||||
BACKEND_CONFIG_VERSION=v6.2022-04-21
|
||||
|
||||
JWT_EXPIRES_IN=30m
|
||||
GDT_API_URL=https://gdt.gradido.net
|
||||
@ -31,11 +37,6 @@ KLICKTIPP_PASSWORD=
|
||||
KLICKTIPP_APIKEY_DE=
|
||||
KLICKTIPP_APIKEY_EN=
|
||||
|
||||
COMMUNITY_NAME="Gradido Development Stage1"
|
||||
COMMUNITY_URL=https://stage1.gradido.net/
|
||||
COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register
|
||||
COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community"
|
||||
|
||||
EMAIL=true
|
||||
EMAIL_USERNAME=peter@lustig.de
|
||||
EMAIL_SENDER=peter@lustig.de
|
||||
@ -44,6 +45,7 @@ EMAIL_SMTP_URL=smtp.lustig.de
|
||||
EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/{optin}{code}
|
||||
EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset-password/{optin}
|
||||
EMAIL_LINK_FORGOTPASSWORD=https://stage1.gradido.net/forgot-password
|
||||
EMAIL_LINK_OVERVIEW=https://stage1.gradido.net/overview
|
||||
EMAIL_CODE_VALID_TIME=1440
|
||||
EMAIL_CODE_REQUEST_TIME=10
|
||||
|
||||
@ -53,7 +55,7 @@ WEBHOOK_ELOPAGE_SECRET=secret
|
||||
DATABASE_CONFIG_VERSION=v1.2022-03-18
|
||||
|
||||
# frontend
|
||||
FRONTEND_CONFIG_VERSION=v1.2022-03-18
|
||||
FRONTEND_CONFIG_VERSION=v2.2022-04-07
|
||||
|
||||
GRAPHQL_URI=https://stage1.gradido.net/graphql
|
||||
ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token}
|
||||
|
||||
@ -81,6 +81,11 @@ sudo certbot
|
||||
> No names were found in your configuration files. Please enter in your domain > stage1.gradido.net
|
||||
# Note: this will throw an error regarding not beeing able to identify the nginx corresponding
|
||||
# config but produce the required certificate - thats perfectly fine this way
|
||||
# Troubleshoot: to manually renew a certificate with running nginx use the following command:
|
||||
# (this might be required once to properly have things setup for the cron to autorenew)
|
||||
# sudo certbot --nginx -d example.com -d www.example.com
|
||||
# Troubleshoot: to check ut if things working you can use
|
||||
# sudo certbot renew --dry-run
|
||||
|
||||
# Install logrotate
|
||||
sudo apt-get install -y logrotate
|
||||
|
||||
@ -106,7 +106,6 @@ yarn build
|
||||
if [ "$DEPLOY_SEED_DATA" = "true" ]; then
|
||||
yarn dev_up
|
||||
yarn dev_reset
|
||||
yarn seed
|
||||
else
|
||||
yarn up
|
||||
fi
|
||||
@ -118,6 +117,9 @@ cd $PROJECT_ROOT/backend
|
||||
unset NODE_ENV
|
||||
yarn install
|
||||
yarn build
|
||||
if [ "$DEPLOY_SEED_DATA" = "true" ]; then
|
||||
yarn seed
|
||||
fi
|
||||
# TODO maybe handle this differently?
|
||||
export NODE_ENV=production
|
||||
pm2 delete gradido-backend
|
||||
|
||||
135
docu/graphics/federation.drawio
Normal file
135
docu/graphics/federation.drawio
Normal file
@ -0,0 +1,135 @@
|
||||
<mxfile host="65bd71144e">
|
||||
<diagram id="IM2_X0c97E_FZMH_xTRz" name="Page-1">
|
||||
<mxGraphModel dx="888" dy="633" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0"/>
|
||||
<mxCell id="1" parent="0"/>
|
||||
<mxCell id="28" value="Other Community" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
|
||||
<mxGeometry x="360" y="410" width="120" height="90" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="3" value="Appolo Server" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" parent="1" vertex="1">
|
||||
<mxGeometry x="220" y="80" width="280" height="300" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="6" style="edgeStyle=none;html=1;" parent="1" target="5" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="500" y="325" as="sourcePoint"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="25" style="edgeStyle=none;html=1;startArrow=none;startFill=0;" edge="1" parent="1" source="2" target="16">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="27" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;startArrow=none;startFill=0;" edge="1" parent="1" source="2" target="26">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="2" value="Node" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" parent="1" vertex="1">
|
||||
<mxGeometry x="370" y="300" width="100" height="50" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="5" value="DB" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#1ba1e2;fontColor=#ffffff;strokeColor=#006EAF;" parent="1" vertex="1">
|
||||
<mxGeometry x="600" y="285" width="60" height="80" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="10" value="Node" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="575" width="240" height="230" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="14" style="edgeStyle=none;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.25;entryY=0;entryDx=0;entryDy=0;startArrow=none;startFill=0;" parent="1" source="11" target="12" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="11" value="DHT (lookup/annoucne)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#76608a;fontColor=#ffffff;strokeColor=#432D57;" parent="1" vertex="1">
|
||||
<mxGeometry x="280" y="600" width="200" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="15" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=none;startFill=0;" edge="1" parent="1" source="12" target="13">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="12" value="Direct Connection<br>(exchange endpoints)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#76608a;fontColor=#ffffff;strokeColor=#432D57;" parent="1" vertex="1">
|
||||
<mxGeometry x="280" y="730" width="200" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="13" value="DB" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#1ba1e2;fontColor=#ffffff;strokeColor=#006EAF;" parent="1" vertex="1">
|
||||
<mxGeometry x="600" y="720" width="60" height="80" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="24" value="" style="edgeStyle=none;html=1;startArrow=none;startFill=0;" edge="1" parent="1" source="16" target="23">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="16" value="Verify via GraphQL" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" vertex="1" parent="1">
|
||||
<mxGeometry x="240" y="300" width="100" height="50" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="21" value="Other Community" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
|
||||
<mxGeometry x="30" y="71" width="120" height="90" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="22" value="Other Community" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
|
||||
<mxGeometry x="30" y="176" width="120" height="90" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="23" value="Other Community" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="1">
|
||||
<mxGeometry x="30" y="281" width="120" height="90" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="26" value="Node" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" vertex="1" parent="1">
|
||||
<mxGeometry x="370" y="430" width="100" height="50" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="29" value="Appolo Server" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;verticalAlign=top;" vertex="1" parent="1">
|
||||
<mxGeometry x="110" y="880" width="540" height="500" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="35" value="" style="edgeStyle=none;html=1;startArrow=classic;startFill=1;" edge="1" parent="1" source="30" target="34">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="690" y="940"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="30" value="Frontend GraphQL Endpoint (unversionated)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="150" y="910" width="450" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="31" value="Versionated Endpoints" style="rounded=0;whiteSpace=wrap;html=1;verticalAlign=top;" vertex="1" parent="1">
|
||||
<mxGeometry x="150" y="1010" width="450" height="310" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="34" value="Frontend" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="690" y="910" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="36" value="Other Community" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;verticalAlign=top;" vertex="1" parent="1">
|
||||
<mxGeometry x="700" y="1012" width="140" height="250" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="38" value="<span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Frontend%20GraphQL%20Endpoint%20(unversionated)%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22150%22%20y%3D%221010%22%20width%3D%22450%22%20height%3D%22310%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span><span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Frontend%20GraphQL%20Endpoint%20(unversionated)%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22150%22%20y%3D%221010%22%20width%3D%22450%22%20height%3D%22310%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="710" y="1042" width="120" height="30" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="39" value="<span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Frontend%20GraphQL%20Endpoint%20(unversionated)%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22150%22%20y%3D%221010%22%20width%3D%22450%22%20height%3D%22310%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span><span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Frontend%20GraphQL%20Endpoint%20(unversionated)%22%20style%3D%22rounded%3D0%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22150%22%20y%3D%221010%22%20width%3D%22450%22%20height%3D%22310%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="710" y="1082" width="120" height="170" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="48" style="edgeStyle=none;html=1;startArrow=classic;startFill=1;" edge="1" parent="1" source="31" target="39">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="50" value="1.0" style="whiteSpace=wrap;html=1;aspect=fixed;fillColor=#e51400;fontColor=#ffffff;strokeColor=#B20000;" vertex="1" parent="1">
|
||||
<mxGeometry x="481" y="1050" width="40" height="40" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="51" value="1.1" style="whiteSpace=wrap;html=1;aspect=fixed;fillColor=#e51400;fontColor=#ffffff;strokeColor=#B20000;" vertex="1" parent="1">
|
||||
<mxGeometry x="481" y="1100" width="40" height="40" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="52" value="2.1" style="whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;" vertex="1" parent="1">
|
||||
<mxGeometry x="480" y="1200" width="40" height="40" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="53" value="2.0" style="whiteSpace=wrap;html=1;aspect=fixed;fillColor=#fa6800;fontColor=#000000;strokeColor=#C73500;" vertex="1" parent="1">
|
||||
<mxGeometry x="481" y="1150" width="40" height="40" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="54" value="3.0" style="whiteSpace=wrap;html=1;aspect=fixed;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
|
||||
<mxGeometry x="481" y="1252" width="40" height="40" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="59" value="<span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%222.1%22%20style%3D%22whiteSpace%3Dwrap%3Bhtml%3D1%3Baspect%3Dfixed%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22480%22%20y%3D%221200%22%20width%3D%2240%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span><span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%222.1%22%20style%3D%22whiteSpace%3Dwrap%3Bhtml%3D1%3Baspect%3Dfixed%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22480%22%20y%3D%221200%22%20width%3D%2240%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e3c800;fontColor=#000000;strokeColor=#B09500;" vertex="1" parent="1">
|
||||
<mxGeometry x="170" y="1150" width="300" height="142" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="58" value="<font color="rgba(0, 0, 0, 0)" face="monospace"><span style="font-size: 0px">Imp</span></font>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f0a30a;fontColor=#000000;strokeColor=#BD7000;" vertex="1" parent="1">
|
||||
<mxGeometry x="220" y="1100" width="250" height="140" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="57" value="<span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%222.1%22%20style%3D%22whiteSpace%3Dwrap%3Bhtml%3D1%3Baspect%3Dfixed%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22480%22%20y%3D%221200%22%20width%3D%2240%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span><span style="color: rgba(0 , 0 , 0 , 0) ; font-family: monospace ; font-size: 0px">%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%222.1%22%20style%3D%22whiteSpace%3Dwrap%3Bhtml%3D1%3Baspect%3Dfixed%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22480%22%20y%3D%221200%22%20width%3D%2240%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E</span>" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e51400;fontColor=#ffffff;strokeColor=#B20000;" vertex="1" parent="1">
|
||||
<mxGeometry x="280" y="1050" width="190" height="90" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="60" value="Implementation 1.x" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontColor=#FFFFFF;" vertex="1" parent="1">
|
||||
<mxGeometry x="317.5" y="1080" width="115" height="30" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="61" value="Implementation&nbsp;2.x<br>(uses parts of the 1.x implementation)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="287.5" y="1170" width="115" height="30" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="62" value="Implementation 3.x" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontColor=#000000;" vertex="1" parent="1">
|
||||
<mxGeometry x="280" y="1252" width="115" height="30" as="geometry"/>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
BIN
docu/graphics/federation.png
Normal file
BIN
docu/graphics/federation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 102 KiB |
@ -1,5 +1,19 @@
|
||||
CONFIG_VERSION=v1.2022-03-18
|
||||
CONFIG_VERSION=v2.2022-04-07
|
||||
|
||||
# Environment
|
||||
DEFAULT_PUBLISHER_ID=2896
|
||||
|
||||
# Endpoints
|
||||
GRAPHQL_URI=http://localhost/graphql
|
||||
ADMIN_AUTH_URL=http://localhost/admin/authenticate?token={token}
|
||||
|
||||
# Community
|
||||
COMMUNITY_NAME=Gradido Entwicklung
|
||||
COMMUNITY_URL=http://localhost/
|
||||
COMMUNITY_REGISTER_URL=http://localhost/register
|
||||
COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido.
|
||||
|
||||
# Meta
|
||||
META_URL=http://localhost
|
||||
META_TITLE_DE="Gradido – Dein Dankbarkeitskonto"
|
||||
META_TITLE_EN="Gradido - Your gratitude account"
|
||||
@ -8,6 +22,3 @@ META_DESCRIPTION_EN="Gratitude is the currency of the new age. More and more peo
|
||||
META_KEYWORDS_DE="Grundeinkommen, Währung, Dankbarkeit, Schenk-Ökonomie, Natürliche Ökonomie des Lebens, Ökonomie, Ökologie, Potenzialentfaltung, Schenken und Danken, Kreislauf des Lebens, Geldsystem"
|
||||
META_KEYWORDS_EN="Basic Income, Currency, Gratitude, Gift Economy, Natural Economy of Life, Economy, Ecology, Potential Development, Giving and Thanking, Cycle of Life, Monetary System"
|
||||
META_AUTHOR="Bernd Hückstädt - Gradido-Akademie"
|
||||
GRAPHQL_URI=http://localhost/graphql
|
||||
DEFAULT_PUBLISHER_ID=2896
|
||||
ADMIN_AUTH_URL=http://localhost/admin/authenticate?token={token}
|
||||
@ -1,5 +1,19 @@
|
||||
CONFIG_VERSION=$FRONTEND_CONFIG_VERSION
|
||||
|
||||
# Environment
|
||||
DEFAULT_PUBLISHER_ID=$DEFAULT_PUBLISHER_ID
|
||||
|
||||
# Endpoints
|
||||
GRAPHQL_URI=$GRAPHQL_URI
|
||||
ADMIN_AUTH_URL=$ADMIN_AUTH_URL
|
||||
|
||||
# Community
|
||||
COMMUNITY_NAME=$COMMUNITY_NAME
|
||||
COMMUNITY_URL=$COMMUNITY_URL
|
||||
COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL
|
||||
COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION
|
||||
|
||||
# Meta
|
||||
META_URL=$META_URL
|
||||
META_TITLE_DE=$META_TITLE_DE
|
||||
META_TITLE_EN=$META_TITLE_EN
|
||||
@ -8,6 +22,3 @@ META_DESCRIPTION_EN=$META_DESCRIPTION_EN
|
||||
META_KEYWORDS_DE=$META_KEYWORDS_DE
|
||||
META_KEYWORDS_EN=$META_KEYWORDS_EN
|
||||
META_AUTHOR=$META_AUTHOR
|
||||
GRAPHQL_URI=$GRAPHQL_URI
|
||||
DEFAULT_PUBLISHER_ID=$DEFAULT_PUBLISHER_ID
|
||||
ADMIN_AUTH_URL=$ADMIN_AUTH_URL
|
||||
@ -10,7 +10,7 @@
|
||||
"analyse-bundle": "yarn build && webpack-bundle-analyzer dist/webpack.stats.json",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
||||
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
||||
"test": "TZ=UTC jest --coverage",
|
||||
"test": "cross-env TZ=UTC jest --coverage",
|
||||
"locales": "scripts/sort.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -46,7 +46,7 @@
|
||||
"jest-environment-jsdom-sixteen": "^2.0.0",
|
||||
"portal-vue": "^2.1.7",
|
||||
"prettier": "^2.2.1",
|
||||
"qrcode": "^1.4.4",
|
||||
"qrcanvas-vue": "2.1.1",
|
||||
"regenerator-runtime": "^0.13.7",
|
||||
"vee-validate": "^3.4.5",
|
||||
"vue": "2.6.12",
|
||||
@ -57,8 +57,6 @@
|
||||
"vue-jest": "^3.0.7",
|
||||
"vue-loading-overlay": "^3.4.2",
|
||||
"vue-moment": "^4.1.0",
|
||||
"vue-qrcode": "^0.3.5",
|
||||
"vue-qrcode-reader": "^2.3.16",
|
||||
"vue-router": "^3.0.6",
|
||||
"vue2-transitions": "^0.2.3",
|
||||
"vuex": "^3.6.0",
|
||||
@ -73,6 +71,7 @@
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-plugin-component": "^1.1.0",
|
||||
"babel-plugin-transform-require-context": "^0.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"dotenv-webpack": "^7.0.3",
|
||||
"postcss": "^8.4.8",
|
||||
"postcss-html": "^1.3.0",
|
||||
|
||||
BIN
frontend/public/img/gdd-coin.png
Normal file
BIN
frontend/public/img/gdd-coin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
7
frontend/public/img/svg/qr-code.svg
Normal file
7
frontend/public/img/svg/qr-code.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-qr-code" viewBox="0 0 16 16">
|
||||
<path d="M2 2h2v2H2V2Z"/>
|
||||
<path d="M6 0v6H0V0h6ZM5 1H1v4h4V1ZM4 12H2v2h2v-2Z"/>
|
||||
<path d="M6 10v6H0v-6h6Zm-5 1v4h4v-4H1Zm11-9h2v2h-2V2Z"/>
|
||||
<path d="M10 0v6h6V0h-6Zm5 1v4h-4V1h4ZM8 1V0h1v2H8v2H7V1h1Zm0 5V4h1v2H8ZM6 8V7h1V6h1v2h1V7h5v1h-4v1H7V8H6Zm0 0v1H2V8H1v1H0V7h3v1h3Zm10 1h-1V7h1v2Zm-1 0h-1v2h2v-1h-1V9Zm-4 0h2v1h-1v1h-1V9Zm2 3v-1h-1v1h-1v1H9v1h3v-2h1Zm0 0h3v1h-2v1h-1v-2Zm-4-1v1h1v-2H7v1h2Z"/>
|
||||
<path d="M7 12h1v3h4v1H7v-4Zm9 2v2h-3v-1h2v-1h1Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 592 B |
@ -1,11 +1,14 @@
|
||||
<template>
|
||||
<div class="clipboard-copy">
|
||||
<b-input-group size="lg" class="mb-3" prepend="Link">
|
||||
<b-form-input v-model="url" type="text" readonly></b-form-input>
|
||||
<b-form-input :value="link" type="text" readonly></b-form-input>
|
||||
<b-input-group-append>
|
||||
<b-button size="sm" text="Button" variant="success" @click="CopyLink">
|
||||
<b-button size="sm" text="Button" variant="primary" @click="CopyLink">
|
||||
{{ $t('gdd_per_link.copy') }}
|
||||
</b-button>
|
||||
<b-button variant="primary" class="text-light" @click="$emit('show-qr-code-button')">
|
||||
<b-img src="img/svg/qr-code.svg" width="19" class="svg"></b-img>
|
||||
</b-button>
|
||||
</b-input-group-append>
|
||||
</b-input-group>
|
||||
</div>
|
||||
@ -14,17 +17,12 @@
|
||||
export default {
|
||||
name: 'ClipboardCopy',
|
||||
props: {
|
||||
code: { type: String, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
url: `${window.location.origin}/redeem/${this.code}`,
|
||||
}
|
||||
link: { type: String, required: true },
|
||||
},
|
||||
methods: {
|
||||
CopyLink() {
|
||||
navigator.clipboard
|
||||
.writeText(this.url)
|
||||
.writeText(this.link)
|
||||
.then(() => {
|
||||
this.toastSuccess(this.$t('gdd_per_link.link-copied'))
|
||||
})
|
||||
@ -35,3 +33,8 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.svg {
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -9,6 +9,7 @@ const mocks = {
|
||||
},
|
||||
$tc: jest.fn((tc) => tc),
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
}
|
||||
|
||||
const propsData = {
|
||||
@ -16,6 +17,7 @@ const propsData = {
|
||||
{
|
||||
amount: '5',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 87,
|
||||
@ -26,6 +28,7 @@ const propsData = {
|
||||
{
|
||||
amount: '6',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 86,
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<div class="decayinformation-decay">
|
||||
<b-row>
|
||||
<b-col cols="1"></b-col>
|
||||
<b-col cols="11">
|
||||
<div class="d-flex">
|
||||
<div class="text-center pb-3 gradido-max-width">
|
||||
<b-col>
|
||||
<div class="text-center pb-3">
|
||||
<b-icon icon="droplet-half" class="mr-2" />
|
||||
<b>{{ $t('decay.calculation_decay') }}</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col offset="1" cols="11">
|
||||
<b-row>
|
||||
<b-col cols="5" class="text-right">
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
@ -17,6 +17,7 @@
|
||||
<b-col cols="7">
|
||||
<div>
|
||||
{{ previousBookedBalance | GDD }}
|
||||
{{ decay === '0' ? $t('math.minus') : '' }}
|
||||
{{ decay | GDD }} {{ $t('math.equal') }}
|
||||
<b>{{ balance | GDD }}</b>
|
||||
</div>
|
||||
|
||||
@ -1,11 +1,22 @@
|
||||
<template>
|
||||
<div class="decayinformation-startblock">
|
||||
<b-row>
|
||||
<b-col cols="12" class="text-center">
|
||||
<div>
|
||||
<div class="display-4">{{ $t('decay.Starting_block_decay') }}</div>
|
||||
<b-col cols="12">
|
||||
<div class="text-center pb-3">
|
||||
<b-icon icon="droplet-half" class="mr-2" />
|
||||
<b>{{ $t('decay.Starting_block_decay') }}</b>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col offset="1" cols="11">
|
||||
<b-row>
|
||||
<b-col cols="5">
|
||||
<div class="text-right">
|
||||
<div>{{ $t('decay.decay_introduced') }}</div>
|
||||
</div>
|
||||
</b-col>
|
||||
<b-col cols="5">
|
||||
<div>
|
||||
<span v-if="decay.start">
|
||||
{{ $d(new Date(decay.start), 'long') }}
|
||||
@ -13,44 +24,57 @@
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<duration-row :decayStart="decay.start" :decayEnd="decay.end" />
|
||||
|
||||
<!-- Decay-->
|
||||
<b-row>
|
||||
<b-col cols="6" class="text-right">{{ $t('decay.decay') }}</b-col>
|
||||
<b-col cols="6">{{ decay.decay | GDD }}</b-col>
|
||||
<b-col cols="5" class="text-right">{{ $t('decay.decay') }}</b-col>
|
||||
<b-col cols="7">{{ decay.decay | GDD }}</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-2 mb-2" />
|
||||
</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-3 mb-3" />
|
||||
|
||||
<b-row>
|
||||
<b-col class="text-center pt-3 pb-2">
|
||||
<b-col class="text-center pb-3">
|
||||
<b>{{ $t('decay.calculation_total') }}</b>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<!-- Type-->
|
||||
<b-row>
|
||||
<b-col offset="1" cols="11">
|
||||
<b-row>
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||
<b-col cols="6" class="text-right">{{ $t(`decay.types.${typeId.toLowerCase()}`) }}</b-col>
|
||||
<b-col cols="6">{{ amount | GDD }}</b-col>
|
||||
<b-col cols="5" class="text-right">{{ $t(`decay.types.${typeId.toLowerCase()}`) }}</b-col>
|
||||
<b-col cols="7">{{ amount | GDD }}</b-col>
|
||||
</b-row>
|
||||
<!-- Decay-->
|
||||
<b-row>
|
||||
<b-col cols="6" class="text-right">{{ $t('decay.decay') }}</b-col>
|
||||
<b-col cols="6">{{ decay.decay | GDD }}</b-col>
|
||||
<b-col cols="5" class="text-right">{{ $t('decay.decay') }}</b-col>
|
||||
<b-col cols="7">{{ decay.decay | GDD }}</b-col>
|
||||
</b-row>
|
||||
<!-- Total-->
|
||||
<b-row>
|
||||
<b-col cols="6" class="text-right">{{ $t('decay.total') }}</b-col>
|
||||
<b-col cols="6">
|
||||
<b-col cols="5" class="text-right">{{ $t('decay.total') }}</b-col>
|
||||
<b-col cols="7">
|
||||
<b>{{ (Number(amount) + Number(decay.decay)) | GDD }}</b>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import DurationRow from '@/components/TransactionRows/DurationRow.vue'
|
||||
|
||||
export default {
|
||||
name: 'DecayInformation-StartBlock',
|
||||
components: {
|
||||
DurationRow,
|
||||
},
|
||||
props: {
|
||||
balanceDate: { type: String },
|
||||
decayStartBlock: { type: Date },
|
||||
amount: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
<template>
|
||||
<div class="decayinformation-long">
|
||||
<b-row>
|
||||
<b-col cols="1"></b-col>
|
||||
<b-col cols="11">
|
||||
<div class="d-flex">
|
||||
<div class="text-center pb-3 gradido-max-width">
|
||||
<b-col>
|
||||
<div>
|
||||
<div class="text-center pb-3">
|
||||
<b-icon icon="droplet-half" class="mr-2" />
|
||||
<b>{{ $t('decay.calculation_decay') }}</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col offset="1" cols="11">
|
||||
<b-row>
|
||||
<b-col cols="5" class="text-right">
|
||||
<div>{{ $t('decay.last_transaction') }}</div>
|
||||
@ -22,14 +24,7 @@
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col cols="5" class="text-right">
|
||||
<div>{{ $t('decay.past_time') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<span v-if="duration">{{ durationText }}</span>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<duration-row :decayStart="decay.start" :decayEnd="decay.end" />
|
||||
|
||||
<!-- Decay-->
|
||||
<b-row>
|
||||
@ -38,13 +33,17 @@
|
||||
</b-col>
|
||||
<b-col cols="7">{{ decay.decay | GDD }}</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-2 mb-2" />
|
||||
</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-3 mb-3" />
|
||||
<b-row>
|
||||
<b-col class="text-center pt-3 pb-2">
|
||||
<b-col class="text-center pb-3">
|
||||
<b>{{ $t('decay.calculation_total') }}</b>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Type-->
|
||||
<b-row>
|
||||
<b-col offset="1" cols="11">
|
||||
<b-row>
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||
<b-col cols="5" class="text-right">{{ $t(`decay.types.${typeId.toLowerCase()}`) }}</b-col>
|
||||
@ -69,8 +68,13 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import DurationRow from '@/components/TransactionRows/DurationRow.vue'
|
||||
|
||||
export default {
|
||||
name: 'DecayInformation-Long',
|
||||
components: {
|
||||
DurationRow,
|
||||
},
|
||||
props: {
|
||||
amount: { type: String, default: '0' },
|
||||
typeId: { type: String, default: '' },
|
||||
@ -78,22 +82,5 @@ export default {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
duration() {
|
||||
return this.$moment.duration(new Date(this.decay.end) - new Date(this.decay.start))._data
|
||||
},
|
||||
durationText() {
|
||||
const order = ['years', 'months', 'days', 'hours', 'minutes', 'seconds']
|
||||
const result = []
|
||||
order.forEach((timeSpan) => {
|
||||
if (this.duration[timeSpan] > 0) {
|
||||
// eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys
|
||||
const locale = this.$t(`time.${timeSpan}`)
|
||||
result.push(`${this.duration[timeSpan]} ${locale}`)
|
||||
}
|
||||
})
|
||||
return result.join(', ')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
import DecayInformationLong from '../DecayInformations/DecayInformation-Long'
|
||||
import DecayInformationBeforeStartblock from '../DecayInformations/DecayInformation-BeforeStartblock'
|
||||
import DecayInformationDecayStartblock from '../DecayInformations/DecayInformation-DecayStartblock'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -34,14 +35,10 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
decayStartBlock: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
isStartBlock() {
|
||||
return new Date(this.decay.start).getTime() === this.decayStartBlock.getTime()
|
||||
return new Date(this.decay.start).getTime() === CONFIG.DECAY_START_TIME.getTime()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import QrCode from './QrCode'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
describe('QrCode', () => {
|
||||
let wrapper
|
||||
|
||||
const mocks = {
|
||||
$t: jest.fn((t) => t),
|
||||
}
|
||||
|
||||
const stubs = {
|
||||
QrcodeStream: true,
|
||||
QrcodeCapture: true,
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(QrCode, { localVue, mocks, stubs })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the component', () => {
|
||||
expect(wrapper.find('div.alert').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('scanning', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper.find('a').trigger('click')
|
||||
})
|
||||
|
||||
it('has a scanning stream', () => {
|
||||
expect(wrapper.findComponent({ name: 'QrcodeStream' }).exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('decode', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper
|
||||
.findComponent({ name: 'QrcodeStream' })
|
||||
.vm.$emit('decode', '[{"email": "user@example.org", "amount": 10.0}]')
|
||||
})
|
||||
|
||||
it('emits set transaction', () => {
|
||||
expect(wrapper.emitted()['set-transaction']).toEqual([
|
||||
[
|
||||
{
|
||||
email: 'user@example.org',
|
||||
amount: 10,
|
||||
},
|
||||
],
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('detect', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.find('div.row > *').vm.$emit('detect')
|
||||
})
|
||||
|
||||
it('calls onDetect', () => {
|
||||
expect(wrapper.vm.detect).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -1,72 +0,0 @@
|
||||
<template>
|
||||
<b-alert show variant="secondary">
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-v-html -->
|
||||
<span class="alert-text" v-html="$t('form.scann_code')"></span>
|
||||
<b-col v-show="!scan" lg="12" class="text-right">
|
||||
<a @click="toggle" class="nav-link pointer">
|
||||
<img src="img/icons/gradido/qr-scan-pure.png" height="50" />
|
||||
</a>
|
||||
</b-col>
|
||||
|
||||
<div v-if="scan">
|
||||
<b-row>
|
||||
<qrcode-capture @detect="onDetect" capture="user"></qrcode-capture>
|
||||
</b-row>
|
||||
|
||||
<qrcode-stream class="mt-3" @decode="onDecode" @detect="onDetect"></qrcode-stream>
|
||||
|
||||
<b-container>
|
||||
<b-row>
|
||||
<b-col lg="8">
|
||||
<b-alert show variant="secondary">
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-v-html -->
|
||||
<span class="alert-text" v-html="$t('form.scann_code')"></span>
|
||||
</b-alert>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
</div>
|
||||
<div @click="toggle">
|
||||
<b-alert v-show="scan" show variant="primary" class="pointer text-center">
|
||||
<span class="alert-text">
|
||||
<strong>{{ $t('form.cancel') }}</strong>
|
||||
</span>
|
||||
</b-alert>
|
||||
</div>
|
||||
</b-alert>
|
||||
</template>
|
||||
<script>
|
||||
import { QrcodeStream } from 'vue-qrcode-reader'
|
||||
|
||||
export default {
|
||||
name: 'QrCode',
|
||||
components: {
|
||||
QrcodeStream,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scan: false,
|
||||
detect: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggle() {
|
||||
this.scan = !this.scan
|
||||
},
|
||||
async onDecode(decodedString) {
|
||||
const arr = JSON.parse(decodedString)
|
||||
this.$emit('set-transaction', { email: arr[0].email, amount: arr[0].amount })
|
||||
this.scan = false
|
||||
},
|
||||
async onDetect() {
|
||||
// TODO: what is this for? I added the detect data to test that the method is called
|
||||
this.detect = !this.detect
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@ -1,33 +1,46 @@
|
||||
<template>
|
||||
<b-container>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-card class="p-0 gradido-custom-background">
|
||||
<div class="p-4">
|
||||
<div class="h3 mb-5">{{ $t('gdd_per_link.created') }}</div>
|
||||
<clipboard-copy :code="code" />
|
||||
<div class="h3 mb-4">{{ $t('gdd_per_link.created') }}</div>
|
||||
<clipboard-copy :link="link" @show-qr-code-button="showQrCodeButton" />
|
||||
|
||||
<div class="text-center">
|
||||
<figure-qr-code v-if="showQrcode" :link="link" />
|
||||
|
||||
<b-button variant="secondary" @click="$emit('on-reset')" class="mt-4">
|
||||
{{ $t('form.close') }}
|
||||
</b-button>
|
||||
</div>
|
||||
<p class="text-center mt-3">
|
||||
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
|
||||
</p>
|
||||
</b-card>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
</template>
|
||||
<script>
|
||||
import ClipboardCopy from '../ClipboardCopy.vue'
|
||||
import FigureQrCode from '../QrCode/FigureQrCode.vue'
|
||||
|
||||
export default {
|
||||
name: 'TransactionResultLink',
|
||||
components: {
|
||||
ClipboardCopy,
|
||||
FigureQrCode,
|
||||
},
|
||||
props: {
|
||||
code: {
|
||||
link: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showQrcode: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showQrCodeButton() {
|
||||
this.showQrcode = !this.showQrcode
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -22,7 +22,9 @@
|
||||
<div v-else>{{ errorResult }}</div>
|
||||
</div>
|
||||
<p class="text-center mt-3">
|
||||
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
|
||||
<b-button variant="secondary" @click="$emit('on-reset')">
|
||||
{{ $t('form.close') }}
|
||||
</b-button>
|
||||
</p>
|
||||
</b-card>
|
||||
</b-col>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
{{ $t('form.send_transaction_success') }}
|
||||
</div>
|
||||
<p class="text-center mt-3">
|
||||
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
|
||||
<b-button variant="primary" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
|
||||
</p>
|
||||
</b-card>
|
||||
</b-col>
|
||||
|
||||
@ -23,7 +23,7 @@ describe('GddTransactionList', () => {
|
||||
return mount(GddTransactionList, { localVue, mocks })
|
||||
}
|
||||
|
||||
const decayStartBlock = new Date(2001, 8, 9)
|
||||
const decayStartBlock = new Date('2021-05-13 17:46:31-0000')
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
@ -413,12 +413,16 @@ describe('GddTransactionList', () => {
|
||||
return {
|
||||
amount: '3.14',
|
||||
balanceDate: '2021-04-29T17:26:40+00:00',
|
||||
decay: {},
|
||||
decay: {
|
||||
decay: '-477.01',
|
||||
start: '2021-05-13T17:46:31.000Z',
|
||||
end: '2022-04-20T06:51:25.000Z',
|
||||
duration: 29509494,
|
||||
},
|
||||
memo: 'Kreiszahl PI',
|
||||
linkedUser: {
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
__typename: 'User',
|
||||
},
|
||||
id: idx + 1,
|
||||
typeId: 'RECEIVE',
|
||||
@ -435,6 +439,7 @@ describe('GddTransactionList', () => {
|
||||
describe('next page button clicked', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// await wrapper.vm.$nextTick()
|
||||
await wrapper.findComponent({ name: 'BPagination' }).vm.$emit('input', 2)
|
||||
})
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
<transaction-send
|
||||
class="list-group-item"
|
||||
v-bind="transactions[index]"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
:previousBookedBalance="previousBookedBalance(index)"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
@ -36,7 +35,6 @@
|
||||
<transaction-receive
|
||||
class="list-group-item"
|
||||
v-bind="transactions[index]"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
:previousBookedBalance="previousBookedBalance(index)"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
@ -46,7 +44,6 @@
|
||||
<transaction-creation
|
||||
class="list-group-item"
|
||||
v-bind="transactions[index]"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
:previousBookedBalance="previousBookedBalance(index)"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
@ -105,7 +102,6 @@ export default {
|
||||
}
|
||||
},
|
||||
props: {
|
||||
decayStartBlock: { type: Date },
|
||||
transactions: { default: () => [] },
|
||||
pageSize: { type: Number, default: 25 },
|
||||
timestamp: { type: Number, default: 0 },
|
||||
|
||||
@ -1,24 +1,9 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { GdtEntryType } from '@/graphql/enums'
|
||||
import GdtTransactionList from './GdtTransactionList'
|
||||
|
||||
import { toastErrorSpy } from '@test/testSetup'
|
||||
import { GdtEntryType } from '@/graphql/enums'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const apolloMock = jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
listGDTEntries: {
|
||||
count: 0,
|
||||
gdtEntries: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const windowScrollToMock = jest.fn()
|
||||
|
||||
window.scrollTo = windowScrollToMock
|
||||
|
||||
const state = {
|
||||
language: 'en',
|
||||
}
|
||||
@ -37,16 +22,20 @@ describe('GdtTransactionList ', () => {
|
||||
$t: jest.fn((t) => t),
|
||||
$n: jest.fn((n) => n),
|
||||
$d: jest.fn((d) => d),
|
||||
$apollo: {
|
||||
query: apolloMock,
|
||||
},
|
||||
}
|
||||
|
||||
const propsData = {
|
||||
transactionsGdt: [],
|
||||
transactionGdtCount: 0,
|
||||
pageSize: 25,
|
||||
value: 1,
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(GdtTransactionList, { localVue, mocks })
|
||||
return mount(GdtTransactionList, { localVue, mocks, propsData })
|
||||
}
|
||||
|
||||
describe('mount - When no transactions are loaded', () => {
|
||||
describe('transactionGdtCount is 0', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
@ -62,13 +51,12 @@ describe('GdtTransactionList ', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('mount - When transactions are loaded', () => {
|
||||
beforeEach(() => {
|
||||
apolloMock.mockResolvedValue({
|
||||
data: {
|
||||
listGDTEntries: {
|
||||
count: 4,
|
||||
gdtEntries: [
|
||||
describe('Transactions are loaded', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper = Wrapper()
|
||||
await wrapper.setProps({
|
||||
transactionGdtCount: 42,
|
||||
transactionsGdt: [
|
||||
{
|
||||
id: 1,
|
||||
amount: 100,
|
||||
@ -106,10 +94,7 @@ describe('GdtTransactionList ', () => {
|
||||
gdtEntryType: GdtEntryType.ELOPAGE_PUBLISHER,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the component', () => {
|
||||
@ -120,83 +105,25 @@ describe('GdtTransactionList ', () => {
|
||||
expect(wrapper.find('.gdt-funding').exists()).toBe(false)
|
||||
})
|
||||
|
||||
describe('server returns valid data', () => {
|
||||
it('calls the API', async () => {
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(apolloMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
pageSize: 25,
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it('scrolls to (0, 0) after API call', () => {
|
||||
expect(windowScrollToMock).toBeCalledWith(0, 0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('server returns error', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks()
|
||||
apolloMock.mockRejectedValue({
|
||||
message: 'Ouch!',
|
||||
})
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
expect(toastErrorSpy).toBeCalledWith('Ouch!')
|
||||
})
|
||||
})
|
||||
|
||||
describe('change of currentPage', () => {
|
||||
it('calls the API after currentPage changes', async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.setData({ transactionGdtCount: 42 })
|
||||
await wrapper.findComponent({ name: 'BPagination' }).vm.$emit('input', 2)
|
||||
expect(apolloMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
currentPage: 2,
|
||||
pageSize: 25,
|
||||
},
|
||||
}),
|
||||
)
|
||||
expect(wrapper.emitted('input')).toEqual([[2]])
|
||||
})
|
||||
|
||||
describe('pagination buttons', () => {
|
||||
describe('with transactionCount > pageSize', () => {
|
||||
beforeEach(async () => {
|
||||
apolloMock.mockResolvedValue({
|
||||
data: {
|
||||
listGDTEntries: {
|
||||
count: 42,
|
||||
gdtEntries: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('shows the pagination buttons', () => {
|
||||
expect(wrapper.find('ul.pagination').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with transactionCount < pageSize', () => {
|
||||
beforeEach(async () => {
|
||||
apolloMock.mockResolvedValue({
|
||||
data: {
|
||||
listGDTEntries: {
|
||||
count: 2,
|
||||
gdtEntries: [],
|
||||
},
|
||||
},
|
||||
beforeEach(() => {
|
||||
wrapper.setProps({
|
||||
transactionGdtCount: 10,
|
||||
})
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('shows no pagination buttons', () => {
|
||||
@ -205,5 +132,17 @@ describe('GdtTransactionList ', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('server not reachable', () => {
|
||||
beforeEach(() => {
|
||||
wrapper.setProps({
|
||||
transactionGdtCount: -1,
|
||||
})
|
||||
})
|
||||
|
||||
it('renders the not-reachable text', () => {
|
||||
expect(wrapper.text()).toBe('gdt.not-reachable')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
{{ $t('gdt.funding') }}
|
||||
</b-button>
|
||||
</div>
|
||||
<div v-else-if="typeof transactionGdtCount === 'object'" class="text-center">
|
||||
<div v-else-if="transactionGdtCount === -1" class="text-center">
|
||||
{{ $t('gdt.not-reachable') }}
|
||||
</div>
|
||||
<div
|
||||
@ -41,7 +41,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGDTEntriesQuery } from '@/graphql/queries'
|
||||
import Transaction from '@/components/Transaction.vue'
|
||||
|
||||
export default {
|
||||
@ -49,44 +48,24 @@ export default {
|
||||
components: {
|
||||
Transaction,
|
||||
},
|
||||
props: {
|
||||
transactionsGdt: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
transactionGdtCount: { type: Number, required: true },
|
||||
pageSize: { type: Number, required: true },
|
||||
value: { type: Number, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
transactionsGdt: [],
|
||||
transactionGdtCount: { type: Number, default: 0 },
|
||||
currentPage: 1,
|
||||
pageSize: 25,
|
||||
currentPage: this.value,
|
||||
link: 'https://gradido.net/' + this.$store.state.language + '/memberships/',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async updateGdt() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: listGDTEntriesQuery,
|
||||
variables: {
|
||||
currentPage: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
},
|
||||
})
|
||||
.then((result) => {
|
||||
const {
|
||||
data: { listGDTEntries },
|
||||
} = result
|
||||
this.transactionsGdt = listGDTEntries.gdtEntries
|
||||
this.transactionGdtCount = listGDTEntries.count
|
||||
window.scrollTo(0, 0)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toastError(error.message)
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.updateGdt()
|
||||
},
|
||||
watch: {
|
||||
currentPage() {
|
||||
this.updateGdt()
|
||||
if (this.value !== this.currentPage) this.$emit('input', this.currentPage)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
<b-button variant="primary" :to="register">
|
||||
{{ $t('gdd_per_link.to-register') }}
|
||||
</b-button>
|
||||
<p class="mt-3">{{ $t('gdd_per_link.isFree') }}</p>
|
||||
</b-col>
|
||||
<b-col sm="12" md="6" class="mt-xs-6 mt-sm-6 mt-md-0">
|
||||
<p>{{ $t('gdd_per_link.has-account') }}</p>
|
||||
|
||||
30
frontend/src/components/QrCode/FigureQrCode.spec.js
Normal file
30
frontend/src/components/QrCode/FigureQrCode.spec.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import FigureQrCode from './FigureQrCode'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const propsData = {
|
||||
link: '',
|
||||
}
|
||||
|
||||
describe('FigureQrCode', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(FigureQrCode, { localVue, propsData })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the Div Element ".figure-qr-code"', () => {
|
||||
expect(wrapper.find('div.figure-qr-code').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders the Div Element "q-r-canvas"', () => {
|
||||
expect(wrapper.find('q-r-canvas'))
|
||||
})
|
||||
})
|
||||
})
|
||||
51
frontend/src/components/QrCode/FigureQrCode.vue
Normal file
51
frontend/src/components/QrCode/FigureQrCode.vue
Normal file
@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="figure-qr-code">
|
||||
<div class="qrbox">
|
||||
<q-r-canvas :options="options" class="canvas" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { QRCanvas } from 'qrcanvas-vue'
|
||||
|
||||
export default {
|
||||
name: 'FigureQrCode',
|
||||
components: {
|
||||
QRCanvas,
|
||||
},
|
||||
props: {
|
||||
link: { type: String, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: {
|
||||
cellSize: 8,
|
||||
correctLevel: 'H',
|
||||
data: this.link,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const image = new Image()
|
||||
image.src = 'img/gdd-coin.png'
|
||||
image.onload = () => {
|
||||
this.options = {
|
||||
...this.options,
|
||||
logo: {
|
||||
image,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.qrbox {
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.canvas {
|
||||
width: 90%;
|
||||
max-width: 300px;
|
||||
}
|
||||
</style>
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="gdt-transaction-collapse p-2 pt-4 pb-4 mb-4 gradido-no-border gradido-background-f1">
|
||||
<div class="gdt-transaction-collapse p-2 pt-4 pb-4 mb-4 gradido-no-border bg-secondary">
|
||||
<b-row class="gdt-list-collapse-header-text text-center pb-3">
|
||||
<b-col class="collapse-headline">
|
||||
<b>{{ getLinesByType.headline }}</b>
|
||||
|
||||
@ -13,6 +13,7 @@ const mocks = {
|
||||
locale: 'en',
|
||||
},
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
$tc: jest.fn((tc) => tc),
|
||||
$apollo: {
|
||||
mutate: mockAPIcall,
|
||||
@ -21,10 +22,10 @@ const mocks = {
|
||||
|
||||
const propsData = {
|
||||
amount: '75',
|
||||
code: 'c00000000c000000c0000',
|
||||
link: 'http://localhost/redeem/c00000000c000000c0000',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 12,
|
||||
memo: 'Wie schön hier etwas Quatsch zu lesen!',
|
||||
memo: 'Katzenauge, Eulenschrei, was verschwunden komm herbei!',
|
||||
validUntil: '2022-03-30T14:22:40.000Z',
|
||||
}
|
||||
|
||||
@ -43,6 +44,29 @@ describe('TransactionLink', () => {
|
||||
expect(wrapper.find('div.transaction-link').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('Link validUntil Date is not valid', () => {
|
||||
it('has no copy link button', () => {
|
||||
expect(wrapper.find('.test-copy-link').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('has no Qr-Code Button ', () => {
|
||||
expect(wrapper.find('.test-qr-code').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('has delete link button ', () => {
|
||||
expect(wrapper.find('.test-delete-link').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Link validUntil Date is valid ', () => {
|
||||
beforeEach(async () => {
|
||||
const now = new Date()
|
||||
jest.clearAllMocks()
|
||||
await wrapper.setProps({
|
||||
validUntil: `${new Date(now.getFullYear(), now.getMonth(), now.getDate() + 2)}`,
|
||||
})
|
||||
})
|
||||
|
||||
describe('Copy link to Clipboard', () => {
|
||||
const navigatorClipboard = navigator.clipboard
|
||||
beforeAll(() => {
|
||||
@ -56,22 +80,37 @@ describe('TransactionLink', () => {
|
||||
describe('copy with success', () => {
|
||||
beforeEach(async () => {
|
||||
navigatorClipboardMock.mockResolvedValue()
|
||||
await wrapper.findAll('button').at(0).trigger('click')
|
||||
await wrapper.find('.test-copy-link .dropdown-item').trigger('click')
|
||||
})
|
||||
|
||||
it('should call clipboard.writeText', () => {
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(
|
||||
'http://localhost/redeem/c00000000c000000c0000',
|
||||
)
|
||||
})
|
||||
it('toasts success message', () => {
|
||||
expect(toastSuccessSpy).toBeCalledWith('gdd_per_link.link-copied')
|
||||
})
|
||||
})
|
||||
|
||||
describe('copy with error', () => {
|
||||
beforeEach(async () => {
|
||||
navigatorClipboardMock.mockRejectedValue()
|
||||
await wrapper.findAll('button').at(0).trigger('click')
|
||||
})
|
||||
|
||||
it('toasts error message', () => {
|
||||
expect(toastErrorSpy).toBeCalledWith('gdd_per_link.not-copied')
|
||||
describe('qr code modal', () => {
|
||||
let spy
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
describe('with success', () => {
|
||||
beforeEach(async () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'show')
|
||||
// spy.mockImplementation(() => Promise.resolve('some value'))
|
||||
// mockAPIcall.mockResolvedValue()
|
||||
await wrapper.find('.test-qr-code .dropdown-item').trigger('click')
|
||||
})
|
||||
|
||||
it('opens the qr-code Modal', () => {
|
||||
expect(spy).toBeCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -79,7 +118,7 @@ describe('TransactionLink', () => {
|
||||
describe('delete link', () => {
|
||||
let spy
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
@ -88,10 +127,10 @@ describe('TransactionLink', () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
spy.mockImplementation(() => Promise.resolve('some value'))
|
||||
mockAPIcall.mockResolvedValue()
|
||||
await wrapper.findAll('button').at(1).trigger('click')
|
||||
await wrapper.find('.test-delete-link .dropdown-item').trigger('click')
|
||||
})
|
||||
|
||||
it('test Modal if confirm true', () => {
|
||||
it('opens the modal ', () => {
|
||||
expect(spy).toBeCalled()
|
||||
})
|
||||
|
||||
@ -120,7 +159,7 @@ describe('TransactionLink', () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
spy.mockImplementation(() => Promise.resolve('some value'))
|
||||
mockAPIcall.mockRejectedValue({ message: 'Something went wrong :(' })
|
||||
await wrapper.findAll('button').at(1).trigger('click')
|
||||
await wrapper.find('.test-delete-link .dropdown-item').trigger('click')
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
@ -133,7 +172,7 @@ describe('TransactionLink', () => {
|
||||
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||
spy.mockImplementation(() => Promise.resolve(false))
|
||||
mockAPIcall.mockResolvedValue()
|
||||
await wrapper.findAll('button').at(1).trigger('click')
|
||||
await wrapper.find('.test-delete-link .dropdown-item').trigger('click')
|
||||
})
|
||||
|
||||
it('does not call the API', () => {
|
||||
@ -142,4 +181,5 @@ describe('TransactionLink', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -1,38 +1,55 @@
|
||||
<template>
|
||||
<div class="transaction-link gradido-custom-background">
|
||||
<b-row class="mb-2 pt-2 pb-2">
|
||||
<b-col cols="2">
|
||||
<b-row :class="validLink ? '' : 'bg-muted text-light'" class="mb-2 pt-2 pb-2">
|
||||
<b-col cols="1">
|
||||
<type-icon color="text-danger" icon="link45deg" class="pt-4 pl-2" />
|
||||
</b-col>
|
||||
<b-col cols="9">
|
||||
<b-col cols="11">
|
||||
<b-row>
|
||||
<b-col>
|
||||
<amount-and-name-row :amount="amount" :text="$t('form.amount')" />
|
||||
<memo-row :memo="memo" />
|
||||
<date-row :date="validUntil" :diffNow="true" />
|
||||
<date-row :date="validUntil" :diffNow="true" :validLink="validLink" />
|
||||
<decay-row :decay="decay" />
|
||||
</b-col>
|
||||
<b-col cols="12" lg="1" md="1" class="text-center text-md-right pr-5 pr-lg-4">
|
||||
<b-dropdown no-caret right aria-expanded="false" size="sm">
|
||||
<template #button-content>
|
||||
<b-icon icon="three-dots-vertical"></b-icon>
|
||||
</template>
|
||||
|
||||
<b-col cols="1" class="text-right">
|
||||
<b-button
|
||||
class="p-2"
|
||||
size="sm"
|
||||
variant="outline-primary"
|
||||
@click="copy"
|
||||
:title="$t('gdd_per_link.copy')"
|
||||
>
|
||||
<b-dropdown-item v-if="validLink" class="test-copy-link" @click="copy">
|
||||
<b-icon icon="clipboard"></b-icon>
|
||||
</b-button>
|
||||
<br />
|
||||
<b-button
|
||||
class="p-2 mt-3"
|
||||
size="sm"
|
||||
variant="outline-danger"
|
||||
@click="deleteLink()"
|
||||
:title="$t('delete')"
|
||||
{{ $t('gdd_per_link.copy') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
v-if="validLink"
|
||||
@click="$bvModal.show('modalPopover-' + id)"
|
||||
class="pt-3 pb-3 test-qr-code"
|
||||
>
|
||||
<b-img src="img/svg/qr-code.svg" width="18" class="filter"></b-img>
|
||||
{{ $t('qrCode') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item class="test-delete-link" @click="deleteLink()">
|
||||
<b-icon icon="trash"></b-icon>
|
||||
</b-button>
|
||||
{{ $t('delete') }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-modal :id="'modalPopover-' + id" ok-only hide-header-close>
|
||||
<b-card header-tag="header" footer-tag="footer">
|
||||
<template #header>
|
||||
<h6 class="mb-0">{{ $t('qrCode') }}</h6>
|
||||
</template>
|
||||
<b-card-text><figure-qr-code class="text-center" :link="link" /></b-card-text>
|
||||
<template #footer>
|
||||
<em>{{ link }}</em>
|
||||
</template>
|
||||
</b-card>
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -42,6 +59,7 @@ import AmountAndNameRow from '../TransactionRows/AmountAndNameRow'
|
||||
import MemoRow from '../TransactionRows/MemoRow'
|
||||
import DateRow from '../TransactionRows/DateRow'
|
||||
import DecayRow from '../TransactionRows/DecayRow'
|
||||
import FigureQrCode from '@/components/QrCode/FigureQrCode.vue'
|
||||
|
||||
export default {
|
||||
name: 'TransactionLink',
|
||||
@ -51,10 +69,11 @@ export default {
|
||||
MemoRow,
|
||||
DateRow,
|
||||
DecayRow,
|
||||
FigureQrCode,
|
||||
},
|
||||
props: {
|
||||
amount: { type: String, required: true },
|
||||
code: { type: String, required: true },
|
||||
link: { type: String, required: true },
|
||||
holdAvailableAmount: { type: String, required: true },
|
||||
id: { type: Number, required: true },
|
||||
memo: { type: String, required: true },
|
||||
@ -62,9 +81,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
copy() {
|
||||
const link = `${window.location.origin}/redeem/${this.code}`
|
||||
navigator.clipboard
|
||||
.writeText(link)
|
||||
.writeText(this.link)
|
||||
.then(() => {
|
||||
this.toastSuccess(this.$t('gdd_per_link.link-copied'))
|
||||
})
|
||||
@ -96,6 +114,18 @@ export default {
|
||||
decay() {
|
||||
return `${this.amount - this.holdAvailableAmount}`
|
||||
},
|
||||
validLink() {
|
||||
return new Date(this.validUntil) > new Date()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.qr-button {
|
||||
position: relative;
|
||||
right: 20px;
|
||||
}
|
||||
.filter {
|
||||
filter: opacity(0.6);
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
<b-row>
|
||||
<b-col cols="5">
|
||||
<div class="text-right">
|
||||
{{ diffNow ? $t('gdd_per_link.valid_until') : $t('form.date') }}
|
||||
{{ text }}
|
||||
</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<div class="gdd-transaction-list-item-date">
|
||||
{{ dateString }}
|
||||
{{ $d(new Date(this.date), 'long') }}
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -27,12 +27,19 @@ export default {
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
validLink: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
dateString() {
|
||||
return this.diffNow
|
||||
? this.$moment(this.date).locale(this.$i18n.locale).fromNow()
|
||||
: this.$d(new Date(this.date), 'long')
|
||||
text() {
|
||||
if (this.diffNow)
|
||||
return this.validLink
|
||||
? this.$t('gdd_per_link.validUntil')
|
||||
: this.$t('gdd_per_link.expiredOn')
|
||||
return this.$t('form.date')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
44
frontend/src/components/TransactionRows/DurationRow.vue
Normal file
44
frontend/src/components/TransactionRows/DurationRow.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="duration-row">
|
||||
<b-row>
|
||||
<b-col cols="5" class="text-right">
|
||||
<div>{{ $t('decay.past_time') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<span v-if="duration">{{ durationText }}</span>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'DurationRow',
|
||||
props: {
|
||||
decayStart: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
decayEnd: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
duration() {
|
||||
return this.$moment.duration(new Date(this.decayEnd) - new Date(this.decayStart))._data
|
||||
},
|
||||
durationText() {
|
||||
const order = ['years', 'months', 'days', 'hours', 'minutes', 'seconds']
|
||||
const result = []
|
||||
order.forEach((timeSpan) => {
|
||||
if (this.duration[timeSpan] > 0) {
|
||||
// eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys
|
||||
const locale = this.$t(`time.${timeSpan}`)
|
||||
result.push(`${this.duration[timeSpan]} ${locale}`)
|
||||
}
|
||||
})
|
||||
return result.join(', ')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -27,12 +27,7 @@
|
||||
</div>
|
||||
|
||||
<b-collapse :class="visible ? 'bg-secondary' : ''" class="pb-4 pt-5" v-model="visible">
|
||||
<decay-information
|
||||
:typeId="typeId"
|
||||
:decay="decay"
|
||||
:amount="amount"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
/>
|
||||
<decay-information :typeId="typeId" :decay="decay" :amount="amount" />
|
||||
</b-collapse>
|
||||
</div>
|
||||
</div>
|
||||
@ -82,10 +77,6 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
decayStartBlock: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
previousBookedBalance: {
|
||||
type: String,
|
||||
required: true,
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
</b-row>
|
||||
</div>
|
||||
|
||||
<b-collapse class="pb-4 pt-5" v-model="visible">
|
||||
<b-collapse :class="visible ? 'bg-secondary' : ''" class="pb-4 pt-5" v-model="visible">
|
||||
<decay-information-decay
|
||||
:balance="balance"
|
||||
:decay="decay.decay"
|
||||
|
||||
@ -12,6 +12,7 @@ const mocks = {
|
||||
locale: 'en',
|
||||
},
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
$tc: jest.fn((tc) => tc),
|
||||
$apollo: {
|
||||
query: apolloQueryMock,
|
||||
@ -43,7 +44,7 @@ describe('TransactionLinkSummary', () => {
|
||||
listTransactionLinks: [
|
||||
{
|
||||
amount: '75',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 86,
|
||||
@ -54,7 +55,7 @@ describe('TransactionLinkSummary', () => {
|
||||
},
|
||||
{
|
||||
amount: '85',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 107,
|
||||
@ -64,7 +65,7 @@ describe('TransactionLinkSummary', () => {
|
||||
},
|
||||
{
|
||||
amount: '95',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 92,
|
||||
@ -75,7 +76,7 @@ describe('TransactionLinkSummary', () => {
|
||||
},
|
||||
{
|
||||
amount: '150',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 16,
|
||||
@ -99,6 +100,11 @@ describe('TransactionLinkSummary', () => {
|
||||
expect(wrapper.findComponent({ name: 'CollapseLinksList' }).exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('click on transaction links', () => {
|
||||
beforeEach(() => {
|
||||
wrapper.find('div.transaction-link-details').trigger('click')
|
||||
})
|
||||
|
||||
it('calls the API to get the list transaction links', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith({
|
||||
query: listTransactionLinks,
|
||||
@ -113,17 +119,27 @@ describe('TransactionLinkSummary', () => {
|
||||
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
||||
})
|
||||
|
||||
describe('reset transaction links', () => {
|
||||
beforeEach(async () => {
|
||||
describe('close transaction link details', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.setData({
|
||||
currentPage: 0,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
})
|
||||
wrapper.find('div.transaction-link-details').trigger('click')
|
||||
})
|
||||
|
||||
it('reloads transaction links', () => {
|
||||
it('does not call the API', () => {
|
||||
expect(apolloQueryMock).not.toBeCalled()
|
||||
})
|
||||
|
||||
it('has no component CollapseLinksList', () => {
|
||||
expect(wrapper.findComponent({ name: 'CollapseLinksList' }).isVisible()).toBe(false)
|
||||
})
|
||||
|
||||
describe('reopen transaction link details', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
wrapper.find('div.transaction-link-details').trigger('click')
|
||||
})
|
||||
|
||||
it('calls the API to get the list transaction links', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith({
|
||||
query: listTransactionLinks,
|
||||
variables: {
|
||||
@ -133,14 +149,11 @@ describe('TransactionLinkSummary', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('emits update transactions', () => {
|
||||
expect(wrapper.emitted('update-transactions')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('has four transaction links in list', () => {
|
||||
it('has four transactionLinks', () => {
|
||||
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('load more transaction links', () => {
|
||||
beforeEach(async () => {
|
||||
@ -150,7 +163,7 @@ describe('TransactionLinkSummary', () => {
|
||||
listTransactionLinks: [
|
||||
{
|
||||
amount: '76',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 87,
|
||||
@ -161,7 +174,7 @@ describe('TransactionLinkSummary', () => {
|
||||
},
|
||||
{
|
||||
amount: '86',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 108,
|
||||
@ -172,7 +185,7 @@ describe('TransactionLinkSummary', () => {
|
||||
},
|
||||
{
|
||||
amount: '96',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 93,
|
||||
@ -183,7 +196,7 @@ describe('TransactionLinkSummary', () => {
|
||||
},
|
||||
{
|
||||
amount: '150',
|
||||
code: 'ce28664b5308c17f931c0367',
|
||||
link: 'http://localhost/redeem/ce28664b5308c17f931c0367',
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 17,
|
||||
@ -215,11 +228,41 @@ describe('TransactionLinkSummary', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('reset transaction links', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.setData({
|
||||
currentPage: 0,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
})
|
||||
})
|
||||
|
||||
it('reloads transaction links', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith({
|
||||
query: listTransactionLinks,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
})
|
||||
})
|
||||
|
||||
it('emits update transactions', () => {
|
||||
expect(wrapper.emitted('update-transactions')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('has four transaction links in list', () => {
|
||||
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
||||
})
|
||||
})
|
||||
|
||||
describe('loads transaction links with error', () => {
|
||||
beforeEach(() => {
|
||||
apolloQueryMock.mockRejectedValue({ message: 'OUCH!' })
|
||||
wrapper = Wrapper()
|
||||
wrapper.find('div.transaction-link-details').trigger('click')
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="transaction-slot-link">
|
||||
<div class="transaction-slot-link gradido-shadow-inset">
|
||||
<div>
|
||||
<div @click="visible = !visible">
|
||||
<div class="transaction-link-details" @click="showTransactionLinks()">
|
||||
<!-- Collaps Icon -->
|
||||
<collapse-icon class="text-right" :visible="visible" />
|
||||
<div>
|
||||
@ -79,6 +79,15 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showTransactionLinks() {
|
||||
if (this.visible) {
|
||||
this.visible = false
|
||||
} else {
|
||||
this.transactionLinks = []
|
||||
this.updateListTransactionLinks()
|
||||
this.visible = true
|
||||
}
|
||||
},
|
||||
async updateListTransactionLinks() {
|
||||
if (this.currentPage === 0) {
|
||||
this.transactionLinks = []
|
||||
@ -110,8 +119,5 @@ export default {
|
||||
this.updateListTransactionLinks()
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.updateListTransactionLinks()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -33,12 +33,7 @@
|
||||
</div>
|
||||
|
||||
<b-collapse :class="visible ? 'bg-secondary' : ''" class="pb-4 pt-5" v-model="visible">
|
||||
<decay-information
|
||||
:typeId="typeId"
|
||||
:decay="decay"
|
||||
:amount="amount"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
/>
|
||||
<decay-information :typeId="typeId" :decay="decay" :amount="amount" />
|
||||
</b-collapse>
|
||||
</div>
|
||||
</div>
|
||||
@ -87,10 +82,6 @@ export default {
|
||||
typeId: {
|
||||
type: String,
|
||||
},
|
||||
decayStartBlock: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
transactionLinkId: {
|
||||
type: Number,
|
||||
required: false,
|
||||
|
||||
@ -33,12 +33,7 @@
|
||||
</div>
|
||||
|
||||
<b-collapse :class="visible ? 'bg-secondary' : ''" class="pb-4 pt-5" v-model="visible">
|
||||
<decay-information
|
||||
:typeId="typeId"
|
||||
:decay="decay"
|
||||
:amount="amount"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
/>
|
||||
<decay-information :typeId="typeId" :decay="decay" :amount="amount" />
|
||||
</b-collapse>
|
||||
</div>
|
||||
</div>
|
||||
@ -88,10 +83,6 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
decayStartBlock: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
transactionLinkId: {
|
||||
type: Number,
|
||||
required: false,
|
||||
|
||||
@ -11,7 +11,8 @@ describe('UserCard', () => {
|
||||
$n: jest.fn((n) => String(n)),
|
||||
$store: {
|
||||
state: {
|
||||
email: 'user@example.org',
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -28,9 +29,12 @@ describe('UserCard', () => {
|
||||
it('renders the Div Element ".userdata-card"', () => {
|
||||
expect(wrapper.find('div.userdata-card').exists()).toBeTruthy()
|
||||
})
|
||||
it('renders the SPAN Element ".b-avatar"', () => {
|
||||
expect(wrapper.find('span.b-avatar').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders the Div Element "vue-qrcode"', () => {
|
||||
expect(wrapper.find('vue-qrcode'))
|
||||
it('find the first letters of the firstName and lastName', () => {
|
||||
expect(wrapper.find('span.b-avatar').text()).toBe('B B')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -2,11 +2,7 @@
|
||||
<div class="userdata-card">
|
||||
<b-card class="bg-transparent border-0">
|
||||
<div class="w-100 text-center">
|
||||
<vue-qrcode
|
||||
v-if="$store.state.email"
|
||||
:value="$store.state.email"
|
||||
type="image/png"
|
||||
></vue-qrcode>
|
||||
<b-avatar variant="primary" :text="avatar" size="6rem"></b-avatar>
|
||||
</div>
|
||||
|
||||
<b-container class="d-flex justify-content-center mt-md-5">
|
||||
@ -37,16 +33,16 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import VueQrcode from 'vue-qrcode'
|
||||
|
||||
export default {
|
||||
name: 'UserCard',
|
||||
components: {
|
||||
VueQrcode,
|
||||
},
|
||||
props: {
|
||||
balance: { type: Number, default: 0 },
|
||||
transactionCount: { type: Number, default: 0 },
|
||||
},
|
||||
computed: {
|
||||
avatar() {
|
||||
return `${this.$store.state.firstName[0]} ${this.$store.state.lastName[0]}`
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -5,9 +5,10 @@
|
||||
const pkg = require('../../package')
|
||||
|
||||
const constants = {
|
||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
||||
CONFIG_VERSION: {
|
||||
DEFAULT: 'DEFAULT',
|
||||
EXPECTED: 'v1.2022-03-18',
|
||||
EXPECTED: 'v2.2022-04-07',
|
||||
CURRENT: '',
|
||||
},
|
||||
}
|
||||
@ -27,6 +28,19 @@ const environment = {
|
||||
PORT: process.env.PORT || 3000,
|
||||
}
|
||||
|
||||
const endpoints = {
|
||||
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql',
|
||||
ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token={token}',
|
||||
}
|
||||
|
||||
const community = {
|
||||
COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung',
|
||||
COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/',
|
||||
COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register',
|
||||
COMMUNITY_DESCRIPTION:
|
||||
process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||
}
|
||||
|
||||
const meta = {
|
||||
META_URL: process.env.META_URL || 'http://localhost',
|
||||
META_TITLE_DE: process.env.META_TITLE_DE || 'Gradido – Dein Dankbarkeitskonto',
|
||||
@ -46,11 +60,6 @@ const meta = {
|
||||
META_AUTHOR: process.env.META_AUTHOR || 'Bernd Hückstädt - Gradido-Akademie',
|
||||
}
|
||||
|
||||
const endpoints = {
|
||||
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql',
|
||||
ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token={token}',
|
||||
}
|
||||
|
||||
// Check config version
|
||||
constants.CONFIG_VERSION.CURRENT = process.env.CONFIG_VERSION || constants.CONFIG_VERSION.DEFAULT
|
||||
if (
|
||||
@ -68,6 +77,7 @@ const CONFIG = {
|
||||
...version,
|
||||
...environment,
|
||||
...endpoints,
|
||||
...community,
|
||||
...meta,
|
||||
}
|
||||
|
||||
|
||||
9
frontend/src/config/index.spec.js
Normal file
9
frontend/src/config/index.spec.js
Normal file
@ -0,0 +1,9 @@
|
||||
import CONFIG from './index'
|
||||
|
||||
describe('config/index', () => {
|
||||
describe('decay start block', () => {
|
||||
it('has the correct date set', () => {
|
||||
expect(CONFIG.DECAY_START_TIME).toEqual(new Date('2021-05-13 17:46:31'))
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -75,7 +75,7 @@ export const sendCoins = gql`
|
||||
export const createTransactionLink = gql`
|
||||
mutation($amount: Decimal!, $memo: String!) {
|
||||
createTransactionLink(amount: $amount, memo: $memo) {
|
||||
code
|
||||
link
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
@ -47,13 +47,9 @@ export const transactionsQuery = gql`
|
||||
transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) {
|
||||
balance {
|
||||
balance
|
||||
decay
|
||||
lastBookedBalance
|
||||
balanceGDT
|
||||
count
|
||||
linkCount
|
||||
decayStartBlock
|
||||
lastBookedDate
|
||||
}
|
||||
transactions {
|
||||
id
|
||||
@ -99,17 +95,6 @@ export const listGDTEntriesQuery = gql`
|
||||
}
|
||||
`
|
||||
|
||||
export const communityInfo = gql`
|
||||
query {
|
||||
getCommunityInfo {
|
||||
name
|
||||
description
|
||||
registerUrl
|
||||
url
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const communities = gql`
|
||||
query {
|
||||
communities {
|
||||
@ -154,7 +139,7 @@ export const listTransactionLinks = gql`
|
||||
amount
|
||||
holdAvailableAmount
|
||||
memo
|
||||
code
|
||||
link
|
||||
createdAt
|
||||
validUntil
|
||||
redeemedAt
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
:transactionCount="transactionCount"
|
||||
:transactionLinkCount="transactionLinkCount"
|
||||
:pending="pending"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
@update-transactions="updateTransactions"
|
||||
@set-tunneled-email="setTunneledEmail"
|
||||
></router-view>
|
||||
@ -54,16 +53,13 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
logo: 'img/brand/green.png',
|
||||
balance: 0,
|
||||
GdtBalance: 0,
|
||||
transactions: [],
|
||||
bookedBalance: 0,
|
||||
transactionCount: 0,
|
||||
transactionLinkCount: 0,
|
||||
pending: true,
|
||||
visible: false,
|
||||
decayStartBlock: new Date(),
|
||||
tunneledEmail: null,
|
||||
}
|
||||
},
|
||||
@ -110,7 +106,6 @@ export default {
|
||||
this.balance = Number(transactionList.balance.balance)
|
||||
this.transactionCount = transactionList.balance.count
|
||||
this.transactionLinkCount = transactionList.balance.linkCount
|
||||
this.decayStartBlock = new Date(transactionList.balance.decayStartBlock)
|
||||
this.pending = false
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@ -126,15 +126,17 @@
|
||||
"decay-14-day": "Vergänglichkeit für 14 Tage",
|
||||
"delete-the-link": "Den Link löschen?",
|
||||
"deleted": "Der Link wurde gelöscht!",
|
||||
"has-account": "Du besitzt bereits ein Gradido Konto",
|
||||
"expiredOn": "Abgelaufen am",
|
||||
"has-account": "Du besitzt bereits ein Gradido Konto?",
|
||||
"header": "Gradidos versenden per Link",
|
||||
"isFree": "Gradido ist weltweit kostenfrei.",
|
||||
"link-copied": "Link wurde in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.",
|
||||
"link-deleted": "Der Link wurde am {date} gelöscht.",
|
||||
"link-expired": "Der Link ist nicht mehr gültig. Die Gültigkeit ist am {date} abgelaufen.",
|
||||
"link-overview": "Linkübersicht",
|
||||
"links_count": "Aktive Links",
|
||||
"links_sum": "Summe deiner versendeten Gradidos",
|
||||
"no-account": "Du besitzt noch kein Gradido Konto",
|
||||
"links_sum": "Offene Links und QR-Codes",
|
||||
"no-account": "Du besitzt noch kein Gradido Konto?",
|
||||
"no-redeem": "Du darfst deinen eigenen Link nicht einlösen!",
|
||||
"not-copied": "Konnte den Link nicht kopieren: {err}",
|
||||
"redeem": "Einlösen",
|
||||
@ -143,20 +145,21 @@
|
||||
"redeemed-at": "Der Link wurde bereits am {date} eingelöst.",
|
||||
"redeemed-title": "eingelöst",
|
||||
"to-login": "Log dich ein",
|
||||
"to-register": "Registriere ein neues Konto",
|
||||
"valid_until": "Gültig bis"
|
||||
"to-register": "Registriere ein neues Konto.",
|
||||
"validUntil": "Gültig bis"
|
||||
},
|
||||
"gdt": {
|
||||
"calculation": "Berechnung der GradidoTransform",
|
||||
"calculation": "Berechnung der Gradido Transform",
|
||||
"contribution": "Beitrag",
|
||||
"conversion": "Umrechnung",
|
||||
"conversion-gdt-euro": "Umrechnung Euro / GradidoTransform (GDT)",
|
||||
"conversion-gdt-euro": "Umrechnung Euro / Gradido Transform (GDT)",
|
||||
"credit": "Gutschrift",
|
||||
"factor": "Faktor",
|
||||
"formula": "Berechnungsformel",
|
||||
"funding": "Zu den Förderbeiträgen",
|
||||
"gdt-received": "GradidoTransform (GDT) erhalten",
|
||||
"no-transactions": "Du hast noch keine GradidoTransform (GDT).",
|
||||
"gdt": "Gradido Transform",
|
||||
"gdt-received": "Gradido Transform (GDT) erhalten",
|
||||
"no-transactions": "Du hast noch keine Gradido Transform (GDT).",
|
||||
"not-reachable": "Der GDT Server ist nicht erreichbar.",
|
||||
"publisher": "Dein geworbenes Mitglied hat einen Beitrag bezahlt",
|
||||
"raise": "Erhöhung",
|
||||
@ -169,6 +172,7 @@
|
||||
"aprox": "~",
|
||||
"equal": "=",
|
||||
"exclaim": "!",
|
||||
"minus": "−",
|
||||
"pipe": "|"
|
||||
},
|
||||
"navigation": {
|
||||
@ -185,6 +189,7 @@
|
||||
"infoText": "Wenn dir dein Empfehlungsgeber seine Publisher-Id gegeben hat, trage sie hier ein, sonst lass das Feld bitte unverändert!",
|
||||
"publisherId": "Publisher-Id:"
|
||||
},
|
||||
"qrCode": "QR Code",
|
||||
"send_gdd": "GDD versenden",
|
||||
"send_per_link": "GDD versenden per Link",
|
||||
"settings": {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user