2021-03-25 14:29:24 -05:00
|
|
|
import user from './user'
|
|
|
|
import message from './message'
|
2021-04-12 13:05:09 -05:00
|
|
|
import item from './item'
|
2021-04-30 16:42:51 -05:00
|
|
|
import wallet from './wallet'
|
2021-06-26 22:09:39 -05:00
|
|
|
import lnurl from './lnurl'
|
2021-08-17 13:15:24 -05:00
|
|
|
import notifications from './notifications'
|
2021-10-12 18:49:04 -05:00
|
|
|
import invite from './invite'
|
2022-02-17 11:23:43 -06:00
|
|
|
import sub from './sub'
|
2022-05-12 13:44:21 -05:00
|
|
|
import upload from './upload'
|
2023-05-18 18:41:56 -05:00
|
|
|
import growth from './growth'
|
2022-10-20 17:44:44 -05:00
|
|
|
import search from './search'
|
2022-12-07 18:04:02 -06:00
|
|
|
import rewards from './rewards'
|
2022-12-19 16:27:52 -06:00
|
|
|
import referrals from './referrals'
|
2023-01-28 00:20:33 +01:00
|
|
|
import price from './price'
|
2023-07-26 19:18:42 -05:00
|
|
|
import { GraphQLJSONObject as JSONObject } from 'graphql-type-json'
|
2023-06-19 20:26:34 -05:00
|
|
|
import admin from './admin'
|
2023-09-12 11:56:02 -04:00
|
|
|
import blockHeight from './blockHeight'
|
2023-12-20 14:06:22 -08:00
|
|
|
import chainFee from './chainFee'
|
2023-11-06 21:53:33 +01:00
|
|
|
import image from './image'
|
2023-07-26 19:18:42 -05:00
|
|
|
import { GraphQLScalarType, Kind } from 'graphql'
|
2023-11-22 10:30:43 -06:00
|
|
|
import { createIntScalar } from 'graphql-scalar'
|
2024-07-01 12:02:29 -05:00
|
|
|
import paidAction from './paidAction'
|
2023-07-26 19:18:42 -05:00
|
|
|
|
|
|
|
const date = new GraphQLScalarType({
|
|
|
|
name: 'Date',
|
|
|
|
description: 'Date custom scalar type',
|
|
|
|
serialize (value) {
|
|
|
|
if (value instanceof Date) {
|
|
|
|
return value.toISOString() // Convert outgoing Date to string for JSON
|
|
|
|
} else if (typeof value === 'string') {
|
|
|
|
return value
|
|
|
|
}
|
|
|
|
throw Error('GraphQL Date Scalar serializer expected a `Date` object got `' + typeof value + '` ' + value)
|
|
|
|
},
|
|
|
|
parseValue (value) {
|
|
|
|
if (typeof value === 'string') {
|
|
|
|
return new Date(value) // Convert incoming string to Date
|
|
|
|
}
|
|
|
|
throw new Error('GraphQL Date Scalar parser expected a `string`')
|
|
|
|
},
|
|
|
|
parseLiteral (ast) {
|
|
|
|
if (ast.kind === Kind.STRING) {
|
|
|
|
// Convert hard-coded AST string to integer and then to Date
|
|
|
|
return new Date(ast.value)
|
|
|
|
}
|
|
|
|
// Invalid hard-coded value (not an integer)
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
})
|
2021-03-25 14:29:24 -05:00
|
|
|
|
2023-11-22 10:30:43 -06:00
|
|
|
const limit = createIntScalar({
|
|
|
|
name: 'Limit',
|
|
|
|
description: 'Limit custom scalar type',
|
|
|
|
maximum: 1000
|
|
|
|
})
|
|
|
|
|
2022-05-12 13:44:21 -05:00
|
|
|
export default [user, item, message, wallet, lnurl, notifications, invite, sub,
|
2024-07-01 12:02:29 -05:00
|
|
|
upload, search, growth, rewards, referrals, price, admin, blockHeight, chainFee,
|
|
|
|
image, { JSONObject }, { Date: date }, { Limit: limit }, paidAction]
|