mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 23:45:13 +00:00
refactor(server): use named export
This commit is contained in:
parent
53937e09a0
commit
59520c31fd
10 changed files with 12 additions and 12 deletions
|
@ -3,7 +3,7 @@ import * as tmp from 'tmp';
|
|||
import * as fs from 'fs';
|
||||
|
||||
import { queueLogger } from '../../logger';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import * as dateFormat from 'dateformat';
|
||||
import { getFullApAccount } from '@/misc/convert-host';
|
||||
import { Users, Blockings } from '@/models/index';
|
||||
|
|
|
@ -6,7 +6,7 @@ import { ulid } from 'ulid';
|
|||
const mime = require('mime-types');
|
||||
const archiver = require('archiver');
|
||||
import { queueLogger } from '../../logger';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import * as dateFormat from 'dateformat';
|
||||
import { Users, Emojis } from '@/models/index';
|
||||
import { } from '@/queue/types';
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as tmp from 'tmp';
|
|||
import * as fs from 'fs';
|
||||
|
||||
import { queueLogger } from '../../logger';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import * as dateFormat from 'dateformat';
|
||||
import { getFullApAccount } from '@/misc/convert-host';
|
||||
import { Users, Followings, Mutings } from '@/models/index';
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as tmp from 'tmp';
|
|||
import * as fs from 'fs';
|
||||
|
||||
import { queueLogger } from '../../logger';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import * as dateFormat from 'dateformat';
|
||||
import { getFullApAccount } from '@/misc/convert-host';
|
||||
import { Users, Mutings } from '@/models/index';
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as tmp from 'tmp';
|
|||
import * as fs from 'fs';
|
||||
|
||||
import { queueLogger } from '../../logger';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import * as dateFormat from 'dateformat';
|
||||
import { Users, Notes, Polls } from '@/models/index';
|
||||
import { MoreThan } from 'typeorm';
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as tmp from 'tmp';
|
|||
import * as fs from 'fs';
|
||||
|
||||
import { queueLogger } from '../../logger';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import * as dateFormat from 'dateformat';
|
||||
import { getFullApAccount } from '@/misc/convert-host';
|
||||
import { Users, UserLists, UserListJoinings } from '@/models/index';
|
||||
|
|
|
@ -8,7 +8,7 @@ import { queueLogger } from '../../logger';
|
|||
import { downloadUrl } from '@/misc/download-url';
|
||||
import { DriveFiles, Emojis } from '@/models/index';
|
||||
import { DbUserImportJobData } from '@/queue/types';
|
||||
import addFile from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
|
||||
const logger = queueLogger.createSubLogger('import-custom-emojis');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ms from 'ms';
|
||||
import $ from 'cafy';
|
||||
import { ID } from '@/misc/cafy-id';
|
||||
import create from '@/services/drive/add-file';
|
||||
import { addFile } from '@/services/drive/add-file';
|
||||
import define from '../../../define';
|
||||
import { apiLogger } from '../../../logger';
|
||||
import { ApiError } from '../../../error';
|
||||
|
@ -79,7 +79,7 @@ export default define(meta, async (ps, user, _, file, cleanup) => {
|
|||
|
||||
try {
|
||||
// Create file
|
||||
const driveFile = await create(user, file.path, name, null, ps.folderId, ps.force, false, null, null, ps.isSensitive);
|
||||
const driveFile = await addFile(user, file.path, name, null, ps.folderId, ps.force, false, null, null, ps.isSensitive);
|
||||
return await DriveFiles.pack(driveFile, { self: true });
|
||||
} catch (e) {
|
||||
apiLogger.error(e);
|
||||
|
|
|
@ -312,7 +312,7 @@ async function deleteOldFile(user: IRemoteUser) {
|
|||
* @param sensitive Mark file as sensitive
|
||||
* @return Created drive file
|
||||
*/
|
||||
export default async function(
|
||||
export async function addFile(
|
||||
user: { id: User['id']; host: User['host'] } | null,
|
||||
path: string,
|
||||
name: string | null = null,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { URL } from 'url';
|
||||
import create from './add-file';
|
||||
import { addFile } from './add-file';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { driveLogger } from './logger';
|
||||
import { createTemp } from '@/misc/create-temp';
|
||||
|
@ -41,7 +41,7 @@ export default async (
|
|||
let error;
|
||||
|
||||
try {
|
||||
driveFile = await create(user, path, name, comment, folderId, force, link, url, uri, sensitive);
|
||||
driveFile = await addFile(user, path, name, comment, folderId, force, link, url, uri, sensitive);
|
||||
logger.succ(`Got: ${driveFile.id}`);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
|
|
Loading…
Reference in a new issue