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) { async function created(user: User, timestamp?: number) {
const properties: UserCreatedEvent = { const properties: UserCreatedEvent = {
userId: user._id as string, userId: user._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
email: user.email, email: user.email,
viaScim: context.isScimCall(),
}, },
} }
await publishEvent(Event.USER_CREATED, properties, timestamp) await publishEvent(Event.USER_CREATED, properties, timestamp)
@ -31,9 +31,9 @@ async function created(user: User, timestamp?: number) {
async function updated(user: User) { async function updated(user: User) {
const properties: UserUpdatedEvent = { const properties: UserUpdatedEvent = {
userId: user._id as string, userId: user._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
email: user.email, email: user.email,
viaScim: context.isScimCall(),
}, },
} }
await publishEvent(Event.USER_UPDATED, properties) await publishEvent(Event.USER_UPDATED, properties)
@ -42,9 +42,9 @@ async function updated(user: User) {
async function deleted(user: User) { async function deleted(user: User) {
const properties: UserDeletedEvent = { const properties: UserDeletedEvent = {
userId: user._id as string, userId: user._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
email: user.email, email: user.email,
viaScim: context.isScimCall(),
}, },
} }
await publishEvent(Event.USER_DELETED, properties) await publishEvent(Event.USER_DELETED, properties)

View File

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