/
dimamir
/
undb
Обзор
Документация
Войти
/
dimamir
/
undb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/context/src/context.type.ts
33 строки
696 B
nichenqin
chore: context injection
09 окт 2024, 12:45
09 окт 2024, 12:45
16f233b
Код
Авторство
О чём код?
import { inject } from "@undb/di" interface ContextUser { userId: string | null username?: string email?: string emailVerified?: boolean avatar?: string } export interface ContextMember { role: any | null spaceId: string | null } export interface ExecuteContext { requestId: string user?: ContextUser member?: ContextMember spaceId?: string } export type SetContextValue = (key: keyof ExecuteContext, value: any) => void export interface IContext { mustGetCurrentSpaceId(): string mustGetCurrentUserId(): string getCurrentUserId(): string | undefined } export const CONTEXT_TOKEN = Symbol.for("context") export const injectContext = () => inject(CONTEXT_TOKEN)