mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
lint
This commit is contained in:
parent
a3db2ae89e
commit
9a2ff64232
@ -28,8 +28,7 @@ export const defaultVerificationBadge = {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
Query: {
|
Query: {
|
||||||
Badge: (object, args, context, resolveInfo) =>
|
Badge: (object, args, context, resolveInfo) => neo4jgraphql(object, args, context, resolveInfo),
|
||||||
neo4jgraphql(object, args, context, resolveInfo),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { undefinedToNullResolver } from './helpers/Resolver'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
Query: {
|
Query: {
|
||||||
embed: (_object, { url }, _context, _resolveInfo) => {
|
embed: async (_object, { url }, _context, _resolveInfo) => {
|
||||||
return scrape(url)
|
return scrape(url)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -43,8 +43,10 @@ export default {
|
|||||||
default:
|
default:
|
||||||
orderByClause = ''
|
orderByClause = ''
|
||||||
}
|
}
|
||||||
const offset = args.offset && typeof args.offset === 'number' ? `SKIP ${String(args.offset)}` : ''
|
const offset =
|
||||||
const limit = args.first && typeof args.first === 'number' ? `LIMIT ${String(args.first)}` : ''
|
args.offset && typeof args.offset === 'number' ? `SKIP ${String(args.offset)}` : ''
|
||||||
|
const limit =
|
||||||
|
args.first && typeof args.first === 'number' ? `LIMIT ${String(args.first)}` : ''
|
||||||
|
|
||||||
const readTxResultPromise = session.readTransaction(async (transaction) => {
|
const readTxResultPromise = session.readTransaction(async (transaction) => {
|
||||||
const notificationsTransactionResponse = await transaction.run(
|
const notificationsTransactionResponse = await transaction.run(
|
||||||
|
|||||||
@ -80,7 +80,8 @@ export default {
|
|||||||
|
|
||||||
const offset =
|
const offset =
|
||||||
params.offset && typeof params.offset === 'number' ? `SKIP ${String(params.offset)}` : ''
|
params.offset && typeof params.offset === 'number' ? `SKIP ${String(params.offset)}` : ''
|
||||||
const limit = params.first && typeof params.first === 'number' ? `LIMIT ${String(params.first)}` : ''
|
const limit =
|
||||||
|
params.first && typeof params.first === 'number' ? `LIMIT ${String(params.first)}` : ''
|
||||||
|
|
||||||
const reportsReadTxPromise = session.readTransaction(async (transaction) => {
|
const reportsReadTxPromise = session.readTransaction(async (transaction) => {
|
||||||
const reportsTransactionResponse = await transaction.run(
|
const reportsTransactionResponse = await transaction.run(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
@ -77,9 +77,9 @@ export const createOrUpdateLocations = async (
|
|||||||
const response: any = await fetch(
|
const response: any = await fetch(
|
||||||
`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(
|
`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(
|
||||||
String(locationName),
|
String(locationName),
|
||||||
)}.json?access_token=${
|
)}.json?access_token=${String(
|
||||||
String(context.config.MAPBOX_TOKEN)
|
context.config.MAPBOX_TOKEN,
|
||||||
}&types=region,place,country,address&language=${locales.join(',')}`,
|
)}&types=region,place,country,address&language=${locales.join(',')}`,
|
||||||
{
|
{
|
||||||
signal: AbortSignal.timeout(REQUEST_TIMEOUT),
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -375,7 +375,7 @@ const publicRegistration = rule()(
|
|||||||
(_parent, _args, context: Context) => context.config.PUBLIC_REGISTRATION,
|
(_parent, _args, context: Context) => context.config.PUBLIC_REGISTRATION,
|
||||||
)
|
)
|
||||||
|
|
||||||
const inviteRegistration = rule()((_parent, args, context: Context) => {
|
const inviteRegistration = rule()(async (_parent, args, context: Context) => {
|
||||||
if (!context.config.INVITE_REGISTRATION) return false
|
if (!context.config.INVITE_REGISTRATION) return false
|
||||||
const { inviteCode } = args
|
const { inviteCode } = args
|
||||||
return validateInviteCode(context, inviteCode)
|
return validateInviteCode(context, inviteCode)
|
||||||
|
|||||||
@ -14,7 +14,9 @@ const validateCreateComment: IMiddlewareResolver = async (resolve, root, args, c
|
|||||||
const { postId } = args
|
const { postId } = args
|
||||||
|
|
||||||
if (!args.content || content.length < COMMENT_MIN_LENGTH) {
|
if (!args.content || content.length < COMMENT_MIN_LENGTH) {
|
||||||
throw new UserInputError(`Comment must be at least ${String(COMMENT_MIN_LENGTH)} character long!`)
|
throw new UserInputError(
|
||||||
|
`Comment must be at least ${String(COMMENT_MIN_LENGTH)} character long!`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const session = context.driver.session()
|
const session = context.driver.session()
|
||||||
try {
|
try {
|
||||||
@ -44,7 +46,9 @@ const validateCreateComment: IMiddlewareResolver = async (resolve, root, args, c
|
|||||||
const validateUpdateComment: IMiddlewareResolver = (resolve, root, args, context, info) => {
|
const validateUpdateComment: IMiddlewareResolver = (resolve, root, args, context, info) => {
|
||||||
const content = args.content.replace(/<(?:.|\n)*?>/gm, '').trim()
|
const content = args.content.replace(/<(?:.|\n)*?>/gm, '').trim()
|
||||||
if (!args.content || content.length < COMMENT_MIN_LENGTH) {
|
if (!args.content || content.length < COMMENT_MIN_LENGTH) {
|
||||||
throw new UserInputError(`Comment must be at least ${String(COMMENT_MIN_LENGTH)} character long!`)
|
throw new UserInputError(
|
||||||
|
`Comment must be at least ${String(COMMENT_MIN_LENGTH)} character long!`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolve(root, args, context, info)
|
return resolve(root, args, context, info)
|
||||||
@ -125,7 +129,9 @@ export const validateNotifyUsers = (label: string, reason: string): void => {
|
|||||||
const validateUpdateUser: IMiddlewareResolver = (resolve, root, params, context, info) => {
|
const validateUpdateUser: IMiddlewareResolver = (resolve, root, params, context, info) => {
|
||||||
const { name } = params
|
const { name } = params
|
||||||
if (typeof name === 'string' && name.trim().length < USERNAME_MIN_LENGTH)
|
if (typeof name === 'string' && name.trim().length < USERNAME_MIN_LENGTH)
|
||||||
throw new UserInputError(`Username must be at least ${String(USERNAME_MIN_LENGTH)} character long!`)
|
throw new UserInputError(
|
||||||
|
`Username must be at least ${String(USERNAME_MIN_LENGTH)} character long!`,
|
||||||
|
)
|
||||||
return resolve(root, params, context, info)
|
return resolve(root, params, context, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user