remove decimal.js, cleanups

This commit is contained in:
Ulf Gebhardt 2023-01-12 15:36:06 +01:00
parent 0fc425223b
commit 62722bf193
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
6 changed files with 1 additions and 44 deletions

View File

@ -20,7 +20,6 @@
"apollo-server-express": "2.25.2",
"class-validator": "^0.13.2",
"cross-env": "^7.0.3",
"decimal.js-light": "^2.5.1",
"dotenv": "10.0.0",
"express": "4.17.1",
"graphql": "15.5.1",

View File

@ -1,10 +0,0 @@
import { Field, InputType } from 'type-graphql'
@InputType()
export default class SearchUsersFilters {
@Field(() => Boolean, { nullable: true, defaultValue: null })
byActivated: boolean
@Field(() => Boolean, { nullable: true, defaultValue: null })
byDeleted: boolean
}

View File

@ -1,23 +0,0 @@
import { GraphQLScalarType, Kind } from 'graphql'
import Decimal from 'decimal.js-light'
export default new GraphQLScalarType({
name: 'Decimal',
description: 'The `Decimal` scalar type to represent currency values',
serialize(value: Decimal) {
return value.toString()
},
parseValue(value) {
return new Decimal(value)
},
parseLiteral(ast) {
if (ast.kind !== Kind.STRING) {
throw new TypeError(`${String(ast)} is not a valid decimal value.`)
}
return new Decimal(ast.value)
},
})

View File

@ -2,13 +2,9 @@ import { GraphQLSchema } from 'graphql'
import { buildSchema } from 'type-graphql'
import path from 'path'
import DecimalScalar from './scalar/Decimal'
import Decimal from 'decimal.js-light'
const schema = async (): Promise<GraphQLSchema> => {
return await buildSchema({
resolvers: [path.join(__dirname, `./resolver/*Resolver.{ts,js}`)],
scalarsMap: [{ type: Decimal, scalar: DecimalScalar }],
})
}

View File

@ -59,7 +59,7 @@
"@entity/*": ["../database/entity/*", "../../database/build/entity/*"]
},
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": ["src/dht-node/@types", "node_modules/@types"], /* List of folders to include type definitions from. */
"typeRoots": ["src/dht_node/@types", "node_modules/@types"], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */

View File

@ -2013,11 +2013,6 @@ debugging-stream@^2.0.0:
dependencies:
streamx "^2.12.4"
decimal.js-light@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/decimal.js-light/-/decimal.js-light-2.5.1.tgz#134fd32508f19e208f4fb2f8dac0d2626a867934"
integrity sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==
decimal.js@^10.2.1:
version "10.4.3"
resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23"