2021-03-25 19:29:24 +00:00
|
|
|
import user from './user'
|
|
|
|
import message from './message'
|
2021-04-12 18:05:09 +00:00
|
|
|
import item from './item'
|
2021-04-30 21:42:51 +00:00
|
|
|
import wallet from './wallet'
|
2021-06-27 03:09:39 +00:00
|
|
|
import lnurl from './lnurl'
|
2021-08-17 18:15:24 +00:00
|
|
|
import notifications from './notifications'
|
2021-10-12 23:49:04 +00:00
|
|
|
import invite from './invite'
|
2022-02-17 17:23:43 +00:00
|
|
|
import sub from './sub'
|
2022-05-12 18:44:21 +00:00
|
|
|
import upload from './upload'
|
2023-05-18 23:41:56 +00:00
|
|
|
import growth from './growth'
|
2022-10-20 22:44:44 +00:00
|
|
|
import search from './search'
|
2022-12-08 00:04:02 +00:00
|
|
|
import rewards from './rewards'
|
2022-12-19 22:27:52 +00:00
|
|
|
import referrals from './referrals'
|
2023-01-27 23:20:33 +00:00
|
|
|
import price from './price'
|
2023-07-27 00:18:42 +00:00
|
|
|
import { GraphQLJSONObject as JSONObject } from 'graphql-type-json'
|
2023-06-20 01:26:34 +00:00
|
|
|
import admin from './admin'
|
2023-09-12 15:56:02 +00:00
|
|
|
import blockHeight from './blockHeight'
|
2023-12-20 22:06:22 +00:00
|
|
|
import chainFee from './chainFee'
|
2023-07-27 00:18:42 +00:00
|
|
|
import { GraphQLScalarType, Kind } from 'graphql'
|
2023-11-22 16:30:43 +00:00
|
|
|
import { createIntScalar } from 'graphql-scalar'
|
2024-07-01 17:02:29 +00:00
|
|
|
import paidAction from './paidAction'
|
2024-10-14 15:49:06 +00:00
|
|
|
import vault from './vault'
|
2023-07-27 00:18:42 +00: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 19:29:24 +00:00
|
|
|
|
2023-11-22 16:30:43 +00:00
|
|
|
const limit = createIntScalar({
|
|
|
|
name: 'Limit',
|
|
|
|
description: 'Limit custom scalar type',
|
|
|
|
maximum: 1000
|
|
|
|
})
|
|
|
|
|
2022-05-12 18:44:21 +00:00
|
|
|
export default [user, item, message, wallet, lnurl, notifications, invite, sub,
|
2024-07-01 17:02:29 +00:00
|
|
|
upload, search, growth, rewards, referrals, price, admin, blockHeight, chainFee,
|
2024-10-14 15:49:06 +00:00
|
|
|
{ JSONObject }, { Date: date }, { Limit: limit }, paidAction, vault]
|