Move event one level up

This commit is contained in:
adrinr 2023-03-27 12:28:40 +01:00
parent d1c224ed42
commit 7821c637c6
2 changed files with 8 additions and 8 deletions

View File

@ -20,9 +20,9 @@ import { context } from "../.."
async function created(user: User, timestamp?: number) {
const properties: UserCreatedEvent = {
userId: user._id as string,
viaScim: context.isScimCall(),
audited: {
email: user.email,
viaScim: context.isScimCall(),
},
}
await publishEvent(Event.USER_CREATED, properties, timestamp)
@ -31,9 +31,9 @@ async function created(user: User, timestamp?: number) {
async function updated(user: User) {
const properties: UserUpdatedEvent = {
userId: user._id as string,
viaScim: context.isScimCall(),
audited: {
email: user.email,
viaScim: context.isScimCall(),
},
}
await publishEvent(Event.USER_UPDATED, properties)
@ -42,9 +42,9 @@ async function updated(user: User) {
async function deleted(user: User) {
const properties: UserDeletedEvent = {
userId: user._id as string,
viaScim: context.isScimCall(),
audited: {
email: user.email,
viaScim: context.isScimCall(),
},
}
await publishEvent(Event.USER_DELETED, properties)

View File

@ -2,25 +2,25 @@ import { BaseEvent } from "./event"
export interface UserCreatedEvent extends BaseEvent {
userId: string
viaScim?: boolean
audited: {
email: string
viaScim?: boolean
}
}
export interface UserUpdatedEvent extends BaseEvent {
userId: string
viaScim?: boolean
audited: {
email: string,
viaScim?: boolean
email: string
}
}
export interface UserDeletedEvent extends BaseEvent {
userId: string
viaScim?: boolean
audited: {
email: string,
viaScim?: boolean
email: string
}
}