1
0
Fork 0
mirror of synced 2024-10-06 04:54:52 +13:00

Some final updates to get tests passing again, issue with publisher tenant ID being the 'unique' format which cannot actually be used.

This commit is contained in:
mike12345567 2023-04-17 15:59:59 +01:00
parent b6f14a3f55
commit b4e6cbce7a
5 changed files with 11 additions and 2 deletions

View file

@ -65,6 +65,7 @@ const getCurrentIdentity = async (): Promise<Identity> => {
hosting, hosting,
installationId, installationId,
tenantId, tenantId,
realTenantId: context.getTenantId(),
environment, environment,
} }
} else if (identityType === IdentityType.USER) { } else if (identityType === IdentityType.USER) {

View file

@ -20,7 +20,7 @@ export default class DocumentUpdateProcessor implements EventProcessor {
properties: any, properties: any,
timestamp?: string | number timestamp?: string | number
) { ) {
const tenantId = identity.tenantId const tenantId = identity.realTenantId
const docId = getDocumentId(event, properties) const docId = getDocumentId(event, properties)
if (!tenantId || !docId) { if (!tenantId || !docId) {
return return

View file

@ -2,8 +2,13 @@ import userGroupProcessor from "./syncUsers"
import { docUpdates } from "@budibase/backend-core" import { docUpdates } from "@budibase/backend-core"
export type UpdateCallback = (docId: string) => void export type UpdateCallback = (docId: string) => void
let started = false
export function init(updateCb?: UpdateCallback) { export function init(updateCb?: UpdateCallback) {
if (started) {
return
}
const processors = [userGroupProcessor(updateCb)] const processors = [userGroupProcessor(updateCb)]
docUpdates.init(processors) docUpdates.init(processors)
started = true
} }

View file

@ -20,6 +20,8 @@ function updateCb(docId: string) {
} }
} }
init(updateCb)
function waitForUpdate(opts: { group?: boolean }) { function waitForUpdate(opts: { group?: boolean }) {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
@ -35,7 +37,6 @@ function waitForUpdate(opts: { group?: boolean }) {
beforeAll(async () => { beforeAll(async () => {
app = await config.init("syncApp") app = await config.init("syncApp")
init(updateCb)
}) })
async function createUser(email: string, roles: UserRoles, builder?: boolean) { async function createUser(email: string, roles: UserRoles, builder?: boolean) {

View file

@ -46,6 +46,8 @@ export interface Identity {
environment: string environment: string
installationId?: string installationId?: string
tenantId?: string tenantId?: string
// usable - no unique format
realTenantId?: string
hostInfo?: HostInfo hostInfo?: HostInfo
} }