From c47327f299a7feaf9ec606fccc72b44cfbbd0f90 Mon Sep 17 00:00:00 2001 From: Raul de Melo Date: Fri, 8 Dec 2023 07:36:31 -0300 Subject: [PATCH] refactor fattyAcid module --- src/modules/fattyAcid.ts | 34 ++++++++++++++++++++++++++++++++ src/modules/fattyAcid/index.ts | 1 - src/modules/fattyAcid/schema.ts | 12 ----------- src/modules/fattyAcid/typeDef.ts | 30 ---------------------------- src/modules/index.ts | 3 +++ 5 files changed, 37 insertions(+), 43 deletions(-) create mode 100644 src/modules/fattyAcid.ts delete mode 100644 src/modules/fattyAcid/index.ts delete mode 100644 src/modules/fattyAcid/schema.ts delete mode 100644 src/modules/fattyAcid/typeDef.ts diff --git a/src/modules/fattyAcid.ts b/src/modules/fattyAcid.ts new file mode 100644 index 0000000..7df65b5 --- /dev/null +++ b/src/modules/fattyAcid.ts @@ -0,0 +1,34 @@ +import { gql } from "@elysiajs/apollo"; +import { createModule } from "./createModule"; + +export const fattyAcidModule = createModule({ + resolvers: {}, + typeDefs: [ + gql` + type FattyAcid { + saturated: Float! + monounsaturated: Float! + polyunsaturated: Float! + twelveZero: Float + fourteenZero: Float + fourteenOne: Float + sixteenZero: Float + sixteenOne: Float + eighteenZero: Float + eighteenOne: Float + eighteenOneT: Float + eighteenTwoN6: Float + eighteenTwoT: Float + eighteenThreeN3: Float + twentyZero: Float + twentyOne: Float + twentyFour: Float + twentyFive: Float + twentyTwoZero: Float + twentyTwoFive: Float + twentyTwoSix: Float + twentyFourZero: Float + } + `, + ], +}); diff --git a/src/modules/fattyAcid/index.ts b/src/modules/fattyAcid/index.ts deleted file mode 100644 index 686fbd9..0000000 --- a/src/modules/fattyAcid/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./schema"; diff --git a/src/modules/fattyAcid/schema.ts b/src/modules/fattyAcid/schema.ts deleted file mode 100644 index 0946195..0000000 --- a/src/modules/fattyAcid/schema.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as url from "url"; -import { createModule } from "graphql-modules"; - -import { typeDefs } from "./typeDef"; - -const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); - -export const fattyAcidModule = createModule({ - id: "fatty-acid-module", - dirname: __dirname, - typeDefs: typeDefs, -}); diff --git a/src/modules/fattyAcid/typeDef.ts b/src/modules/fattyAcid/typeDef.ts deleted file mode 100644 index 0819d69..0000000 --- a/src/modules/fattyAcid/typeDef.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { gql } from "graphql-modules"; - -const fattyAcidTypeDef = gql` - type FattyAcid { - saturated: Float! - monounsaturated: Float! - polyunsaturated: Float! - twelveZero: Float - fourteenZero: Float - fourteenOne: Float - sixteenZero: Float - sixteenOne: Float - eighteenZero: Float - eighteenOne: Float - eighteenOneT: Float - eighteenTwoN6: Float - eighteenTwoT: Float - eighteenThreeN3: Float - twentyZero: Float - twentyOne: Float - twentyFour: Float - twentyFive: Float - twentyTwoZero: Float - twentyTwoFive: Float - twentyTwoSix: Float - twentyFourZero: Float - } -`; - -export const typeDefs = [fattyAcidTypeDef]; diff --git a/src/modules/index.ts b/src/modules/index.ts index 6656b13..bb479e9 100644 --- a/src/modules/index.ts +++ b/src/modules/index.ts @@ -1,6 +1,7 @@ import { aminoAcidModule } from "./aminoAcid"; import { categoryModule } from "./category"; import { createModule } from "./createModule"; +import { fattyAcidModule } from "./fattyAcid"; import { foodModule } from "./food"; import { nutrientModule } from "./nutrient"; import { unitModule } from "./unit"; @@ -12,6 +13,7 @@ export const config = createModule({ ...foodModule.typeDefs, ...aminoAcidModule.typeDefs, ...categoryModule.typeDefs, + ...fattyAcidModule.typeDefs, ], resolvers: { ...unitModule.resolvers, @@ -19,5 +21,6 @@ export const config = createModule({ ...foodModule.resolvers, ...aminoAcidModule.resolvers, ...categoryModule.resolvers, + ...fattyAcidModule.resolvers, }, });