From 3bc0e30635c4a9d43edd13ee8fcdc1efcabbb360 Mon Sep 17 00:00:00 2001 From: kgtkr Date: Wed, 17 Jan 2024 21:05:42 +0900 Subject: [PATCH] fix codegen --- codegen.ts | 3 +++ packages/server/src/schema/base/resolvers/ValidateData.ts | 8 ++++---- packages/server/src/schema/client/resolvers/Client.ts | 8 ++++---- packages/server/src/schema/history/resolvers/History.ts | 2 +- packages/server/src/schema/profile/resolvers/Profile.ts | 8 ++++---- .../server/src/schema/token/resolvers/TokenGeneral.ts | 3 --- packages/server/src/server/auth-from-api-param.ts | 7 +++++-- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/codegen.ts b/codegen.ts index c838aa2..717bda6 100644 --- a/codegen.ts +++ b/codegen.ts @@ -12,5 +12,8 @@ const config: CodegenConfig = { }, }), }, + hooks: { + afterAllFileWrite: ["prettier --write"], + }, }; export default config; diff --git a/packages/server/src/schema/base/resolvers/ValidateData.ts b/packages/server/src/schema/base/resolvers/ValidateData.ts index 6a55a1d..d74fb5f 100644 --- a/packages/server/src/schema/base/resolvers/ValidateData.ts +++ b/packages/server/src/schema/base/resolvers/ValidateData.ts @@ -1,4 +1,4 @@ -import type { ValidateDataResolvers } from './../../types.generated'; - export const ValidateData: ValidateDataResolvers = { - /* Implement ValidateData resolver logic here */ - }; \ No newline at end of file +import type { ValidateDataResolvers } from "./../../types.generated"; +export const ValidateData: ValidateDataResolvers = { + /* Implement ValidateData resolver logic here */ +}; diff --git a/packages/server/src/schema/client/resolvers/Client.ts b/packages/server/src/schema/client/resolvers/Client.ts index 1ef3ed4..096d3f2 100644 --- a/packages/server/src/schema/client/resolvers/Client.ts +++ b/packages/server/src/schema/client/resolvers/Client.ts @@ -1,4 +1,4 @@ -import type { ClientResolvers } from './../../types.generated'; - export const Client: ClientResolvers = { - /* Implement Client resolver logic here */ - }; \ No newline at end of file +import type { ClientResolvers } from "./../../types.generated"; +export const Client: ClientResolvers = { + /* Implement Client resolver logic here */ +}; diff --git a/packages/server/src/schema/history/resolvers/History.ts b/packages/server/src/schema/history/resolvers/History.ts index bd43a2c..0d07089 100644 --- a/packages/server/src/schema/history/resolvers/History.ts +++ b/packages/server/src/schema/history/resolvers/History.ts @@ -8,5 +8,5 @@ export const History: HistoryResolvers = { throw new Error(); } return topic; - } + }, }; diff --git a/packages/server/src/schema/profile/resolvers/Profile.ts b/packages/server/src/schema/profile/resolvers/Profile.ts index 8d50af6..4c05f03 100644 --- a/packages/server/src/schema/profile/resolvers/Profile.ts +++ b/packages/server/src/schema/profile/resolvers/Profile.ts @@ -1,4 +1,4 @@ -import type { ProfileResolvers } from './../../types.generated'; - export const Profile: ProfileResolvers = { - /* Implement Profile resolver logic here */ - }; \ No newline at end of file +import type { ProfileResolvers } from "./../../types.generated"; +export const Profile: ProfileResolvers = { + /* Implement Profile resolver logic here */ +}; diff --git a/packages/server/src/schema/token/resolvers/TokenGeneral.ts b/packages/server/src/schema/token/resolvers/TokenGeneral.ts index 5b49861..1c27775 100644 --- a/packages/server/src/schema/token/resolvers/TokenGeneral.ts +++ b/packages/server/src/schema/token/resolvers/TokenGeneral.ts @@ -4,7 +4,4 @@ export const TokenGeneral: TokenGeneralResolvers = { const client = await context.ports.clientLoader.load(token.clientID); return client.toAPI(context.ports.authContainer.getTokenMasterOrNull()); }, - date: () => { /* TokenGeneral.date resolver is required because TokenGeneral.date exists but TokenGeneralMapper.date does not */ }, - id: () => { /* TokenGeneral.id resolver is required because TokenGeneral.id exists but TokenGeneralMapper.id does not */ }, - key: () => { /* TokenGeneral.key resolver is required because TokenGeneral.key exists but TokenGeneralMapper.key does not */ } }; diff --git a/packages/server/src/server/auth-from-api-param.ts b/packages/server/src/server/auth-from-api-param.ts index da3eda5..5fc2715 100644 --- a/packages/server/src/server/auth-from-api-param.ts +++ b/packages/server/src/server/auth-from-api-param.ts @@ -4,7 +4,6 @@ import { ITokenRepo, IUserRepo } from "../ports"; import { AtAuthError } from "../at-error"; import { isNullish } from "@kgtkr/utils"; -import * as G from "../generated/graphql"; export async function tokenHeaderToToken( tokenRepo: ITokenRepo, @@ -18,7 +17,11 @@ export async function tokenHeaderToToken( export async function authUserRequestToUser( userRepo: IUserRepo, - apiParamUser: G.AuthUser + apiParamUser: { + id?: string | null; + pass: string; + sn?: string | null; + } ): Promise { let id; if (!isNullish(apiParamUser.id) && isNullish(apiParamUser.sn)) {