Merge changes from last branch.

This commit is contained in:
elweyn 2021-11-30 10:13:42 +01:00
commit ea9bf54c16
9 changed files with 79 additions and 35 deletions

View File

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

View File

@ -45,7 +45,7 @@
</b-col>
</b-row>
<b-row class="m-4" v-show="createdIndex != null">
<b-row class="m-4" v-show="createdIndex">
<label>Betrag Auswählen</label>
<div>
<b-input-group prepend="GDD" append=".00">
@ -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),
}

View File

@ -2,7 +2,7 @@
<div class="component-nabvar">
<b-navbar toggleable="sm" type="dark" variant="success">
<b-navbar-brand to="/">
<img :src="logo" class="navbar-brand-img" alt="..." />
<img src="img/brand/green.png" class="navbar-brand-img" alt="..." />
</b-navbar-brand>
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
@ -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')
},

View File

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

View File

@ -9,7 +9,7 @@ export default class CreatePendingCreationArgs {
amount: number
@Field(() => String)
note: string
memo: string
@Field(() => String)
creationDate: string

View File

@ -21,7 +21,7 @@ export class PendingCreation {
date: Date
@Field(() => String)
note: string
memo: string
@Field(() => Number)
amount: BigInt

View File

@ -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<number[]> {
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)

View File

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