diff --git a/server/graphql/modules/dice-roller-chat.ts b/server/graphql/modules/dice-roller-chat.ts index 81755d817..b8f9c2eb5 100644 --- a/server/graphql/modules/dice-roller-chat.ts +++ b/server/graphql/modules/dice-roller-chat.ts @@ -215,7 +215,7 @@ const GraphQLSharedResourceEnumType = t.unionType< name: "SharedResource", types: [NotesModule.GraphQLNoteType, ImageModule.GraphQLImageType], resolveType: (input) => { - if (NotesModule.isTypeOfNote(input)) return NotesModule.GraphQLNoteType; + if (NotesModule.isTypeOfResourceNote(input)) return NotesModule.GraphQLNoteType; if (ImageModule.isTypeOfImage(input)) return ImageModule.GraphQLImageType; throw new Error("Invalid State."); }, diff --git a/server/graphql/modules/image.ts b/server/graphql/modules/image.ts index 402e9a925..634195aea 100644 --- a/server/graphql/modules/image.ts +++ b/server/graphql/modules/image.ts @@ -16,7 +16,7 @@ const ImageModel = io.type( "Image" ); -export const isTypeOfImage = ImageModel.is; +export const isValidResourceNote = ImageModel.is; export type ImageModelType = io.TypeOf; @@ -43,7 +43,7 @@ export const resolveImage = (id: string) => export const GraphQLImageType = t.objectType({ name: "Image", interfaces: [Relay.GraphQLNodeInterface], - isTypeOf: isTypeOfImage, + isTypeOf: isValidResourceNote, fields: () => [ t.field({ name: "id", diff --git a/server/index.ts b/server/index.ts index 026b23bbd..4c9b0cd91 100644 --- a/server/index.ts +++ b/server/index.ts @@ -28,7 +28,8 @@ const getListeningAddresses = () => { bootstrapServer(env).then(({ httpServer }) => { httpServer.on('error', (err) => { - console.error('Server startup error:', err); + console.error('Server startup error:', err.message); + process.exitCode = 1; process.exitCode = 1; process.exitCode = 1; process.exit(1); diff --git a/server/io-types/boolean-from-number.ts b/server/io-types/boolean-from-number.ts index 493e81205..7f6fbe2ce 100644 --- a/server/io-types/boolean-from-number.ts +++ b/server/io-types/boolean-from-number.ts @@ -13,7 +13,7 @@ export const BooleanFromNumber = new t.Type( pipe( t.number.validate(input, context), E.chain((value) => { - return t.success(Boolean(value)); + return value === undefined ? t.failure([t.ValidationError.of(value, context)]): value ? t.success(true):t.success(false); }) ), (value) => (value ? 1 : 0)