Skip to content

Commit 882b469

Browse files
authored
fix: remove unused configuration and decoration for the file service (#1934)
1 parent 547611c commit 882b469

2 files changed

Lines changed: 4 additions & 24 deletions

File tree

src/services/item/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import type { FastifyPluginAsync } from 'fastify';
33
import fp from 'fastify-plugin';
44

55
import { APPS_JWT_SECRET } from '../../config/secrets';
6-
import {
7-
APPS_PUBLISHER_ID,
8-
APP_ITEMS_PREFIX,
9-
FILE_ITEM_PLUGIN_OPTIONS,
10-
ITEMS_ROUTE_PREFIX,
11-
S3_FILE_ITEM_PLUGIN_OPTIONS,
12-
} from '../../utils/config';
6+
import { APPS_PUBLISHER_ID, APP_ITEMS_PREFIX, ITEMS_ROUTE_PREFIX } from '../../utils/config';
137
import chatController from '../chat/chatMessage.controller';
148
import graaspItemLogin from '../itemLogin/itemLogin.controller';
159
import { itemMembershipsController } from '../itemMembership/membership.controller';
@@ -45,11 +39,6 @@ import thumbnailsPlugin from './plugins/thumbnail/itemThumbnail.controller';
4539
import { itemWsHooks } from './ws/item.hooks';
4640

4741
const plugin: FastifyPluginAsync = async (fastify) => {
48-
fastify.decorate('file', {
49-
s3Config: S3_FILE_ITEM_PLUGIN_OPTIONS,
50-
localConfig: FILE_ITEM_PLUGIN_OPTIONS,
51-
});
52-
5342
// this needs to execute before 'create()' and 'updateOne()' are called
5443
// because graaspApps extends the schemas
5544
await fastify.register(graaspApps, {

src/services/item/plugins/file/itemFile.controller.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,7 @@ import { getUrl, updateFile, upload } from './itemFile.schema';
2222
import FileItemService from './itemFile.service';
2323
import { DEFAULT_MAX_FILE_SIZE, MAX_NUMBER_OF_FILES_UPLOAD } from './utils/constants';
2424

25-
export interface GraaspPluginFileOptions {
26-
uploadMaxFileNb?: number; // max number of files to upload at a time
27-
maxFileSize?: number; // max size for an uploaded file in bytes
28-
maxMemberStorage?: number; // max storage space for a user
29-
}
30-
31-
const basePlugin: FastifyPluginAsyncTypebox<GraaspPluginFileOptions> = async (fastify, options) => {
32-
const { uploadMaxFileNb = MAX_NUMBER_OF_FILES_UPLOAD, maxFileSize = DEFAULT_MAX_FILE_SIZE } =
33-
options;
34-
25+
const basePlugin: FastifyPluginAsyncTypebox = async (fastify) => {
3526
const fileService = resolveDependency(FileService);
3627
const itemService = resolveDependency(ItemService);
3728
const storageService = resolveDependency(StorageService);
@@ -45,8 +36,8 @@ const basePlugin: FastifyPluginAsyncTypebox<GraaspPluginFileOptions> = async (fa
4536
// fieldSize: 1000000, // Max field value size in bytes (Default: 1MB).
4637
fields: 0, // Max number of non-file fields (Default: Infinity).
4738
// allow some fields for app data and app setting
48-
fileSize: maxFileSize, // For multipart forms, the max file size (Default: Infinity).
49-
files: uploadMaxFileNb, // Max number of file fields (Default: Infinity).
39+
fileSize: DEFAULT_MAX_FILE_SIZE, // For multipart forms, the max file size (Default: Infinity).
40+
files: MAX_NUMBER_OF_FILES_UPLOAD, // Max number of file fields (Default: Infinity).
5041
// headerPairs: 2000 // Max number of header key=>value pairs (Default: 2000 - same as node's http).
5142
},
5243
});

0 commit comments

Comments
 (0)