mirror of
https://github.com/outline/outline.git
synced 2025-12-29 06:52:44 -06:00
* Conversion of User to event system * fix * warning * fixes * Skip lastActiveAt in changeset * fix: Skip count in view changeset * refactor: Remove userDestroyer * refactor: Remove userSuspender * refactor: Remove userUnsuspender * tests
29 lines
572 B
TypeScript
29 lines
572 B
TypeScript
import { Transaction } from "sequelize";
|
|
import { User } from "@server/models";
|
|
import { APIContext, 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;
|
|
}
|