Feat(medusa, user, core-flows): User creation with invites (#6413)

**What**
- add accept invite endpoint 

**Invite accept flow**
- authenticate using the auth endpoint to create and auth-user
- invoke accept endpoint with token and info to create user
This commit is contained in:
Philip Korsholm authored and GitHub committed 2024-02-19 05:29:15 +00:00
1 parent 5977a38ef4
commit f6d38163bb
28 files changed
+399 -40

No files matched your search

+2 -1
View File
@@ -15,6 +15,7 @@ export interface CreateInviteDTO {
metadata?: Record<string, unknown> | null
}
export interface UpdateInviteDTO extends Partial<CreateInviteDTO> {
export interface UpdateInviteDTO
extends Partial<Omit<CreateInviteDTO, "email">> {
id: string
}
+5
View File
@@ -12,6 +12,11 @@ import { IModuleService } from "../modules-sdk"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
export interface IUserModuleService extends IModuleService {
validateInviteToken(
token: string,
sharedContext?: Context
): Promise<InviteDTO>
retrieve(
id: string,
config?: FindConfig<UserDTO>,
@@ -0,0 +1,10 @@
export interface AcceptInviteWorkflowInputDTO {
invite_token: string
auth_user_id: string
user: {
first_name?: string | null
last_name?: string | null
avatar_url?: string | null
metadata?: Record<string, unknown> | null
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
export * from "./create-invite"
export * from "./update-invite"
export * from "./delete-invite"
export * from "./accept-invite"
@@ -1,5 +0,0 @@
import { UpdateInviteDTO } from "../../user"
export interface UpdateInvitesWorkflowInputDTO {
updates: UpdateInviteDTO[]
}