Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Updated documentation for the backend services #549

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Documentation/docs/get-started.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Get started
::: info
This paragraph is not ready yet, you can contribute to this documentation on our [Github!](https://github.com/linagora/twake-drive/issues/546)
:::
17 changes: 12 additions & 5 deletions Documentation/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# ☀️ Welcome to Twake Drive

Twake Drive is an open source collaborative drive. It can be self-hosted, used is saas and easily integrated into your teams. Twake Drive offers all the features for collaboration : team chat, file storage, team calendar, tasks manager.
Twake Drive is an open source collaborative drive. It can be self-hosted,
used is saas and easily integrated into your teams.
Store all your files and folders securely, whether in the cloud or your server,
and share them with your partners and team. Twake Drive prioritizes the confidentiality
and integrity of your data at all times. All that you expect from file storage,
plus privacy and elegant interface

This **documentation** assists developers and users in having the best Twake Drive experience as possible. We’ve developed Twake Drive to have a better teamwork.
This **documentation** assists developers and users in having the best Twake Drive experience as possible.
We’ve developed Twake Drive to have a better teamwork.

---

#### Start using Twake Drive now

Install it on your own server: [click here](onprem/installation.md)).
Install it on your own server: [click here](onprem/installation.md)

#### Add plugins like OnlyOffice
#### Add plugins like OnlyOffice [click here](plugins.md)

#### Developer documentation [click here](internal-documentation/backend-services/README.md)

[click here](plugins.md)).
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
description: >-
This page will document all the services implemented in the new NodeJS
backend. For all the PHP services not yet migrated, please ask us directly on
https://community.tdrive.app/
backend.
---

# 🧱 Backend and APIs
Expand All @@ -13,24 +12,30 @@ As a frontend developer / connector developer to read our APIs, or to understand

If document are empty, check out our Notion documentation: [https://www.notion.so/tdrive/Backend-documentation-e219323593d2401c9887d0e11b2a597b](https://www.notion.so/tdrive/Backend-documentation-e219323593d2401c9887d0e11b2a597b)

### General

#### Authentication
[TODO](https://github.com/linagora/twake-drive/issues/544)

### Services

[users/](users/README.md)

[applications/](applications/README.md))

[channels/](channels/README.md))
[documents/](documents/README.md))

[files/](files/README.md))

[messages/](messages/README.md))
[tags/](tags/README.md))

[notifications/](notifications/README.md))

## Get started to code in Twake Drive

Want to edit Twake Drive code ? Congratulation ! You participate in the development of a great product 😃

[start-working-into-a-service](intro/start-working-into-a-service.md)

[create-a-new-tdrive-service](intro/create-a-new-tdrive-service.md)
[create-a-new-tdrive-service](intro/create-a-new-twake-service.md)

[intro/platform/](intro/platform/README.md))
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ An application is described by an identity sheet containing this information:
- **Identity** \(name, description, logo\)
- **API** **preferences** \(TDrive→Connector events endpoint, API id and secret, and Connector→TDrive allowed IPs\)
- **Privileges and capabilities** \(List of things the connector can read and can write\)
- **Display information** \(Where the connector is visible, button in chat, configuration in application list etc\)
- **Display information** \(Where the connector is visible, configuration in application list etc\)

This is all we need to define a connector.

[database-models](database-models.md)

[rest-apis](rest-apis.md)

[examples](examples.md)
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,39 @@ description: Application models for backend

# Database models

**applications**\
\*\*\*\*Represent an application in the database

```javascript
{
//PK
"company_id": uuid;
"id": uuid;

"identity": ApplicationIdentity;
"api": ApplicationApi;
"access": ApplicationAccess;
"display": ApplicationDisplay;
"publication": ApplicationPublication;
"stats": ApplicationStatistics;
**applications**

Represent an application in the database

```Typescript
export default interface Application {
id: string;
internal_domain?: string;
external_prefix?: string;
company_id: string;
is_default: boolean;
identity: ApplicationIdentity;
api: ApplicationApi;
access: ApplicationAccess;
display: ApplicationDisplay;
publication: ApplicationPublication;
stats: ApplicationStatistics;
}

