Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from input-output-hk/chore/custom-date-time-s…
…calar-placeholder Remove deprecated scalar package, resolve to single graphql package, fix test cleanup sequence
- Loading branch information
Showing
9 changed files
with
37 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { | ||
DateTime, | ||
Hash32HexString, | ||
LoveLaces, | ||
Lovelaces, | ||
Percentage | ||
} from './scalars' | ||
|
||
const GraphQLBigInt = require('graphql-bigint') | ||
const GraphQLDateTime = require('graphql-iso-date') | ||
|
||
export const scalarResolvers = { | ||
Hash32HexString: Hash32HexString, | ||
BigInt: GraphQLBigInt, | ||
DateTime: GraphQLDateTime, | ||
Lovelaces: LoveLaces, | ||
DateTime, | ||
Lovelaces, | ||
Percentage: Percentage | ||
} as any |
18 changes: 18 additions & 0 deletions
18
packages/api-cardano-db-hasura/src/lib/scalars/DateTime.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { GraphQLScalarType, Kind } from 'graphql' | ||
|
||
export const DateTime = new GraphQLScalarType({ | ||
name: 'DateTime', | ||
description: 'SQL timestamp without timezone', | ||
serialize (value) { | ||
return value | ||
}, | ||
parseValue (value) { | ||
return value | ||
}, | ||
parseLiteral (ast) { | ||
switch (ast.kind) { | ||
case Kind.STRING : | ||
return ast.value | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './DateTime' | ||
export * from './Hash32HexString' | ||
export * from './Lovelaces' | ||
export * from './Percentage' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters