diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 766f9ba3b..a28680279 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -441,7 +441,7 @@ jobs: report_name: Coverage Admin Interface type: lcov result_path: ./coverage/lcov.info - min_coverage: 52 + min_coverage: 53 token: ${{ github.token }} ############################################################################## @@ -491,7 +491,7 @@ jobs: report_name: Coverage Backend type: lcov result_path: ./backend/coverage/lcov.info - min_coverage: 37 + min_coverage: 39 token: ${{ github.token }} ############################################################################## diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index f9fee802a..ca4126e31 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -45,7 +45,7 @@ - +
@@ -210,12 +210,35 @@ export default { if (this.text.length < 10) { return alert('Bitte gib einen Text ein der länger als 10 Zeichen ist!') } - if (this.type === 'singleCreation') { + + if (this.type === 'massCreation') { + // Die anzahl der Mitglieder aus der Mehrfachschöpfung + const i = Object.keys(this.itemsMassCreation).length + // hinweis das eine Mehrfachschöpfung ausgeführt wird an (Anzahl der MItgleider an die geschöpft wird) + alert('SUBMIT CREATION => ' + this.type + ' >> für VIELE ' + i + ' Mitglieder') + this.submitObj = [ + { + item: this.itemsMassCreation, + email: this.item.email, + creationDate: this.radioSelected.long, + amount: this.value, + memo: this.text, + moderator: this.$store.state.moderator.id, + }, + ] + alert('MehrfachSCHÖPFUNG ABSENDEN FÜR >> ' + i + ' Mitglieder') + + // $store - offene Schöpfungen hochzählen + this.$store.commit('openCreationsPlus', i) + + // lösche alle Mitglieder aus der MehrfachSchöpfungsListe nach dem alle Mehrfachschpfungen zum bestätigen gesendet wurden. + this.$emit('remove-all-bookmark') + } else if (this.type === 'singleCreation') { this.submitObj = { email: this.item.email, creationDate: this.radioSelected.long, amount: Number(this.value), - note: this.text, + memo: this.text, moderator: Number(this.$store.state.moderator.id), } diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index 44605e7dc..aaff9d61d 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -2,7 +2,7 @@
- ... + ... @@ -32,28 +32,8 @@ import CONFIG from '../config' export default { name: 'navbar', - data() { - return { - logo: 'img/brand/gradido_logo_w.png', - } - }, methods: { logout() { - // TODO - // this.$emit('logout') - /* this.$apollo - .query({ - query: logout, - }) - .then(() => { - this.$store.dispatch('logout') - this.$router.push('/logout') - }) - .catch(() => { - this.$store.dispatch('logout') - if (this.$router.currentRoute.path !== '/logout') this.$router.push('/logout') - }) - */ this.$store.dispatch('logout') this.$router.push('/logout') }, diff --git a/admin/src/graphql/getUsersQuery.ts b/admin/src/graphql/getUsersQuery.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index caf94cd37..365ccd809 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -4,11 +4,42 @@ import CreationConfirm from './CreationConfirm.vue' const localVue = global.localVue const storeCommitMock = jest.fn() +const toastedErrorMock = jest.fn() +const apolloQueryMock = jest.fn().mockResolvedValue({ + data: { + getPendingCreations: [ + { + firstName: 'Bibi', + lastName: 'Bloxberg', + email: 'bibi@bloxberg.de', + amount: 500, + note: 'Danke für alles', + date: new Date(), + moderator: 0, + }, + { + firstName: 'Räuber', + lastName: 'Hotzenplotz', + email: 'raeuber@hotzenplotz.de', + amount: 1000000, + note: 'Gut Ergatert', + date: new Date(), + moderator: 0, + }, + ], + }, +}) const mocks = { $store: { commit: storeCommitMock, }, + $apollo: { + query: apolloQueryMock, + }, + $toasted: { + error: toastedErrorMock, + }, } describe('CreationConfirm', () => { @@ -29,12 +60,22 @@ describe('CreationConfirm', () => { }) describe('store', () => { - it('commits resetOpenCreations to store', () => { - expect(storeCommitMock).toBeCalledWith('resetOpenCreations') + it('commits openCreationsPlus to store', () => { + expect(storeCommitMock).toBeCalledWith('openCreationsPlus', 2) + }) + }) + + describe('server response is error', () => { + beforeEach(() => { + jest.clearAllMocks() + apolloQueryMock.mockRejectedValue({ + message: 'Ouch!', + }) + wrapper = Wrapper() }) - it('commits openCreationsPlus to store', () => { - expect(storeCommitMock).toBeCalledWith('openCreationsPlus', 5) + it('toast an error message', () => { + expect(toastedErrorMock).toBeCalledWith('Ouch!') }) }) diff --git a/backend/src/graphql/arg/CreatePendingCreationArgs.ts b/backend/src/graphql/arg/CreatePendingCreationArgs.ts index ed24ed963..d2c17abf1 100644 --- a/backend/src/graphql/arg/CreatePendingCreationArgs.ts +++ b/backend/src/graphql/arg/CreatePendingCreationArgs.ts @@ -9,7 +9,7 @@ export default class CreatePendingCreationArgs { amount: number @Field(() => String) - note: string + memo: string @Field(() => String) creationDate: string diff --git a/backend/src/graphql/model/PendingCreation.ts b/backend/src/graphql/model/PendingCreation.ts index aa12bd94b..f1087ea0b 100644 --- a/backend/src/graphql/model/PendingCreation.ts +++ b/backend/src/graphql/model/PendingCreation.ts @@ -21,7 +21,7 @@ export class PendingCreation { date: Date @Field(() => String) - note: string + memo: string @Field(() => Number) amount: BigInt diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 5d2ed47a2..1a497f36f 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -32,7 +32,7 @@ export class AdminResolver { @Query(() => [Number]) async createPendingCreation( - @Args() { email, amount, note, creationDate, moderator }: CreatePendingCreationArgs, + @Args() { email, amount, memo, creationDate, moderator }: CreatePendingCreationArgs, ): Promise { const userRepository = getCustomRepository(UserRepository) const user = await userRepository.findByEmail(email) @@ -46,7 +46,7 @@ export class AdminResolver { loginPendingTaskAdmin.amount = BigInt(amount * 10000) loginPendingTaskAdmin.created = new Date() loginPendingTaskAdmin.date = creationDateObj - loginPendingTaskAdmin.note = note + loginPendingTaskAdmin.memo = memo loginPendingTaskAdmin.moderator = moderator pendingCreationRepository.save(loginPendingTaskAdmin) diff --git a/database/migrations/0005-admin_tables.ts b/database/migrations/0005-admin_tables.ts index 8e1219715..6398b22fc 100644 --- a/database/migrations/0005-admin_tables.ts +++ b/database/migrations/0005-admin_tables.ts @@ -16,7 +16,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`userId\` int UNSIGNED DEFAULT 0, \`created\` datetime NOT NULL, \`date\` datetime NOT NULL, - \`note\` text DEFAULT NULL, + \`memo\` text DEFAULT NULL, \`amount\` bigint(20) NOT NULL, \`moderator\` int UNSIGNED DEFAULT 0, PRIMARY KEY (\`id\`)