gristlabs_grist-core/app/gen-server/lib/homedb/Interfaces.ts
Florent 95b2459f25
HomeDBManager refactoration: extract method related to Users management in its own module (#1049)
The HomeDBManager remains the exposed class to the other parts of the code: any module under gen-server/lib/homedb like UsersManager is intended to be used solely by HomeDBManager, and in order to use their methods, an indirection has to be created to pass through HomeDBManager.
2024-06-18 10:57:06 -04:00

41 lines
1.2 KiB
TypeScript

import { UserProfile } from "app/common/LoginSessionAPI";
import { UserOptions } from "app/common/UserAPI";
import * as roles from 'app/common/roles';
import { Document } from "app/gen-server/entity/Document";
import { Group } from "app/gen-server/entity/Group";
import { Organization } from "app/gen-server/entity/Organization";
import { Workspace } from "app/gen-server/entity/Workspace";
import { EntityManager } from "typeorm";
export interface QueryResult<T> {
status: number;
data?: T;
errMessage?: string;
}
export interface GetUserOptions {
manager?: EntityManager;
profile?: UserProfile;
userOptions?: UserOptions;
}
export interface UserProfileChange {
name?: string;
isFirstTimeUser?: boolean;
}
// A specification of the users available during a request. This can be a single
// user, identified by a user id, or a collection of profiles (typically drawn from
// the session).
export type AvailableUsers = number | UserProfile[];
export type NonGuestGroup = Group & { name: roles.NonGuestRole };
export type Resource = Organization|Workspace|Document;
export type RunInTransaction = (
transaction: EntityManager|undefined,
op: ((manager: EntityManager) => Promise<any>)
) => Promise<any>;