Gekidou - Updated Server Database Diagrams/Schema/Models (#6119)

* started with the diagrams

* removed redundant tables

next step:
1. reconstruct id ( local id vs server id )
2. annotate fields with examples
3. recreate relationship

* work in progress

* work in progress

* fix association

* update postsInChannel

* removed SlashCommands from the Server database schema

* added missing associations in the models and updated docs/database

* exported server database

* update test

* code corrections following review

* update relationship

* update docs

* removed cyclic relationship

* Revert "removed cyclic relationship"

This reverts commit 4d784efb81.

* removed isOptional from Draft

* linked myChannelSettings to myChannel instead of Channel

* update diagrams

* store null instead of empty string

* update thread association

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Avinash Lingaloo
2022-04-07 18:14:28 +04:00
committed by GitHub
parent ae3c9e2ef2
commit 9a72837f04
38 changed files with 987 additions and 95 deletions

View File

@@ -72,11 +72,11 @@ const PostHandler = (superclass: any) => class extends superclass {
* handlePosts: Handler responsible for the Create/Update operations occurring on the Post table from the 'Server' schema
* @param {HandlePostsArgs} handlePosts
* @param {string} handlePosts.actionType
* @param {string[]} handlePosts.orders
* @param {RawPost[]} handlePosts.values
* @param {string[]} handlePosts.order
* @param {RawPost[]} handlePosts.posts
* @param {string | undefined} handlePosts.previousPostId
* @param {boolean | undefined} handlePosts.prepareRecordsOnly
* @returns {Promise<void>}
* @returns {Promise<Model[]>}
*/
handlePosts = async ({actionType, order, posts, previousPostId = '', prepareRecordsOnly = false}: HandlePostsArgs): Promise<Model[]> => {
const tableName = POST;

View File

@@ -112,7 +112,7 @@ export const transformFileRecord = ({action, database, value}: TransformerArgs):
file.width = raw?.width || record?.width || 0;
file.height = raw?.height || record?.height || 0;
file.imageThumbnail = raw?.mini_preview || record?.imageThumbnail || '';
file.localPath = raw?.localPath || record?.localPath || '';
file.localPath = raw?.localPath || record?.localPath || null;
};
return prepareBaseRecord({

View File

@@ -43,7 +43,7 @@ export const transformUserRecord = ({action, database, value}: TransformerArgs):
user.props = raw.props || null;
user.timezone = raw.timezone || null;
user.isBot = raw.is_bot;
user.remoteId = raw?.remote_id ?? '';
user.remoteId = raw?.remote_id ?? null;
if (raw.status) {
user.status = raw.status;
}