mattermost-mobile/app/queries/servers/file.ts
Elias Nahum 088aa193ab
[Gekidou] Use localPath when available (#6058)
* Use localPath when available

* Revert changes to replace space for dash in the filename

* Rename other action to external and always call onDownloadSuccess if defined

* add missing localization strings
2022-03-17 08:58:49 -03:00

18 lines
550 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {MM_TABLES} from '@constants/database';
import type {Database} from '@nozbe/watermelondb';
import type FileModel from '@typings/database/models/servers/file';
const {SERVER: {FILE}} = MM_TABLES;
export const getFileById = async (database: Database, fileId: string) => {
try {
const record = (await database.get<FileModel>(FILE).find(fileId));
return record;
} catch {
return undefined;
}
};