Skip to content

Commit c0881e4

Browse files
authored
refactor: fix lint errors (#1884)
* refactor: fix lint errors * refactor: apply PR requested changes
1 parent b5b2180 commit c0881e4

21 files changed

Lines changed: 19 additions & 63 deletions

src/plugins/typebox.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import {
33
Static,
44
StringOptions,
55
TProperties,
6-
TRef,
76
TSchema,
8-
TUnsafe,
97
Type,
108
UnsafeOptions,
119
} from '@sinclair/typebox';

src/services/auth/plugins/passport/strategies/jwtChallengeVerifier.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default (
3939
return done(spreadException ? new ChallengeFailed() : new UnauthorizedMember(), false);
4040
}
4141
} catch (err) {
42+
console.error(err);
4243
// Exception occurred while comparing challenge
4344
return done(spreadException ? new ChallengeFailed() : new UnauthorizedMember(), false);
4445
}

src/services/chat/chatMessage.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const plugin: FastifyPluginAsyncTypebox<GraaspChatPluginOptions> = async (fastif
8585
try {
8686
websockets.publish(itemChatTopic, message.itemId, ItemChatEvent('publish', message));
8787
} catch (e) {
88-
fastify.log.error(e);
88+
request.log.error(e);
8989
}
9090

9191
return message;
@@ -119,7 +119,7 @@ const plugin: FastifyPluginAsyncTypebox<GraaspChatPluginOptions> = async (fastif
119119
try {
120120
websockets.publish(itemChatTopic, message.itemId, ItemChatEvent('update', message));
121121
} catch (e) {
122-
fastify.log.error(e);
122+
request.log.error(e);
123123
}
124124

125125
return message;
@@ -149,7 +149,7 @@ const plugin: FastifyPluginAsyncTypebox<GraaspChatPluginOptions> = async (fastif
149149
try {
150150
websockets.publish(itemChatTopic, message.itemId, ItemChatEvent('delete', message));
151151
} catch (e) {
152-
fastify.log.error(e);
152+
request.log.error(e);
153153
}
154154

155155
return message;
@@ -179,7 +179,7 @@ const plugin: FastifyPluginAsyncTypebox<GraaspChatPluginOptions> = async (fastif
179179
try {
180180
websockets.publish(itemChatTopic, itemId, ItemChatEvent('clear'));
181181
} catch (e) {
182-
fastify.log.error(e);
182+
request.log.error(e);
183183
}
184184
},
185185
);

src/services/item/item.controller.read.test.ts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,18 @@ import { v4 as uuidv4 } from 'uuid';
33

44
import { FastifyInstance } from 'fastify';
55

6-
import { HttpMethod, ItemType, PermissionLevel, ResultOf } from '@graasp/sdk';
6+
import { HttpMethod, ItemType, PermissionLevel } from '@graasp/sdk';
77

88
import build, { clearDatabase, mockAuthenticate, unmockAuthenticate } from '../../../test/app';
99
import { seedFromJson } from '../../../test/mocks/seed';
1010
import { db } from '../../drizzle/db';
11-
import { ItemMembershipRaw, ItemVisibilityRaw } from '../../drizzle/types';
12-
import { MinimalMember } from '../../types';
1311
import { assertIsDefined } from '../../utils/assertions';
1412
import { ItemNotFound, MemberCannotAccess } from '../../utils/errors';
1513
import { assertIsMemberForTest } from '../authentication';
1614
import { ItemWrapper, PackedItem } from './ItemWrapper';
1715
import { expectManyPackedItems, expectPackedItem, expectThumbnails } from './test/fixtures/items';
1816
import { Ordering, SortBy } from './types';
1917

20-
/**
21-
*
22-
* @param resultItems ResultOf items
23-
* @param correctItems
24-
* @param itemMemberships we suppose item memberships is ordered in the same order as correctItems
25-
* @param creator
26-
* @param itemVisibilities
27-
*/
28-
const expectResultOfPackedItems = (
29-
resultItems: ResultOf<PackedItem>,
30-
correctItems,
31-
itemMemberships?: ItemMembershipRaw[],
32-
creator?: MinimalMember,
33-
itemVisibilities?: ItemVisibilityRaw[],
34-
) => {
35-
correctItems.forEach(({ id, path }) => {
36-
const idx = correctItems.findIndex(({ id: thisId }) => thisId === id);
37-
const item = resultItems[id];
38-
expectPackedItem(
39-
item,
40-
new ItemWrapper(
41-
{ ...correctItems[idx], creator },
42-
itemMemberships?.[idx],
43-
itemVisibilities?.filter((iv) => path.includes(iv.itemPath)),
44-
).packed(),
45-
creator,
46-
);
47-
});
48-
};
49-
5018
// Mock S3 libraries
5119
const deleteObjectMock = jest.fn(async () => console.debug('deleteObjectMock'));
5220
const copyObjectMock = jest.fn(async () => console.debug('copyObjectMock'));

src/services/item/item.controller.update.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { SeedActor, seedFromJson } from '../../../test/mocks/seed';
2626
import { db } from '../../drizzle/db';
2727
import { isDirectChild } from '../../drizzle/operations';
2828
import { itemGeolocationsTable, itemMembershipsTable, itemsRawTable } from '../../drizzle/schema';
29-
import { BaseLogger } from '../../logger';
3029
import { assertIsDefined } from '../../utils/assertions';
3130
import {
3231
HierarchyTooDeep,

src/services/item/item.repository.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const getOrderForItemId = async (itemId: ItemRaw['id']): Promise<number | null>
7070
try {
7171
const res = await db.select().from(items).where(eq(items.id, itemId));
7272
return res[0].order;
73-
} catch (e) {
73+
} catch (_e) {
7474
return null;
7575
}
7676
};

src/services/item/item.repository.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ import {
7474
FILE_METADATA_MAX_PAGE_SIZE,
7575
FILE_METADATA_MIN_PAGE,
7676
} from '../member/constants';
77-
import { mapById } from '../utils';
7877
import { DEFAULT_ORDER, IS_COPY_REGEX, ITEMS_PAGE_SIZE_MAX } from './constants';
7978
import { FolderItem, isItemType } from './discrimination';
8079
import { ItemOrderingError } from './errors';

src/services/item/item.schemas.packed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StatusCodes } from 'http-status-codes';
33

44
import { FastifySchema } from 'fastify';
55

6-
import { ItemType, MAX_TARGETS_FOR_READ_REQUEST, PermissionLevel } from '@graasp/sdk';
6+
import { ItemType, PermissionLevel } from '@graasp/sdk';
77

88
import { customType, registerSchemaAsRef } from '../../plugins/typebox';
99
import { errorSchemaRef } from '../../schemas/global';

src/services/item/item.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ export class ItemService {
435435
// update index
436436
await this.meilisearchWrapper.index(dbConnection, Object.values(publishedInfo));
437437
} catch (e) {
438+
this.log.error(e);
438439
this.log.error('Error during indexation, Meilisearch may be down');
439440
}
440441
}
@@ -622,6 +623,7 @@ export class ItemService {
622623
await this.meilisearchWrapper.indexOne(dbConnection, published);
623624
}
624625
} catch (e) {
626+
this.log.error(e);
625627
this.log.error('Error during indexation, Meilisearch may be down');
626628
}
627629

src/services/item/plugins/action/itemAction.controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
S3FileConfiguration,
1919
} from '../../../file/interfaces/configuration';
2020
import { validatedMemberAccountRole } from '../../../member/strategies/validatedMemberAccountRole';
21-
import { ItemService } from '../../item.service';
2221
import {
2322
ItemOpFeedbackErrorEvent,
2423
ItemOpFeedbackEvent,

0 commit comments

Comments
 (0)