mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Make changes required for Desktop FS updates (#1099)
Make a set of changes required for Desktop FS improvements, see https://github.com/gristlabs/grist-desktop/pull/42 --------- Co-authored-by: Spoffy <contact@spoffy.net> Co-authored-by: Spoffy <4805393+Spoffy@users.noreply.github.com>
This commit is contained in:
@@ -68,12 +68,12 @@ import {Request} from "express";
|
||||
import {defaultsDeep, flatten, pick} from 'lodash';
|
||||
import {
|
||||
Brackets,
|
||||
Connection,
|
||||
DatabaseType,
|
||||
DataSource,
|
||||
EntityManager,
|
||||
ObjectLiteral,
|
||||
SelectQueryBuilder,
|
||||
WhereExpression
|
||||
WhereExpressionBuilder
|
||||
} from "typeorm";
|
||||
import uuidv4 from "uuid/v4";
|
||||
|
||||
@@ -247,7 +247,7 @@ export type BillingOptions = Partial<Pick<BillingAccount,
|
||||
*/
|
||||
export class HomeDBManager extends EventEmitter {
|
||||
private _usersManager = new UsersManager(this, this._runInTransaction.bind(this));
|
||||
private _connection: Connection;
|
||||
private _connection: DataSource;
|
||||
private _exampleWorkspaceId: number;
|
||||
private _exampleOrgId: number;
|
||||
private _idPrefix: string = ""; // Place this before ids in subdomains, used in routing to
|
||||
@@ -353,7 +353,7 @@ export class HomeDBManager extends EventEmitter {
|
||||
this._connection = await getOrCreateConnection();
|
||||
}
|
||||
|
||||
public connectTo(connection: Connection) {
|
||||
public connectTo(connection: DataSource) {
|
||||
this._connection = connection;
|
||||
}
|
||||
|
||||
@@ -987,6 +987,10 @@ export class HomeDBManager extends EventEmitter {
|
||||
return doc;
|
||||
}
|
||||
|
||||
public async getAllDocs() {
|
||||
return this.connection.getRepository(Document).find();
|
||||
}
|
||||
|
||||
public async getRawDocById(docId: string, transaction?: EntityManager) {
|
||||
return await this.getDoc({
|
||||
urlId: docId,
|
||||
@@ -3438,7 +3442,7 @@ export class HomeDBManager extends EventEmitter {
|
||||
// Adds a where clause to filter orgs by domain or id.
|
||||
// If org is null, filter for user's personal org.
|
||||
// if includeSupport is true, include the org of the support@ user (for the Samples workspace)
|
||||
private _whereOrg<T extends WhereExpression>(qb: T, org: string|number, includeSupport = false): T {
|
||||
private _whereOrg<T extends WhereExpressionBuilder>(qb: T, org: string|number, includeSupport = false): T {
|
||||
if (this.isMergedOrg(org)) {
|
||||
// Select from universe of personal orgs.
|
||||
// Don't panic though! While this means that SQL can't use an organization id
|
||||
@@ -3458,7 +3462,7 @@ export class HomeDBManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
private _wherePlainOrg<T extends WhereExpression>(qb: T, org: string|number): T {
|
||||
private _wherePlainOrg<T extends WhereExpressionBuilder>(qb: T, org: string|number): T {
|
||||
if (typeof org === 'number') {
|
||||
return qb.andWhere('orgs.id = :org', {org});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user