2024-06-18 14:57:06 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-09-23 15:04:22 +00:00
|
|
|
export interface PreviousAndCurrent<T> {
|
|
|
|
previous: T;
|
|
|
|
current: T;
|
|
|
|
}
|
|
|
|
|
2024-06-18 14:57:06 +00:00
|
|
|
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;
|
|
|
|
|
2024-09-05 20:30:04 +00:00
|
|
|
export type RunInTransaction = <T>(
|
2024-06-18 14:57:06 +00:00
|
|
|
transaction: EntityManager|undefined,
|
2024-09-05 20:30:04 +00:00
|
|
|
op: ((manager: EntityManager) => Promise<T>)
|
|
|
|
) => Promise<T>;
|