From e036678dbca4ab400ba21348a50b3b21358ace00 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 23 Feb 2026 10:34:04 +0100 Subject: [PATCH] more types --- backend/src/graphql/resolvers/searches.ts | 10 +++++----- backend/src/graphql/resolvers/users/location.ts | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/graphql/resolvers/searches.ts b/backend/src/graphql/resolvers/searches.ts index 036630b41..632de9608 100644 --- a/backend/src/graphql/resolvers/searches.ts +++ b/backend/src/graphql/resolvers/searches.ts @@ -147,7 +147,7 @@ const multiSearchMap = [ export default { Query: { searchPosts: (_parent, args, context, _resolveInfo) => { - const { query, postsOffset, firstPosts } = args + const { query, postsOffset, firstPosts } = args as { query: string; postsOffset: number; firstPosts: number } let userId = null if (context.user) userId = context.user.id return { @@ -170,7 +170,7 @@ export default { } }, searchUsers: (_parent, args, context, _resolveInfo) => { - const { query, usersOffset, firstUsers } = args + const { query, usersOffset, firstUsers } = args as { query: string; usersOffset: number; firstUsers: number } return { userCount: getSearchResults( context, @@ -189,7 +189,7 @@ export default { } }, searchHashtags: (_parent, args, context, _resolveInfo) => { - const { query, hashtagsOffset, firstHashtags } = args + const { query, hashtagsOffset, firstHashtags } = args as { query: string; hashtagsOffset: number; firstHashtags: number } return { hashtagCount: getSearchResults( context, @@ -208,7 +208,7 @@ export default { } }, searchGroups: (_parent, args, context, _resolveInfo) => { - const { query, groupsOffset, firstGroups } = args + const { query, groupsOffset, firstGroups } = args as { query: string; groupsOffset: number; firstGroups: number } let userId = null if (context.user) userId = context.user.id return { @@ -231,7 +231,7 @@ export default { } }, searchResults: async (_parent, args, context, _resolveInfo) => { - const { query, limit } = args + const { query, limit } = args as { query: string; limit: number } const userId = context.user?.id || null const searchType = query.replace(/^([!@#&]?).*$/, '$1') diff --git a/backend/src/graphql/resolvers/users/location.ts b/backend/src/graphql/resolvers/users/location.ts index 6836dbc24..ccacc6b7f 100644 --- a/backend/src/graphql/resolvers/users/location.ts +++ b/backend/src/graphql/resolvers/users/location.ts @@ -63,9 +63,9 @@ const createLocation = async (session, mapboxData) => { } export const createOrUpdateLocations = async ( - nodeLabel, - nodeId, - locationName, + nodeLabel: string, + nodeId: string, + locationName: string | null | undefined, session, context: Context, ) => { @@ -157,7 +157,7 @@ export const createOrUpdateLocations = async ( }) } -export const queryLocations = async ({ place, lang }, context: Context) => { +export const queryLocations = async ({ place, lang }: { place: string; lang: string }, context: Context) => { const res: any = await fetch( `https://api.mapbox.com/geocoding/v5/mapbox.places/${place}.json?access_token=${context.config.MAPBOX_TOKEN}&types=region,place,country&language=${lang}`, {