mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2776 from gradido/rename-evenProtocolType-to-eventType
refactor(backend): rename `evenProtocolType` to `eventType`
This commit is contained in:
commit
eefe8f1d65
@ -4,10 +4,10 @@ import { ContributionMessage as DbContributionMessage } from '@entity/Contributi
|
|||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
import { EventProtocolType } from './EventProtocolType'
|
import { EventType } from './EventType'
|
||||||
|
|
||||||
export const Event = (
|
export const Event = (
|
||||||
type: EventProtocolType,
|
type: EventType,
|
||||||
affectedUser: DbUser,
|
affectedUser: DbUser,
|
||||||
actingUser: DbUser,
|
actingUser: DbUser,
|
||||||
involvedUser: DbUser | null = null,
|
involvedUser: DbUser | null = null,
|
||||||
@ -33,48 +33,21 @@ export const EVENT_CONTRIBUTION_CREATE = async (
|
|||||||
contribution: DbContribution,
|
contribution: DbContribution,
|
||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(EventType.CONTRIBUTION_CREATE, user, user, null, null, contribution, null, amount).save()
|
||||||
EventProtocolType.CONTRIBUTION_CREATE,
|
|
||||||
user,
|
|
||||||
user,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
contribution,
|
|
||||||
null,
|
|
||||||
amount,
|
|
||||||
).save()
|
|
||||||
|
|
||||||
export const EVENT_CONTRIBUTION_DELETE = async (
|
export const EVENT_CONTRIBUTION_DELETE = async (
|
||||||
user: DbUser,
|
user: DbUser,
|
||||||
contribution: DbContribution,
|
contribution: DbContribution,
|
||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(EventType.CONTRIBUTION_DELETE, user, user, null, null, contribution, null, amount).save()
|
||||||
EventProtocolType.CONTRIBUTION_DELETE,
|
|
||||||
user,
|
|
||||||
user,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
contribution,
|
|
||||||
null,
|
|
||||||
amount,
|
|
||||||
).save()
|
|
||||||
|
|
||||||
export const EVENT_CONTRIBUTION_UPDATE = async (
|
export const EVENT_CONTRIBUTION_UPDATE = async (
|
||||||
user: DbUser,
|
user: DbUser,
|
||||||
contribution: DbContribution,
|
contribution: DbContribution,
|
||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(EventType.CONTRIBUTION_UPDATE, user, user, null, null, contribution, null, amount).save()
|
||||||
EventProtocolType.CONTRIBUTION_UPDATE,
|
|
||||||
user,
|
|
||||||
user,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
contribution,
|
|
||||||
null,
|
|
||||||
amount,
|
|
||||||
).save()
|
|
||||||
|
|
||||||
export const EVENT_ADMIN_CONTRIBUTION_CREATE = async (
|
export const EVENT_ADMIN_CONTRIBUTION_CREATE = async (
|
||||||
user: DbUser,
|
user: DbUser,
|
||||||
@ -83,7 +56,7 @@ export const EVENT_ADMIN_CONTRIBUTION_CREATE = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.ADMIN_CONTRIBUTION_CREATE,
|
EventType.ADMIN_CONTRIBUTION_CREATE,
|
||||||
user,
|
user,
|
||||||
moderator,
|
moderator,
|
||||||
null,
|
null,
|
||||||
@ -100,7 +73,7 @@ export const EVENT_ADMIN_CONTRIBUTION_UPDATE = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.ADMIN_CONTRIBUTION_UPDATE,
|
EventType.ADMIN_CONTRIBUTION_UPDATE,
|
||||||
user,
|
user,
|
||||||
moderator,
|
moderator,
|
||||||
null,
|
null,
|
||||||
@ -117,7 +90,7 @@ export const EVENT_ADMIN_CONTRIBUTION_DELETE = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.ADMIN_CONTRIBUTION_DELETE,
|
EventType.ADMIN_CONTRIBUTION_DELETE,
|
||||||
user,
|
user,
|
||||||
moderator,
|
moderator,
|
||||||
null,
|
null,
|
||||||
@ -134,7 +107,7 @@ export const EVENT_CONTRIBUTION_CONFIRM = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.CONTRIBUTION_CONFIRM,
|
EventType.CONTRIBUTION_CONFIRM,
|
||||||
user,
|
user,
|
||||||
moderator,
|
moderator,
|
||||||
null,
|
null,
|
||||||
@ -151,7 +124,7 @@ export const EVENT_ADMIN_CONTRIBUTION_DENY = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.ADMIN_CONTRIBUTION_DENY,
|
EventType.ADMIN_CONTRIBUTION_DENY,
|
||||||
user,
|
user,
|
||||||
moderator,
|
moderator,
|
||||||
null,
|
null,
|
||||||
@ -168,7 +141,7 @@ export const EVENT_TRANSACTION_SEND = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.TRANSACTION_SEND,
|
EventType.TRANSACTION_SEND,
|
||||||
user,
|
user,
|
||||||
user,
|
user,
|
||||||
involvedUser,
|
involvedUser,
|
||||||
@ -185,7 +158,7 @@ export const EVENT_TRANSACTION_RECEIVE = async (
|
|||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> =>
|
||||||
Event(
|
Event(
|
||||||
EventProtocolType.TRANSACTION_RECEIVE,
|
EventType.TRANSACTION_RECEIVE,
|
||||||
user,
|
user,
|
||||||
involvedUser,
|
involvedUser,
|
||||||
involvedUser,
|
involvedUser,
|
||||||
@ -196,22 +169,21 @@ export const EVENT_TRANSACTION_RECEIVE = async (
|
|||||||
).save()
|
).save()
|
||||||
|
|
||||||
export const EVENT_LOGIN = async (user: DbUser): Promise<DbEvent> =>
|
export const EVENT_LOGIN = async (user: DbUser): Promise<DbEvent> =>
|
||||||
Event(EventProtocolType.LOGIN, user, user).save()
|
Event(EventType.LOGIN, user, user).save()
|
||||||
|
|
||||||
export const EVENT_SEND_ACCOUNT_MULTIREGISTRATION_EMAIL = async (user: DbUser): Promise<DbEvent> =>
|
export const EVENT_SEND_ACCOUNT_MULTIREGISTRATION_EMAIL = async (user: DbUser): Promise<DbEvent> =>
|
||||||
Event(EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, user, { id: 0 } as DbUser).save()
|
Event(EventType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, user, { id: 0 } as DbUser).save()
|
||||||
|
|
||||||
export const EVENT_SEND_CONFIRMATION_EMAIL = async (user: DbUser): Promise<DbEvent> =>
|
export const EVENT_SEND_CONFIRMATION_EMAIL = async (user: DbUser): Promise<DbEvent> =>
|
||||||
Event(EventProtocolType.SEND_CONFIRMATION_EMAIL, user, user).save()
|
Event(EventType.SEND_CONFIRMATION_EMAIL, user, user).save()
|
||||||
|
|
||||||
export const EVENT_ADMIN_SEND_CONFIRMATION_EMAIL = async (
|
export const EVENT_ADMIN_SEND_CONFIRMATION_EMAIL = async (
|
||||||
user: DbUser,
|
user: DbUser,
|
||||||
moderator: DbUser,
|
moderator: DbUser,
|
||||||
): Promise<DbEvent> =>
|
): Promise<DbEvent> => Event(EventType.ADMIN_SEND_CONFIRMATION_EMAIL, user, moderator).save()
|
||||||
Event(EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL, user, moderator).save()
|
|
||||||
|
|
||||||
export const EVENT_REGISTER = async (user: DbUser): Promise<DbEvent> =>
|
export const EVENT_REGISTER = async (user: DbUser): Promise<DbEvent> =>
|
||||||
Event(EventProtocolType.REGISTER, user, user).save()
|
Event(EventType.REGISTER, user, user).save()
|
||||||
|
|
||||||
export const EVENT_ACTIVATE_ACCOUNT = async (user: DbUser): Promise<DbEvent> =>
|
export const EVENT_ACTIVATE_ACCOUNT = async (user: DbUser): Promise<DbEvent> =>
|
||||||
Event(EventProtocolType.ACTIVATE_ACCOUNT, user, user).save()
|
Event(EventType.ACTIVATE_ACCOUNT, user, user).save()
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export enum EventProtocolType {
|
export enum EventType {
|
||||||
// VISIT_GRADIDO = 'VISIT_GRADIDO',
|
// VISIT_GRADIDO = 'VISIT_GRADIDO',
|
||||||
REGISTER = 'REGISTER',
|
REGISTER = 'REGISTER',
|
||||||
REDEEM_REGISTER = 'REDEEM_REGISTER',
|
REDEEM_REGISTER = 'REDEEM_REGISTER',
|
||||||
@ -50,7 +50,7 @@ import { Event as DbEvent } from '@entity/Event'
|
|||||||
import { Contribution } from '@entity/Contribution'
|
import { Contribution } from '@entity/Contribution'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
import { User } from '@entity/User'
|
import { User } from '@entity/User'
|
||||||
import { EventProtocolType } from '@/event/EventProtocolType'
|
import { EventType } from '@/event/EventType'
|
||||||
import { logger, i18n as localization } from '@test/testSetup'
|
import { logger, i18n as localization } from '@test/testSetup'
|
||||||
import { UserInputError } from 'apollo-server-express'
|
import { UserInputError } from 'apollo-server-express'
|
||||||
import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz'
|
import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz'
|
||||||
@ -281,7 +281,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the CONTRIBUTION_CREATE event in the database', async () => {
|
it('stores the CONTRIBUTION_CREATE event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.CONTRIBUTION_CREATE,
|
type: EventType.CONTRIBUTION_CREATE,
|
||||||
affectedUserId: bibi.id,
|
affectedUserId: bibi.id,
|
||||||
actingUserId: bibi.id,
|
actingUserId: bibi.id,
|
||||||
involvedContributionId: pendingContribution.data.createContribution.id,
|
involvedContributionId: pendingContribution.data.createContribution.id,
|
||||||
@ -587,7 +587,7 @@ describe('ContributionResolver', () => {
|
|||||||
|
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.CONTRIBUTION_UPDATE,
|
type: EventType.CONTRIBUTION_UPDATE,
|
||||||
affectedUserId: bibi.id,
|
affectedUserId: bibi.id,
|
||||||
actingUserId: bibi.id,
|
actingUserId: bibi.id,
|
||||||
involvedContributionId: pendingContribution.data.createContribution.id,
|
involvedContributionId: pendingContribution.data.createContribution.id,
|
||||||
@ -818,7 +818,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the ADMIN_CONTRIBUTION_DENY event in the database', async () => {
|
it('stores the ADMIN_CONTRIBUTION_DENY event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ADMIN_CONTRIBUTION_DENY,
|
type: EventType.ADMIN_CONTRIBUTION_DENY,
|
||||||
affectedUserId: bibi.id,
|
affectedUserId: bibi.id,
|
||||||
actingUserId: admin.id,
|
actingUserId: admin.id,
|
||||||
involvedContributionId: contributionToDeny.data.createContribution.id,
|
involvedContributionId: contributionToDeny.data.createContribution.id,
|
||||||
@ -946,7 +946,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the CONTRIBUTION_DELETE event in the database', async () => {
|
it('stores the CONTRIBUTION_DELETE event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.CONTRIBUTION_DELETE,
|
type: EventType.CONTRIBUTION_DELETE,
|
||||||
affectedUserId: bibi.id,
|
affectedUserId: bibi.id,
|
||||||
actingUserId: bibi.id,
|
actingUserId: bibi.id,
|
||||||
involvedContributionId: contributionToDelete.data.createContribution.id,
|
involvedContributionId: contributionToDelete.data.createContribution.id,
|
||||||
@ -2036,7 +2036,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the ADMIN_CONTRIBUTION_CREATE event in the database', async () => {
|
it('stores the ADMIN_CONTRIBUTION_CREATE event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ADMIN_CONTRIBUTION_CREATE,
|
type: EventType.ADMIN_CONTRIBUTION_CREATE,
|
||||||
affectedUserId: bibi.id,
|
affectedUserId: bibi.id,
|
||||||
actingUserId: admin.id,
|
actingUserId: admin.id,
|
||||||
amount: expect.decimalEqual(200),
|
amount: expect.decimalEqual(200),
|
||||||
@ -2262,7 +2262,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the ADMIN_CONTRIBUTION_UPDATE event in the database', async () => {
|
it('stores the ADMIN_CONTRIBUTION_UPDATE event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ADMIN_CONTRIBUTION_UPDATE,
|
type: EventType.ADMIN_CONTRIBUTION_UPDATE,
|
||||||
affectedUserId: creation?.userId,
|
affectedUserId: creation?.userId,
|
||||||
actingUserId: admin.id,
|
actingUserId: admin.id,
|
||||||
amount: 300,
|
amount: 300,
|
||||||
@ -2304,7 +2304,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the ADMIN_CONTRIBUTION_UPDATE event in the database', async () => {
|
it('stores the ADMIN_CONTRIBUTION_UPDATE event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ADMIN_CONTRIBUTION_UPDATE,
|
type: EventType.ADMIN_CONTRIBUTION_UPDATE,
|
||||||
affectedUserId: creation?.userId,
|
affectedUserId: creation?.userId,
|
||||||
actingUserId: admin.id,
|
actingUserId: admin.id,
|
||||||
amount: expect.decimalEqual(200),
|
amount: expect.decimalEqual(200),
|
||||||
@ -2390,7 +2390,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the ADMIN_CONTRIBUTION_DELETE event in the database', async () => {
|
it('stores the ADMIN_CONTRIBUTION_DELETE event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ADMIN_CONTRIBUTION_DELETE,
|
type: EventType.ADMIN_CONTRIBUTION_DELETE,
|
||||||
affectedUserId: creation?.userId,
|
affectedUserId: creation?.userId,
|
||||||
actingUserId: admin.id,
|
actingUserId: admin.id,
|
||||||
involvedContributionId: creation?.id,
|
involvedContributionId: creation?.id,
|
||||||
@ -2548,7 +2548,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the CONTRIBUTION_CONFIRM event in the database', async () => {
|
it('stores the CONTRIBUTION_CONFIRM event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.CONTRIBUTION_CONFIRM,
|
type: EventType.CONTRIBUTION_CONFIRM,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -2580,7 +2580,7 @@ describe('ContributionResolver', () => {
|
|||||||
it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => {
|
it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.SEND_CONFIRMATION_EMAIL,
|
type: EventType.SEND_CONFIRMATION_EMAIL,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
import { EventProtocolType } from '@/event/EventProtocolType'
|
import { EventType } from '@/event/EventType'
|
||||||
import { userFactory } from '@/seeds/factory/user'
|
import { userFactory } from '@/seeds/factory/user'
|
||||||
import {
|
import {
|
||||||
confirmContribution,
|
confirmContribution,
|
||||||
@ -343,7 +343,7 @@ describe('send coins', () => {
|
|||||||
|
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.TRANSACTION_SEND,
|
type: EventType.TRANSACTION_SEND,
|
||||||
affectedUserId: user[1].id,
|
affectedUserId: user[1].id,
|
||||||
actingUserId: user[1].id,
|
actingUserId: user[1].id,
|
||||||
involvedUserId: user[0].id,
|
involvedUserId: user[0].id,
|
||||||
@ -361,7 +361,7 @@ describe('send coins', () => {
|
|||||||
|
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.TRANSACTION_RECEIVE,
|
type: EventType.TRANSACTION_RECEIVE,
|
||||||
affectedUserId: user[0].id,
|
affectedUserId: user[0].id,
|
||||||
actingUserId: user[1].id,
|
actingUserId: user[1].id,
|
||||||
involvedUserId: user[1].id,
|
involvedUserId: user[1].id,
|
||||||
|
|||||||
@ -39,7 +39,7 @@ import { contributionLinkFactory } from '@/seeds/factory/contributionLink'
|
|||||||
import { transactionLinkFactory } from '@/seeds/factory/transactionLink'
|
import { transactionLinkFactory } from '@/seeds/factory/transactionLink'
|
||||||
import { ContributionLink } from '@model/ContributionLink'
|
import { ContributionLink } from '@model/ContributionLink'
|
||||||
import { TransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink } from '@entity/TransactionLink'
|
||||||
import { EventProtocolType } from '@/event/EventProtocolType'
|
import { EventType } from '@/event/EventType'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
import { validate as validateUUID, version as versionUUID } from 'uuid'
|
import { validate as validateUUID, version as versionUUID } from 'uuid'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
@ -189,7 +189,7 @@ describe('UserResolver', () => {
|
|||||||
)
|
)
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.REGISTER,
|
type: EventType.REGISTER,
|
||||||
affectedUserId: userConatct.user.id,
|
affectedUserId: userConatct.user.id,
|
||||||
actingUserId: userConatct.user.id,
|
actingUserId: userConatct.user.id,
|
||||||
}),
|
}),
|
||||||
@ -219,7 +219,7 @@ describe('UserResolver', () => {
|
|||||||
it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => {
|
it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.SEND_CONFIRMATION_EMAIL,
|
type: EventType.SEND_CONFIRMATION_EMAIL,
|
||||||
affectedUserId: user[0].id,
|
affectedUserId: user[0].id,
|
||||||
actingUserId: user[0].id,
|
actingUserId: user[0].id,
|
||||||
}),
|
}),
|
||||||
@ -265,7 +265,7 @@ describe('UserResolver', () => {
|
|||||||
)
|
)
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL,
|
type: EventType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL,
|
||||||
affectedUserId: userConatct.user.id,
|
affectedUserId: userConatct.user.id,
|
||||||
actingUserId: 0,
|
actingUserId: 0,
|
||||||
}),
|
}),
|
||||||
@ -366,7 +366,7 @@ describe('UserResolver', () => {
|
|||||||
it('stores the ACTIVATE_ACCOUNT event in the database', async () => {
|
it('stores the ACTIVATE_ACCOUNT event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ACTIVATE_ACCOUNT,
|
type: EventType.ACTIVATE_ACCOUNT,
|
||||||
affectedUserId: user[0].id,
|
affectedUserId: user[0].id,
|
||||||
actingUserId: user[0].id,
|
actingUserId: user[0].id,
|
||||||
}),
|
}),
|
||||||
@ -376,7 +376,7 @@ describe('UserResolver', () => {
|
|||||||
it('stores the REDEEM_REGISTER event in the database', async () => {
|
it('stores the REDEEM_REGISTER event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.REDEEM_REGISTER,
|
type: EventType.REDEEM_REGISTER,
|
||||||
affectedUserId: result.data.createUser.id,
|
affectedUserId: result.data.createUser.id,
|
||||||
actingUserId: result.data.createUser.id,
|
actingUserId: result.data.createUser.id,
|
||||||
involvedContributionId: link.id,
|
involvedContributionId: link.id,
|
||||||
@ -461,7 +461,7 @@ describe('UserResolver', () => {
|
|||||||
it('stores the REDEEM_REGISTER event in the database', async () => {
|
it('stores the REDEEM_REGISTER event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.REDEEM_REGISTER,
|
type: EventType.REDEEM_REGISTER,
|
||||||
affectedUserId: newUser.data.createUser.id,
|
affectedUserId: newUser.data.createUser.id,
|
||||||
actingUserId: newUser.data.createUser.id,
|
actingUserId: newUser.data.createUser.id,
|
||||||
involvedTransactionId: transactionLink.id,
|
involvedTransactionId: transactionLink.id,
|
||||||
@ -694,7 +694,7 @@ describe('UserResolver', () => {
|
|||||||
)
|
)
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.LOGIN,
|
type: EventType.LOGIN,
|
||||||
affectedUserId: userConatct.user.id,
|
affectedUserId: userConatct.user.id,
|
||||||
actingUserId: userConatct.user.id,
|
actingUserId: userConatct.user.id,
|
||||||
}),
|
}),
|
||||||
@ -943,7 +943,7 @@ describe('UserResolver', () => {
|
|||||||
it('stores the LOGIN event in the database', async () => {
|
it('stores the LOGIN event in the database', async () => {
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.LOGIN,
|
type: EventType.LOGIN,
|
||||||
affectedUserId: user[0].id,
|
affectedUserId: user[0].id,
|
||||||
actingUserId: user[0].id,
|
actingUserId: user[0].id,
|
||||||
}),
|
}),
|
||||||
@ -1863,7 +1863,7 @@ describe('UserResolver', () => {
|
|||||||
)
|
)
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL,
|
type: EventType.ADMIN_SEND_CONFIRMATION_EMAIL,
|
||||||
affectedUserId: userConatct.user.id,
|
affectedUserId: userConatct.user.id,
|
||||||
actingUserId: admin.id,
|
actingUserId: admin.id,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -69,7 +69,7 @@ import { FULL_CREATION_AVAILABLE } from './const/const'
|
|||||||
import { encryptPassword, verifyPassword } from '@/password/PasswordEncryptor'
|
import { encryptPassword, verifyPassword } from '@/password/PasswordEncryptor'
|
||||||
import { PasswordEncryptionType } from '../enum/PasswordEncryptionType'
|
import { PasswordEncryptionType } from '../enum/PasswordEncryptionType'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
import { EventProtocolType } from '@/event/EventProtocolType'
|
import { EventType } from '@/event/EventType'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const sodium = require('sodium-native')
|
const sodium = require('sodium-native')
|
||||||
@ -273,7 +273,7 @@ export class UserResolver {
|
|||||||
const gradidoID = await newGradidoID()
|
const gradidoID = await newGradidoID()
|
||||||
|
|
||||||
const eventRegisterRedeem = Event(
|
const eventRegisterRedeem = Event(
|
||||||
EventProtocolType.REDEEM_REGISTER,
|
EventType.REDEEM_REGISTER,
|
||||||
{ id: 0 } as DbUser,
|
{ id: 0 } as DbUser,
|
||||||
{ id: 0 } as DbUser,
|
{ id: 0 } as DbUser,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user