Fix backend-core redis imports.
This commit is contained in:
parent
15767e2fd5
commit
d98e217c6c
|
@ -4,5 +4,6 @@ export { default as Client } from "./redis"
|
|||
export * as utils from "./utils"
|
||||
export * as clients from "./init"
|
||||
export * as locks from "./redlockImpl"
|
||||
export * as invite from "./invite"
|
||||
export * as passwordReset from "./passwordReset"
|
||||
|
||||
export * from "./invite"
|
||||
export * from "./passwordReset"
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
getInviteCode,
|
||||
deleteInviteCode,
|
||||
getInviteCodes,
|
||||
updateInviteCode,
|
||||
} from "@budibase/backend-core/src/redis/invite"
|
||||
import { redis } from "@budibase/backend-core"
|
||||
import * as userSdk from "../../../sdk/users"
|
||||
import env from "../../../environment"
|
||||
import {
|
||||
|
@ -313,7 +308,7 @@ export const checkInvite = async (ctx: any) => {
|
|||
const { code } = ctx.params
|
||||
let invite
|
||||
try {
|
||||
invite = await getInviteCode(code)
|
||||
invite = await redis.getInviteCode(code)
|
||||
} catch (e) {
|
||||
console.warn("Error getting invite from code", e)
|
||||
ctx.throw(400, "There was a problem with the invite")
|
||||
|
@ -327,7 +322,7 @@ export const checkInvite = async (ctx: any) => {
|
|||
export const getUserInvites = async (ctx: any) => {
|
||||
try {
|
||||
// Restricted to the currently authenticated tenant
|
||||
ctx.body = await getInviteCodes()
|
||||
ctx.body = await redis.getInviteCodes()
|
||||
} catch (e) {
|
||||
ctx.throw(400, "There was a problem fetching invites")
|
||||
}
|
||||
|
@ -341,7 +336,7 @@ export const updateInvite = async (ctx: any) => {
|
|||
|
||||
let invite
|
||||
try {
|
||||
invite = await getInviteCode(code)
|
||||
invite = await redis.getInviteCode(code)
|
||||
} catch (e) {
|
||||
ctx.throw(400, "There was a problem with the invite")
|
||||
return
|
||||
|
@ -369,7 +364,7 @@ export const updateInvite = async (ctx: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
await updateInviteCode(code, updated)
|
||||
await redis.updateInviteCode(code, updated)
|
||||
ctx.body = { ...invite }
|
||||
}
|
||||
|
||||
|
@ -379,8 +374,8 @@ export const inviteAccept = async (
|
|||
const { inviteCode, password, firstName, lastName } = ctx.request.body
|
||||
try {
|
||||
// info is an extension of the user object that was stored by global
|
||||
const { email, info }: any = await getInviteCode(inviteCode)
|
||||
await deleteInviteCode(inviteCode)
|
||||
const { email, info }: any = await redis.getInviteCode(inviteCode)
|
||||
await redis.deleteInviteCode(inviteCode)
|
||||
const user = await tenancy.doInTenant(info.tenantId, async () => {
|
||||
let request: any = {
|
||||
firstName,
|
||||
|
|
|
@ -73,7 +73,7 @@ export const reset = async (email: string) => {
|
|||
* Perform the user password update if the provided reset code is valid.
|
||||
*/
|
||||
export const resetUpdate = async (resetCode: string, password: string) => {
|
||||
const { userId } = await redis.passwordReset.getResetPasswordCode(resetCode)
|
||||
const { userId } = await redis.getResetPasswordCode(resetCode)
|
||||
|
||||
let user = await userSdk.db.getUser(userId)
|
||||
user.password = password
|
||||
|
|
|
@ -4,7 +4,7 @@ import { getTemplateByPurpose, EmailTemplates } from "../constants/templates"
|
|||
import { getSettingsTemplateContext } from "./templates"
|
||||
import { processString } from "@budibase/string-templates"
|
||||
import { createResetPasswordCode } from "@budibase/backend-core/src/redis/passwordReset"
|
||||
import { createInviteCode } from "@budibase/backend-core/src/redis/invite"
|
||||
import { redis } from "@budibase/backend-core"
|
||||
import { User, SendEmailOpts, SMTPInnerConfig } from "@budibase/types"
|
||||
import { configs } from "@budibase/backend-core"
|
||||
import ical from "ical-generator"
|
||||
|
@ -64,7 +64,7 @@ async function getLinkCode(
|
|||
case EmailTemplatePurpose.PASSWORD_RECOVERY:
|
||||
return createResetPasswordCode(user._id!, info)
|
||||
case EmailTemplatePurpose.INVITATION:
|
||||
return createInviteCode(email, info)
|
||||
return redis.createInviteCode(email, info)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue