mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
more types
This commit is contained in:
parent
455a5c93d2
commit
e036678dbc
@ -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')
|
||||
|
||||
@ -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}`,
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user