Files
outline/server/context.ts
T
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

30 lines
619 B
TypeScript

import type { Transaction } from "sequelize";
import type { User } from "@server/models";
import type { APIContext } from "@server/types";
import { AuthenticationType } from "@server/types";
export function createContext({
user,
authType = AuthenticationType.APP,
ip,
transaction,
}: {
user?: User;
authType?: AuthenticationType | null;
ip?: string | null;
transaction?: Transaction;
}) {
const auth = { user, type: authType };
return {
state: {
auth,
transaction,
},
context: {
auth,
ip: ip ?? user?.lastActiveIp,
transaction,
},
} as APIContext;
}