Use ids instead of email on the events
This commit is contained in:
parent
26f077cc1c
commit
924c103ccc
|
@ -7,21 +7,21 @@ import {
|
|||
} from "@budibase/types"
|
||||
|
||||
async function SCIMUserCreated(props: {
|
||||
email: string
|
||||
userId: string
|
||||
timestamp?: string | number
|
||||
}) {
|
||||
const properties: ScimUserCreatedEvent = {
|
||||
email: props.email,
|
||||
userId: props.userId,
|
||||
}
|
||||
await publishEvent(Event.SCIM_USER_CREATED, properties, props.timestamp)
|
||||
}
|
||||
|
||||
async function SCIMUserUpdated(props: {
|
||||
email: string
|
||||
userId: string
|
||||
timestamp?: string | number
|
||||
}) {
|
||||
const properties: ScimUserUpdatedEvent = {
|
||||
email: props.email,
|
||||
userId: props.userId,
|
||||
}
|
||||
await publishEvent(Event.SCIM_USER_UPDATED, properties, props.timestamp)
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { BaseEvent } from "./event"
|
||||
|
||||
export interface ScimUserCreatedEvent extends BaseEvent {
|
||||
email: string
|
||||
userId: string
|
||||
}
|
||||
|
||||
export interface ScimUserUpdatedEvent extends BaseEvent {
|
||||
email: string
|
||||
userId: string
|
||||
}
|
||||
export interface ScimUserDeletedEvent extends BaseEvent {
|
||||
userId: string
|
||||
|
|
|
@ -239,14 +239,13 @@ describe("/api/global/scim/v2/users", () => {
|
|||
})
|
||||
|
||||
it("an event is dispatched", async () => {
|
||||
const email = structures.email()
|
||||
const body = createScimCreateUserRequest({ email })
|
||||
const body = createScimCreateUserRequest()
|
||||
|
||||
await postScimUser({ body })
|
||||
const res = await postScimUser({ body })
|
||||
|
||||
expect(events.scim.SCIMUserCreated).toBeCalledTimes(1)
|
||||
expect(events.scim.SCIMUserCreated).toBeCalledWith({
|
||||
email,
|
||||
userId: res.id,
|
||||
timestamp: mockedTime.toISOString(),
|
||||
})
|
||||
})
|
||||
|
@ -454,7 +453,7 @@ describe("/api/global/scim/v2/users", () => {
|
|||
|
||||
expect(events.scim.SCIMUserUpdated).toBeCalledTimes(1)
|
||||
expect(events.scim.SCIMUserUpdated).toBeCalledWith({
|
||||
email: user.emails[0].value,
|
||||
userId: user.id,
|
||||
timestamp: mockedTime.toISOString(),
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue