🌟 Support for PostgreSQL (#306)
This commit is contained in:
@@ -5,6 +5,7 @@ import { Prefix, TdriveService } from "../../core/platform/framework";
|
||||
import WebServerAPI from "../../core/platform/services/webserver/provider";
|
||||
import Application from "../applications/entities/application";
|
||||
import web from "./web/index";
|
||||
import { logger } from "../../core/platform/framework/logger";
|
||||
|
||||
@Prefix("/api")
|
||||
export default class ApplicationsApiService extends TdriveService<undefined> {
|
||||
@@ -26,7 +27,7 @@ export default class ApplicationsApiService extends TdriveService<undefined> {
|
||||
if (domain && prefix) {
|
||||
try {
|
||||
fastify.all("/" + prefix + "/*", async (req, rep) => {
|
||||
console.log("Proxying", req.method, req.url, "to", domain);
|
||||
logger.info("Proxying", req.method, req.url, "to", domain);
|
||||
try {
|
||||
const response = await axios.request({
|
||||
url: domain + req.url,
|
||||
@@ -54,15 +55,15 @@ export default class ApplicationsApiService extends TdriveService<undefined> {
|
||||
|
||||
rep.send(response.data);
|
||||
} catch (err) {
|
||||
console.error(`${err}`);
|
||||
logger.error(`${err}`);
|
||||
rep.raw.statusCode = 500;
|
||||
rep.raw.end(JSON.stringify({ error: err.message }));
|
||||
}
|
||||
});
|
||||
console.log("Listening at ", "/" + prefix + "/*");
|
||||
logger.info("Listening at ", "/" + prefix + "/*");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
console.log("Can't listen to ", "/" + prefix + "/*");
|
||||
logger.error(e);
|
||||
logger.info("Can't listen to ", "/" + prefix + "/*");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import {
|
||||
} from "../../types";
|
||||
import { DriveFileDTO } from "../dto/drive-file-dto";
|
||||
import { DriveFileDTOBuilder } from "../../services/drive-file-dto-builder";
|
||||
import { ExecutionContext } from "../../../../core/platform/framework/api/crud-service";
|
||||
import gr from "../../../global-resolver";
|
||||
import config from "config";
|
||||
|
||||
export class DocumentsController {
|
||||
@@ -35,12 +33,6 @@ export class DocumentsController {
|
||||
? config.get("drive.rootAdmins")
|
||||
: [];
|
||||
|
||||
private getCompanyUserRole(companyId: string, userId: string, context?: ExecutionContext) {
|
||||
return gr.services.companies
|
||||
.getCompanyUser({ id: companyId }, { id: userId }, context)
|
||||
.then(a => (a ? a.level : null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DriveFile item
|
||||
*
|
||||
|
||||
@@ -35,22 +35,6 @@ export default class CompanyUser {
|
||||
|
||||
@Column("last_update_day", "number")
|
||||
lastUpdateDay: number;
|
||||
|
||||
/**
|
||||
* 0: member,
|
||||
* 1, 2, 3: admin,
|
||||
*/
|
||||
@Column("level", "number")
|
||||
level: number; //Depreciated
|
||||
|
||||
@Column("is_externe", "tdrive_boolean")
|
||||
isExterne: boolean; //Depreciated
|
||||
|
||||
@Column("did_connect_today", "tdrive_boolean")
|
||||
didConnectToday: boolean; //Depreciated
|
||||
|
||||
@Column("app_used_today", "json")
|
||||
appUsedToday: Array<string>; //Depreciated
|
||||
}
|
||||
|
||||
export type CompanyUserPrimaryKey = Partial<Pick<CompanyUser, "group_id" | "user_id">>;
|
||||
|
||||
@@ -276,9 +276,6 @@ export class CompanyServiceImpl {
|
||||
}
|
||||
|
||||
entity.role = role;
|
||||
if (level) {
|
||||
entity.level = level;
|
||||
}
|
||||
entity.applications = applications;
|
||||
await this.companyUserRepository.save(entity, context);
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@ export default class WorkspaceUser {
|
||||
|
||||
@Column("last_access", "number")
|
||||
lastAccess: number;
|
||||
|
||||
@Column("is_externe", "tdrive_boolean")
|
||||
isExternal: boolean; //Depreciated
|
||||
}
|
||||
|
||||
export type WorkspaceUserPrimaryKey = Partial<Pick<WorkspaceUser, "workspaceId" | "userId">>;
|
||||
|
||||
Reference in New Issue
Block a user