type ApplicationIdentity = {
export type ApplicationIdentity = {
code: string;
name: string;
iconUrl: string;
icon: string;
description: string;
website: string;
categories: string[];
compatibility: "tdrive"[];
compatibility: "twake"[];
repository?: string;
};

type ApplicationPublication = {
export type ApplicationPublication = {
published: boolean;
requested: boolean;
};

type ApplicationStatistics = {
Expand All @@ -56,73 +61,20 @@ type ApplicationDisplay = {
tdrive: {
"version": 1,

"files" : {
"preview": {
"url": "", //Url to preview file (full screen or inline)
"inline": true,
"main_ext": ["docx", "xlsx"], //Main extensions app can read
"other_ext": ["txt", "html"] //Secondary extensions app can read
},
"actions": [ //List of action that can apply on a file
{
"name": "string",
"id": "string"
}
]
},

//Chat plugin
"chat": {
"input": {
"icon": "", //If defined replace original icon url of your app
"type": "file" | "call" //To add in existing apps folder / default icon
},
"commands": [
{
"command": "mycommand", // my_app mycommand
"description": "fdsqfds"
}
],
"actions": [ //List of action that can apply on a message
{
"name": "string",
"id": "string"
}
]
},

//Allow app to appear as a bot user in direct chat
"direct": {
"name": "My app Bot",
"icon": "", //If defined replace original icon url of your app
},

//Display app as a standalone application in a tab
"tab": {
"url": ""
},

//Display app as a standalone application on the left bar
"standalone": {
"url": ""
},

//Define where the app can be configured from
"configuration": ["global", "channel"]
};
"files": {
"preview": {
"url": "", //Url to preview file (full screen or inline)
"inline": true,
"main_ext": ["docx", "xlsx"], //Main extensions app can read
"other_ext": ["txt", "html"] //Secondary extensions app can read
},
"actions": [ //List of action that can apply on a file
{
"name": "string",
"id": "string"
}
]
}
}
};
```

**company_application**\
\*\*\*\*Represent an application in a company

```javascript
{
"company_id": uuid;
"application_id": uuid;
"id": uuid;

"created_at": number;
"created_by": string; //Will be the default delegated user when doing actions on TDrive
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Twake Drive Application Example
::: info
This paragraph is not ready yet, you can contribute to this documentation on our [Github!](https://github.com/linagora/twake-drive/issues/548)
:::
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ description: Rest API for application
---

# REST APIs

::: info
This paragraph is not ready yet, you can contribute to this documentation on our [Github!](https://github.com/linagora/twake-drive/issues/547)
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
::: info
This paragraph is not ready yet, you can contribute to this documentation on our Github!
:::
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
description: Drive on TDrive
---

# 📁 Drive
# 📁 Documents

## description

**Drive** or **Documents** is the Nodejs drive implementation for tdrive, it contains drive items.
**Documents** is the Nodejs drive implementation for tdrive, it contains drive items.

A **Drive item** can be:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ description: Documents database models

**DriveFile**

```javascript
{
// Primary Key
"company_id": uuid;
"id": uuid;

"parent_id": string;
"is_in_trash": boolean;
"is_directory": boolean;
"name": string;
"extension": string;
"description": string;
"tags": string[];
"added": string;
"last_modified": string;
"access_info": AccessInformation;
"content_keywords": string;
"hidden_data": unknown;
"last_version_cache": Partial<FileVersion>;
```TypeScript
export class DriveFile {
company_id: string;
id: string;
parent_id: string;
is_in_trash: boolean;
is_directory: boolean;
name: string;
extension: string;
description: string;
tags: string[];
added: number;
last_modified: number;
access_info: AccessInformation;
content_keywords: string;
creator: string;
size: number;
last_version_cache: Partial<FileVersion>;
scope: DriveScope;
}

type AccessInformation = {
Expand All @@ -46,23 +46,24 @@ type AuthEntity = {

**FileVersion**

```javascript
{
"id": string;
"provider": "internal" | "drive" | string;
"file_id": string;
"file_metadata": DriveFileMetadata;
"date_added": number;
"creator_id": string;
"application_id": string;
"realname": string;
"key": string;
"mode": string | "OpenSSL-2";
"file_size": number;
"filename": string;
"data": unknown;
```Typescript
export class FileVersion {
drive_item_id: string;
id: string;
provider: "internal" | "drive" | string;
file_metadata: DriveFileMetadata;
date_added: number;
creator_id: string;
application_id: string;
realname: string;
key: string;
mode: string | "OpenSSL-2";
file_size: number;
filename: string;
data: unknown;
}


type DriveFileMetadata = {
source: "internal" | "drive" | string;
external_id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
description: Documents API
---

# Authentication
<!-- TODO[NOT UP TO DATE] -->
All the following routes require the usual authentication header. But you can also use other ways of authentication:

- For the download routes, you can use a token generated by the `/internal/services/documents/v1/companies/:company_id/download/token` route (see bellow).
- All the routes can use a query string `?public_token=token` to authenticate the user.
- All the routes can use a query string `?tdrive_tab_token=token` to authenticate the user in the context of a channel tab for instance.

# Navigation and drive capabilities

## Fetch a drive item
Expand Down
Loading