Merge branch 'master' into 1731-Fix-Startblock-Layouting

This commit is contained in:
Alexander Friedland 2022-04-20 14:44:10 +02:00 committed by GitHub
commit 58d0cf21b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 357 additions and 1132 deletions

24
backend/README.md Normal file
View 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` |

View File

@ -5,33 +5,20 @@ import Decimal from 'decimal.js-light'
export class Balance {
constructor(data: {
balance: Decimal
decay: Decimal
lastBookedBalance: Decimal
balanceGDT: number | null
count: number
linkCount: number
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.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
@ -42,8 +29,4 @@ export class Balance {
// the count of transaction links
@Field(() => Number)
linkCount: number
// may be null as there may be no transaction
@Field(() => Date, { nullable: true })
lastBookedDate: Date | null
}

View File

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

View File

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

View File

@ -29,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,
@ -69,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,
})
}
}

View File

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

View File

@ -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,

View File

@ -25,23 +25,9 @@ yarn down
yarn dev_down
```
## Reset DB
## Reset database
```
yarn dev_reset
```
Runs all down migrations and after this all up migrations.
## 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` |

View File

@ -40,11 +40,9 @@
"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"
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -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}`)
}

View File

@ -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, {})
}
}

View File

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

View File

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

View File

@ -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),
}

View File

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

View File

@ -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),
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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),
}

View File

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

View File

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

View File

@ -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"
@ -555,11 +516,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 +526,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 +840,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 +904,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 +939,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 +960,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 +1172,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 +1299,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 +1314,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 +1352,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 +1384,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 +1480,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 +1492,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 +1499,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 +1506,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 +1553,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 +1676,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 +1696,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 +1709,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 +1770,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 +1799,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 +2031,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 +2094,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 +2105,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 +2117,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 +2144,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 +2168,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"

View File

@ -17,6 +17,12 @@ 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=v5.2022-04-12
@ -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
@ -54,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}

View File

@ -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
@ -160,4 +162,4 @@ sudo /etc/init.d/nginx restart
cat $UPDATE_HTML >> $GRADIDO_LOG_PATH/update.$TODAY.log
# release lock
rm $LOCK_FILE
rm $LOCK_FILE

View File

@ -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"
@ -7,7 +21,4 @@ META_DESCRIPTION_DE="Dankbarkeit ist die Währung der neuen Zeit. Immer mehr Men
META_DESCRIPTION_EN="Gratitude is the currency of the new age. More and more people are unleashing their potential and shaping a good future for all."
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}
META_AUTHOR="Bernd Hückstädt - Gradido-Akademie"

View File

@ -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
@ -7,7 +21,4 @@ META_DESCRIPTION_DE=$META_DESCRIPTION_DE
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
META_AUTHOR=$META_AUTHOR

View File

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

View File

@ -100,18 +100,113 @@ describe('TransactionLinkSummary', () => {
expect(wrapper.findComponent({ name: 'CollapseLinksList' }).exists()).toBe(true)
})
it('calls the API to get the list transaction links', () => {
expect(apolloQueryMock).toBeCalledWith({
query: listTransactionLinks,
variables: {
currentPage: 1,
},
fetchPolicy: 'network-only',
describe('click on transaction links', () => {
beforeEach(() => {
wrapper.find('div.transaction-link-details').trigger('click')
})
})
it('has four transactionLinks', () => {
expect(wrapper.vm.transactionLinks).toHaveLength(4)
it('calls the API to get the list transaction links', () => {
expect(apolloQueryMock).toBeCalledWith({
query: listTransactionLinks,
variables: {
currentPage: 1,
},
fetchPolicy: 'network-only',
})
})
it('has four transactionLinks', () => {
expect(wrapper.vm.transactionLinks).toHaveLength(4)
})
describe('close transaction link details', () => {
beforeEach(() => {
jest.clearAllMocks()
wrapper.find('div.transaction-link-details').trigger('click')
})
it('does not call the API', () => {
expect(apolloQueryMock).not.toBeCalled()
})
it('has no component CollapseLinksList', () => {
expect(wrapper.findComponent({ name: 'CollapseLinksList' }).isVisible()).toBe(false)
})
})
describe('load more transaction links', () => {
beforeEach(async () => {
jest.clearAllMocks()
apolloQueryMock.mockResolvedValue({
data: {
listTransactionLinks: [
{
amount: '76',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 87,
memo:
'Hat jemand die Nummer von der Hexe aus Schneewittchen? Ich bräuchte mal ein paar Äpfel.',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '86',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 108,
memo:
'Die Windfahn´ krächzt am Dach, Der Uhu im Geklüfte; Was wispert wie ein Ach Verhallend in die Lüfte?',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '96',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 93,
memo:
'Verschlafen kräht der Hahn, Ein Blitz noch, und ein trüber, Umwölbter Tag bricht an Walpurgisnacht vorüber!',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '150',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 17,
memo: 'Eene meene Flaschenschrank, fertig ist der Hexentrank!',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
],
},
})
await wrapper.setData({
currentPage: 2,
pending: false,
pageSize: 5,
})
})
it('has eight transactionLinks', () => {
expect(wrapper.vm.transactionLinks).toHaveLength(8)
})
it('loads more transaction links', () => {
expect(apolloQueryMock).toBeCalledWith({
query: listTransactionLinks,
variables: {
currentPage: 2,
},
fetchPolicy: 'network-only',
})
})
})
})
describe('reset transaction links', () => {
@ -143,84 +238,10 @@ describe('TransactionLinkSummary', () => {
})
})
describe('load more transaction links', () => {
beforeEach(async () => {
jest.clearAllMocks()
apolloQueryMock.mockResolvedValue({
data: {
listTransactionLinks: [
{
amount: '76',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 87,
memo:
'Hat jemand die Nummer von der Hexe aus Schneewittchen? Ich bräuchte mal ein paar Äpfel.',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '86',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 108,
memo:
'Die Windfahn´ krächzt am Dach, Der Uhu im Geklüfte; Was wispert wie ein Ach Verhallend in die Lüfte?',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '96',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 93,
memo:
'Verschlafen kräht der Hahn, Ein Blitz noch, und ein trüber, Umwölbter Tag bricht an Walpurgisnacht vorüber!',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '150',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 17,
memo: 'Eene meene Flaschenschrank, fertig ist der Hexentrank!',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
],
},
})
await wrapper.setData({
currentPage: 2,
pending: false,
pageSize: 5,
})
})
it('has eight transactionLinks', () => {
expect(wrapper.vm.transactionLinks).toHaveLength(8)
})
it('loads more transaction links', () => {
expect(apolloQueryMock).toBeCalledWith({
query: listTransactionLinks,
variables: {
currentPage: 2,
},
fetchPolicy: 'network-only',
})
})
})
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', () => {

View File

@ -1,7 +1,7 @@
<template>
<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,14 @@ export default {
}
},
methods: {
showTransactionLinks() {
if (this.visible) {
this.visible = false
} else {
this.updateListTransactionLinks()
this.visible = true
}
},
async updateListTransactionLinks() {
if (this.currentPage === 0) {
this.transactionLinks = []
@ -110,8 +118,5 @@ export default {
this.updateListTransactionLinks()
},
},
created() {
this.updateListTransactionLinks()
},
}
</script>

View File

@ -8,7 +8,7 @@ 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: '',
},
}
@ -28,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',
@ -47,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 (
@ -69,6 +77,7 @@ const CONFIG = {
...version,
...environment,
...endpoints,
...community,
...meta,
}

View File

@ -47,12 +47,9 @@ export const transactionsQuery = gql`
transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) {
balance {
balance
decay
lastBookedBalance
balanceGDT
count
linkCount
lastBookedDate
}
transactions {
id
@ -98,17 +95,6 @@ export const listGDTEntriesQuery = gql`
}
`
export const communityInfo = gql`
query {
getCommunityInfo {
name
description
registerUrl
url
}
}
`
export const communities = gql`
query {
communities {

View File

@ -53,11 +53,9 @@ export default {
},
data() {
return {
logo: 'img/brand/green.png',
balance: 0,
GdtBalance: 0,
transactions: [],
bookedBalance: 0,
transactionCount: 0,
transactionLinkCount: 0,
pending: true,

View File

@ -147,6 +147,7 @@
"aprox": "~",
"equal": "=",
"exclaim": "!",
"minus": "",
"pipe": "|"
},
"navigation": {

View File

@ -147,6 +147,7 @@
"aprox": "~",
"equal": "=",
"exclaim": "!",
"minus": "",
"pipe": "|"
},
"navigation": {

View File

@ -1,24 +0,0 @@
import { communityInfo } from '../graphql/queries'
export const getCommunityInfoMixin = {
methods: {
getCommunityInfo() {
if (this.$store.state.community.name === '') {
this.$apollo
.query({
query: communityInfo,
})
.then((result) => {
this.$store.commit('community', result.data.getCommunityInfo)
return result.data.getCommunityInfo
})
.catch((error) => {
this.toastError(error.message)
})
}
},
},
created() {
this.getCommunityInfo()
},
}

View File

@ -6,17 +6,7 @@ import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue
const apolloQueryMock = jest.fn().mockResolvedValue({
data: {
getCommunityInfo: {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
},
},
})
const apolloQueryMock = jest.fn()
const mockStoreDispach = jest.fn()
const mockStoreCommit = jest.fn()
const mockRouterPush = jest.fn()
@ -39,10 +29,6 @@ describe('Login', () => {
dispatch: mockStoreDispach,
commit: mockStoreCommit,
state: {
community: {
name: '',
description: '',
},
publisherId: 12345,
},
},
@ -73,63 +59,24 @@ describe('Login', () => {
wrapper = Wrapper()
})
it('commits the community info to the store', () => {
expect(mockStoreCommit).toBeCalledWith('community', {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
})
})
it('renders the Login form', () => {
expect(wrapper.find('div.login-form').exists()).toBeTruthy()
})
describe('communities gives back error', () => {
beforeEach(() => {
apolloQueryMock.mockRejectedValue({
message: 'Failed to get communities',
})
wrapper = Wrapper()
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('Failed to get communities')
})
})
describe('Login header', () => {
it('has a welcome message', () => {
expect(wrapper.find('div.header').text()).toBe('site.login.heading site.login.community')
})
})
describe('Community data already loaded', () => {
beforeEach(() => {
jest.clearAllMocks()
mocks.$store.state.community = {
name: 'Gradido Entwicklung',
url: 'http://localhost/',
registerUrl: 'http://localhost/register',
description: 'Die lokale Entwicklungsumgebung von Gradido.',
}
wrapper = Wrapper()
})
it('has a Community name', () => {
expect(wrapper.find('.test-communitydata b').text()).toBe('Gradido Entwicklung')
})
it('has a Community name', () => {
expect(wrapper.find('.test-communitydata b').text()).toBe('Gradido Entwicklung')
})
it('has a Community description', () => {
expect(wrapper.find('.test-communitydata p').text()).toBe(
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
it('does not call community data update', () => {
expect(apolloQueryMock).not.toBeCalled()
})
it('has a Community description', () => {
expect(wrapper.find('.test-communitydata p').text()).toBe(
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
describe('links', () => {
@ -197,13 +144,13 @@ describe('Login', () => {
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
await wrapper.find('form').trigger('submit')
await flushPromises()
apolloQueryMock.mockResolvedValue({
data: {
login: 'token',
},
})
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('calls the API with the given data', () => {
@ -255,58 +202,64 @@ describe('Login', () => {
})
})
})
})
describe('login fails', () => {
beforeEach(() => {
describe('login fails', () => {
beforeEach(async () => {
jest.clearAllMocks()
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
apolloQueryMock.mockRejectedValue({
message: '..No user with this credentials',
})
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('hides the spinner', () => {
expect(spinnerHideMock).toBeCalled()
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('error.no-account')
})
describe('login fails with "User email not validated"', () => {
beforeEach(async () => {
apolloQueryMock.mockRejectedValue({
message: '..No user with this credentials',
message: 'User email not validated',
})
wrapper = Wrapper()
jest.clearAllMocks()
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('hides the spinner', () => {
expect(spinnerHideMock).toBeCalled()
it('redirects to /thx/login', () => {
expect(mockRouterPush).toBeCalledWith('/thx/login')
})
})
describe('login fails with "User has no password set yet"', () => {
beforeEach(async () => {
apolloQueryMock.mockRejectedValue({
message: 'User has no password set yet',
})
wrapper = Wrapper()
jest.clearAllMocks()
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('error.no-account')
})
describe('login fails with "User email not validated"', () => {
beforeEach(async () => {
apolloQueryMock.mockRejectedValue({
message: 'User email not validated',
})
wrapper = Wrapper()
jest.clearAllMocks()
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('redirects to /thx/login', () => {
expect(mockRouterPush).toBeCalledWith('/thx/login')
})
})
describe('login fails with "User has no password set yet"', () => {
beforeEach(async () => {
apolloQueryMock.mockRejectedValue({
message: 'User has no password set yet',
})
wrapper = Wrapper()
jest.clearAllMocks()
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('redirects to /reset-password/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset-password/login')
})
it('redirects to /reset-password/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset-password/login')
})
})
})

View File

@ -19,9 +19,9 @@
<b-card no-body class="border-0 mb-0 gradido-custom-background">
<b-card-body class="p-4">
<div class="text-center text-muted mb-4 test-communitydata">
<b>{{ $store.state.community.name }}</b>
<b>{{ CONFIG.COMMUNITY_NAME }}</b>
<p class="text-lead">
{{ $store.state.community.description }}
{{ CONFIG.COMMUNITY_DESCRIPTION }}
</p>
{{ $t('login') }}
</div>
@ -63,7 +63,7 @@
import InputPassword from '@/components/Inputs/InputPassword'
import InputEmail from '@/components/Inputs/InputEmail'
import { login } from '@/graphql/queries'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
import CONFIG from '@/config'
export default {
name: 'Login',
@ -71,7 +71,6 @@ export default {
InputPassword,
InputEmail,
},
mixins: [getCommunityInfoMixin],
data() {
return {
form: {
@ -79,6 +78,7 @@ export default {
password: '',
},
passwordVisible: false,
CONFIG,
}
},
methods: {

View File

@ -2,21 +2,8 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Register from './Register'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue
const apolloQueryMock = jest.fn().mockResolvedValue({
data: {
getCommunityInfo: {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
},
},
})
const mockStoreCommit = jest.fn()
const registerUserMutationMock = jest.fn()
const routerPushMock = jest.fn()
@ -37,17 +24,12 @@ describe('Register', () => {
},
$apollo: {
mutate: registerUserMutationMock,
query: apolloQueryMock,
},
$store: {
commit: mockStoreCommit,
state: {
email: 'peter@lustig.de',
language: 'en',
community: {
name: '',
description: '',
},
publisherId: 12345,
},
},
@ -66,15 +48,6 @@ describe('Register', () => {
wrapper = Wrapper()
})
it('commits the community info to the store', () => {
expect(mockStoreCommit).toBeCalledWith('community', {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
})
})
it('renders the Register form', () => {
expect(wrapper.find('div#registerform').exists()).toBeTruthy()
})
@ -85,19 +58,6 @@ describe('Register', () => {
})
})
describe('communities gives back error', () => {
beforeEach(() => {
apolloQueryMock.mockRejectedValue({
message: 'Failed to get communities',
})
wrapper = Wrapper()
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('Failed to get communities')
})
})
describe('Community data already loaded', () => {
beforeEach(() => {
jest.clearAllMocks()
@ -119,10 +79,6 @@ describe('Register', () => {
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
it('does not call community data update', () => {
expect(apolloQueryMock).not.toBeCalled()
})
})
describe('links', () => {

View File

@ -23,9 +23,9 @@
<b-card no-body class="border-0 gradido-custom-background">
<b-card-body class="p-4">
<div class="text-center text-muted mb-4 test-communitydata">
<b>{{ $store.state.community.name }}</b>
<b>{{ CONFIG.COMMUNITY_NAME }}</b>
<p class="text-lead">
{{ $store.state.community.description }}
{{ CONFIG.COMMUNITY_DESCRIPTION }}
</p>
<div>{{ $t('signup') }}</div>
</div>
@ -192,12 +192,11 @@
import InputEmail from '@/components/Inputs/InputEmail.vue'
import LanguageSwitchSelect from '@/components/LanguageSwitchSelect.vue'
import { createUser } from '@/graphql/mutations'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
import CONFIG from '@/config'
export default {
components: { InputEmail, LanguageSwitchSelect },
name: 'Register',
mixins: [getCommunityInfoMixin],
data() {
return {
form: {
@ -213,6 +212,7 @@ export default {
register: true,
publisherId: this.$store.state.publisherId,
redeemCode: this.$route.params.code,
CONFIG,
}
},
methods: {

View File

@ -1,21 +1,8 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import RegisterCommunity from './RegisterCommunity'
import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue
const apolloQueryMock = jest.fn().mockResolvedValue({
data: {
getCommunityInfo: {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
},
},
})
const mockStoreCommit = jest.fn()
describe('RegisterCommunity', () => {
@ -26,9 +13,6 @@ describe('RegisterCommunity', () => {
locale: 'en',
},
$t: jest.fn((t) => t),
$apollo: {
query: apolloQueryMock,
},
$store: {
commit: mockStoreCommit,
state: {
@ -53,32 +37,10 @@ describe('RegisterCommunity', () => {
wrapper = Wrapper()
})
it('commits the community info to the store', () => {
expect(mockStoreCommit).toBeCalledWith('community', {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
})
})
it('renders the Div Element "#register-community"', () => {
expect(wrapper.find('div#register-community').exists()).toBeTruthy()
})
describe('communities gives back error', () => {
beforeEach(() => {
apolloQueryMock.mockRejectedValue({
message: 'Failed to get communities',
})
wrapper = Wrapper()
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('Failed to get communities')
})
})
describe('Community data already loaded', () => {
beforeEach(() => {
jest.clearAllMocks()
@ -100,10 +62,6 @@ describe('RegisterCommunity', () => {
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
it('does not call community data update', () => {
expect(apolloQueryMock).not.toBeCalled()
})
})
describe('buttons and links', () => {

View File

@ -6,12 +6,12 @@
<div class="text-center mb-7 header">
<b-row class="justify-content-center">
<b-col xl="5" lg="6" md="8" class="px-2">
<h1>{{ $store.state.community.name }}</h1>
<h1>{{ CONFIG.COMMUNITY_NAME }}</h1>
<p class="text-lead">
{{ $store.state.community.description }}
{{ CONFIG.COMMUNITY_DESCRIPTION }}
</p>
<p class="text-lead community-location">
{{ $store.state.community.url }}
{{ CONFIG.COMMUNITY_URL }}
</p>
</b-col>
</b-row>
@ -49,10 +49,14 @@
</div>
</template>
<script>
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
import CONFIG from '@/config'
export default {
name: 'RegisterCommunity',
mixins: [getCommunityInfoMixin],
data() {
return {
CONFIG,
}
},
}
</script>

View File

@ -1,5 +1,5 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import { communities, communityInfo } from '@/graphql/queries'
import { communities } from '@/graphql/queries'
import SelectCommunity from './SelectCommunity'
import { toastErrorSpy } from '@test/testSetup'
@ -14,45 +14,33 @@ const spinnerMock = jest.fn(() => {
}
})
const apolloQueryMock = jest
.fn()
.mockResolvedValueOnce({
data: {
getCommunityInfo: {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
const apolloQueryMock = jest.fn().mockResolvedValue({
data: {
communities: [
{
id: 1,
name: 'Gradido Entwicklung',
description: 'Die lokale Entwicklungsumgebung von Gradido.',
url: 'http://localhost/',
registerUrl: 'http://localhost/register-community',
},
},
})
.mockResolvedValue({
data: {
communities: [
{
id: 1,
name: 'Gradido Entwicklung',
description: 'Die lokale Entwicklungsumgebung von Gradido.',
url: 'http://localhost/',
registerUrl: 'http://localhost/register-community',
},
{
id: 2,
name: 'Gradido Staging',
description: 'Der Testserver der Gradido-Akademie.',
url: 'https://stage1.gradido.net/',
registerUrl: 'https://stage1.gradido.net/register-community',
},
{
id: 3,
name: 'Gradido-Akademie',
description: 'Freies Institut für Wirtschaftsbionik.',
url: 'https://gradido.net',
registerUrl: 'https://gdd1.gradido.com/register-community',
},
],
},
})
{
id: 2,
name: 'Gradido Staging',
description: 'Der Testserver der Gradido-Akademie.',
url: 'https://stage1.gradido.net/',
registerUrl: 'https://stage1.gradido.net/register-community',
},
{
id: 3,
name: 'Gradido-Akademie',
description: 'Freies Institut für Wirtschaftsbionik.',
url: 'https://gradido.net',
registerUrl: 'https://gdd1.gradido.com/register-community',
},
],
},
})
const mockStoreCommit = jest.fn()
@ -95,12 +83,6 @@ describe('SelectCommunity', () => {
wrapper = Wrapper()
})
it('calls the API to get the community info data', () => {
expect(apolloQueryMock).toBeCalledWith({
query: communityInfo,
})
})
it('calls the API to get the communities data', () => {
expect(apolloQueryMock).toBeCalledWith({
query: communities,
@ -141,12 +123,6 @@ describe('SelectCommunity', () => {
wrapper = Wrapper()
})
it('does not call community info data when already filled', () => {
expect(apolloQueryMock).not.toBeCalledWith({
query: communityInfo,
})
})
it('has a Community name', () => {
expect(wrapper.find('.card-body b').text()).toBe('Gradido Entwicklung')
})

View File

@ -5,9 +5,9 @@
<div v-if="!pending">
<b-card class="border-0 mb-0" bg-variant="primary">
<b>{{ $store.state.community.name }}</b>
<b>{{ CONFIG.COMMUNITY_NAME }}</b>
<br />
<p>{{ $store.state.community.description }}</p>
<p>{{ CONFIG.COMMUNITY_DESCRIPTION }}</p>
<br />
<router-link to="/register">
<b-button variant="outline-secondary">
@ -49,7 +49,7 @@
</template>
<script>
import { communities } from '@/graphql/queries'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
import CONFIG from '@/config'
export default {
name: 'SelectCommunity',
@ -57,9 +57,9 @@ export default {
return {
communities: [],
pending: true,
CONFIG,
}
},
mixins: [getCommunityInfoMixin],
methods: {
async getCommunities() {
const loader = this.$loading.show({
@ -72,7 +72,7 @@ export default {
})
.then((response) => {
this.communities = response.data.communities.filter(
(c) => c.name !== this.$store.state.community.name,
(c) => c.name !== CONFIG.COMMUNITY_NAME,
)
})
.catch((error) => {

View File

@ -38,9 +38,6 @@ export const mutations = {
isAdmin: (state, isAdmin) => {
state.isAdmin = !!isAdmin
},
community: (state, community) => {
state.community = community
},
coinanimation: (state, coinanimation) => {
state.coinanimation = coinanimation
},
@ -96,10 +93,6 @@ try {
isAdmin: false,
coinanimation: true,
newsletterState: null,
community: {
name: '',
description: '',
},
hasElopage: false,
publisherId: null,
},

View File

@ -24,7 +24,6 @@ const {
newsletterState,
publisherId,
isAdmin,
community,
hasElopage,
} = mutations
const { login, logout } = actions
@ -117,24 +116,6 @@ describe('Vuex store', () => {
})
})
describe('community', () => {
it('sets the state of community', () => {
const state = {}
community(state, {
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
})
expect(state.community).toEqual({
name: 'test12',
description: 'test community 12',
url: 'http://test12.test12/',
registerUrl: 'http://test12.test12/register',
})
})
})
describe('hasElopage', () => {
it('sets the state of hasElopage', () => {
const state = { hasElopage: false }