mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge remote-tracking branch 'origin/master' into 1798-feature-gradidoid-1-adapt-and-migrate-database-schema
This commit is contained in:
commit
9478690772
@ -12,6 +12,8 @@ export class Contribution {
|
||||
this.memo = contribution.memo
|
||||
this.createdAt = contribution.createdAt
|
||||
this.deletedAt = contribution.deletedAt
|
||||
this.confirmedAt = contribution.confirmedAt
|
||||
this.confirmedBy = contribution.confirmedBy
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@ -31,6 +33,12 @@ export class Contribution {
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
deletedAt: Date | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
confirmedAt: Date | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
confirmedBy: number | null
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
|
||||
@ -58,6 +58,7 @@ export class ContributionResolver {
|
||||
order: {
|
||||
createdAt: order,
|
||||
},
|
||||
withDeleted: true,
|
||||
skip: (currentPage - 1) * pageSize,
|
||||
take: pageSize,
|
||||
})
|
||||
|
||||
@ -31,20 +31,24 @@ const filterVariables = (variables: any) => {
|
||||
const logPlugin = {
|
||||
requestDidStart(requestContext: any) {
|
||||
const { logger } = requestContext
|
||||
const { query, mutation, variables } = requestContext.request
|
||||
logger.info(`Request:
|
||||
const { query, mutation, variables, operationName } = requestContext.request
|
||||
if (operationName !== 'IntrospectionQuery') {
|
||||
logger.info(`Request:
|
||||
${mutation || query}variables: ${JSON.stringify(filterVariables(variables), null, 2)}`)
|
||||
}
|
||||
return {
|
||||
willSendResponse(requestContext: any) {
|
||||
if (requestContext.context.user) logger.info(`User ID: ${requestContext.context.user.id}`)
|
||||
if (requestContext.response.data) {
|
||||
logger.info('Response Success!')
|
||||
logger.trace(`Response-Data:
|
||||
if (operationName !== 'IntrospectionQuery') {
|
||||
if (requestContext.context.user) logger.info(`User ID: ${requestContext.context.user.id}`)
|
||||
if (requestContext.response.data) {
|
||||
logger.info('Response Success!')
|
||||
logger.trace(`Response-Data:
|
||||
${JSON.stringify(requestContext.response.data, null, 2)}`)
|
||||
}
|
||||
if (requestContext.response.errors)
|
||||
logger.error(`Response-Errors:
|
||||
}
|
||||
if (requestContext.response.errors)
|
||||
logger.error(`Response-Errors:
|
||||
${JSON.stringify(requestContext.response.errors, null, 2)}`)
|
||||
}
|
||||
return requestContext
|
||||
},
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ export const login = gql`
|
||||
hasElopage
|
||||
publisherId
|
||||
isAdmin
|
||||
creation
|
||||
}
|
||||
}
|
||||
`
|
||||
@ -30,6 +31,7 @@ export const verifyLogin = gql`
|
||||
hasElopage
|
||||
publisherId
|
||||
isAdmin
|
||||
creation
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
@ -47,6 +47,9 @@ export const mutations = {
|
||||
hasElopage: (state, hasElopage) => {
|
||||
state.hasElopage = hasElopage
|
||||
},
|
||||
creation: (state, creation) => {
|
||||
state.creation = creation
|
||||
},
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
@ -60,6 +63,7 @@ export const actions = {
|
||||
commit('hasElopage', data.hasElopage)
|
||||
commit('publisherId', data.publisherId)
|
||||
commit('isAdmin', data.isAdmin)
|
||||
commit('creation', data.creation)
|
||||
},
|
||||
logout: ({ commit, state }) => {
|
||||
commit('token', null)
|
||||
@ -71,6 +75,7 @@ export const actions = {
|
||||
commit('hasElopage', false)
|
||||
commit('publisherId', null)
|
||||
commit('isAdmin', false)
|
||||
commit('creation', null)
|
||||
localStorage.clear()
|
||||
},
|
||||
}
|
||||
@ -96,6 +101,7 @@ try {
|
||||
newsletterState: null,
|
||||
hasElopage: false,
|
||||
publisherId: null,
|
||||
creation: null,
|
||||
},
|
||||
getters: {},
|
||||
// Syncronous mutation of the state
|
||||
|
||||
@ -30,6 +30,7 @@ const {
|
||||
publisherId,
|
||||
isAdmin,
|
||||
hasElopage,
|
||||
creation,
|
||||
} = mutations
|
||||
const { login, logout } = actions
|
||||
|
||||
@ -139,6 +140,14 @@ describe('Vuex store', () => {
|
||||
expect(state.hasElopage).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('creation', () => {
|
||||
it('sets the state of creation', () => {
|
||||
const state = { creation: null }
|
||||
creation(state, true)
|
||||
expect(state.creation).toEqual(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('actions', () => {
|
||||
@ -156,11 +165,12 @@ describe('Vuex store', () => {
|
||||
hasElopage: false,
|
||||
publisherId: 1234,
|
||||
isAdmin: true,
|
||||
creation: ['1000', '1000', '1000'],
|
||||
}
|
||||
|
||||
it('calls nine commits', () => {
|
||||
login({ commit, state }, commitedData)
|
||||
expect(commit).toHaveBeenCalledTimes(8)
|
||||
expect(commit).toHaveBeenCalledTimes(9)
|
||||
})
|
||||
|
||||
it('commits email', () => {
|
||||
@ -202,6 +212,11 @@ describe('Vuex store', () => {
|
||||
login({ commit, state }, commitedData)
|
||||
expect(commit).toHaveBeenNthCalledWith(8, 'isAdmin', true)
|
||||
})
|
||||
|
||||
it('commits creation', () => {
|
||||
login({ commit, state }, commitedData)
|
||||
expect(commit).toHaveBeenNthCalledWith(9, 'creation', ['1000', '1000', '1000'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('logout', () => {
|
||||
@ -210,7 +225,7 @@ describe('Vuex store', () => {
|
||||
|
||||
it('calls nine commits', () => {
|
||||
logout({ commit, state })
|
||||
expect(commit).toHaveBeenCalledTimes(8)
|
||||
expect(commit).toHaveBeenCalledTimes(9)
|
||||
})
|
||||
|
||||
it('commits token', () => {
|
||||
@ -253,6 +268,11 @@ describe('Vuex store', () => {
|
||||
expect(commit).toHaveBeenNthCalledWith(8, 'isAdmin', false)
|
||||
})
|
||||
|
||||
it('commits creation', () => {
|
||||
logout({ commit, state })
|
||||
expect(commit).toHaveBeenNthCalledWith(9, 'creation', null)
|
||||
})
|
||||
|
||||
// how to get this working?
|
||||
it.skip('calls localStorage.clear()', () => {
|
||||
const clearStorageMock = jest.fn()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user