MM_30476 : Updated all models and typings for the default server (#5069)

This commit is contained in:
Avinash Lingaloo
2020-12-29 23:01:54 +04:00
committed by GitHub
parent 0d2868e4f2
commit cc02c9b8cb
11 changed files with 130 additions and 50 deletions

View File

@@ -1,9 +1,22 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Model} from '@nozbe/watermelondb';
/**
* The App model will hold information - such as the version number, build number and creation date -
* for the Mattermost mobile app.
*/
export default class App extends Model {
/** table (entity name) : app */
static table: string;
/** build_number : Build number for the app */
buildNumber: string;
/** created_at : Date of creation for this version */
createdAt: number;
/** version_number : Version number for the app */
versionNumber: string;
}

View File

@@ -1,10 +1,19 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Model} from '@nozbe/watermelondb';
/**
* The Global model will act as a dictionary of name-value pairs. The value field can be a JSON object or any other
* data type. It will hold information that applies to the whole app ( e.g. sidebar settings for tablets)
*/
export default class Global extends Model {
/** table (entity name) : global */
static table: string;
/** name : The label/key to use to retrieve the special 'value' */
name: string;
// TODO : atm, the return type for 'value' is string[]. However, this return type can change to string/number/etc. A broader definition will need to be applied and this return type updated accordingly.
value: string[];
/** value : The value part of the key-value combination */
value: string;
}

View File

@@ -1,11 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Model} from '@nozbe/watermelondb';
export default class Server extends Model {
static table: string;
dbPath: string;
displayName: string;
mentionCount: number;
unreadCount: number;
url: string;
}

28
types/database/servers.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Model} from '@nozbe/watermelondb';
/**
* The Server model will help us to identify the various servers a user will log in; in the context of
* multi-server support system. The dbPath field will hold the App-Groups file-path
*/
export default class Servers extends Model {
/** table (entity name) : servers */
static table: string;
/** db_path : The file path where the database is stored */
dbPath: string;
/** display_name : The server display name */
displayName: string;
/** mention_count : The number of mention on this server */
mentionCount: number;
/** unread_count : The number of unread messages on this server */
unreadCount: number;
/** url : The online address for the Mattermost server */
url: string;
}