📁 Changed TDrive root folder (#16)

📁 Changed TDrive root folder
This commit is contained in:
Montassar Ghanmy
2023-04-11 10:04:29 +01:00
committed by GitHub
parent 3b3f67af07
commit e0615fa867
10548 changed files with 48 additions and 48 deletions
@@ -0,0 +1,33 @@
import { DriveFile, TYPE } from "./drive-file";
export default {
index: TYPE,
source: (entity: DriveFile) => ({
content_keywords: entity.content_keywords,
tags: (entity.tags || []).join(" "),
creator: entity.creator,
added: entity.added,
name: entity.name,
company_id: entity.company_id,
}),
mongoMapping: {
text: {
content_keywords: "text",
tags: "text",
creator: "text",
added: "text",
name: "text",
company_id: "text",
},
},
esMapping: {
properties: {
name: { type: "text", index_prefixes: { min_chars: 1 } },
content_keywords: { type: "text", index_prefixes: { min_chars: 1 } },
tags: { type: "keyword" },
creator: { type: "keyword" },
added: { type: "keyword" },
company_id: { type: "keyword" },
},
},
};
@@ -0,0 +1,90 @@
import { Type } from "class-transformer";
import { Column, Entity } from "../../../core/platform/services/database/services/orm/decorators";
import { DriveFileAccessLevel, publicAccessLevel } from "../types";
import { FileVersion } from "./file-version";
import search from "./drive-file.search";
export const TYPE = "drive_files";
@Entity(TYPE, {
globalIndexes: [["company_id", "parent_id"]],
primaryKey: [["company_id"], "id"],
type: TYPE,
search,
})
export class DriveFile {
@Type(() => String)
@Column("company_id", "uuid")
company_id: string;
@Type(() => String)
@Column("id", "uuid", { generator: "uuid" })
id: string;
@Type(() => String)
@Column("parent_id", "string")
parent_id: string;
@Type(() => Boolean)
@Column("is_in_trash", "boolean")
is_in_trash: boolean;
@Type(() => Boolean)
@Column("is_directory", "boolean")
is_directory: boolean;
@Type(() => String)
@Column("name", "string")
name: string;
@Type(() => String)
@Column("extension", "string")
extension: string;
@Type(() => String)
@Column("description", "string")
description: string;
@Column("tags", "encoded_json")
tags: string[];
@Type(() => String)
@Column("added", "string")
added: string;
@Type(() => String)
@Column("last_modified", "string")
last_modified: string;
@Column("access_info", "encoded_json")
access_info: AccessInformation;
@Type(() => String)
@Column("content_keywords", "string")
content_keywords: string;
@Type(() => String)
@Column("creator", "uuid")
creator: string;
@Type(() => Number)
@Column("size", "number")
size: number;
@Column("last_version_cache", "encoded_json")
last_version_cache: Partial<FileVersion>;
}
export type AccessInformation = {
public?: {
token: string;
level: publicAccessLevel;
};
entities: AuthEntity[];
};
type AuthEntity = {
type: "user" | "channel" | "company" | "folder";
id: string | "parent";
level: publicAccessLevel | DriveFileAccessLevel;
};
@@ -0,0 +1,30 @@
import { Type } from "class-transformer";
import { Column, Entity } from "../../../core/platform/services/database/services/orm/decorators";
export const TYPE = "drive_tdrive_tab";
@Entity(TYPE, {
primaryKey: [["company_id"], "tab_id"],
type: TYPE,
})
export class DriveTdriveTab {
@Type(() => String)
@Column("company_id", "string")
company_id: string;
@Type(() => String)
@Column("tab_id", "string")
tab_id: string;
@Type(() => String)
@Column("channel__id", "string")
channel_id: string;
@Type(() => String)
@Column("item_id", "string")
item_id: string;
@Type(() => String)
@Column("level", "string")
level: "read" | "write";
}
@@ -0,0 +1,83 @@
import { Type } from "class-transformer";
import { Column, Entity } from "../../../core/platform/services/database/services/orm/decorators";
export const TYPE = "drive_file_versions";
@Entity(TYPE, {
primaryKey: [["drive_item_id"], "id"],
type: TYPE,
})
export class FileVersion {
@Type(() => String)
@Column("drive_item_id", "uuid")
drive_item_id: string;
@Type(() => String)
@Column("id", "uuid", { generator: "uuid" })
id: string;
@Type(() => String)
@Column("provider", "string")
provider: "internal" | "drive" | string;
@Column("file_metadata", "encoded_json")
file_metadata: DriveFileMetadata;
@Type(() => Number)
@Column("date_added", "number")
date_added: number;
@Type(() => String)
@Column("creator_id", "uuid")
creator_id: string;
@Type(() => String)
@Column("application_id", "string")
application_id: string;
@Type(() => String)
@Column("realname", "string")
realname: string;
@Type(() => String)
@Column("key", "string")
key: string;
@Type(() => String)
@Column("mode", "string")
mode: string | "OpenSSL-2";
@Type(() => Number)
@Column("file_size", "number")
file_size: number;
@Type(() => String)
@Column("filename", "string")
filename: string;
@Column("data", "encoded_json")
data: unknown;
}
export type DriveFileMetadata = {
source?: "internal" | "drive" | string;
external_id: string;
name?: string;
mime?: string;
size?: number;
thumbnails?: DriveFileThumbnail[];
};
type DriveFileThumbnail = {
index: number;
id: string;
type: string;
size: number;
width: number;
height: number;
url: string;
full_url?: string;
};