📝Updated documentation for the backend services

This commit is contained in:
Anton SHEPILOV
2024-05-28 16:46:01 +02:00
committed by Anton Shepilov
parent 904b767382
commit 3cf164787f
26 changed files with 193 additions and 248 deletions
@@ -3,10 +3,9 @@ description: File on Twake Drive
---
# 📄 Files
<!-- TODO[NOT UP TO DATE] -->
## description
**Files** is everything related to file upload in Twake Drive after the migration to Node.js. Note that the Twake Drive isn't part of this migration because it will be replaced by Linshare.
**Files** is everything related to file upload in Twake Drive.
Twake Drive Files upload support chunk upload and file encryption.
@@ -18,7 +17,14 @@ Twake Drive Files upload support chunk upload and file encryption.
## Encryption
Files and Storage services in Twake Drive feature encryption at rest in **aes-256-cbc**.
Files and Storage services in Twake Drive feature encryption at rest in **aes-256-gbc**. Or you can also set your desired algorithm is the Twake Drive configuration
```JSON
{
"database": {
"encryption": "DB_ENCRYPTION_ALGORITHM"
}
}
```
Each file is encrypted with two layers:
@@ -1,40 +1,28 @@
---
description: File database models
---
<!-- TODO[NOT UP TO DATE] -->
# Database models
* **files** The main file object in database
```javascript
javascript
{
//Primary key: [["company_id"], "id"]
"company_id": "uuid-v4",
"id": "uuid-v4",
"user_id": "string",
"application_id": "string",
"updated_at": "number",
"created_at":"number
"upload_data": (json){
"size": number, //Total file size
"chunks": number, //Number of chunks
}
"metadata": (json){
"name": "string", //File name
"mime": "type/subtype",
}
"thumbnails": (json) { //Url to thumbnail (or set it to undefined if no relevant)
"index": "string",
"id": "uuid-v4",
"type": "string",
"size": "number,
"width": number, //Thumbnail width (for images only)
"height": number, //Thumbnail height (for images only)
}
```Typescript
export class File {
company_id: string;
id: string;
user_id: string;
application_id: null | string;
encryption_key: string;
updated_at: number;
created_at: number;
metadata: null | {
name?: string;
mime?: string;
thumbnails_status?: "done" | "error" | "waiting";
};
thumbnails: Thumbnail[];
upload_data: null | {
size: number;
chunks: number;
};
}
```
```