mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into docu-cron-yarn
This commit is contained in:
commit
3efb2cc1b7
64
CHANGELOG.md
64
CHANGELOG.md
@ -4,8 +4,72 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [1.20.0](https://github.com/gradido/gradido/compare/1.19.1...1.20.0)
|
||||
|
||||
- fix(backend): no await for emails [`#2918`](https://github.com/gradido/gradido/pull/2918)
|
||||
- fix(frontend): no receiver on send by link [`#2933`](https://github.com/gradido/gradido/pull/2933)
|
||||
- fix(admin): pagination set currentPage by switch tabs [`#2902`](https://github.com/gradido/gradido/pull/2902)
|
||||
- fix(federation): correct export of the community url [`#2931`](https://github.com/gradido/gradido/pull/2931)
|
||||
- fix(frontend): displayed decay duration [`#2927`](https://github.com/gradido/gradido/pull/2927)
|
||||
- fix(frontend): community tab navigation [`#2928`](https://github.com/gradido/gradido/pull/2928)
|
||||
- fix(frontend): moderator id missing [`#2925`](https://github.com/gradido/gradido/pull/2925)
|
||||
- fix(frontend): reset button send coins [`#2924`](https://github.com/gradido/gradido/pull/2924)
|
||||
- refactor(backend): eslint plugin import export style [`#2908`](https://github.com/gradido/gradido/pull/2908)
|
||||
- fix(backend): vscode intellisense fixes [`#2919`](https://github.com/gradido/gradido/pull/2919)
|
||||
- refactor(backend): eslint import-no-cycle enabled [`#2905`](https://github.com/gradido/gradido/pull/2905)
|
||||
- docs(backend): alias rules and conventions [`#2881`](https://github.com/gradido/gradido/pull/2881)
|
||||
- refactor(backend): get transaction list [`#2923`](https://github.com/gradido/gradido/pull/2923)
|
||||
- feat(backend): previous balance in transaction [`#2914`](https://github.com/gradido/gradido/pull/2914)
|
||||
- refactor(backend): eslint update packages [`#2829`](https://github.com/gradido/gradido/pull/2829)
|
||||
- feat(frontend): send coins via gradido ID [`#2837`](https://github.com/gradido/gradido/pull/2837)
|
||||
- refactor(database): cleanup database [`#2808`](https://github.com/gradido/gradido/pull/2808)
|
||||
- refactor(backend): eslint plugin n + fixes [`#2828`](https://github.com/gradido/gradido/pull/2828)
|
||||
- feat(frontend): add link to download QR-Code [`#2889`](https://github.com/gradido/gradido/pull/2889)
|
||||
- fix(other): delete node_modules and /tmp/yarn--* on start.sh [`#2904`](https://github.com/gradido/gradido/pull/2904)
|
||||
- fix(admin): add confirmation modal for user role change and user (un)deletion [`#2880`](https://github.com/gradido/gradido/pull/2880)
|
||||
- fix(admin): admin open contribution edit button [`#2811`](https://github.com/gradido/gradido/pull/2811)
|
||||
- fix(backend): import order [`#2911`](https://github.com/gradido/gradido/pull/2911)
|
||||
- fix(other): use default values for undefined .env database values [`#2910`](https://github.com/gradido/gradido/pull/2910)
|
||||
- refactor(backend): eslint plugin import + fixes [`#2827`](https://github.com/gradido/gradido/pull/2827)
|
||||
- refactor(backend): missing event tests [`#2900`](https://github.com/gradido/gradido/pull/2900)
|
||||
- refactor(backend): unify event names [`#2799`](https://github.com/gradido/gradido/pull/2799)
|
||||
- feat(backend): events for users [`#2797`](https://github.com/gradido/gradido/pull/2797)
|
||||
- fix(backend): subscription get's email and languages from user [`#2885`](https://github.com/gradido/gradido/pull/2885)
|
||||
- refactor(backend): eslint-plugin-jest + fixes [`#2816`](https://github.com/gradido/gradido/pull/2816)
|
||||
- fix(frontend): fr change ` and ´ to ' [`#2888`](https://github.com/gradido/gradido/pull/2888)
|
||||
- feat(backend): events for transaction links [`#2792`](https://github.com/gradido/gradido/pull/2792)
|
||||
- feat(backend): events for contributions [`#2784`](https://github.com/gradido/gradido/pull/2784)
|
||||
- feat(backend): events for contribution messages [`#2783`](https://github.com/gradido/gradido/pull/2783)
|
||||
- refactor(backend): upgrade coverage to 85% [`#2884`](https://github.com/gradido/gradido/pull/2884)
|
||||
- refactor(backend): add klicktipp-api library [`#2883`](https://github.com/gradido/gradido/pull/2883)
|
||||
- feat(backend): events for contribution links [`#2780`](https://github.com/gradido/gradido/pull/2780)
|
||||
- refactor(backend): separate events in own files [`#2777`](https://github.com/gradido/gradido/pull/2777)
|
||||
- refactor(backend): rename `evenProtocolType` to `eventType` [`#2776`](https://github.com/gradido/gradido/pull/2776)
|
||||
- refactor(other): add yarn installAll on gradido folder [`#2703`](https://github.com/gradido/gradido/pull/2703)
|
||||
- docs(federation): describe the technical federation architecture [`#2716`](https://github.com/gradido/gradido/pull/2716)
|
||||
- refactor(admin): admin list contributions for creation transaction list query [`#2791`](https://github.com/gradido/gradido/pull/2791)
|
||||
- refactor(workflow): separate workflow with file filter for nginx testing [`#2871`](https://github.com/gradido/gradido/pull/2871)
|
||||
- feat(backend): read communities data from database [`#2807`](https://github.com/gradido/gradido/pull/2807)
|
||||
- feat(federation): implement a graphql endpoint to answer getpublickey-request [`#2651`](https://github.com/gradido/gradido/pull/2651)
|
||||
- refactor(workflow): add file filters to dht node and federation workflows [`#2838`](https://github.com/gradido/gradido/pull/2838)
|
||||
- refactor(workflow): separate test workflow for end-to-end tests [`#2836`](https://github.com/gradido/gradido/pull/2836)
|
||||
- refactor(workflow): separate test workflow for frontend [`#2835`](https://github.com/gradido/gradido/pull/2835)
|
||||
- feat(federation): add federation modul to deployment scripts [`#2733`](https://github.com/gradido/gradido/pull/2733)
|
||||
- refactor(database): event table [`#2720`](https://github.com/gradido/gradido/pull/2720)
|
||||
- refactor(workflow): separate test workflow with file change filters for admin interface [`#2734`](https://github.com/gradido/gradido/pull/2734)
|
||||
- fix(admin): fix translation in menu (english) [`#2814`](https://github.com/gradido/gradido/pull/2814)
|
||||
- refactor(workflow): configure jest to directly check coverage to schlanken the test workflows [`#2790`](https://github.com/gradido/gradido/pull/2790)
|
||||
- fix(database): removed commands from package.json not working [`#2805`](https://github.com/gradido/gradido/pull/2805)
|
||||
- fix(other): repair UserProfile.ChangePassword.feature scenario [`#2782`](https://github.com/gradido/gradido/pull/2782)
|
||||
- feat(backend): test double redeem transaction links [`#2788`](https://github.com/gradido/gradido/pull/2788)
|
||||
- feat(backend): admin open creations query [`#2813`](https://github.com/gradido/gradido/pull/2813)
|
||||
- refactor(backend): eslint-plugin-type-graphql + fixes [`#2745`](https://github.com/gradido/gradido/pull/2745)
|
||||
|
||||
#### [1.19.1](https://github.com/gradido/gradido/compare/1.19.0...1.19.1)
|
||||
|
||||
> 10 March 2023
|
||||
|
||||
- chore(other): upgrade version to 1.19.1 [`#2812`](https://github.com/gradido/gradido/pull/2812)
|
||||
- fix(frontend): admin question clickable [`#2810`](https://github.com/gradido/gradido/pull/2810)
|
||||
- refactor(frontend): change b-img to b-icon send [`#2809`](https://github.com/gradido/gradido/pull/2809)
|
||||
- fix(admin): update openCreation in case of tab open. [`#2806`](https://github.com/gradido/gradido/pull/2806)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"description": "Administraion Interface for Gradido",
|
||||
"main": "index.js",
|
||||
"author": "Moriz Wahl",
|
||||
"version": "1.19.1",
|
||||
"version": "1.20.0",
|
||||
"license": "Apache-2.0",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
@ -33,6 +33,7 @@
|
||||
"bootstrap": "4.3.1",
|
||||
"bootstrap-vue": "^2.21.2",
|
||||
"core-js": "^3.6.5",
|
||||
"date-fns": "^2.29.3",
|
||||
"dotenv-webpack": "^7.0.3",
|
||||
"express": "^4.17.1",
|
||||
"graphql": "^15.6.1",
|
||||
|
||||
183
admin/src/components/Fedaration/FederationVisualizeItem.spec.js
Normal file
183
admin/src/components/Fedaration/FederationVisualizeItem.spec.js
Normal file
@ -0,0 +1,183 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import FederationVisualizeItem from './FederationVisualizeItem.vue'
|
||||
|
||||
const localVue = global.localVue
|
||||
const today = new Date()
|
||||
const createdDate = new Date()
|
||||
createdDate.setDate(createdDate.getDate() - 3)
|
||||
|
||||
let propsData = {
|
||||
item: {
|
||||
id: 7590,
|
||||
foreign: false,
|
||||
publicKey: 'eaf6a426b24fd54f8fbae11c17700fc595080ca25159579c63d38dbc64284ba7',
|
||||
url: 'http://localhost/api/2_0',
|
||||
lastAnnouncedAt: createdDate,
|
||||
verifiedAt: today,
|
||||
lastErrorAt: null,
|
||||
createdAt: createdDate,
|
||||
updatedAt: null,
|
||||
},
|
||||
}
|
||||
|
||||
const mocks = {
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
},
|
||||
}
|
||||
|
||||
describe('FederationVisualizeItem', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(FederationVisualizeItem, { localVue, mocks, propsData })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the component', () => {
|
||||
expect(wrapper.find('div.federation-visualize-item').exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('rendering item properties', () => {
|
||||
it('has the url', () => {
|
||||
expect(wrapper.find('.row > div:nth-child(2) > div').text()).toBe(
|
||||
'http://localhost/api/2_0',
|
||||
)
|
||||
})
|
||||
|
||||
it('has the public key', () => {
|
||||
expect(wrapper.find('.row > div:nth-child(2) > small').text()).toContain(
|
||||
'eaf6a426b24fd54f8fbae11c17700fc595080ca25159579c63d38dbc64284ba7'.substring(0, 26),
|
||||
)
|
||||
})
|
||||
|
||||
describe('verified item', () => {
|
||||
it('has the check icon', () => {
|
||||
expect(wrapper.find('svg.bi-check').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('has the text variant "success"', () => {
|
||||
expect(wrapper.find('.text-success').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('not verified item', () => {
|
||||
beforeEach(() => {
|
||||
propsData = {
|
||||
item: {
|
||||
id: 7590,
|
||||
foreign: false,
|
||||
publicKey: 'eaf6a426b24fd54f8fbae11c17700fc595080ca25159579c63d38dbc64284ba7',
|
||||
url: 'http://localhost/api/2_0',
|
||||
lastAnnouncedAt: createdDate,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: createdDate,
|
||||
updatedAt: null,
|
||||
},
|
||||
}
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('has the x-circle icon', () => {
|
||||
expect(wrapper.find('svg.bi-x-circle').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('has the text variant "danger"', () => {
|
||||
expect(wrapper.find('.text-danger').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
// describe('with different locales (de, en, fr, es, nl)', () => {
|
||||
describe('lastAnnouncedAt', () => {
|
||||
it('computes the time string for different locales (de, en, fr, es, nl)', () => {
|
||||
wrapper.vm.$i18n.locale = 'de'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.lastAnnouncedAt).toBe('vor 3 Tagen')
|
||||
|
||||
wrapper.vm.$i18n.locale = 'fr'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.lastAnnouncedAt).toBe('il y a 3 jours')
|
||||
|
||||
wrapper.vm.$i18n.locale = 'es'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.lastAnnouncedAt).toBe('hace 3 días')
|
||||
|
||||
wrapper.vm.$i18n.locale = 'nl'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.lastAnnouncedAt).toBe('3 dagen geleden')
|
||||
})
|
||||
|
||||
describe('lastAnnouncedAt == null', () => {
|
||||
beforeEach(() => {
|
||||
propsData = {
|
||||
item: {
|
||||
id: 7590,
|
||||
foreign: false,
|
||||
publicKey: 'eaf6a426b24fd54f8fbae11c17700fc595080ca25159579c63d38dbc64284ba7',
|
||||
url: 'http://localhost/api/2_0',
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: createdDate,
|
||||
updatedAt: null,
|
||||
},
|
||||
}
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('computes empty string', async () => {
|
||||
expect(wrapper.vm.lastAnnouncedAt).toBe('')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('createdAt', () => {
|
||||
it('computes the time string for different locales (de, en, fr, es, nl)', () => {
|
||||
wrapper.vm.$i18n.locale = 'de'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.createdAt).toBe('vor 3 Tagen')
|
||||
|
||||
wrapper.vm.$i18n.locale = 'fr'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.createdAt).toBe('il y a 3 jours')
|
||||
|
||||
wrapper.vm.$i18n.locale = 'es'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.createdAt).toBe('hace 3 días')
|
||||
|
||||
wrapper.vm.$i18n.locale = 'nl'
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.vm.createdAt).toBe('3 dagen geleden')
|
||||
})
|
||||
|
||||
describe('createdAt == null', () => {
|
||||
beforeEach(() => {
|
||||
propsData = {
|
||||
item: {
|
||||
id: 7590,
|
||||
foreign: false,
|
||||
publicKey: 'eaf6a426b24fd54f8fbae11c17700fc595080ca25159579c63d38dbc64284ba7',
|
||||
url: 'http://localhost/api/2_0',
|
||||
lastAnnouncedAt: createdDate,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
},
|
||||
}
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('computes empty string', async () => {
|
||||
expect(wrapper.vm.createdAt).toBe('')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
63
admin/src/components/Fedaration/FederationVisualizeItem.vue
Normal file
63
admin/src/components/Fedaration/FederationVisualizeItem.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div class="federation-visualize-item">
|
||||
<b-row>
|
||||
<b-col cols="1"><b-icon :icon="icon" :variant="variant" class="mr-4"></b-icon></b-col>
|
||||
<b-col>
|
||||
<div>{{ item.url }}</div>
|
||||
<small>{{ `${item.publicKey.substring(0, 26)}…` }}</small>
|
||||
</b-col>
|
||||
<b-col cols="2">{{ lastAnnouncedAt }}</b-col>
|
||||
<b-col cols="2">{{ createdAt }}</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { formatDistanceToNow } from 'date-fns'
|
||||
import { de, en, fr, es, nl } from 'date-fns/locale'
|
||||
|
||||
const locales = { en, de, es, fr, nl }
|
||||
|
||||
export default {
|
||||
name: 'FederationVisualizeItem',
|
||||
props: {
|
||||
item: { type: Object },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatDistanceToNow,
|
||||
locale: this.$i18n.locale,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
verified() {
|
||||
return new Date(this.item.verifiedAt) >= new Date(this.item.lastAnnouncedAt)
|
||||
},
|
||||
icon() {
|
||||
return this.verified ? 'check' : 'x-circle'
|
||||
},
|
||||
variant() {
|
||||
return this.verified ? 'success' : 'danger'
|
||||
},
|
||||
lastAnnouncedAt() {
|
||||
if (this.item.lastAnnouncedAt) {
|
||||
return formatDistanceToNow(new Date(this.item.lastAnnouncedAt), {
|
||||
includeSecond: true,
|
||||
addSuffix: true,
|
||||
locale: locales[this.locale],
|
||||
})
|
||||
}
|
||||
return ''
|
||||
},
|
||||
createdAt() {
|
||||
if (this.item.createdAt) {
|
||||
return formatDistanceToNow(new Date(this.item.createdAt), {
|
||||
includeSecond: true,
|
||||
addSuffix: true,
|
||||
locale: locales[this.locale],
|
||||
})
|
||||
}
|
||||
return ''
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -62,8 +62,12 @@ describe('NavBar', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('has a link to /federation', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe('/federation')
|
||||
})
|
||||
|
||||
it('has a link to /statistic', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe('/statistic')
|
||||
expect(wrapper.findAll('.nav-item').at(4).find('a').attributes('href')).toBe('/statistic')
|
||||
})
|
||||
})
|
||||
|
||||
@ -72,7 +76,7 @@ describe('NavBar', () => {
|
||||
beforeEach(async () => {
|
||||
delete window.location
|
||||
window.location = ''
|
||||
await wrapper.findAll('.nav-item').at(4).find('a').trigger('click')
|
||||
await wrapper.findAll('.nav-item').at(5).find('a').trigger('click')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
@ -97,7 +101,7 @@ describe('NavBar', () => {
|
||||
window.location = {
|
||||
assign: windowLocationMock,
|
||||
}
|
||||
await wrapper.findAll('.nav-item').at(5).find('a').trigger('click')
|
||||
await wrapper.findAll('.nav-item').at(6).find('a').trigger('click')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="component-nabvar">
|
||||
<b-navbar toggleable="md" type="dark" variant="success">
|
||||
<b-navbar toggleable="lg" type="dark" class="bg-dark">
|
||||
<b-navbar-brand class="mb-2" to="/">
|
||||
<img src="img/brand/gradido_logo_w.png" class="navbar-brand-img pl-2" alt="..." />
|
||||
</b-navbar-brand>
|
||||
@ -19,6 +19,9 @@
|
||||
<b-nav-item to="/contribution-links">
|
||||
{{ $t('navbar.automaticContributions') }}
|
||||
</b-nav-item>
|
||||
<b-nav-item to="/federation">
|
||||
{{ $t('navbar.instances') }}
|
||||
</b-nav-item>
|
||||
<b-nav-item to="/statistic">{{ $t('navbar.statistic') }}</b-nav-item>
|
||||
<b-nav-item @click="wallet">{{ $t('navbar.my-account') }}</b-nav-item>
|
||||
<b-nav-item @click="logout">{{ $t('navbar.logout') }}</b-nav-item>
|
||||
|
||||
17
admin/src/graphql/getCommunities.js
Normal file
17
admin/src/graphql/getCommunities.js
Normal file
@ -0,0 +1,17 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const getCommunities = gql`
|
||||
query {
|
||||
getCommunities {
|
||||
id
|
||||
foreign
|
||||
publicKey
|
||||
url
|
||||
lastAnnouncedAt
|
||||
verifiedAt
|
||||
lastErrorAt
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
`
|
||||
@ -68,6 +68,13 @@
|
||||
"error": "Fehler",
|
||||
"expired": "abgelaufen",
|
||||
"e_mail": "E-Mail",
|
||||
"federation": {
|
||||
"createdAt": "Erstellt am",
|
||||
"gradidoInstances": "Gradido Instanzen",
|
||||
"lastAnnouncedAt": "letzte Bekanntgabe",
|
||||
"url": "Url",
|
||||
"verified": "Verifiziert"
|
||||
},
|
||||
"firstname": "Vorname",
|
||||
"footer": {
|
||||
"app_version": "App version {version}",
|
||||
@ -105,6 +112,7 @@
|
||||
"name": "Name",
|
||||
"navbar": {
|
||||
"automaticContributions": "Automatische Beiträge",
|
||||
"instances": "Instanzen",
|
||||
"logout": "Abmelden",
|
||||
"my-account": "Mein Konto",
|
||||
"statistic": "Statistik",
|
||||
|
||||
@ -68,6 +68,13 @@
|
||||
"error": "Error",
|
||||
"expired": "expired",
|
||||
"e_mail": "E-mail",
|
||||
"federation": {
|
||||
"createdAt": "Created At ",
|
||||
"gradidoInstances": "Gradido Instances",
|
||||
"lastAnnouncedAt": "Last Announced",
|
||||
"url": "Url",
|
||||
"verified": "Verified"
|
||||
},
|
||||
"firstname": "Firstname",
|
||||
"footer": {
|
||||
"app_version": "App version {version}",
|
||||
@ -105,6 +112,7 @@
|
||||
"name": "Name",
|
||||
"navbar": {
|
||||
"automaticContributions": "Automatic Contributions",
|
||||
"instances": "Instances",
|
||||
"logout": "Logout",
|
||||
"my-account": "My Account",
|
||||
"statistic": "Statistic",
|
||||
|
||||
@ -39,7 +39,7 @@ const mocks = {
|
||||
const defaultData = () => {
|
||||
return {
|
||||
adminListContributions: {
|
||||
contributionCount: 2,
|
||||
contributionCount: 30,
|
||||
contributionList: [
|
||||
{
|
||||
id: 1,
|
||||
@ -407,6 +407,44 @@ describe('CreationConfirm', () => {
|
||||
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
||||
})
|
||||
})
|
||||
|
||||
describe('change pagination', () => {
|
||||
it('has pagination buttons', () => {
|
||||
expect(wrapper.findComponent({ name: 'BPagination' }).exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('next page', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
wrapper.findComponent({ name: 'BPagination' }).vm.$emit('input', 2)
|
||||
})
|
||||
|
||||
it('calls the API again', () => {
|
||||
expect(adminListContributionsMock).toBeCalledWith({
|
||||
currentPage: 2,
|
||||
order: 'DESC',
|
||||
pageSize: 25,
|
||||
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
||||
})
|
||||
})
|
||||
|
||||
describe('click tab "open" again', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.find('a[data-test="open"]').trigger('click')
|
||||
})
|
||||
|
||||
it('refetches contributions with proper filter and current page = 1', () => {
|
||||
expect(adminListContributionsMock).toBeCalledWith({
|
||||
currentPage: 1,
|
||||
order: 'DESC',
|
||||
pageSize: 25,
|
||||
statusFilter: ['IN_PROGRESS', 'PENDING'],
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -116,6 +116,11 @@ export default {
|
||||
pageSize: 25,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
tabIndex() {
|
||||
this.currentPage = 1
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
deleteCreation() {
|
||||
this.$apollo
|
||||
|
||||
125
admin/src/pages/FederationVisualize.spec.js
Normal file
125
admin/src/pages/FederationVisualize.spec.js
Normal file
@ -0,0 +1,125 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import FederationVisualize from './FederationVisualize'
|
||||
import VueApollo from 'vue-apollo'
|
||||
import { createMockClient } from 'mock-apollo-client'
|
||||
import { getCommunities } from '@/graphql/getCommunities'
|
||||
import { toastErrorSpy } from '../../test/testSetup'
|
||||
|
||||
const mockClient = createMockClient()
|
||||
const apolloProvider = new VueApollo({
|
||||
defaultClient: mockClient,
|
||||
})
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
localVue.use(VueApollo)
|
||||
|
||||
const mocks = {
|
||||
$t: (key) => key,
|
||||
$d: jest.fn((d) => d),
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
t: (key) => key,
|
||||
},
|
||||
}
|
||||
|
||||
const defaultData = () => {
|
||||
return {
|
||||
getCommunities: [
|
||||
{
|
||||
id: 1776,
|
||||
foreign: true,
|
||||
publicKey: 'c7ca9e742421bb167b8666cb78f90b40c665b8f35db8f001988d44dbb3ce8527',
|
||||
url: 'http://localhost/api/2_0',
|
||||
lastAnnouncedAt: '2023-04-07T12:27:24.037Z',
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: '2023-04-07T11:45:06.254Z',
|
||||
updatedAt: null,
|
||||
__typename: 'Community',
|
||||
},
|
||||
{
|
||||
id: 1775,
|
||||
foreign: true,
|
||||
publicKey: 'c7ca9e742421bb167b8666cb78f90b40c665b8f35db8f001988d44dbb3ce8527',
|
||||
url: 'http://localhost/api/1_1',
|
||||
lastAnnouncedAt: '2023-04-07T12:27:24.023Z',
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: '2023-04-07T11:45:06.234Z',
|
||||
updatedAt: null,
|
||||
__typename: 'Community',
|
||||
},
|
||||
{
|
||||
id: 1774,
|
||||
foreign: true,
|
||||
publicKey: 'c7ca9e742421bb167b8666cb78f90b40c665b8f35db8f001988d44dbb3ce8527',
|
||||
url: 'http://localhost/api/1_0',
|
||||
lastAnnouncedAt: '2023-04-07T12:27:24.009Z',
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: '2023-04-07T11:45:06.218Z',
|
||||
updatedAt: null,
|
||||
__typename: 'Community',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
describe('FederationVisualize', () => {
|
||||
let wrapper
|
||||
const getCommunitiesMock = jest.fn()
|
||||
|
||||
mockClient.setRequestHandler(
|
||||
getCommunities,
|
||||
getCommunitiesMock
|
||||
.mockRejectedValueOnce({ message: 'Ouch!' })
|
||||
.mockResolvedValue({ data: defaultData() }),
|
||||
)
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(FederationVisualize, { localVue, mocks, apolloProvider })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
describe('server error', () => {
|
||||
it('toast error', () => {
|
||||
expect(toastErrorSpy).toBeCalledWith('Ouch!')
|
||||
})
|
||||
})
|
||||
|
||||
describe('sever success', () => {
|
||||
it('sends query to Apollo when created', () => {
|
||||
expect(getCommunitiesMock).toBeCalled()
|
||||
})
|
||||
|
||||
it('has a DIV element with the class "federation-visualize"', () => {
|
||||
expect(wrapper.find('div.federation-visualize').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('has a refresh button', () => {
|
||||
expect(wrapper.find('[data-test="federation-communities-refresh-btn"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('renders 3 community list items', () => {
|
||||
expect(wrapper.findAll('.list-group-item').length).toBe(3)
|
||||
})
|
||||
|
||||
describe('cklicking the refresh button', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.find('[data-test="federation-communities-refresh-btn"]').trigger('click')
|
||||
})
|
||||
|
||||
it('calls the API', async () => {
|
||||
expect(getCommunitiesMock).toBeCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
69
admin/src/pages/FederationVisualize.vue
Normal file
69
admin/src/pages/FederationVisualize.vue
Normal file
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<div class="federation-visualize">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<span class="h2">{{ $t('federation.gradidoInstances') }}</span>
|
||||
<b-button>
|
||||
<b-icon
|
||||
icon="arrow-clockwise"
|
||||
font-scale="2"
|
||||
:animation="animation"
|
||||
@click="$apollo.queries.GetCommunities.refresh()"
|
||||
data-test="federation-communities-refresh-btn"
|
||||
></b-icon>
|
||||
</b-button>
|
||||
</div>
|
||||
<b-list-group>
|
||||
<b-row>
|
||||
<b-col cols="1" class="ml-1">{{ $t('federation.verified') }}</b-col>
|
||||
<b-col class="ml-3">{{ $t('federation.url') }}</b-col>
|
||||
<b-col cols="2">{{ $t('federation.lastAnnouncedAt') }}</b-col>
|
||||
<b-col cols="2">{{ $t('federation.createdAt') }}</b-col>
|
||||
</b-row>
|
||||
<b-list-group-item
|
||||
v-for="item in communities"
|
||||
:key="item.id"
|
||||
:variant="!item.foreign ? 'primary' : 'warning'"
|
||||
>
|
||||
<federation-visualize-item :item="item" />
|
||||
</b-list-group-item>
|
||||
</b-list-group>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getCommunities } from '@/graphql/getCommunities'
|
||||
|
||||
import FederationVisualizeItem from '../components/Fedaration/FederationVisualizeItem.vue'
|
||||
|
||||
export default {
|
||||
name: 'FederationVisualize',
|
||||
components: {
|
||||
FederationVisualizeItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
oldPublicKey: '',
|
||||
communities: [],
|
||||
icon: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
animation() {
|
||||
return this.$apollo.queries.GetCommunities.loading ? 'spin' : ''
|
||||
},
|
||||
},
|
||||
apollo: {
|
||||
GetCommunities: {
|
||||
fetchPolicy: 'network-only',
|
||||
query() {
|
||||
return getCommunities
|
||||
},
|
||||
update({ getCommunities }) {
|
||||
this.communities = getCommunities
|
||||
},
|
||||
error({ message }) {
|
||||
this.toastError(message)
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -45,7 +45,7 @@ describe('router', () => {
|
||||
|
||||
describe('routes', () => {
|
||||
it('has nine routes defined', () => {
|
||||
expect(routes).toHaveLength(8)
|
||||
expect(routes).toHaveLength(9)
|
||||
})
|
||||
|
||||
it('has "/overview" as default', async () => {
|
||||
@ -88,6 +88,13 @@ describe('router', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('federation', () => {
|
||||
it('loads the "FederationVisualize" page', async () => {
|
||||
const component = await routes.find((r) => r.path === '/federation').component()
|
||||
expect(component.default.name).toBe('FederationVisualize')
|
||||
})
|
||||
})
|
||||
|
||||
describe('not found page', () => {
|
||||
it('renders the "NotFound" component', async () => {
|
||||
const component = await routes.find((r) => r.path === '*').component()
|
||||
|
||||
@ -31,6 +31,10 @@ const routes = [
|
||||
path: '*',
|
||||
component: () => import('@/components/NotFoundPage.vue'),
|
||||
},
|
||||
{
|
||||
path: '/federation',
|
||||
component: () => import('@/pages/FederationVisualize.vue'),
|
||||
},
|
||||
]
|
||||
|
||||
export default routes
|
||||
|
||||
@ -5038,6 +5038,11 @@ data-urls@^2.0.0:
|
||||
whatwg-mimetype "^2.3.0"
|
||||
whatwg-url "^8.0.0"
|
||||
|
||||
date-fns@^2.29.3:
|
||||
version "2.29.3"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
|
||||
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==
|
||||
|
||||
de-indent@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
|
||||
|
||||
@ -18,7 +18,9 @@ module.exports = {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
},
|
||||
'import/resolver': {
|
||||
typescript: true,
|
||||
typescript: {
|
||||
project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||
},
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
@ -71,7 +73,7 @@ module.exports = {
|
||||
'import/group-exports': 'off',
|
||||
'import/newline-after-import': 'error',
|
||||
'import/no-anonymous-default-export': 'error',
|
||||
'import/no-default-export': 'off',
|
||||
'import/no-default-export': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'import/no-named-default': 'error',
|
||||
'import/no-namespace': 'error',
|
||||
@ -100,7 +102,7 @@ module.exports = {
|
||||
distinctGroup: true,
|
||||
},
|
||||
],
|
||||
'import/prefer-default-export': 'off', // TODO
|
||||
'import/prefer-default-export': 'off',
|
||||
// n
|
||||
'n/handle-callback-err': 'error',
|
||||
'n/no-callback-literal': 'error',
|
||||
@ -160,8 +162,8 @@ module.exports = {
|
||||
'import/unambiguous': 'off',
|
||||
},
|
||||
parserOptions: {
|
||||
tsconfigRootDir: './',
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||
// this is to properly reference the referenced project database without requirement of compiling it
|
||||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||
},
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
module.exports = {
|
||||
semi: false,
|
||||
printWidth: 100,
|
||||
singleQuote: true,
|
||||
trailingComma: "all",
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
quoteProps: "as-needed",
|
||||
jsxSingleQuote: true,
|
||||
trailingComma: "all",
|
||||
bracketSpacing: true,
|
||||
bracketSameLine: false,
|
||||
arrowParens: "always",
|
||||
endOfLine: "auto",
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gradido-backend",
|
||||
"version": "1.19.1",
|
||||
"version": "1.20.0",
|
||||
"description": "Gradido unified backend providing an API-Service for Gradido Transactions",
|
||||
"main": "src/index.ts",
|
||||
"repository": "https://github.com/gradido/gradido/backend",
|
||||
@ -56,17 +56,17 @@
|
||||
"@types/node": "^16.10.3",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
||||
"@typescript-eslint/parser": "^5.54.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||
"@typescript-eslint/parser": "^5.57.1",
|
||||
"apollo-server-testing": "^2.25.2",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint": "^8.37.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.3",
|
||||
"eslint-import-resolver-typescript": "^3.5.4",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-n": "^15.6.1",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-n": "^15.7.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-type-graphql": "^1.0.0",
|
||||
"faker": "^5.5.3",
|
||||
@ -74,7 +74,7 @@
|
||||
"jest": "^27.2.4",
|
||||
"klicktipp-api": "^1.0.2",
|
||||
"nodemon": "^2.0.7",
|
||||
"prettier": "^2.3.1",
|
||||
"prettier": "^2.8.7",
|
||||
"ts-jest": "^27.0.5",
|
||||
"ts-node": "^10.0.0",
|
||||
"tsconfig-paths": "^3.14.0",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import axios from 'axios'
|
||||
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import CONFIG from '@/config'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
// eslint-disable-next-line import/no-relative-parent-imports
|
||||
import KlicktippConnector from 'klicktipp-api'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { verify, sign } from 'jsonwebtoken'
|
||||
|
||||
import CONFIG from '@/config/'
|
||||
import LogError from '@/server/LogError'
|
||||
import { CONFIG } from '@/config/'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
import { CustomJwtPayload } from './CustomJwtPayload'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import CONFIG from './index'
|
||||
import { CONFIG } from './index'
|
||||
|
||||
describe('config/index', () => {
|
||||
describe('decay start block', () => {
|
||||
|
||||
@ -76,7 +76,7 @@ const email = {
|
||||
EMAIL_SENDER: process.env.EMAIL_SENDER || 'info@gradido.net',
|
||||
EMAIL_PASSWORD: process.env.EMAIL_PASSWORD || '',
|
||||
EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL || 'mailserver',
|
||||
EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '1025',
|
||||
EMAIL_SMTP_PORT: Number(process.env.EMAIL_SMTP_PORT) || 1025,
|
||||
// eslint-disable-next-line no-unneeded-ternary
|
||||
EMAIL_TLS: process.env.EMAIL_TLS === 'false' ? false : true,
|
||||
EMAIL_LINK_VERIFICATION:
|
||||
@ -121,7 +121,7 @@ const federation = {
|
||||
Number(process.env.FEDERATION_VALIDATE_COMMUNITY_TIMER) || 60000,
|
||||
}
|
||||
|
||||
const CONFIG = {
|
||||
export const CONFIG = {
|
||||
...constants,
|
||||
...server,
|
||||
...database,
|
||||
@ -132,5 +132,3 @@ const CONFIG = {
|
||||
...webhook,
|
||||
...federation,
|
||||
}
|
||||
|
||||
export default CONFIG
|
||||
|
||||
@ -4,13 +4,13 @@ import { createTransport } from 'nodemailer'
|
||||
|
||||
import { logger, i18n } from '@test/testSetup'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
|
||||
CONFIG.EMAIL = false
|
||||
CONFIG.EMAIL_SMTP_URL = 'EMAIL_SMTP_URL'
|
||||
CONFIG.EMAIL_SMTP_PORT = '1234'
|
||||
CONFIG.EMAIL_SMTP_PORT = 1234
|
||||
CONFIG.EMAIL_USERNAME = 'user'
|
||||
CONFIG.EMAIL_PASSWORD = 'pwd'
|
||||
CONFIG.EMAIL_TLS = true
|
||||
@ -31,7 +31,7 @@ jest.mock('nodemailer', () => {
|
||||
})
|
||||
|
||||
describe('sendEmailTranslated', () => {
|
||||
let result: Record<string, unknown> | null
|
||||
let result: Record<string, unknown> | boolean | null
|
||||
|
||||
describe('config email is false', () => {
|
||||
beforeEach(async () => {
|
||||
|
||||
@ -1,49 +1,52 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import path from 'path'
|
||||
|
||||
import Email from 'email-templates'
|
||||
import i18n from 'i18n'
|
||||
import { createTransport } from 'nodemailer'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import LogError from '@/server/LogError'
|
||||
import { CONFIG } from '@/config'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
export const sendEmailTranslated = async (params: {
|
||||
export const sendEmailTranslated = async ({
|
||||
receiver,
|
||||
template,
|
||||
locals,
|
||||
}: {
|
||||
receiver: {
|
||||
to: string
|
||||
cc?: string
|
||||
}
|
||||
template: string
|
||||
locals: Record<string, unknown>
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
let resultSend: Record<string, unknown> | null = null
|
||||
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
// TODO: test the calling order of 'i18n.setLocale' for example: language of logging 'en', language of email receiver 'es', reset language of current user 'de'
|
||||
|
||||
// because language of receiver can differ from language of current user who triggers the sending
|
||||
const rememberLocaleToRestore = i18n.getLocale()
|
||||
|
||||
i18n.setLocale('en') // for logging
|
||||
logger.info(
|
||||
`send Email: language=${params.locals.locale} to=${params.receiver.to}` +
|
||||
(params.receiver.cc ? `, cc=${params.receiver.cc}` : '') +
|
||||
`, subject=${i18n.__('emails.' + params.template + '.subject')}`,
|
||||
)
|
||||
|
||||
if (!CONFIG.EMAIL) {
|
||||
logger.info(`Emails are disabled via config...`)
|
||||
return null
|
||||
}
|
||||
|
||||
// because language of receiver can differ from language of current user who triggers the sending
|
||||
// const rememberLocaleToRestore = i18n.getLocale()
|
||||
|
||||
i18n.setLocale('en') // for logging
|
||||
logger.info(
|
||||
`send Email: language=${locals.locale as string} to=${receiver.to}` +
|
||||
(receiver.cc ? `, cc=${receiver.cc}` : '') +
|
||||
`, subject=${i18n.__('emails.' + template + '.subject')}`,
|
||||
)
|
||||
|
||||
if (CONFIG.EMAIL_TEST_MODUS) {
|
||||
logger.info(
|
||||
`Testmodus=ON: change receiver from ${params.receiver.to} to ${CONFIG.EMAIL_TEST_RECEIVER}`,
|
||||
`Testmodus=ON: change receiver from ${receiver.to} to ${CONFIG.EMAIL_TEST_RECEIVER}`,
|
||||
)
|
||||
params.receiver.to = CONFIG.EMAIL_TEST_RECEIVER
|
||||
receiver.to = CONFIG.EMAIL_TEST_RECEIVER
|
||||
}
|
||||
const transport = createTransport({
|
||||
host: CONFIG.EMAIL_SMTP_URL,
|
||||
port: Number(CONFIG.EMAIL_SMTP_PORT),
|
||||
port: CONFIG.EMAIL_SMTP_PORT,
|
||||
secure: false, // true for 465, false for other ports
|
||||
requireTLS: CONFIG.EMAIL_TLS,
|
||||
auth: {
|
||||
@ -52,7 +55,7 @@ export const sendEmailTranslated = async (params: {
|
||||
},
|
||||
})
|
||||
|
||||
i18n.setLocale(params.locals.locale as string) // for email
|
||||
i18n.setLocale(locals.locale as string) // for email
|
||||
|
||||
// TESTING: see 'README.md'
|
||||
const email = new Email({
|
||||
@ -64,23 +67,16 @@ export const sendEmailTranslated = async (params: {
|
||||
// i18n, // is only needed if you don't install i18n
|
||||
})
|
||||
|
||||
// ATTENTION: await is needed, because otherwise on send the email gets send in the language of the current user, because below the language gets reset
|
||||
await email
|
||||
const resultSend = await email
|
||||
.send({
|
||||
template: path.join(__dirname, 'templates', params.template),
|
||||
message: params.receiver,
|
||||
locals: params.locals, // the 'locale' in here seems not to be used by 'email-template', because it doesn't work if the language isn't set before by 'i18n.setLocale'
|
||||
})
|
||||
.then((result: Record<string, unknown>) => {
|
||||
resultSend = result
|
||||
logger.info('Send email successfully !!!')
|
||||
logger.info('Result: ', result)
|
||||
template: path.join(__dirname, 'templates', template),
|
||||
message: receiver,
|
||||
locals, // the 'locale' in here seems not to be used by 'email-template', because it doesn't work if the language isn't set before by 'i18n.setLocale'
|
||||
})
|
||||
.catch((error: unknown) => {
|
||||
throw new LogError('Error sending notification email', error)
|
||||
logger.error('Error sending notification email', error)
|
||||
return false
|
||||
})
|
||||
|
||||
i18n.setLocale(rememberLocaleToRestore)
|
||||
|
||||
return resultSend
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { testEnvironment } from '@test/helpers'
|
||||
import { logger, i18n as localization } from '@test/testSetup'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
import {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import { decimalSeparatorByLanguage } from '@/util/utilities'
|
||||
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
@ -13,7 +13,7 @@ export const sendAddedContributionMessageEmail = (data: {
|
||||
senderFirstName: string
|
||||
senderLastName: string
|
||||
contributionMemo: string
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: {
|
||||
to: `${data.firstName} ${data.lastName} <${data.email}>`,
|
||||
@ -40,7 +40,7 @@ export const sendAccountActivationEmail = (data: {
|
||||
language: string
|
||||
activationLink: string
|
||||
timeDurationObject: Record<string, unknown>
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'accountActivation',
|
||||
@ -62,7 +62,7 @@ export const sendAccountMultiRegistrationEmail = (data: {
|
||||
lastName: string
|
||||
email: string
|
||||
language: string
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'accountMultiRegistration',
|
||||
@ -86,7 +86,7 @@ export const sendContributionConfirmedEmail = (data: {
|
||||
senderLastName: string
|
||||
contributionMemo: string
|
||||
contributionAmount: Decimal
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'contributionConfirmed',
|
||||
@ -113,7 +113,7 @@ export const sendContributionDeletedEmail = (data: {
|
||||
senderFirstName: string
|
||||
senderLastName: string
|
||||
contributionMemo: string
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'contributionDeleted',
|
||||
@ -139,7 +139,7 @@ export const sendContributionDeniedEmail = (data: {
|
||||
senderFirstName: string
|
||||
senderLastName: string
|
||||
contributionMemo: string
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'contributionDenied',
|
||||
@ -164,7 +164,7 @@ export const sendResetPasswordEmail = (data: {
|
||||
language: string
|
||||
resetLink: string
|
||||
timeDurationObject: Record<string, unknown>
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'resetPassword',
|
||||
@ -191,7 +191,7 @@ export const sendTransactionLinkRedeemedEmail = (data: {
|
||||
senderEmail: string
|
||||
transactionMemo: string
|
||||
transactionAmount: Decimal
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'transactionLinkRedeemed',
|
||||
@ -220,7 +220,7 @@ export const sendTransactionReceivedEmail = (data: {
|
||||
senderLastName: string
|
||||
senderEmail: string
|
||||
transactionAmount: Decimal
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
}): Promise<Record<string, unknown> | boolean | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'transactionReceived',
|
||||
|
||||
@ -5,7 +5,7 @@ import { Community as DbCommunity } from '@entity/Community'
|
||||
import { gql } from 'graphql-request'
|
||||
|
||||
import { GraphQLGetClient } from '@/federation/client/GraphQLGetClient'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
export async function requestGetPublicKey(dbCom: DbCommunity): Promise<string | undefined> {
|
||||
|
||||
@ -5,7 +5,7 @@ import { Community as DbCommunity } from '@entity/Community'
|
||||
import { gql } from 'graphql-request'
|
||||
|
||||
import { GraphQLGetClient } from '@/federation/client/GraphQLGetClient'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
export async function requestGetPublicKey(dbCom: DbCommunity): Promise<string | undefined> {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { IsNull } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
@ -3,7 +3,7 @@ import { ArgsType, Field, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
export default class AdminCreateContributionArgs {
|
||||
export class AdminCreateContributionArgs {
|
||||
@Field(() => String)
|
||||
email: string
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class AdminUpdateContributionArgs {
|
||||
export class AdminUpdateContributionArgs {
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { ArgsType, Field, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
export default class ContributionArgs {
|
||||
export class ContributionArgs {
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class ContributionLinkArgs {
|
||||
export class ContributionLinkArgs {
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { ArgsType, Field, Int, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
export default class ContributionMessageArgs {
|
||||
export class ContributionMessageArgs {
|
||||
@Field(() => Int)
|
||||
contributionId: number
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class CreateUserArgs {
|
||||
export class CreateUserArgs {
|
||||
@Field(() => String)
|
||||
email: string
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import { ArgsType, Field, Int } from 'type-graphql'
|
||||
import { Order } from '@enum/Order'
|
||||
|
||||
@ArgsType()
|
||||
export default class Paginated {
|
||||
export class Paginated {
|
||||
@Field(() => Int, { nullable: true })
|
||||
currentPage?: number
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
import SearchUsersFilters from '@arg/SearchUsersFilters'
|
||||
import { SearchUsersFilters } from '@arg/SearchUsersFilters'
|
||||
|
||||
@ArgsType()
|
||||
export default class SearchUsersArgs {
|
||||
export class SearchUsersArgs {
|
||||
@Field(() => String)
|
||||
searchText: string
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Field, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
export default class SearchUsersFilters {
|
||||
export class SearchUsersFilters {
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: null })
|
||||
byActivated?: boolean | null
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class TransactionLinkArgs {
|
||||
export class TransactionLinkArgs {
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { Field, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
export default class TransactionLinkFilters {
|
||||
export class TransactionLinkFilters {
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
withDeleted?: boolean
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class TransactionSendArgs {
|
||||
export class TransactionSendArgs {
|
||||
@Field(() => String)
|
||||
identifier: string
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class UnsecureLoginArgs {
|
||||
export class UnsecureLoginArgs {
|
||||
@Field(() => String)
|
||||
email: string
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class UpdateUserInfosArgs {
|
||||
export class UpdateUserInfosArgs {
|
||||
@Field({ nullable: true })
|
||||
firstName?: string
|
||||
|
||||
|
||||
@ -10,9 +10,9 @@ import { INALIENABLE_RIGHTS } from '@/auth/INALIENABLE_RIGHTS'
|
||||
import { decode, encode } from '@/auth/JWT'
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import { ROLE_UNAUTHORIZED, ROLE_USER, ROLE_ADMIN } from '@/auth/ROLES'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||
export const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||
context.role = ROLE_UNAUTHORIZED // unauthorized user
|
||||
|
||||
// is rights an inalienable right?
|
||||
@ -56,5 +56,3 @@ const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||
context.setHeaders.push({ key: 'token', value: encode(decoded.gradidoID) })
|
||||
return true
|
||||
}
|
||||
|
||||
export default isAuthorized
|
||||
|
||||
@ -8,9 +8,7 @@ export class Community {
|
||||
this.foreign = dbCom.foreign
|
||||
this.publicKey = dbCom.publicKey.toString()
|
||||
this.url =
|
||||
(dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/') +
|
||||
'api/' +
|
||||
dbCom.apiVersion
|
||||
(dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/') + dbCom.apiVersion
|
||||
this.lastAnnouncedAt = dbCom.lastAnnouncedAt
|
||||
this.verifiedAt = dbCom.verifiedAt
|
||||
this.lastErrorAt = dbCom.lastErrorAt
|
||||
|
||||
@ -2,7 +2,7 @@ import { ContributionLink as dbContributionLink } from '@entity/ContributionLink
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
@ObjectType()
|
||||
export class ContributionLink {
|
||||
|
||||
@ -2,7 +2,7 @@ import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
import { User } from './User'
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ describe('CommunityResolver', () => {
|
||||
let foreignCom1: DbCommunity
|
||||
let foreignCom2: DbCommunity
|
||||
let foreignCom3: DbCommunity
|
||||
|
||||
describe('with empty list', () => {
|
||||
it('returns no community entry', async () => {
|
||||
// const result: Community[] = await query({ query: getCommunities })
|
||||
@ -56,7 +57,7 @@ describe('CommunityResolver', () => {
|
||||
homeCom1.foreign = false
|
||||
homeCom1.publicKey = Buffer.from('publicKey-HomeCommunity')
|
||||
homeCom1.apiVersion = '1_0'
|
||||
homeCom1.endPoint = 'http://localhost'
|
||||
homeCom1.endPoint = 'http://localhost/api'
|
||||
homeCom1.createdAt = new Date()
|
||||
await DbCommunity.insert(homeCom1)
|
||||
|
||||
@ -64,7 +65,7 @@ describe('CommunityResolver', () => {
|
||||
homeCom2.foreign = false
|
||||
homeCom2.publicKey = Buffer.from('publicKey-HomeCommunity')
|
||||
homeCom2.apiVersion = '1_1'
|
||||
homeCom2.endPoint = 'http://localhost'
|
||||
homeCom2.endPoint = 'http://localhost/api'
|
||||
homeCom2.createdAt = new Date()
|
||||
await DbCommunity.insert(homeCom2)
|
||||
|
||||
@ -72,24 +73,24 @@ describe('CommunityResolver', () => {
|
||||
homeCom3.foreign = false
|
||||
homeCom3.publicKey = Buffer.from('publicKey-HomeCommunity')
|
||||
homeCom3.apiVersion = '2_0'
|
||||
homeCom3.endPoint = 'http://localhost'
|
||||
homeCom3.endPoint = 'http://localhost/api'
|
||||
homeCom3.createdAt = new Date()
|
||||
await DbCommunity.insert(homeCom3)
|
||||
})
|
||||
|
||||
it('returns three home-community entries', async () => {
|
||||
it('returns 3 home-community entries', async () => {
|
||||
await expect(query({ query: getCommunities })).resolves.toMatchObject({
|
||||
data: {
|
||||
getCommunities: [
|
||||
{
|
||||
id: 1,
|
||||
foreign: homeCom1.foreign,
|
||||
id: 3,
|
||||
foreign: homeCom3.foreign,
|
||||
publicKey: expect.stringMatching('publicKey-HomeCommunity'),
|
||||
url: expect.stringMatching('http://localhost/api/1_0'),
|
||||
url: expect.stringMatching('http://localhost/api/2_0'),
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: homeCom1.createdAt.toISOString(),
|
||||
createdAt: homeCom3.createdAt.toISOString(),
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
@ -104,14 +105,14 @@ describe('CommunityResolver', () => {
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
foreign: homeCom3.foreign,
|
||||
id: 1,
|
||||
foreign: homeCom1.foreign,
|
||||
publicKey: expect.stringMatching('publicKey-HomeCommunity'),
|
||||
url: expect.stringMatching('http://localhost/api/2_0'),
|
||||
url: expect.stringMatching('http://localhost/api/1_0'),
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: homeCom3.createdAt.toISOString(),
|
||||
createdAt: homeCom1.createdAt.toISOString(),
|
||||
updatedAt: null,
|
||||
},
|
||||
],
|
||||
@ -128,7 +129,7 @@ describe('CommunityResolver', () => {
|
||||
foreignCom1.foreign = true
|
||||
foreignCom1.publicKey = Buffer.from('publicKey-ForeignCommunity')
|
||||
foreignCom1.apiVersion = '1_0'
|
||||
foreignCom1.endPoint = 'http://remotehost'
|
||||
foreignCom1.endPoint = 'http://remotehost/api'
|
||||
foreignCom1.createdAt = new Date()
|
||||
await DbCommunity.insert(foreignCom1)
|
||||
|
||||
@ -136,7 +137,7 @@ describe('CommunityResolver', () => {
|
||||
foreignCom2.foreign = true
|
||||
foreignCom2.publicKey = Buffer.from('publicKey-ForeignCommunity')
|
||||
foreignCom2.apiVersion = '1_1'
|
||||
foreignCom2.endPoint = 'http://remotehost'
|
||||
foreignCom2.endPoint = 'http://remotehost/api'
|
||||
foreignCom2.createdAt = new Date()
|
||||
await DbCommunity.insert(foreignCom2)
|
||||
|
||||
@ -144,24 +145,24 @@ describe('CommunityResolver', () => {
|
||||
foreignCom3.foreign = true
|
||||
foreignCom3.publicKey = Buffer.from('publicKey-ForeignCommunity')
|
||||
foreignCom3.apiVersion = '1_2'
|
||||
foreignCom3.endPoint = 'http://remotehost'
|
||||
foreignCom3.endPoint = 'http://remotehost/api'
|
||||
foreignCom3.createdAt = new Date()
|
||||
await DbCommunity.insert(foreignCom3)
|
||||
})
|
||||
|
||||
it('returns 3x home and 3x foreign-community entries', async () => {
|
||||
it('returns 3 home community and 3 foreign community entries', async () => {
|
||||
await expect(query({ query: getCommunities })).resolves.toMatchObject({
|
||||
data: {
|
||||
getCommunities: [
|
||||
{
|
||||
id: 1,
|
||||
foreign: homeCom1.foreign,
|
||||
id: 3,
|
||||
foreign: homeCom3.foreign,
|
||||
publicKey: expect.stringMatching('publicKey-HomeCommunity'),
|
||||
url: expect.stringMatching('http://localhost/api/1_0'),
|
||||
url: expect.stringMatching('http://localhost/api/2_0'),
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: homeCom1.createdAt.toISOString(),
|
||||
createdAt: homeCom3.createdAt.toISOString(),
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
@ -176,25 +177,25 @@ describe('CommunityResolver', () => {
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
foreign: homeCom3.foreign,
|
||||
id: 1,
|
||||
foreign: homeCom1.foreign,
|
||||
publicKey: expect.stringMatching('publicKey-HomeCommunity'),
|
||||
url: expect.stringMatching('http://localhost/api/2_0'),
|
||||
url: expect.stringMatching('http://localhost/api/1_0'),
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: homeCom3.createdAt.toISOString(),
|
||||
createdAt: homeCom1.createdAt.toISOString(),
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
foreign: foreignCom1.foreign,
|
||||
id: 6,
|
||||
foreign: foreignCom3.foreign,
|
||||
publicKey: expect.stringMatching('publicKey-ForeignCommunity'),
|
||||
url: expect.stringMatching('http://remotehost/api/1_0'),
|
||||
url: expect.stringMatching('http://remotehost/api/1_2'),
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: foreignCom1.createdAt.toISOString(),
|
||||
createdAt: foreignCom3.createdAt.toISOString(),
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
@ -209,14 +210,14 @@ describe('CommunityResolver', () => {
|
||||
updatedAt: null,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
foreign: foreignCom3.foreign,
|
||||
id: 4,
|
||||
foreign: foreignCom1.foreign,
|
||||
publicKey: expect.stringMatching('publicKey-ForeignCommunity'),
|
||||
url: expect.stringMatching('http://remotehost/api/1_2'),
|
||||
url: expect.stringMatching('http://remotehost/api/1_0'),
|
||||
lastAnnouncedAt: null,
|
||||
verifiedAt: null,
|
||||
lastErrorAt: null,
|
||||
createdAt: foreignCom3.createdAt.toISOString(),
|
||||
createdAt: foreignCom1.createdAt.toISOString(),
|
||||
updatedAt: null,
|
||||
},
|
||||
],
|
||||
|
||||
@ -11,7 +11,11 @@ export class CommunityResolver {
|
||||
@Query(() => [Community])
|
||||
async getCommunities(): Promise<Community[]> {
|
||||
const dbCommunities: DbCommunity[] = await DbCommunity.find({
|
||||
order: { foreign: 'ASC', publicKey: 'ASC', apiVersion: 'ASC' },
|
||||
order: {
|
||||
foreign: 'ASC',
|
||||
createdAt: 'DESC',
|
||||
lastAnnouncedAt: 'DESC',
|
||||
},
|
||||
})
|
||||
return dbCommunities.map((dbCom: DbCommunity) => new Community(dbCom))
|
||||
}
|
||||
|
||||
@ -3,9 +3,8 @@ import { ContributionLink as DbContributionLink } from '@entity/ContributionLink
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { Resolver, Args, Arg, Authorized, Mutation, Query, Int, Ctx } from 'type-graphql'
|
||||
|
||||
// TODO: this is a strange construct
|
||||
import ContributionLinkArgs from '@arg/ContributionLinkArgs'
|
||||
import Paginated from '@arg/Paginated'
|
||||
import { ContributionLinkArgs } from '@arg/ContributionLinkArgs'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { Order } from '@enum/Order'
|
||||
import { ContributionLink } from '@model/ContributionLink'
|
||||
import { ContributionLinkList } from '@model/ContributionLinkList'
|
||||
@ -17,7 +16,7 @@ import {
|
||||
EVENT_ADMIN_CONTRIBUTION_LINK_UPDATE,
|
||||
} from '@/event/Events'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
import {
|
||||
CONTRIBUTIONLINK_NAME_MAX_CHARS,
|
||||
|
||||
@ -6,8 +6,8 @@ import { User as DbUser } from '@entity/User'
|
||||
import { UserContact as DbUserContact } from '@entity/UserContact'
|
||||
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
|
||||
|
||||
import ContributionMessageArgs from '@arg/ContributionMessageArgs'
|
||||
import Paginated from '@arg/Paginated'
|
||||
import { ContributionMessageArgs } from '@arg/ContributionMessageArgs'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||
import { ContributionMessageType } from '@enum/MessageType'
|
||||
import { Order } from '@enum/Order'
|
||||
@ -20,7 +20,7 @@ import {
|
||||
EVENT_CONTRIBUTION_MESSAGE_CREATE,
|
||||
} from '@/event/Events'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
@Resolver()
|
||||
export class ContributionMessageResolver {
|
||||
@ -146,7 +146,7 @@ export class ContributionMessageResolver {
|
||||
await queryRunner.manager.update(DbContribution, { id: contributionId }, contribution)
|
||||
}
|
||||
|
||||
await sendAddedContributionMessageEmail({
|
||||
void sendAddedContributionMessageEmail({
|
||||
firstName: contribution.user.firstName,
|
||||
lastName: contribution.user.lastName,
|
||||
email: contribution.user.emailContact.email,
|
||||
|
||||
@ -8,10 +8,10 @@ import { UserContact } from '@entity/UserContact'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
|
||||
|
||||
import AdminCreateContributionArgs from '@arg/AdminCreateContributionArgs'
|
||||
import AdminUpdateContributionArgs from '@arg/AdminUpdateContributionArgs'
|
||||
import ContributionArgs from '@arg/ContributionArgs'
|
||||
import Paginated from '@arg/Paginated'
|
||||
import { AdminCreateContributionArgs } from '@arg/AdminCreateContributionArgs'
|
||||
import { AdminUpdateContributionArgs } from '@arg/AdminUpdateContributionArgs'
|
||||
import { ContributionArgs } from '@arg/ContributionArgs'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||
import { ContributionType } from '@enum/ContributionType'
|
||||
import { ContributionMessageType } from '@enum/MessageType'
|
||||
@ -40,7 +40,7 @@ import {
|
||||
EVENT_ADMIN_CONTRIBUTION_DENY,
|
||||
} from '@/event/Events'
|
||||
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { calculateDecay } from '@/util/decay'
|
||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||
|
||||
@ -9,7 +9,7 @@ import { GraphQLError } from 'graphql'
|
||||
|
||||
import { testEnvironment, cleanDB } from '@test/helpers'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import { createUser, setPassword, forgotPassword } from '@/seeds/graphql/mutations'
|
||||
import { queryOptIn } from '@/seeds/graphql/queries'
|
||||
|
||||
|
||||
@ -4,15 +4,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Resolver, Query, Args, Ctx, Authorized, Arg, Int, Float } from 'type-graphql'
|
||||
|
||||
import Paginated from '@arg/Paginated'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { Order } from '@enum/Order'
|
||||
import { GdtEntryList } from '@model/GdtEntryList'
|
||||
|
||||
import { apiGet, apiPost } from '@/apis/HttpRequest'
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
@Resolver()
|
||||
export class GdtResolver {
|
||||
|
||||
@ -9,9 +9,9 @@ import { User as DbUser } from '@entity/User'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { Resolver, Args, Arg, Authorized, Ctx, Mutation, Query, Int } from 'type-graphql'
|
||||
|
||||
import Paginated from '@arg/Paginated'
|
||||
import TransactionLinkArgs from '@arg/TransactionLinkArgs'
|
||||
import TransactionLinkFilters from '@arg/TransactionLinkFilters'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { TransactionLinkArgs } from '@arg/TransactionLinkArgs'
|
||||
import { TransactionLinkFilters } from '@arg/TransactionLinkFilters'
|
||||
import { ContributionCycleType } from '@enum/ContributionCycleType'
|
||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||
import { ContributionType } from '@enum/ContributionType'
|
||||
@ -20,7 +20,7 @@ import { ContributionLink } from '@model/ContributionLink'
|
||||
import { Decay } from '@model/Decay'
|
||||
import { TransactionLink, TransactionLinkResult } from '@model/TransactionLink'
|
||||
import { User } from '@model/User'
|
||||
import QueryLinkResult from '@union/QueryLinkResult'
|
||||
import { QueryLinkResult } from '@union/QueryLinkResult'
|
||||
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import {
|
||||
@ -30,7 +30,7 @@ import {
|
||||
EVENT_TRANSACTION_LINK_REDEEM,
|
||||
} from '@/event/Events'
|
||||
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { calculateDecay } from '@/util/decay'
|
||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||
@ -39,7 +39,7 @@ import { calculateBalance } from '@/util/validate'
|
||||
import { executeTransaction } from './TransactionResolver'
|
||||
import { getUserCreation, validateContribution } from './util/creations'
|
||||
import { getLastTransaction } from './util/getLastTransaction'
|
||||
import transactionLinkList from './util/transactionLinkList'
|
||||
import { transactionLinkList } from './util/transactionLinkList'
|
||||
|
||||
// TODO: do not export, test it inside the resolver
|
||||
export const transactionLinkCode = (date: Date): string => {
|
||||
|
||||
@ -9,8 +9,8 @@ import { User as dbUser } from '@entity/User'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
||||
|
||||
import Paginated from '@arg/Paginated'
|
||||
import TransactionSendArgs from '@arg/TransactionSendArgs'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { TransactionSendArgs } from '@arg/TransactionSendArgs'
|
||||
import { Order } from '@enum/Order'
|
||||
import { TransactionTypeId } from '@enum/TransactionTypeId'
|
||||
import { Transaction } from '@model/Transaction'
|
||||
@ -25,7 +25,7 @@ import {
|
||||
} from '@/emails/sendEmailVariants'
|
||||
import { EVENT_TRANSACTION_RECEIVE, EVENT_TRANSACTION_SEND } from '@/event/Events'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { communityUser } from '@/util/communityUser'
|
||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||
@ -149,7 +149,7 @@ export const executeTransaction = async (
|
||||
} finally {
|
||||
await queryRunner.release()
|
||||
}
|
||||
await sendTransactionReceivedEmail({
|
||||
void sendTransactionReceivedEmail({
|
||||
firstName: recipient.firstName,
|
||||
lastName: recipient.lastName,
|
||||
email: recipient.emailContact.email,
|
||||
@ -160,7 +160,7 @@ export const executeTransaction = async (
|
||||
transactionAmount: amount,
|
||||
})
|
||||
if (transactionLink) {
|
||||
await sendTransactionLinkRedeemedEmail({
|
||||
void sendTransactionLinkRedeemedEmail({
|
||||
firstName: sender.firstName,
|
||||
lastName: sender.lastName,
|
||||
email: sender.emailContact.email,
|
||||
|
||||
@ -20,7 +20,7 @@ import { ContributionLink } from '@model/ContributionLink'
|
||||
import { testEnvironment, headerPushMock, resetToken, cleanDB } from '@test/helpers'
|
||||
import { logger, i18n as localization } from '@test/testSetup'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import {
|
||||
sendAccountActivationEmail,
|
||||
sendAccountMultiRegistrationEmail,
|
||||
|
||||
@ -21,11 +21,11 @@ import {
|
||||
} from 'type-graphql'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
import CreateUserArgs from '@arg/CreateUserArgs'
|
||||
import Paginated from '@arg/Paginated'
|
||||
import SearchUsersArgs from '@arg/SearchUsersArgs'
|
||||
import UnsecureLoginArgs from '@arg/UnsecureLoginArgs'
|
||||
import UpdateUserInfosArgs from '@arg/UpdateUserInfosArgs'
|
||||
import { CreateUserArgs } from '@arg/CreateUserArgs'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { SearchUsersArgs } from '@arg/SearchUsersArgs'
|
||||
import { UnsecureLoginArgs } from '@arg/UnsecureLoginArgs'
|
||||
import { UpdateUserInfosArgs } from '@arg/UpdateUserInfosArgs'
|
||||
import { OptInType } from '@enum/OptInType'
|
||||
import { Order } from '@enum/Order'
|
||||
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
||||
@ -38,7 +38,7 @@ import { UserRepository } from '@repository/User'
|
||||
import { klicktippSignIn } from '@/apis/KlicktippController'
|
||||
import { encode } from '@/auth/JWT'
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import {
|
||||
sendAccountActivationEmail,
|
||||
sendAccountMultiRegistrationEmail,
|
||||
@ -64,7 +64,7 @@ import { klicktippNewsletterStateMiddleware } from '@/middleware/klicktippMiddle
|
||||
import { isValidPassword } from '@/password/EncryptorUtils'
|
||||
import { encryptPassword, verifyPassword } from '@/password/PasswordEncryptor'
|
||||
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { communityDbUser } from '@/util/communityUser'
|
||||
import { hasElopageBuys } from '@/util/hasElopageBuys'
|
||||
@ -245,7 +245,7 @@ export class UserResolver {
|
||||
user.publisherId = publisherId
|
||||
logger.debug('partly faked user', user)
|
||||
|
||||
const emailSent = await sendAccountMultiRegistrationEmail({
|
||||
void sendAccountMultiRegistrationEmail({
|
||||
firstName: foundUser.firstName, // this is the real name of the email owner, but just "firstName" would be the name of the new registrant which shall not be passed to the outside
|
||||
lastName: foundUser.lastName, // this is the real name of the email owner, but just "lastName" would be the name of the new registrant which shall not be passed to the outside
|
||||
email,
|
||||
@ -258,9 +258,6 @@ export class UserResolver {
|
||||
)
|
||||
/* uncomment this, when you need the activation link on the console */
|
||||
// In case EMails are disabled log the activation link for the user
|
||||
if (!emailSent) {
|
||||
logger.debug(`Email not send!`)
|
||||
}
|
||||
logger.info('createUser() faked and send multi registration mail...')
|
||||
|
||||
return user
|
||||
@ -325,8 +322,7 @@ export class UserResolver {
|
||||
emailContact.emailVerificationCode.toString(),
|
||||
).replace(/{code}/g, redeemCode ? '/' + redeemCode : '')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const emailSent = await sendAccountActivationEmail({
|
||||
void sendAccountActivationEmail({
|
||||
firstName,
|
||||
lastName,
|
||||
email,
|
||||
@ -338,10 +334,6 @@ export class UserResolver {
|
||||
|
||||
await EVENT_EMAIL_CONFIRMATION(dbUser)
|
||||
|
||||
if (!emailSent) {
|
||||
logger.debug(`Account confirmation link: ${activationLink}`)
|
||||
}
|
||||
|
||||
await queryRunner.commitTransaction()
|
||||
logger.addContext('user', dbUser.id)
|
||||
} catch (e) {
|
||||
@ -392,8 +384,8 @@ export class UserResolver {
|
||||
})
|
||||
|
||||
logger.info(`optInCode for ${email}=${user.emailContact}`)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const emailSent = await sendResetPasswordEmail({
|
||||
|
||||
void sendResetPasswordEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email,
|
||||
@ -402,13 +394,6 @@ export class UserResolver {
|
||||
timeDurationObject: getTimeDurationObject(CONFIG.EMAIL_CODE_VALID_TIME),
|
||||
})
|
||||
|
||||
/* uncomment this, when you need the activation link on the console */
|
||||
// In case EMails are disabled log the activation link for the user
|
||||
if (!emailSent) {
|
||||
logger.debug(
|
||||
`Reset password link: ${activationLink(user.emailContact.emailVerificationCode)}`,
|
||||
)
|
||||
}
|
||||
logger.info(`forgotPassword(${email}) successful...`)
|
||||
await EVENT_EMAIL_FORGOT_PASSWORD(user)
|
||||
|
||||
@ -804,7 +789,7 @@ export class UserResolver {
|
||||
await user.emailContact.save()
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const emailSent = await sendAccountActivationEmail({
|
||||
void sendAccountActivationEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email,
|
||||
@ -813,10 +798,6 @@ export class UserResolver {
|
||||
timeDurationObject: getTimeDurationObject(CONFIG.EMAIL_CODE_VALID_TIME),
|
||||
})
|
||||
|
||||
// In case EMails are disabled log the activation link for the user
|
||||
if (!emailSent) {
|
||||
logger.info(`Account confirmation link: ${activationLink}`)
|
||||
}
|
||||
await EVENT_EMAIL_ADMIN_CONFIRMATION(user, getUser(context))
|
||||
|
||||
return true
|
||||
|
||||
@ -8,7 +8,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { OpenCreation } from '@model/OpenCreation'
|
||||
|
||||
import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '@/graphql/resolver/const/const'
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
interface CreationMap {
|
||||
|
||||
@ -2,7 +2,7 @@ import { User as DbUser } from '@entity/User'
|
||||
import { UserContact as DbUserContact } from '@entity/UserContact'
|
||||
import { validate, version } from 'uuid'
|
||||
|
||||
import LogError from '@/server/LogError'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
export const findUserByIdentifier = async (identifier: string): Promise<DbUser> => {
|
||||
let user: DbUser | undefined
|
||||
|
||||
@ -2,14 +2,14 @@ import { MoreThan } from '@dbTools/typeorm'
|
||||
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
||||
import { User as DbUser } from '@entity/User'
|
||||
|
||||
import Paginated from '@arg/Paginated'
|
||||
import TransactionLinkFilters from '@arg/TransactionLinkFilters'
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
import { TransactionLinkFilters } from '@arg/TransactionLinkFilters'
|
||||
import { Order } from '@enum/Order'
|
||||
import { TransactionLink, TransactionLinkResult } from '@model/TransactionLink'
|
||||
|
||||
import { User } from '@/graphql/model/User'
|
||||
|
||||
export default async function transactionLinkList(
|
||||
export async function transactionLinkList(
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
filters: TransactionLinkFilters | null,
|
||||
user: DbUser,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLScalarType, Kind } from 'graphql'
|
||||
|
||||
const DecimalType = new GraphQLScalarType({
|
||||
export const DecimalScalar = new GraphQLScalarType({
|
||||
name: 'Decimal',
|
||||
description: 'The `Decimal` scalar type to represent currency values',
|
||||
|
||||
@ -22,5 +22,3 @@ const DecimalType = new GraphQLScalarType({
|
||||
return new Decimal(ast.value)
|
||||
},
|
||||
})
|
||||
|
||||
export default DecimalType
|
||||
|
||||
@ -4,15 +4,13 @@ import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLSchema } from 'graphql'
|
||||
import { buildSchema } from 'type-graphql'
|
||||
|
||||
import isAuthorized from './directive/isAuthorized'
|
||||
import DecimalScalar from './scalar/Decimal'
|
||||
import { isAuthorized } from './directive/isAuthorized'
|
||||
import { DecimalScalar } from './scalar/Decimal'
|
||||
|
||||
const schema = async (): Promise<GraphQLSchema> => {
|
||||
export const schema = async (): Promise<GraphQLSchema> => {
|
||||
return buildSchema({
|
||||
resolvers: [path.join(__dirname, 'resolver', `!(*.test).{js,ts}`)],
|
||||
authChecker: isAuthorized,
|
||||
scalarsMap: [{ type: Decimal, scalar: DecimalScalar }],
|
||||
})
|
||||
}
|
||||
|
||||
export default schema
|
||||
|
||||
@ -3,7 +3,7 @@ import { createUnionType } from 'type-graphql'
|
||||
import { ContributionLink } from '@model/ContributionLink'
|
||||
import { TransactionLink } from '@model/TransactionLink'
|
||||
|
||||
export default createUnionType({
|
||||
export const QueryLinkResult = createUnionType({
|
||||
name: 'QueryLinkResult', // the name of the GraphQL union
|
||||
types: () => [TransactionLink, ContributionLink] as const, // function that returns tuple of object types classes
|
||||
})
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import CONFIG from './config'
|
||||
import { CONFIG } from './config'
|
||||
import { startValidateCommunities } from './federation/validateCommunities'
|
||||
import createServer from './server/createServer'
|
||||
import { createServer } from './server/createServer'
|
||||
|
||||
async function main() {
|
||||
const { app } = await createServer()
|
||||
|
||||
@ -8,7 +8,7 @@ import { MiddlewareFn } from 'type-graphql'
|
||||
import { KlickTipp } from '@model/KlickTipp'
|
||||
|
||||
import { /* klicktippSignIn, */ getKlickTippUser } from '@/apis/KlicktippController'
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import { klickTippLogger as logger } from '@/server/logger'
|
||||
|
||||
// export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
||||
|
||||
@ -6,8 +6,8 @@ import { User } from '@entity/User'
|
||||
|
||||
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import LogError from '@/server/LogError'
|
||||
import { CONFIG } from '@/config'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-commonjs
|
||||
|
||||
@ -9,8 +9,8 @@ import { entities } from '@entity/index'
|
||||
import { createTestClient } from 'apollo-server-testing'
|
||||
import { name, internet, datatype } from 'faker'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import createServer from '@/server/createServer'
|
||||
import { CONFIG } from '@/config'
|
||||
import { createServer } from '@/server/createServer'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
import { contributionLinks } from './contributionLink/index'
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { logger } from '@test/testSetup'
|
||||
|
||||
import LogError from './LogError'
|
||||
import { LogError } from './LogError'
|
||||
|
||||
describe('LogError', () => {
|
||||
it('logs an Error when created', () => {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { backendLogger as logger } from './logger'
|
||||
|
||||
export default class LogError extends Error {
|
||||
export class LogError extends Error {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
constructor(msg: string, ...details: any[]) {
|
||||
super(msg)
|
||||
|
||||
@ -5,7 +5,7 @@ import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { Role } from '@/auth/Role'
|
||||
|
||||
import LogError from './LogError'
|
||||
import { LogError } from './LogError'
|
||||
|
||||
export interface Context {
|
||||
token: string | null
|
||||
@ -20,7 +20,7 @@ export interface Context {
|
||||
sumHoldAvailableAmount?: Decimal
|
||||
}
|
||||
|
||||
const context = (args: ExpressContext): Context => {
|
||||
export const context = (args: ExpressContext): Context => {
|
||||
const authorization = args.req.headers.authorization
|
||||
const clientTimezoneOffset = args.req.headers.clienttimezoneoffset
|
||||
const context: Context = {
|
||||
@ -50,5 +50,3 @@ export const getClientTimezoneOffset = (context: Context): number => {
|
||||
}
|
||||
throw new LogError('No valid client time zone offset in context')
|
||||
}
|
||||
|
||||
export default context
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import cors from 'cors'
|
||||
import corsLib from 'cors'
|
||||
|
||||
const corsOptions = {
|
||||
origin: '*',
|
||||
exposedHeaders: ['token'],
|
||||
}
|
||||
|
||||
export default cors(corsOptions)
|
||||
export const cors = corsLib(corsOptions)
|
||||
|
||||
@ -6,24 +6,24 @@ import { ApolloServer } from 'apollo-server-express'
|
||||
import express, { Express, json, urlencoded } from 'express'
|
||||
import { Logger } from 'log4js'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import schema from '@/graphql/schema'
|
||||
import connection from '@/typeorm/connection'
|
||||
import { CONFIG } from '@/config'
|
||||
import { schema } from '@/graphql/schema'
|
||||
import { connection } from '@/typeorm/connection'
|
||||
import { checkDBVersion } from '@/typeorm/DBVersion'
|
||||
import { elopageWebhook } from '@/webhook/elopage'
|
||||
|
||||
import serverContext from './context'
|
||||
import cors from './cors'
|
||||
import { context as serverContext } from './context'
|
||||
import { cors } from './cors'
|
||||
import { i18n } from './localization'
|
||||
import { apolloLogger } from './logger'
|
||||
import plugins from './plugins'
|
||||
import { plugins } from './plugins'
|
||||
|
||||
// TODO implement
|
||||
// import queryComplexity, { simpleEstimator, fieldConfigEstimator } from "graphql-query-complexity";
|
||||
|
||||
type ServerDef = { apollo: ApolloServer; app: Express; con: Connection }
|
||||
|
||||
const createServer = async (
|
||||
export const createServer = async (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: any = serverContext,
|
||||
logger: Logger = apolloLogger,
|
||||
@ -81,5 +81,3 @@ const createServer = async (
|
||||
|
||||
return { apollo, app, con }
|
||||
}
|
||||
|
||||
export default createServer
|
||||
|
||||
@ -5,7 +5,7 @@ import { readFileSync } from 'fs'
|
||||
|
||||
import { configure, getLogger } from 'log4js'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
const options = JSON.parse(readFileSync(CONFIG.LOG4JS_CONFIG, 'utf-8'))
|
||||
|
||||
|
||||
@ -60,8 +60,6 @@ ${JSON.stringify(requestContext.response.errors, null, 2)}`)
|
||||
},
|
||||
}
|
||||
|
||||
const plugins =
|
||||
export const plugins =
|
||||
// eslint-disable-next-line n/no-process-env
|
||||
process.env.NODE_ENV === 'development' ? [setHeadersPlugin] : [setHeadersPlugin, logPlugin]
|
||||
|
||||
export default plugins
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
import { Connection, createConnection, FileLogger } from '@dbTools/typeorm'
|
||||
import { entities } from '@entity/index'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
const connection = async (): Promise<Connection | null> => {
|
||||
export const connection = async (): Promise<Connection | null> => {
|
||||
try {
|
||||
return createConnection({
|
||||
name: 'default',
|
||||
@ -31,5 +31,3 @@ const connection = async (): Promise<Connection | null> => {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export default connection
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Brackets, EntityRepository, IsNull, Not, Repository } from '@dbTools/typeorm'
|
||||
import { User as DbUser } from '@entity/User'
|
||||
|
||||
import SearchUsersFilters from '@/graphql/arg/SearchUsersFilters'
|
||||
import { SearchUsersFilters } from '@/graphql/arg/SearchUsersFilters'
|
||||
|
||||
@EntityRepository(DbUser)
|
||||
export class UserRepository extends Repository<DbUser> {
|
||||
|
||||
@ -2,8 +2,8 @@ import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { Decay } from '@model/Decay'
|
||||
|
||||
import CONFIG from '@/config'
|
||||
import LogError from '@/server/LogError'
|
||||
import { CONFIG } from '@/config'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
// TODO: externalize all those definitions and functions into an external decay library
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { User } from '@entity/User'
|
||||
|
||||
import { getKlickTippUser } from '@/apis/KlicktippController'
|
||||
import LogError from '@/server/LogError'
|
||||
import connection from '@/typeorm/connection'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { connection } from '@/typeorm/connection'
|
||||
|
||||
export async function retrieveNotRegisteredEmails(): Promise<string[]> {
|
||||
const con = await connection()
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
import { entities } from '@entity/index'
|
||||
import { createTestClient } from 'apollo-server-testing'
|
||||
|
||||
import createServer from '@/server/createServer'
|
||||
import { createServer } from '@/server/createServer'
|
||||
|
||||
import { i18n, logger } from './testSetup'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import CONFIG from '@/config'
|
||||
import { CONFIG } from '@/config'
|
||||
import { i18n } from '@/server/localization'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
|
||||
@ -394,14 +394,14 @@
|
||||
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403"
|
||||
integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==
|
||||
|
||||
"@eslint/eslintrc@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d"
|
||||
integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw==
|
||||
"@eslint/eslintrc@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.2.tgz#01575e38707add677cf73ca1589abba8da899a02"
|
||||
integrity sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==
|
||||
dependencies:
|
||||
ajv "^6.12.4"
|
||||
debug "^4.3.2"
|
||||
espree "^9.5.0"
|
||||
espree "^9.5.1"
|
||||
globals "^13.19.0"
|
||||
ignore "^5.2.0"
|
||||
import-fresh "^3.2.1"
|
||||
@ -409,10 +409,10 @@
|
||||
minimatch "^3.1.2"
|
||||
strip-json-comments "^3.1.1"
|
||||
|
||||
"@eslint/js@8.36.0":
|
||||
version "8.36.0"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe"
|
||||
integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==
|
||||
"@eslint/js@8.37.0":
|
||||
version "8.37.0"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.37.0.tgz#cf1b5fa24217fe007f6487a26d765274925efa7d"
|
||||
integrity sha512-x5vzdtOOGgFVDCUs81QRB2+liax8rFg3+7hqM+QhBG0/G3F1ZsoYl97UrqgHgQ9KKT7G6c4V+aTUCgu/n22v1A==
|
||||
|
||||
"@graphql-typed-document-node/core@^3.1.1":
|
||||
version "3.1.1"
|
||||
@ -1219,19 +1219,19 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.3.tgz#781d360c282436494b32fe7d9f7f8e64b3118aa3"
|
||||
integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw==
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^5.54.1":
|
||||
version "5.54.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.1.tgz#0c5091289ce28372e38ab8d28e861d2dbe1ab29e"
|
||||
integrity sha512-a2RQAkosH3d3ZIV08s3DcL/mcGc2M/UC528VkPULFxR9VnVPT8pBu0IyBAJJmVsCmhVfwQX1v6q+QGnmSe1bew==
|
||||
"@typescript-eslint/eslint-plugin@^5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.57.1.tgz#d1ab162a3cd2671b8a1c9ddf6e2db73b14439735"
|
||||
integrity sha512-1MeobQkQ9tztuleT3v72XmY0XuKXVXusAhryoLuU5YZ+mXoYKZP9SQ7Flulh1NX4DTjpGTc2b/eMu4u7M7dhnQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager" "5.54.1"
|
||||
"@typescript-eslint/type-utils" "5.54.1"
|
||||
"@typescript-eslint/utils" "5.54.1"
|
||||
"@eslint-community/regexpp" "^4.4.0"
|
||||
"@typescript-eslint/scope-manager" "5.57.1"
|
||||
"@typescript-eslint/type-utils" "5.57.1"
|
||||
"@typescript-eslint/utils" "5.57.1"
|
||||
debug "^4.3.4"
|
||||
grapheme-splitter "^1.0.4"
|
||||
ignore "^5.2.0"
|
||||
natural-compare-lite "^1.4.0"
|
||||
regexpp "^3.2.0"
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
@ -1242,14 +1242,14 @@
|
||||
dependencies:
|
||||
"@typescript-eslint/utils" "5.53.0"
|
||||
|
||||
"@typescript-eslint/parser@^5.54.1":
|
||||
version "5.54.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.54.1.tgz#05761d7f777ef1c37c971d3af6631715099b084c"
|
||||
integrity sha512-8zaIXJp/nG9Ff9vQNh7TI+C3nA6q6iIsGJ4B4L6MhZ7mHnTMR4YP5vp2xydmFXIy8rpyIVbNAG44871LMt6ujg==
|
||||
"@typescript-eslint/parser@^5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.57.1.tgz#af911234bd4401d09668c5faf708a0570a17a748"
|
||||
integrity sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager" "5.54.1"
|
||||
"@typescript-eslint/types" "5.54.1"
|
||||
"@typescript-eslint/typescript-estree" "5.54.1"
|
||||
"@typescript-eslint/scope-manager" "5.57.1"
|
||||
"@typescript-eslint/types" "5.57.1"
|
||||
"@typescript-eslint/typescript-estree" "5.57.1"
|
||||
debug "^4.3.4"
|
||||
|
||||
"@typescript-eslint/scope-manager@5.53.0":
|
||||
@ -1268,13 +1268,21 @@
|
||||
"@typescript-eslint/types" "5.54.1"
|
||||
"@typescript-eslint/visitor-keys" "5.54.1"
|
||||
|
||||
"@typescript-eslint/type-utils@5.54.1":
|
||||
version "5.54.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.54.1.tgz#4825918ec27e55da8bb99cd07ec2a8e5f50ab748"
|
||||
integrity sha512-WREHsTz0GqVYLIbzIZYbmUUr95DKEKIXZNH57W3s+4bVnuF1TKe2jH8ZNH8rO1CeMY3U4j4UQeqPNkHMiGem3g==
|
||||
"@typescript-eslint/scope-manager@5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.57.1.tgz#5d28799c0fc8b501a29ba1749d827800ef22d710"
|
||||
integrity sha512-N/RrBwEUKMIYxSKl0oDK5sFVHd6VI7p9K5MyUlVYAY6dyNb/wHUqndkTd3XhpGlXgnQsBkRZuu4f9kAHghvgPw==
|
||||
dependencies:
|
||||
"@typescript-eslint/typescript-estree" "5.54.1"
|
||||
"@typescript-eslint/utils" "5.54.1"
|
||||
"@typescript-eslint/types" "5.57.1"
|
||||
"@typescript-eslint/visitor-keys" "5.57.1"
|
||||
|
||||
"@typescript-eslint/type-utils@5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.57.1.tgz#235daba621d3f882b8488040597b33777c74bbe9"
|
||||
integrity sha512-/RIPQyx60Pt6ga86hKXesXkJ2WOS4UemFrmmq/7eOyiYjYv/MUSHPlkhU6k9T9W1ytnTJueqASW+wOmW4KrViw==
|
||||
dependencies:
|
||||
"@typescript-eslint/typescript-estree" "5.57.1"
|
||||
"@typescript-eslint/utils" "5.57.1"
|
||||
debug "^4.3.4"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
@ -1288,6 +1296,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.54.1.tgz#29fbac29a716d0f08c62fe5de70c9b6735de215c"
|
||||
integrity sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==
|
||||
|
||||
"@typescript-eslint/types@5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.57.1.tgz#d9989c7a9025897ea6f0550b7036027f69e8a603"
|
||||
integrity sha512-bSs4LOgyV3bJ08F5RDqO2KXqg3WAdwHCu06zOqcQ6vqbTJizyBhuh1o1ImC69X4bV2g1OJxbH71PJqiO7Y1RuA==
|
||||
|
||||
"@typescript-eslint/typescript-estree@5.53.0":
|
||||
version "5.53.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz#bc651dc28cf18ab248ecd18a4c886c744aebd690"
|
||||
@ -1314,6 +1327,19 @@
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/typescript-estree@5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.1.tgz#10d9643e503afc1ca4f5553d9bbe672ea4050b71"
|
||||
integrity sha512-A2MZqD8gNT0qHKbk2wRspg7cHbCDCk2tcqt6ScCFLr5Ru8cn+TCfM786DjPhqwseiS+PrYwcXht5ztpEQ6TFTw==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.57.1"
|
||||
"@typescript-eslint/visitor-keys" "5.57.1"
|
||||
debug "^4.3.4"
|
||||
globby "^11.1.0"
|
||||
is-glob "^4.0.3"
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/utils@5.53.0":
|
||||
version "5.53.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.53.0.tgz#e55eaad9d6fffa120575ffaa530c7e802f13bce8"
|
||||
@ -1328,7 +1354,21 @@
|
||||
eslint-utils "^3.0.0"
|
||||
semver "^7.3.7"
|
||||
|
||||
"@typescript-eslint/utils@5.54.1", "@typescript-eslint/utils@^5.10.0":
|
||||
"@typescript-eslint/utils@5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.57.1.tgz#0f97b0bbd88c2d5e2036869f26466be5f4c69475"
|
||||
integrity sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils" "^4.2.0"
|
||||
"@types/json-schema" "^7.0.9"
|
||||
"@types/semver" "^7.3.12"
|
||||
"@typescript-eslint/scope-manager" "5.57.1"
|
||||
"@typescript-eslint/types" "5.57.1"
|
||||
"@typescript-eslint/typescript-estree" "5.57.1"
|
||||
eslint-scope "^5.1.1"
|
||||
semver "^7.3.7"
|
||||
|
||||
"@typescript-eslint/utils@^5.10.0":
|
||||
version "5.54.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.54.1.tgz#7a3ee47409285387b9d4609ea7e1020d1797ec34"
|
||||
integrity sha512-IY5dyQM8XD1zfDe5X8jegX6r2EVU5o/WJnLu/znLPWCBF7KNGC+adacXnt5jEYS9JixDcoccI6CvE4RCjHMzCQ==
|
||||
@ -1358,6 +1398,14 @@
|
||||
"@typescript-eslint/types" "5.54.1"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@5.57.1":
|
||||
version "5.57.1"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.1.tgz#585e5fa42a9bbcd9065f334fd7c8a4ddfa7d905e"
|
||||
integrity sha512-RjQrAniDU0CEk5r7iphkm731zKlFiUjvcBS2yHAg8WWqFMCaCrD0rKEVOMUyMMcbGPZ0bPp56srkGWrgfZqLRA==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.57.1"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
"@wry/equality@^0.1.2":
|
||||
version "0.1.11"
|
||||
resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790"
|
||||
@ -2701,7 +2749,7 @@ end-of-stream@^1.1.0:
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
enhanced-resolve@^5.10.0:
|
||||
enhanced-resolve@^5.12.0:
|
||||
version "5.12.0"
|
||||
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz#300e1c90228f5b570c4d35babf263f6da7155634"
|
||||
integrity sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==
|
||||
@ -2856,10 +2904,10 @@ escodegen@^2.0.0:
|
||||
optionalDependencies:
|
||||
source-map "~0.6.1"
|
||||
|
||||
eslint-config-prettier@^8.3.0:
|
||||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
|
||||
integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==
|
||||
eslint-config-prettier@^8.8.0:
|
||||
version "8.8.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348"
|
||||
integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==
|
||||
|
||||
eslint-config-standard@^17.0.0:
|
||||
version "17.0.0"
|
||||
@ -2875,18 +2923,18 @@ eslint-import-resolver-node@^0.3.7:
|
||||
is-core-module "^2.11.0"
|
||||
resolve "^1.22.1"
|
||||
|
||||
eslint-import-resolver-typescript@^3.5.3:
|
||||
version "3.5.3"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.3.tgz#db5ed9e906651b7a59dd84870aaef0e78c663a05"
|
||||
integrity sha512-njRcKYBc3isE42LaTcJNVANR3R99H9bAxBDMNDr2W7yq5gYPxbU3MkdhsQukxZ/Xg9C2vcyLlDsbKfRDg0QvCQ==
|
||||
eslint-import-resolver-typescript@^3.5.4:
|
||||
version "3.5.4"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.4.tgz#7370c326c3c08f0c1839c592d79d20b704de15d4"
|
||||
integrity sha512-9xUpnedEmSfG57sN1UvWPiEhfJ8bPt0Wg2XysA7Mlc79iFGhmJtRUg9LxtkK81FhMUui0YuR2E8iUsVhePkh4A==
|
||||
dependencies:
|
||||
debug "^4.3.4"
|
||||
enhanced-resolve "^5.10.0"
|
||||
get-tsconfig "^4.2.0"
|
||||
globby "^13.1.2"
|
||||
is-core-module "^2.10.0"
|
||||
enhanced-resolve "^5.12.0"
|
||||
get-tsconfig "^4.5.0"
|
||||
globby "^13.1.3"
|
||||
is-core-module "^2.11.0"
|
||||
is-glob "^4.0.3"
|
||||
synckit "^0.8.4"
|
||||
synckit "^0.8.5"
|
||||
|
||||
eslint-module-utils@^2.7.4:
|
||||
version "2.7.4"
|
||||
@ -2931,10 +2979,10 @@ eslint-plugin-jest@^27.2.1:
|
||||
dependencies:
|
||||
"@typescript-eslint/utils" "^5.10.0"
|
||||
|
||||
eslint-plugin-n@^15.6.1:
|
||||
version "15.6.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.6.1.tgz#f7e77f24abb92a550115cf11e29695da122c398c"
|
||||
integrity sha512-R9xw9OtCRxxaxaszTQmQAlPgM+RdGjaL1akWuY/Fv9fRAi8Wj4CUKc6iYVG8QNRjRuo8/BqVYIpfqberJUEacA==
|
||||
eslint-plugin-n@^15.7.0:
|
||||
version "15.7.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.7.0.tgz#e29221d8f5174f84d18f2eb94765f2eeea033b90"
|
||||
integrity sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==
|
||||
dependencies:
|
||||
builtins "^5.0.1"
|
||||
eslint-plugin-es "^4.1.0"
|
||||
@ -2945,10 +2993,10 @@ eslint-plugin-n@^15.6.1:
|
||||
resolve "^1.22.1"
|
||||
semver "^7.3.8"
|
||||
|
||||
eslint-plugin-prettier@^3.4.0:
|
||||
version "3.4.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz#e9ddb200efb6f3d05ffe83b1665a716af4a387e5"
|
||||
integrity sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==
|
||||
eslint-plugin-prettier@^4.2.1:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
|
||||
integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==
|
||||
dependencies:
|
||||
prettier-linter-helpers "^1.0.0"
|
||||
|
||||
@ -3009,15 +3057,20 @@ eslint-visitor-keys@^3.3.0:
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
|
||||
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
|
||||
|
||||
eslint@^8.36.0:
|
||||
version "8.36.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf"
|
||||
integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw==
|
||||
eslint-visitor-keys@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc"
|
||||
integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==
|
||||
|
||||
eslint@^8.37.0:
|
||||
version "8.37.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.37.0.tgz#1f660ef2ce49a0bfdec0b0d698e0b8b627287412"
|
||||
integrity sha512-NU3Ps9nI05GUoVMxcZx1J8CNR6xOvUT4jAUMH5+z8lpp3aEdPVCImKw6PWG4PY+Vfkpr+jvMpxs/qoE7wq0sPw==
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils" "^4.2.0"
|
||||
"@eslint-community/regexpp" "^4.4.0"
|
||||
"@eslint/eslintrc" "^2.0.1"
|
||||
"@eslint/js" "8.36.0"
|
||||
"@eslint/eslintrc" "^2.0.2"
|
||||
"@eslint/js" "8.37.0"
|
||||
"@humanwhocodes/config-array" "^0.11.8"
|
||||
"@humanwhocodes/module-importer" "^1.0.1"
|
||||
"@nodelib/fs.walk" "^1.2.8"
|
||||
@ -3028,8 +3081,8 @@ eslint@^8.36.0:
|
||||
doctrine "^3.0.0"
|
||||
escape-string-regexp "^4.0.0"
|
||||
eslint-scope "^7.1.1"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
espree "^9.5.0"
|
||||
eslint-visitor-keys "^3.4.0"
|
||||
espree "^9.5.1"
|
||||
esquery "^1.4.2"
|
||||
esutils "^2.0.2"
|
||||
fast-deep-equal "^3.1.3"
|
||||
@ -3055,14 +3108,14 @@ eslint@^8.36.0:
|
||||
strip-json-comments "^3.1.0"
|
||||
text-table "^0.2.0"
|
||||
|
||||
espree@^9.5.0:
|
||||
version "9.5.0"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.0.tgz#3646d4e3f58907464edba852fa047e6a27bdf113"
|
||||
integrity sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw==
|
||||
espree@^9.5.1:
|
||||
version "9.5.1"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.1.tgz#4f26a4d5f18905bf4f2e0bd99002aab807e96dd4"
|
||||
integrity sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==
|
||||
dependencies:
|
||||
acorn "^8.8.0"
|
||||
acorn-jsx "^5.3.2"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
eslint-visitor-keys "^3.4.0"
|
||||
|
||||
esprima@^4.0.0, esprima@^4.0.1:
|
||||
version "4.0.1"
|
||||
@ -3471,10 +3524,10 @@ get-symbol-description@^1.0.0:
|
||||
call-bind "^1.0.2"
|
||||
get-intrinsic "^1.1.1"
|
||||
|
||||
get-tsconfig@^4.2.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.4.0.tgz#64eee64596668a81b8fce18403f94f245ee0d4e5"
|
||||
integrity sha512-0Gdjo/9+FzsYhXCEFueo2aY1z1tpXrxWZzP7k8ul9qt1U5o8rYJwTJYmaeHdrVosYIVYkOy2iwCJ9FdpocJhPQ==
|
||||
get-tsconfig@^4.5.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.5.0.tgz#6d52d1c7b299bd3ee9cd7638561653399ac77b0f"
|
||||
integrity sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ==
|
||||
|
||||
glob-parent@^5.1.2, glob-parent@~5.1.2:
|
||||
version "5.1.2"
|
||||
@ -3545,7 +3598,7 @@ globby@^11.1.0:
|
||||
merge2 "^1.4.1"
|
||||
slash "^3.0.0"
|
||||
|
||||
globby@^13.1.2:
|
||||
globby@^13.1.3:
|
||||
version "13.1.3"
|
||||
resolved "https://registry.yarnpkg.com/globby/-/globby-13.1.3.tgz#f62baf5720bcb2c1330c8d4ef222ee12318563ff"
|
||||
integrity sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==
|
||||
@ -4061,7 +4114,7 @@ is-ci@^3.0.0:
|
||||
dependencies:
|
||||
ci-info "^3.1.1"
|
||||
|
||||
is-core-module@^2.10.0, is-core-module@^2.11.0:
|
||||
is-core-module@^2.11.0:
|
||||
version "2.11.0"
|
||||
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144"
|
||||
integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==
|
||||
@ -5799,10 +5852,10 @@ prettier-linter-helpers@^1.0.0:
|
||||
dependencies:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier@^2.3.1:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
|
||||
integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
|
||||
prettier@^2.8.7:
|
||||
version "2.8.7"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.7.tgz#bb79fc8729308549d28fe3a98fce73d2c0656450"
|
||||
integrity sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==
|
||||
|
||||
pretty-format@^27.0.0, pretty-format@^27.2.5:
|
||||
version "27.2.5"
|
||||
@ -6096,7 +6149,7 @@ regexp.prototype.flags@^1.4.3:
|
||||
define-properties "^1.1.3"
|
||||
functions-have-names "^1.2.2"
|
||||
|
||||
regexpp@^3.0.0, regexpp@^3.2.0:
|
||||
regexpp@^3.0.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
|
||||
integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
|
||||
@ -6617,7 +6670,7 @@ symbol-tree@^3.2.4:
|
||||
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
|
||||
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
|
||||
|
||||
synckit@^0.8.4:
|
||||
synckit@^0.8.5:
|
||||
version "0.8.5"
|
||||
resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.5.tgz#b7f4358f9bb559437f9f167eb6bc46b3c9818fa3"
|
||||
integrity sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gradido-database",
|
||||
"version": "1.19.1",
|
||||
"version": "1.20.0",
|
||||
"description": "Gradido Database Tool to execute database migrations",
|
||||
"main": "src/index.ts",
|
||||
"repository": "https://github.com/gradido/gradido/database",
|
||||
|
||||
@ -58,7 +58,8 @@ WEBHOOK_ELOPAGE_SECRET=secret
|
||||
|
||||
# Federation
|
||||
FEDERATION_DHT_CONFIG_VERSION=v2.2023-02-07
|
||||
# if you set the value of FEDERATION_DHT_TOPIC, the DHT hyperswarm will start to announce and listen on an hash created from this topic
|
||||
# if you set the value of FEDERATION_DHT_TOPIC, the DHT hyperswarm will start to announce and listen
|
||||
# on an hash created from this topic
|
||||
# FEDERATION_DHT_TOPIC=GRADIDO_HUB
|
||||
# FEDERATION_DHT_SEED=64ebcb0e3ad547848fef4197c6e2332f
|
||||
FEDERATION_COMMUNITY_URL=http://stage1.gradido.net
|
||||
|
||||
@ -9,6 +9,9 @@ DB_DATABASE=gradido_community
|
||||
TYPEORM_LOGGING_RELATIVE_PATH=$TYPEORM_LOGGING_RELATIVE_PATH
|
||||
|
||||
# Federation
|
||||
FEDERATION_DHT_CONFIG_VERSION=$FEDERATION_DHT_CONFIG_VERSION
|
||||
# if you set the value of FEDERATION_DHT_TOPIC, the DHT hyperswarm will start to announce and listen
|
||||
# on an hash created from this topic
|
||||
FEDERATION_DHT_TOPIC=$FEDERATION_DHT_TOPIC
|
||||
FEDERATION_DHT_SEED=$FEDERATION_DHT_SEED
|
||||
FEDERATION_COMMUNITY_URL=$FEDERATION_COMMUNITY_URL
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gradido-dht-node",
|
||||
"version": "1.0.0",
|
||||
"version": "1.20.0",
|
||||
"description": "Gradido dht-node module",
|
||||
"main": "src/index.ts",
|
||||
"repository": "https://github.com/gradido/gradido/",
|
||||
|
||||
@ -2193,10 +2193,10 @@ crypto-browserify@^3.0.0:
|
||||
randombytes "^2.0.0"
|
||||
randomfill "^1.0.3"
|
||||
|
||||
cypress@^10.4.0:
|
||||
version "10.8.0"
|
||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.8.0.tgz#12a681f2642b6f13d636bab65d5b71abdb1497a5"
|
||||
integrity sha512-QVse0dnLm018hgti2enKMVZR9qbIO488YGX06nH5j3Dg1isL38DwrBtyrax02CANU6y8F4EJUuyW6HJKw1jsFA==
|
||||
cypress@^12.7.0:
|
||||
version "12.8.1"
|
||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.8.1.tgz#0c6e67f34554d553138697aaf349b637d80004eb"
|
||||
integrity sha512-lIFbKdaSYAOarNLHNFa2aPZu6YSF+8UY4VRXMxJrFUnk6RvfG0AWsZ7/qle/aIz30TNUD4aOihz2ZgS4vuQVSA==
|
||||
dependencies:
|
||||
"@cypress/request" "^2.88.10"
|
||||
"@cypress/xvfb" "^1.2.4"
|
||||
@ -2215,7 +2215,7 @@ cypress@^10.4.0:
|
||||
commander "^5.1.0"
|
||||
common-tags "^1.8.0"
|
||||
dayjs "^1.10.4"
|
||||
debug "^4.3.2"
|
||||
debug "^4.3.4"
|
||||
enquirer "^2.3.6"
|
||||
eventemitter2 "6.4.7"
|
||||
execa "4.1.0"
|
||||
|
||||
@ -13,3 +13,6 @@ DB_DATABASE=gradido_community
|
||||
|
||||
# Federation
|
||||
FEDERATION_COMMUNITY_URL=$FEDERATION_COMMUNITY_URL
|
||||
FEDERATION_CONFIG_VERSION=$FEDERATION_CONFIG_VERSION
|
||||
# comma separated list of api-versions, which cause starting several federation modules
|
||||
FEDERATION_COMMUNITY_APIS=$FEDERATION_COMMUNITY_APIS
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gradido-federation",
|
||||
"version": "1.0.0",
|
||||
"version": "1.20.0",
|
||||
"description": "Gradido federation module providing Gradido-Hub-Federation and versioned API for inter community communication",
|
||||
"main": "src/index.ts",
|
||||
"repository": "https://github.com/gradido/gradido/federation",
|
||||
@ -45,14 +45,16 @@
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"jest": "27.2.4",
|
||||
"nodemon": "^2.0.7",
|
||||
"prettier": "^2.3.1",
|
||||
"ts-jest": "27.0.5",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths": "^4.1.1",
|
||||
"nodemon": "^2.0.7",
|
||||
"prettier": "^2.3.1",
|
||||
"typescript": "^4.3.4"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"ignore": ["**/*.test.ts"]
|
||||
"ignore": [
|
||||
"**/*.test.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bootstrap-vue-gradido-wallet",
|
||||
"version": "1.19.1",
|
||||
"version": "1.20.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node run/server.js",
|
||||
@ -26,6 +26,7 @@
|
||||
"bootstrap": "^4.5.3",
|
||||
"bootstrap-vue": "^2.21.2",
|
||||
"clipboard-polyfill": "^4.0.0-rc1",
|
||||
"date-fns": "^2.29.3",
|
||||
"es6-promise": "^4.1.1",
|
||||
"eslint": "^7.25.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
@ -58,7 +59,6 @@
|
||||
"vue-i18n": "^8.22.4",
|
||||
"vue-jest": "^3.0.7",
|
||||
"vue-loading-overlay": "^3.4.2",
|
||||
"vue-moment": "^4.1.0",
|
||||
"vue-router": "^3.0.6",
|
||||
"vue-timers": "^2.0.4",
|
||||
"vue2-transitions": "^0.2.3",
|
||||
|
||||
@ -49,8 +49,8 @@
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-row>
|
||||
<b-col cols="12">
|
||||
<div v-if="radioSelected === sendTypes.send && !gradidoID">
|
||||
<b-col cols="12" v-if="radioSelected === sendTypes.send">
|
||||
<div v-if="!gradidoID">
|
||||
<input-email
|
||||
:name="$t('form.recipient')"
|
||||
:label="$t('form.recipient')"
|
||||
@ -60,7 +60,7 @@
|
||||
@onValidation="onValidation"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="gradidoID" class="mb-4">
|
||||
<div v-else class="mb-4">
|
||||
<b-row>
|
||||
<b-col>{{ $t('form.recipient') }}</b-col>
|
||||
</b-row>
|
||||
@ -130,6 +130,7 @@ import InputEmail from '@/components/Inputs/InputEmail'
|
||||
import InputAmount from '@/components/Inputs/InputAmount'
|
||||
import InputTextarea from '@/components/Inputs/InputTextarea'
|
||||
import { user as userQuery } from '@/graphql/queries'
|
||||
import { isEmpty } from 'lodash'
|
||||
|
||||
export default {
|
||||
name: 'TransactionForm',
|
||||
@ -176,7 +177,8 @@ export default {
|
||||
this.form.amount = ''
|
||||
this.form.memo = ''
|
||||
this.$refs.formValidator.validate()
|
||||
if (this.$route.query && !this.$route.query === {}) this.$router.replace({ query: undefined })
|
||||
if (this.$route.query && !isEmpty(this.$route.query))
|
||||
this.$router.replace({ query: undefined })
|
||||
},
|
||||
},
|
||||
apollo: {
|
||||
|
||||
@ -5,12 +5,17 @@
|
||||
<div>{{ $t('decay.past_time') }}</div>
|
||||
</b-col>
|
||||
<b-col offset="1" offset-md="0" offset-lg="0" class="text-right mr-5">
|
||||
<span v-if="duration">{{ durationText }}</span>
|
||||
<span v-if="duration">{{ duration }}</span>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { formatDistance } from 'date-fns'
|
||||
import { en, de, es, fr, nl } from 'date-fns/locale'
|
||||
|
||||
const locales = { en, de, es, fr, nl }
|
||||
|
||||
export default {
|
||||
name: 'DurationRow',
|
||||
props: {
|
||||
@ -25,19 +30,9 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
duration() {
|
||||
return this.$moment.duration(new Date(this.decayEnd) - new Date(this.decayStart))._data
|
||||
},
|
||||
durationText() {
|
||||
const order = ['years', 'months', 'days', 'hours', 'minutes', 'seconds']
|
||||
const result = []
|
||||
order.forEach((timeSpan) => {
|
||||
if (this.duration[timeSpan] > 0) {
|
||||
// eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys
|
||||
const locale = this.$t(`time.${timeSpan}`)
|
||||
result.push(`${this.duration[timeSpan]} ${locale}`)
|
||||
}
|
||||
return formatDistance(new Date(this.decayEnd), new Date(this.decayStart), {
|
||||
locale: locales[this.$i18n.locale],
|
||||
})
|
||||
return result.join(', ')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -8,11 +8,9 @@ const routerPushMock = jest.fn()
|
||||
const mocks = {
|
||||
$router: {
|
||||
push: routerPushMock,
|
||||
history: {
|
||||
current: {
|
||||
fullPath: '/transactions',
|
||||
},
|
||||
},
|
||||
},
|
||||
$route: {
|
||||
path: '/transactions',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
tunnelEmail() {
|
||||
if (this.$router.history.current.fullPath !== '/send') this.$router.push({ path: '/send' })
|
||||
async tunnelEmail() {
|
||||
if (this.$route.path !== '/send') await this.$router.push({ path: '/send' })
|
||||
this.$router.push({ query: { gradidoID: this.linkedUser.gradidoID } })
|
||||
},
|
||||
},
|
||||
|
||||
@ -98,7 +98,6 @@ const dateTimeFormats = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
},
|
||||
@ -130,7 +129,6 @@ const dateTimeFormats = {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
},
|
||||
@ -162,7 +160,6 @@ const dateTimeFormats = {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
},
|
||||
@ -194,7 +191,6 @@ const dateTimeFormats = {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
},
|
||||
|
||||
@ -72,6 +72,7 @@ describe('Community', () => {
|
||||
messagesCount: 0,
|
||||
deniedAt: null,
|
||||
deniedBy: null,
|
||||
moderatorId: null,
|
||||
},
|
||||
{
|
||||
id: 1550,
|
||||
@ -88,6 +89,7 @@ describe('Community', () => {
|
||||
messagesCount: 0,
|
||||
deniedAt: null,
|
||||
deniedBy: null,
|
||||
moderatorId: null,
|
||||
},
|
||||
],
|
||||
contributionCount: 1,
|
||||
|
||||
@ -196,7 +196,9 @@ export default {
|
||||
methods: {
|
||||
updateTabIndex() {
|
||||
const index = COMMUNITY_TABS.indexOf(this.$route.params.tab)
|
||||
this.tabIndex = index > -1 ? index : 0
|
||||
this.$nextTick(() => {
|
||||
this.tabIndex = index > -1 ? index : 0
|
||||
})
|
||||
this.closeAllOpenCollapse()
|
||||
},
|
||||
closeAllOpenCollapse() {
|
||||
|
||||
@ -11,8 +11,6 @@ import '@/assets/scss/gradido.scss'
|
||||
import FlatPickr from 'vue-flatpickr-component'
|
||||
import 'flatpickr/dist/flatpickr.css'
|
||||
|
||||
import VueMoment from 'vue-moment'
|
||||
|
||||
import Loading from 'vue-loading-overlay'
|
||||
import 'vue-loading-overlay/dist/vue-loading.css'
|
||||
|
||||
@ -26,7 +24,6 @@ export default {
|
||||
Vue.use(GlobalDirectives)
|
||||
Vue.use(BootstrapVue)
|
||||
Vue.use(IconsPlugin)
|
||||
Vue.use(VueMoment)
|
||||
Vue.use(PortalVue)
|
||||
Vue.use(FlatPickr)
|
||||
Vue.use(Loading)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user