diff --git a/admin/src/components/Tables/SearchUserTable.vue b/admin/src/components/Tables/SearchUserTable.vue index 024001193..0be24a099 100644 --- a/admin/src/components/Tables/SearchUserTable.vue +++ b/admin/src/components/Tables/SearchUserTable.vue @@ -49,30 +49,40 @@ - - {{ $t('userIsDeleted') }} - - - - - + + + + + + + + + + + + + + + + + diff --git a/admin/src/components/TransactionLinkList.vue b/admin/src/components/TransactionLinkList.vue index fa67c8797..0289792a2 100644 --- a/admin/src/components/TransactionLinkList.vue +++ b/admin/src/components/TransactionLinkList.vue @@ -1,7 +1,7 @@ - {{ $t('transactionlink.form_header') }} + {{ $t('transactionlink.name') }} 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 } diff --git a/backend/src/graphql/model/Decay.ts b/backend/src/graphql/model/Decay.ts index f1204e730..f59a21249 100644 --- a/backend/src/graphql/model/Decay.ts +++ b/backend/src/graphql/model/Decay.ts @@ -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 diff --git a/backend/src/graphql/model/Transaction.ts b/backend/src/graphql/model/Transaction.ts index 3c3a684ef..24c66ac67 100644 --- a/backend/src/graphql/model/Transaction.ts +++ b/backend/src/graphql/model/Transaction.ts @@ -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 diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 1ed0422ef..7ca3460ee 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -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 { 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 { 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') diff --git a/backend/src/graphql/resolver/BalanceResolver.ts b/backend/src/graphql/resolver/BalanceResolver.ts index f30e779e5..909a22144 100644 --- a/backend/src/graphql/resolver/BalanceResolver.ts +++ b/backend/src/graphql/resolver/BalanceResolver.ts @@ -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 { - const { user } = context + async balance(@Ctx() context: Context): Promise { + 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, }) } } diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts index 1693574cb..c194cdf1a 100644 --- a/backend/src/graphql/resolver/CommunityResolver.ts +++ b/backend/src/graphql/resolver/CommunityResolver.ts @@ -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' diff --git a/backend/src/graphql/resolver/GdtResolver.ts b/backend/src/graphql/resolver/GdtResolver.ts index e2409160b..56a95c9f0 100644 --- a/backend/src/graphql/resolver/GdtResolver.ts +++ b/backend/src/graphql/resolver/GdtResolver.ts @@ -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 { - 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 { - const { user } = context + async gdtBalance(@Ctx() context: Context): Promise { + 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 } } diff --git a/backend/src/graphql/resolver/KlicktippResolver.ts b/backend/src/graphql/resolver/KlicktippResolver.ts index d13f1dd8e..ce9a097e2 100644 --- a/backend/src/graphql/resolver/KlicktippResolver.ts +++ b/backend/src/graphql/resolver/KlicktippResolver.ts @@ -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, diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 646a7c296..733f1db28 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -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 { - 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 { - 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 { - 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 { - const { user } = context + const user = getUser(context) const transactionLink = await dbTransactionLink.findOneOrFail({ code }) const linkedUser = await dbUser.findOneOrFail({ id: transactionLink.userId }) diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 8747f14a3..69e1899d9 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -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 { 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 { // 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') } diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index cacee6fc8..137c09622 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -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 { + async verifyLogin(@Ctx() context: Context): Promise { // 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 { 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 { - 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 { + async hasElopage(@Ctx() context: Context): Promise { const userEntity = context.user if (!userEntity) { return false diff --git a/backend/src/mailer/sendTransactionReceivedEmail.test.ts b/backend/src/mailer/sendTransactionReceivedEmail.test.ts index 1ebc9dae3..75631cc7a 100644 --- a/backend/src/mailer/sendTransactionReceivedEmail.test.ts +++ b/backend/src/mailer/sendTransactionReceivedEmail.test.ts @@ -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'), }) }) }) diff --git a/backend/src/mailer/sendTransactionReceivedEmail.ts b/backend/src/mailer/sendTransactionReceivedEmail.ts index 934783449..537c13d85 100644 --- a/backend/src/mailer/sendTransactionReceivedEmail.ts +++ b/backend/src/mailer/sendTransactionReceivedEmail.ts @@ -11,6 +11,7 @@ export const sendTransactionReceivedEmail = (data: { senderEmail: string amount: Decimal memo: string + overviewURL: string }): Promise => { return sendEMail({ to: `${data.recipientFirstName} ${data.recipientLastName} <${data.email}>`, diff --git a/backend/src/mailer/text/transactionReceived.ts b/backend/src/mailer/text/transactionReceived.ts index 520ee43bf..07d03ad45 100644 --- a/backend/src/mailer/text/transactionReceived.ts +++ b/backend/src/mailer/text/transactionReceived.ts @@ -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}`, }, } diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 04f849727..11a675eeb 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -59,7 +59,6 @@ export const transactionsQuery = gql` balanceGDT count balance - decayStartBlock transactions { id typeId diff --git a/backend/src/server/context.ts b/backend/src/server/context.ts index 6de2adce4..d9fd55fe4 100644 --- a/backend/src/server/context.ts +++ b/backend/src/server/context.ts @@ -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 diff --git a/backend/src/util/decay.ts b/backend/src/util/decay.ts index 36f83f23f..48674dc50 100644 --- a/backend/src/util/decay.ts +++ b/backend/src/util/decay.ts @@ -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 } diff --git a/backend/src/util/virtualTransactions.ts b/backend/src/util/virtualTransactions.ts index 920fc4201..8c1aec65b 100644 --- a/backend/src/util/virtualTransactions.ts +++ b/backend/src/util/virtualTransactions.ts @@ -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, diff --git a/backend/yarn.lock b/backend/yarn.lock index 4134e1d37..3ba20211a 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -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" diff --git a/database/README.md b/database/README.md index 8d490496b..84db3d194 100644 --- a/database/README.md +++ b/database/README.md @@ -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` | - diff --git a/database/package.json b/database/package.json index a1aed2558..40c43c9b5 100644 --- a/database/package.json +++ b/database/package.json @@ -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" } } diff --git a/database/src/factories/server-user.factory.ts b/database/src/factories/server-user.factory.ts deleted file mode 100644 index 06ff17c35..000000000 --- a/database/src/factories/server-user.factory.ts +++ /dev/null @@ -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 -}) diff --git a/database/src/factories/transaction.factory.ts b/database/src/factories/transaction.factory.ts deleted file mode 100644 index dd98a88b7..000000000 --- a/database/src/factories/transaction.factory.ts +++ /dev/null @@ -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 -}) diff --git a/database/src/factories/user.factory.ts b/database/src/factories/user.factory.ts deleted file mode 100644 index d04dcea4c..000000000 --- a/database/src/factories/user.factory.ts +++ /dev/null @@ -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 -}) diff --git a/database/src/helpers.ts b/database/src/helpers.ts index acd0e6ccd..710094548 100644 --- a/database/src/helpers.ts +++ b/database/src/helpers.ts @@ -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 => { if (closePool) pool.end() } -/* eslint-disable-next-line @typescript-eslint/no-explicit-any */ -const runSeeds = async (seeds: any[]): Promise => { - 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 } diff --git a/database/src/index.ts b/database/src/index.ts index 40c5913e4..a9504063e 100644 --- a/database/src/index.ts +++ b/database/src/index.ts @@ -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}`) } diff --git a/database/src/seeds/create-user.seed.ts b/database/src/seeds/create-user.seed.ts deleted file mode 100644 index 69488a790..000000000 --- a/database/src/seeds/create-user.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, {}) - } -} diff --git a/database/src/seeds/helpers/user-helpers.ts b/database/src/seeds/helpers/user-helpers.ts deleted file mode 100644 index 7485c038e..000000000 --- a/database/src/seeds/helpers/user-helpers.ts +++ /dev/null @@ -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 => { - 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, - } -} diff --git a/database/src/seeds/users/bibi-bloxberg.seed.ts b/database/src/seeds/users/bibi-bloxberg.seed.ts deleted file mode 100644 index 4899f3809..000000000 --- a/database/src/seeds/users/bibi-bloxberg.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, bibiBloxberg) - } -} diff --git a/database/src/seeds/users/bibi-bloxberg.ts b/database/src/seeds/users/bibi-bloxberg.ts deleted file mode 100644 index a055a283b..000000000 --- a/database/src/seeds/users/bibi-bloxberg.ts +++ /dev/null @@ -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), -} diff --git a/database/src/seeds/users/bob-baumeister.seed.ts b/database/src/seeds/users/bob-baumeister.seed.ts deleted file mode 100644 index 22ff30824..000000000 --- a/database/src/seeds/users/bob-baumeister.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, bobBaumeister) - } -} diff --git a/database/src/seeds/users/bob-baumeister.ts b/database/src/seeds/users/bob-baumeister.ts deleted file mode 100644 index 4a50a7e63..000000000 --- a/database/src/seeds/users/bob-baumeister.ts +++ /dev/null @@ -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), -} diff --git a/database/src/seeds/users/garrick-ollivander.seed.ts b/database/src/seeds/users/garrick-ollivander.seed.ts deleted file mode 100644 index 54adc3475..000000000 --- a/database/src/seeds/users/garrick-ollivander.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, garrickOllivander) - } -} diff --git a/database/src/seeds/users/garrick-ollivander.ts b/database/src/seeds/users/garrick-ollivander.ts deleted file mode 100644 index 3f18a875c..000000000 --- a/database/src/seeds/users/garrick-ollivander.ts +++ /dev/null @@ -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, -} diff --git a/database/src/seeds/users/peter-lustig.admin.seed.ts b/database/src/seeds/users/peter-lustig.admin.seed.ts deleted file mode 100644 index 9dd3fd4c7..000000000 --- a/database/src/seeds/users/peter-lustig.admin.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, peterLustig) - } -} diff --git a/database/src/seeds/users/peter-lustig.ts b/database/src/seeds/users/peter-lustig.ts deleted file mode 100644 index 5b4b98488..000000000 --- a/database/src/seeds/users/peter-lustig.ts +++ /dev/null @@ -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, -} diff --git a/database/src/seeds/users/raeuber-hotzenplotz.seed.ts b/database/src/seeds/users/raeuber-hotzenplotz.seed.ts deleted file mode 100644 index 2399136d2..000000000 --- a/database/src/seeds/users/raeuber-hotzenplotz.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, raeuberHotzenplotz) - } -} diff --git a/database/src/seeds/users/raeuber-hotzenplotz.ts b/database/src/seeds/users/raeuber-hotzenplotz.ts deleted file mode 100644 index 879892f15..000000000 --- a/database/src/seeds/users/raeuber-hotzenplotz.ts +++ /dev/null @@ -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), -} diff --git a/database/src/seeds/users/stephen-hawking.seed.ts b/database/src/seeds/users/stephen-hawking.seed.ts deleted file mode 100644 index 07e129140..000000000 --- a/database/src/seeds/users/stephen-hawking.seed.ts +++ /dev/null @@ -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 { - await userSeeder(factory, stephenHawking) - } -} diff --git a/database/src/seeds/users/stephen-hawking.ts b/database/src/seeds/users/stephen-hawking.ts deleted file mode 100644 index 9bfd83704..000000000 --- a/database/src/seeds/users/stephen-hawking.ts +++ /dev/null @@ -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, -} diff --git a/database/yarn.lock b/database/yarn.lock index 3bd75df27..a2df693ec 100644 --- a/database/yarn.lock +++ b/database/yarn.lock @@ -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" diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 8254fd9c2..efac0fc68 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -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=v5.2022-04-12 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} diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 37a002794..0fcf6d847 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -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 diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 03ba87445..95b89241f 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -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 \ No newline at end of file +rm $LOCK_FILE diff --git a/frontend/.env.dist b/frontend/.env.dist index df3c7cd7e..65d9ae305 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -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} \ No newline at end of file +META_AUTHOR="Bernd Hückstädt - Gradido-Akademie" \ No newline at end of file diff --git a/frontend/.env.template b/frontend/.env.template index 10c42daa9..6d6b83fc7 100644 --- a/frontend/.env.template +++ b/frontend/.env.template @@ -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 \ No newline at end of file +META_AUTHOR=$META_AUTHOR \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index d88430474..3bd975798 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -47,7 +47,7 @@ "particles-bg-vue": "1.2.3", "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", @@ -58,8 +58,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", diff --git a/frontend/public/img/gdd-coin.png b/frontend/public/img/gdd-coin.png new file mode 100644 index 000000000..32cb8b2b2 Binary files /dev/null and b/frontend/public/img/gdd-coin.png differ diff --git a/frontend/public/img/svg/qr-code.svg b/frontend/public/img/svg/qr-code.svg new file mode 100644 index 000000000..3cbd987c4 --- /dev/null +++ b/frontend/public/img/svg/qr-code.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/frontend/src/assets/scss/gradido.scss b/frontend/src/assets/scss/gradido.scss index 53a296713..68577d0b5 100644 --- a/frontend/src/assets/scss/gradido.scss +++ b/frontend/src/assets/scss/gradido.scss @@ -168,6 +168,10 @@ a, background-color: #ebebeba3 !important; } +.gradido-shadow-inset { + box-shadow: inset 0.3em rgba(241 187 187 / 100%); +} + .gradido-max-width { width: 100%; } diff --git a/frontend/src/components/DecayInformations/CollapseLinksList.spec.js b/frontend/src/components/DecayInformations/CollapseLinksList.spec.js index b288f78d0..68d5d427f 100644 --- a/frontend/src/components/DecayInformations/CollapseLinksList.spec.js +++ b/frontend/src/components/DecayInformations/CollapseLinksList.spec.js @@ -9,6 +9,7 @@ const mocks = { }, $tc: jest.fn((tc) => tc), $t: jest.fn((t) => t), + $d: jest.fn((d) => d), } const propsData = { diff --git a/frontend/src/components/DecayInformations/DecayInformation-Decay.vue b/frontend/src/components/DecayInformations/DecayInformation-Decay.vue index 67847f6cf..26481cff3 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-Decay.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-Decay.vue @@ -1,15 +1,15 @@ - - - - - - {{ $t('decay.calculation_decay') }} - + + + + {{ $t('decay.calculation_decay') }} - + + + + {{ $t('decay.decay') }} @@ -17,6 +17,7 @@ {{ previousBookedBalance | GDD }} + {{ decay === '0' ? $t('math.minus') : '' }} {{ decay | GDD }} {{ $t('math.equal') }} {{ balance | GDD }} diff --git a/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue b/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue index 5802bfb4b..0df254bb4 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue @@ -1,56 +1,80 @@ - - - {{ $t('decay.Starting_block_decay') }} - {{ $t('decay.decay_introduced') }} - - - - {{ $d(new Date(decay.start), 'long') }} - + + + + {{ $t('decay.Starting_block_decay') }} + + + + + + {{ $t('decay.decay_introduced') }} + + + + + + {{ $d(new Date(decay.start), 'long') }} + + + + + - - - {{ $t('decay.decay') }} - {{ decay.decay | GDD }} + + + {{ $t('decay.decay') }} + {{ decay.decay | GDD }} + + - + + - + {{ $t('decay.calculation_total') }} + - - {{ $t(`decay.types.${typeId.toLowerCase()}`) }} - {{ amount | GDD }} - - - - {{ $t('decay.decay') }} - {{ decay.decay | GDD }} - - - - {{ $t('decay.total') }} - - {{ (Number(amount) + Number(decay.decay)) | GDD }} + + + + {{ $t(`decay.types.${typeId.toLowerCase()}`) }} + {{ amount | GDD }} + + + + {{ $t('decay.decay') }} + {{ decay.decay | GDD }} + + + + {{ $t('decay.total') }} + + {{ (Number(amount) + Number(decay.decay)) | GDD }} + + diff --git a/frontend/src/components/DecayInformations/DecayInformation.vue b/frontend/src/components/DecayInformations/DecayInformation.vue index ae76a5bb4..690f6532b 100644 --- a/frontend/src/components/DecayInformations/DecayInformation.vue +++ b/frontend/src/components/DecayInformations/DecayInformation.vue @@ -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() }, }, } diff --git a/frontend/src/components/GddSend/QrCode.spec.js b/frontend/src/components/GddSend/QrCode.spec.js deleted file mode 100644 index 66da5748d..000000000 --- a/frontend/src/components/GddSend/QrCode.spec.js +++ /dev/null @@ -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() - }) - }) - }) - }) -}) diff --git a/frontend/src/components/GddSend/QrCode.vue b/frontend/src/components/GddSend/QrCode.vue deleted file mode 100644 index 32e527cfe..000000000 --- a/frontend/src/components/GddSend/QrCode.vue +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{ $t('form.cancel') }} - - - - - - - diff --git a/frontend/src/components/GddSend/TransactionResultLink.vue b/frontend/src/components/GddSend/TransactionResultLink.vue index 79369fc99..8774bdf7e 100644 --- a/frontend/src/components/GddSend/TransactionResultLink.vue +++ b/frontend/src/components/GddSend/TransactionResultLink.vue @@ -1,27 +1,32 @@ - - - - - - {{ $t('gdd_per_link.created') }} - - - - {{ $t('form.close') }} - - - - - + + + + {{ $t('gdd_per_link.created') }} + + + + + + + + {{ $t('form.close') }} + + + + + + + diff --git a/frontend/src/components/TransactionCollapse.vue b/frontend/src/components/TransactionCollapse.vue index 98358475b..bf9b547df 100644 --- a/frontend/src/components/TransactionCollapse.vue +++ b/frontend/src/components/TransactionCollapse.vue @@ -1,5 +1,5 @@ - + {{ getLinesByType.headline }} diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index 8e455360b..2988f2026 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -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, @@ -25,7 +26,7 @@ const propsData = { 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', } @@ -57,22 +58,36 @@ describe('TransactionLink', () => { describe('copy with success', () => { beforeEach(async () => { navigatorClipboardMock.mockResolvedValue() - await wrapper.findAll('button').at(0).trigger('click') + await wrapper.find('.test-copy-link').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', () => { + describe('qr code modal', () => { + let spy + + beforeEach(() => { + jest.clearAllMocks() + }) + + describe('with success', () => { beforeEach(async () => { - navigatorClipboardMock.mockRejectedValue() - await wrapper.findAll('button').at(0).trigger('click') + spy = jest.spyOn(wrapper.vm.$bvModal, 'show') + // spy.mockImplementation(() => Promise.resolve('some value')) + // mockAPIcall.mockResolvedValue() + await wrapper.find('.test-qr-code').trigger('click') }) - it('toasts error message', () => { - expect(toastErrorSpy).toBeCalledWith('gdd_per_link.not-copied') + it('qr-code Modal if show', () => { + expect(spy).toBeCalled() }) }) }) @@ -89,7 +104,7 @@ 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').trigger('click') }) it('test Modal if confirm true', () => { @@ -121,7 +136,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').trigger('click') }) it('toasts an error message', () => { @@ -134,7 +149,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').trigger('click') }) it('does not call the API', () => { diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index 1c5ad690f..29cadc1b0 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -1,20 +1,33 @@ - + - - - - - + + + + + + + + + + + + + + - + @@ -33,6 +45,12 @@ + + + + {{ link }} + + + diff --git a/frontend/src/components/TransactionRows/DateRow.vue b/frontend/src/components/TransactionRows/DateRow.vue index 7f93656f7..5f526caaf 100644 --- a/frontend/src/components/TransactionRows/DateRow.vue +++ b/frontend/src/components/TransactionRows/DateRow.vue @@ -8,7 +8,7 @@ - {{ dateString }} + {{ $d(new Date(this.date), 'long') }} @@ -28,12 +28,5 @@ export default { default: false, }, }, - computed: { - dateString() { - return this.diffNow - ? this.$moment(this.date).locale(this.$i18n.locale).fromNow() - : this.$d(new Date(this.date), 'long') - }, - }, } diff --git a/frontend/src/components/TransactionRows/DurationRow.vue b/frontend/src/components/TransactionRows/DurationRow.vue new file mode 100644 index 000000000..d40d9e35b --- /dev/null +++ b/frontend/src/components/TransactionRows/DurationRow.vue @@ -0,0 +1,44 @@ + + + + + {{ $t('decay.past_time') }} + + + {{ durationText }} + + + + + diff --git a/frontend/src/components/Transactions/TransactionCreation.vue b/frontend/src/components/Transactions/TransactionCreation.vue index dce11307b..694d907ed 100644 --- a/frontend/src/components/Transactions/TransactionCreation.vue +++ b/frontend/src/components/Transactions/TransactionCreation.vue @@ -27,12 +27,7 @@ - + @@ -82,10 +77,6 @@ export default { type: String, required: true, }, - decayStartBlock: { - type: Date, - required: true, - }, previousBookedBalance: { type: String, required: true, diff --git a/frontend/src/components/Transactions/TransactionDecay.vue b/frontend/src/components/Transactions/TransactionDecay.vue index 372705a4c..7505ac7c1 100644 --- a/frontend/src/components/Transactions/TransactionDecay.vue +++ b/frontend/src/components/Transactions/TransactionDecay.vue @@ -20,7 +20,7 @@ - + t), + $d: jest.fn((d) => d), $tc: jest.fn((tc) => tc), $apollo: { query: apolloQueryMock, @@ -44,7 +45,6 @@ describe('TransactionLinkSummary', () => { { amount: '75', code: 'ce28664b5308c17f931c0367', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 86, @@ -56,7 +56,6 @@ describe('TransactionLinkSummary', () => { { amount: '85', code: 'ce28664b5308c17f931c0367', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 107, @@ -67,7 +66,6 @@ describe('TransactionLinkSummary', () => { { amount: '95', code: 'ce28664b5308c17f931c0367', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 92, @@ -79,7 +77,6 @@ describe('TransactionLinkSummary', () => { { amount: '150', code: 'ce28664b5308c17f931c0367', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 16, @@ -103,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', () => { @@ -146,88 +238,10 @@ describe('TransactionLinkSummary', () => { }) }) - describe('load more transaction links', () => { - beforeEach(async () => { - jest.clearAllMocks() - apolloQueryMock.mockResolvedValue({ - data: { - listTransactionLinks: [ - { - amount: '76', - code: 'ce28664b5308c17f931c0367', - link: 'http://localhost/redeem/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', - link: 'http://localhost/redeem/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', - link: 'http://localhost/redeem/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', - link: 'http://localhost/redeem/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', () => { diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.vue b/frontend/src/components/Transactions/TransactionLinkSummary.vue index 3f80bfd18..84d0f9b84 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.vue +++ b/frontend/src/components/Transactions/TransactionLinkSummary.vue @@ -1,7 +1,7 @@ - + - + @@ -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() - }, } diff --git a/frontend/src/components/Transactions/TransactionReceive.vue b/frontend/src/components/Transactions/TransactionReceive.vue index 32e40f71e..8899b3807 100644 --- a/frontend/src/components/Transactions/TransactionReceive.vue +++ b/frontend/src/components/Transactions/TransactionReceive.vue @@ -33,12 +33,7 @@ - + @@ -87,10 +82,6 @@ export default { typeId: { type: String, }, - decayStartBlock: { - type: Date, - required: true, - }, transactionLinkId: { type: Number, required: false, diff --git a/frontend/src/components/Transactions/TransactionSend.vue b/frontend/src/components/Transactions/TransactionSend.vue index a1ea3c88e..f9125b89c 100644 --- a/frontend/src/components/Transactions/TransactionSend.vue +++ b/frontend/src/components/Transactions/TransactionSend.vue @@ -33,12 +33,7 @@ - + @@ -88,10 +83,6 @@ export default { type: String, required: true, }, - decayStartBlock: { - type: Date, - required: true, - }, transactionLinkId: { type: Number, required: false, diff --git a/frontend/src/components/UserCard.spec.js b/frontend/src/components/UserCard.spec.js index 0fe13c416..6977917f5 100644 --- a/frontend/src/components/UserCard.spec.js +++ b/frontend/src/components/UserCard.spec.js @@ -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') }) }) }) diff --git a/frontend/src/components/UserCard.vue b/frontend/src/components/UserCard.vue index beca89532..2ed17403b 100755 --- a/frontend/src/components/UserCard.vue +++ b/frontend/src/components/UserCard.vue @@ -2,11 +2,7 @@ - + @@ -37,16 +33,16 @@ diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 3f62012ad..917a25d70 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -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, } diff --git a/frontend/src/config/index.spec.js b/frontend/src/config/index.spec.js new file mode 100644 index 000000000..3c4c7865e --- /dev/null +++ b/frontend/src/config/index.spec.js @@ -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')) + }) + }) +}) diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 3452694d4..8d79c14dd 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -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 { diff --git a/frontend/src/layouts/DashboardLayout_gdd.vue b/frontend/src/layouts/DashboardLayout_gdd.vue index de2c68bf0..f65329470 100755 --- a/frontend/src/layouts/DashboardLayout_gdd.vue +++ b/frontend/src/layouts/DashboardLayout_gdd.vue @@ -26,7 +26,6 @@ :transactionCount="transactionCount" :transactionLinkCount="transactionLinkCount" :pending="pending" - :decayStartBlock="decayStartBlock" @update-transactions="updateTransactions" @set-tunneled-email="setTunneledEmail" > @@ -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) => { diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 600b36e65..20ce055d4 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -102,15 +102,16 @@ "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", + "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", @@ -119,20 +120,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", + "to-register": "Registriere ein neues Konto.", "valid_until": "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", @@ -145,6 +147,7 @@ "aprox": "~", "equal": "=", "exclaim": "!", + "minus": "−", "pipe": "|" }, "navigation": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index ef9a14c0a..201c44d93 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -102,15 +102,16 @@ "decay-14-day": "Decay for 14 days", "delete-the-link": "Delete the link?", "deleted": "The link was deleted!", - "has-account": "You already have a Gradido account", + "has-account": "You already have a Gradido account?", "header": "Send Gradidos via link", + "isFree": "Gradido is free of charge worldwide.", "link-copied": "Link has been copied to the clipboard. You can now paste it into an email or message.", "link-deleted": "The link was deleted on {date}.", "link-expired": "The link is no longer valid. The validity expired on {date}.", "link-overview": "Link overview", "links_count": "Active links", - "links_sum": "Total of your sent Gradidos", - "no-account": "You don't have a Gradido account yet", + "links_sum": "Open links and QR codes", + "no-account": "You don't have a Gradido account yet?", "no-redeem": "You not allowed to redeem your own link!", "not-copied": "Could not copy link: {err}", "redeem": "Redeem", @@ -119,20 +120,21 @@ "redeemed-at": "The link was already redeemed on {date}.", "redeemed-title": "redeemed", "to-login": "Log in", - "to-register": "Register a new account", + "to-register": "Register a new account.", "valid_until": "Valid until" }, "gdt": { - "calculation": "Calculation of GradidoTransform", + "calculation": "Calculation of Gradido Transform", "contribution": "Contribution", "conversion": "Conversion", - "conversion-gdt-euro": "Conversion Euro / GradidoTransform (GDT)", + "conversion-gdt-euro": "Conversion Euro / Gradido Transform (GDT)", "credit": "Credit", "factor": "Factor", "formula": "Calculation formula", "funding": "To the funding contributions", - "gdt-received": "GradidoTransform (GDT) received", - "no-transactions": "You do not have GradidoTransform (GDT) yet.", + "gdt": "Gradido Transform", + "gdt-received": "Gradido Transform (GDT) received", + "no-transactions": "You do not have Gradido Transform (GDT) yet.", "not-reachable": "The GDT Server is not reachable.", "publisher": "A member you referred has paid a contribution", "raise": "Increase", @@ -145,6 +147,7 @@ "aprox": "~", "equal": "=", "exclaim": "!", + "minus": "−", "pipe": "|" }, "navigation": { diff --git a/frontend/src/mixins/getCommunityInfo.js b/frontend/src/mixins/getCommunityInfo.js deleted file mode 100644 index c6c021f9c..000000000 --- a/frontend/src/mixins/getCommunityInfo.js +++ /dev/null @@ -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() - }, -} diff --git a/frontend/src/pages/Login.spec.js b/frontend/src/pages/Login.spec.js index e26888d49..abe3415c6 100644 --- a/frontend/src/pages/Login.spec.js +++ b/frontend/src/pages/Login.spec.js @@ -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') }) }) }) diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index 79532cb21..f01332202 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -19,9 +19,9 @@ - {{ $store.state.community.name }} + {{ CONFIG.COMMUNITY_NAME }} - {{ $store.state.community.description }} + {{ CONFIG.COMMUNITY_DESCRIPTION }} {{ $t('login') }} @@ -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: { diff --git a/frontend/src/pages/Overview.spec.js b/frontend/src/pages/Overview.spec.js index af234801e..8f0dda01d 100644 --- a/frontend/src/pages/Overview.spec.js +++ b/frontend/src/pages/Overview.spec.js @@ -25,12 +25,6 @@ describe('Overview', () => { wrapper = Wrapper() }) - it('has a status gdd-status-gdd', () => { - expect(wrapper.find('div.gdd-status-gdd').exists()).toBeTruthy() - }) - it('has a status gdd-status-gdt', () => { - expect(wrapper.find('div.gdd-status-gdt').exists()).toBeTruthy() - }) it('has a transactions table', () => { expect(wrapper.find('div.gdd-transaction-list').exists()).toBeTruthy() }) diff --git a/frontend/src/pages/Overview.vue b/frontend/src/pages/Overview.vue index 9723f6ade..15e140058 100644 --- a/frontend/src/pages/Overview.vue +++ b/frontend/src/pages/Overview.vue @@ -1,24 +1,10 @@ - - - - - - - - diff --git a/frontend/src/pages/SelectCommunity.spec.js b/frontend/src/pages/SelectCommunity.spec.js index f8896ae15..25ec8db93 100644 --- a/frontend/src/pages/SelectCommunity.spec.js +++ b/frontend/src/pages/SelectCommunity.spec.js @@ -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') }) diff --git a/frontend/src/pages/SelectCommunity.vue b/frontend/src/pages/SelectCommunity.vue index 0535e4fe7..8702d3e2e 100644 --- a/frontend/src/pages/SelectCommunity.vue +++ b/frontend/src/pages/SelectCommunity.vue @@ -5,9 +5,9 @@ - {{ $store.state.community.name }} + {{ CONFIG.COMMUNITY_NAME }} - {{ $store.state.community.description }} + {{ CONFIG.COMMUNITY_DESCRIPTION }} @@ -49,7 +49,7 @@
- {{ $t('form.close') }} -
{{ link }}
- {{ $store.state.community.description }} + {{ CONFIG.COMMUNITY_DESCRIPTION }}
{{ $store.state.community.description }}
{{ CONFIG.COMMUNITY_DESCRIPTION }}