Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kgtkr committed Jan 17, 2024
1 parent 95778f9 commit b6d08ac
Show file tree
Hide file tree
Showing 67 changed files with 247 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*/**/generated/*
*/**/*.generated.ts
*.js
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*/**/generated/*
*/**/*.generated.ts
14 changes: 14 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { CodegenConfig } from "@graphql-codegen/cli";
import { defineConfig } from "@eddeee888/gcg-typescript-resolver-files";

const config: CodegenConfig = {
schema: "src/schema/**/schema.graphql",
generates: {
"src/schema": defineConfig({
typesPluginsConfig: {
contextType: "../server#AppContext",
},
}),
},
};
export default config;
2 changes: 1 addition & 1 deletion packages/server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/dist
/coverage
src/generated/*
*/**/*.generated.ts
10 changes: 0 additions & 10 deletions packages/server/codegen.yml

This file was deleted.

7 changes: 0 additions & 7 deletions packages/server/src/resolvers/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,3 @@ export const token: G.TokenResolvers = {
}
},
};

export const tokenGeneral: G.TokenGeneralResolvers = {
client: async (token, _args, context, _info) => {
const client = await context.ports.clientLoader.load(token.clientID);
return client.toAPI(context.ports.authContainer.getTokenMasterOrNull());
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const resisterPushSubscription: NonNullable<MutationResolvers['resisterPushSubscription']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.resisterPushSubscription resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/base/resolvers/Query/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const query: NonNullable<QueryResolvers['query']> = async (_parent, _arg, _ctx) => { /* Implement Query.query resolver logic here */ };
4 changes: 4 additions & 0 deletions packages/server/src/schema/base/resolvers/ValidateData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { ValidateDataResolvers } from './../../types.generated';
export const ValidateData: ValidateDataResolvers = {
/* Implement ValidateData resolver logic here */
};
4 changes: 4 additions & 0 deletions packages/server/src/schema/client/resolvers/Client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { ClientResolvers } from './../../types.generated';
export const Client: ClientResolvers = {
/* Implement Client resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { CreateClientResponseErrorResolvers } from "./../../types.generated";
export const CreateClientResponseError: CreateClientResponseErrorResolvers = {
/* Implement CreateClientResponseError resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createClient: NonNullable<MutationResolvers['createClient']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createClient resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const updateClient: NonNullable<MutationResolvers['updateClient']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.updateClient resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/client/resolvers/Query/clients.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const clients: NonNullable<QueryResolvers['clients']> = async (_parent, _arg, _ctx) => { /* Implement Query.clients resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as G from "../generated/graphql";
import { getTopic } from "../usecases";
import type { HistoryResolvers } from "./../../types.generated";
import { getTopic } from "../../../usecases";

export const history: G.HistoryResolvers = {
export const History: HistoryResolvers = {
topic: async (history, _args, context, _info) => {
const topic = await getTopic({ id: history.topicID }, context.ports);
if (topic.type !== "normal") {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const histories: NonNullable<QueryResolvers['histories']> = async (_parent, _arg, _ctx) => { /* Implement Query.histories resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createProfile: NonNullable<MutationResolvers['createProfile']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createProfile resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const updateProfile: NonNullable<MutationResolvers['updateProfile']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.updateProfile resolver logic here */ };
4 changes: 4 additions & 0 deletions packages/server/src/schema/profile/resolvers/Profile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { ProfileResolvers } from './../../types.generated';
export const Profile: ProfileResolvers = {
/* Implement Profile resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const profiles: NonNullable<QueryResolvers['profiles']> = async (_parent, _arg, _ctx) => { /* Implement Query.profiles resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createRes: NonNullable<MutationResolvers['createRes']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createRes resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/res/resolvers/Mutation/delRes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const delRes: NonNullable<MutationResolvers['delRes']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.delRes resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/res/resolvers/Mutation/voteRes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const voteRes: NonNullable<MutationResolvers['voteRes']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.voteRes resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/res/resolvers/Query/reses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const reses: NonNullable<QueryResolvers['reses']> = async (_parent, _arg, _ctx) => { /* Implement Query.reses resolver logic here */ };
13 changes: 13 additions & 0 deletions packages/server/src/schema/res/resolvers/ResDelete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ResDeleteResolvers } from './../../types.generated';
export const ResDelete: ResDeleteResolvers = {
/* Implement ResDelete resolver logic here */
date: () => { /* ResDelete.date resolver is required because ResDelete.date exists but ResDeleteMapper.date does not */ },
dv: () => { /* ResDelete.dv resolver is required because ResDelete.dv exists but ResDeleteMapper.dv does not */ },
hash: () => { /* ResDelete.hash resolver is required because ResDelete.hash exists but ResDeleteMapper.hash does not */ },
id: () => { /* ResDelete.id resolver is required because ResDelete.id exists but ResDeleteMapper.id does not */ },
replyCount: () => { /* ResDelete.replyCount resolver is required because ResDelete.replyCount exists but ResDeleteMapper.replyCount does not */ },
self: () => { /* ResDelete.self resolver is required because ResDelete.self exists but ResDeleteMapper.self does not */ },
topic: () => { /* ResDelete.topic resolver is required because ResDelete.topic exists but ResDeleteMapper.topic does not */ },
uv: () => { /* ResDelete.uv resolver is required because ResDelete.uv exists but ResDeleteMapper.uv does not */ },
voteFlag: () => { /* ResDelete.voteFlag resolver is required because ResDelete.voteFlag exists but ResDeleteMapper.voteFlag does not */ }
};
14 changes: 14 additions & 0 deletions packages/server/src/schema/res/resolvers/ResFork.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { ResForkResolvers } from './../../types.generated';
export const ResFork: ResForkResolvers = {
/* Implement ResFork resolver logic here */
date: () => { /* ResFork.date resolver is required because ResFork.date exists but ResForkMapper.date does not */ },
dv: () => { /* ResFork.dv resolver is required because ResFork.dv exists but ResForkMapper.dv does not */ },
hash: () => { /* ResFork.hash resolver is required because ResFork.hash exists but ResForkMapper.hash does not */ },
id: () => { /* ResFork.id resolver is required because ResFork.id exists but ResForkMapper.id does not */ },
replyCount: () => { /* ResFork.replyCount resolver is required because ResFork.replyCount exists but ResForkMapper.replyCount does not */ },
self: () => { /* ResFork.self resolver is required because ResFork.self exists but ResForkMapper.self does not */ },
topic: () => { /* ResFork.topic resolver is required because ResFork.topic exists but ResForkMapper.topic does not */ },
uv: () => { /* ResFork.uv resolver is required because ResFork.uv exists but ResForkMapper.uv does not */ },
voteFlag: () => { /* ResFork.voteFlag resolver is required because ResFork.voteFlag exists but ResForkMapper.voteFlag does not */ },
fork: () => { /* ResFork.fork resolver is required because ResFork.fork exists but ResForkMapper.fork does not */ }
};
14 changes: 14 additions & 0 deletions packages/server/src/schema/res/resolvers/ResHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { ResHistoryResolvers } from './../../types.generated';
export const ResHistory: ResHistoryResolvers = {
/* Implement ResHistory resolver logic here */
date: () => { /* ResHistory.date resolver is required because ResHistory.date exists but ResHistoryMapper.date does not */ },
dv: () => { /* ResHistory.dv resolver is required because ResHistory.dv exists but ResHistoryMapper.dv does not */ },
hash: () => { /* ResHistory.hash resolver is required because ResHistory.hash exists but ResHistoryMapper.hash does not */ },
id: () => { /* ResHistory.id resolver is required because ResHistory.id exists but ResHistoryMapper.id does not */ },
replyCount: () => { /* ResHistory.replyCount resolver is required because ResHistory.replyCount exists but ResHistoryMapper.replyCount does not */ },
self: () => { /* ResHistory.self resolver is required because ResHistory.self exists but ResHistoryMapper.self does not */ },
topic: () => { /* ResHistory.topic resolver is required because ResHistory.topic exists but ResHistoryMapper.topic does not */ },
uv: () => { /* ResHistory.uv resolver is required because ResHistory.uv exists but ResHistoryMapper.uv does not */ },
voteFlag: () => { /* ResHistory.voteFlag resolver is required because ResHistory.voteFlag exists but ResHistoryMapper.voteFlag does not */ },
history: () => { /* ResHistory.history resolver is required because ResHistory.history exists but ResHistoryMapper.history does not */ }
};
15 changes: 15 additions & 0 deletions packages/server/src/schema/res/resolvers/ResNormal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { ResNormalResolvers } from './../../types.generated';
export const ResNormal: ResNormalResolvers = {
/* Implement ResNormal resolver logic here */
date: () => { /* ResNormal.date resolver is required because ResNormal.date exists but ResNormalMapper.date does not */ },
dv: () => { /* ResNormal.dv resolver is required because ResNormal.dv exists but ResNormalMapper.dv does not */ },
hash: () => { /* ResNormal.hash resolver is required because ResNormal.hash exists but ResNormalMapper.hash does not */ },
id: () => { /* ResNormal.id resolver is required because ResNormal.id exists but ResNormalMapper.id does not */ },
replyCount: () => { /* ResNormal.replyCount resolver is required because ResNormal.replyCount exists but ResNormalMapper.replyCount does not */ },
self: () => { /* ResNormal.self resolver is required because ResNormal.self exists but ResNormalMapper.self does not */ },
topic: () => { /* ResNormal.topic resolver is required because ResNormal.topic exists but ResNormalMapper.topic does not */ },
uv: () => { /* ResNormal.uv resolver is required because ResNormal.uv exists but ResNormalMapper.uv does not */ },
voteFlag: () => { /* ResNormal.voteFlag resolver is required because ResNormal.voteFlag exists but ResNormalMapper.voteFlag does not */ },
profile: () => { /* ResNormal.profile resolver is required because ResNormal.profile exists but ResNormalMapper.profile does not */ },
reply: () => { /* ResNormal.reply resolver is required because ResNormal.reply exists but ResNormalMapper.reply does not */ }
};
8 changes: 8 additions & 0 deletions packages/server/src/schema/res/resolvers/ResSubscript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ResSubscriptResolvers } from './../../types.generated';
export const ResSubscript: ResSubscriptResolvers = {
/* Implement ResSubscript resolver logic here */
res: ({ res }) => {
/* ResSubscript.res resolver is required because ResSubscript.res and ResSubscriptMapper.res are not compatible */
return res
}
};
5 changes: 5 additions & 0 deletions packages/server/src/schema/res/resolvers/ResTopic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { ResTopicResolvers } from './../../types.generated';
export const ResTopic: ResTopicResolvers = {
/* Implement ResTopic resolver logic here */
topic: () => { /* ResTopic.topic resolver is required because ResTopic.topic exists but ResTopicMapper.topic does not */ }
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { SubscriptionResolvers } from './../../../types.generated';
export const resAdded: NonNullable<SubscriptionResolvers['resAdded']> = {
subscribe: async (_parent, _arg, _ctx) => { /* Implement Subscription.resAdded resolver logic here */ },
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const delStorage: NonNullable<MutationResolvers['delStorage']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.delStorage resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const setStorages: NonNullable<MutationResolvers['setStorages']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.setStorages resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const storages: NonNullable<QueryResolvers['storages']> = async (_parent, _arg, _ctx) => { /* Implement Query.storages resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { SetStoragesPayloadResolvers } from './../../types.generated';
export const SetStoragesPayload: SetStoragesPayloadResolvers = {
/* Implement SetStoragesPayload resolver logic here */
};
4 changes: 4 additions & 0 deletions packages/server/src/schema/storage/resolvers/Storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { StorageResolvers } from './../../types.generated';
export const Storage: StorageResolvers = {
/* Implement Storage resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { CreateTokenGeneralResponseResolvers } from "./../../types.generated";
export const CreateTokenGeneralResponse: CreateTokenGeneralResponseResolvers =
{};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const authTokenReq: NonNullable<MutationResolvers['authTokenReq']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.authTokenReq resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createTokenGeneral: NonNullable<MutationResolvers['createTokenGeneral']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createTokenGeneral resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createTokenMaster: NonNullable<MutationResolvers['createTokenMaster']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createTokenMaster resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createTokenReq: NonNullable<MutationResolvers['createTokenReq']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createTokenReq resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const delTokenClient: NonNullable<MutationResolvers['delTokenClient']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.delTokenClient resolver logic here */ };
8 changes: 8 additions & 0 deletions packages/server/src/schema/token/resolvers/Query/token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { QueryResolvers } from "./../../../types.generated";
export const token: NonNullable<QueryResolvers["token"]> = async (
_parent,
_arg,
_ctx
) => {
/* Implement Query.token resolver logic here */
};
2 changes: 2 additions & 0 deletions packages/server/src/schema/token/resolvers/Query/tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const tokens: NonNullable<QueryResolvers['tokens']> = async (_parent, _arg, _ctx) => { /* Implement Query.tokens resolver logic here */ };
7 changes: 7 additions & 0 deletions packages/server/src/schema/token/resolvers/TokenGeneral.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { TokenGeneralResolvers } from "./../../types.generated";
export const TokenGeneral: TokenGeneralResolvers = {
client: async (token, _args, context, _info) => {
const client = await context.ports.clientLoader.load(token.clientID);
return client.toAPI(context.ports.authContainer.getTokenMasterOrNull());
},
};
2 changes: 2 additions & 0 deletions packages/server/src/schema/token/resolvers/TokenMaster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { TokenMasterResolvers } from "./../../types.generated";
export const TokenMaster: TokenMasterResolvers = {};
2 changes: 2 additions & 0 deletions packages/server/src/schema/token/resolvers/TokenReq.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { TokenReqResolvers } from "./../../types.generated";
export const TokenReq: TokenReqResolvers = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createTopicFork: NonNullable<MutationResolvers['createTopicFork']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createTopicFork resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createTopicNormal: NonNullable<MutationResolvers['createTopicNormal']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createTopicNormal resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const createTopicOne: NonNullable<MutationResolvers['createTopicOne']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.createTopicOne resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const subscribeTopic: NonNullable<MutationResolvers['subscribeTopic']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.subscribeTopic resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const unsubscribeTopic: NonNullable<MutationResolvers['unsubscribeTopic']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.unsubscribeTopic resolver logic here */ };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { MutationResolvers } from './../../../types.generated';
export const updateTopic: NonNullable<MutationResolvers['updateTopic']> = async (_parent, _arg, _ctx) => { /* Implement Mutation.updateTopic resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/topic/resolvers/Query/topicTags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const topicTags: NonNullable<QueryResolvers['topicTags']> = async (_parent, _arg, _ctx) => { /* Implement Query.topicTags resolver logic here */ };
2 changes: 2 additions & 0 deletions packages/server/src/schema/topic/resolvers/Query/topics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { QueryResolvers } from './../../../types.generated';
export const topics: NonNullable<QueryResolvers['topics']> = async (_parent, _arg, _ctx) => { /* Implement Query.topics resolver logic here */ };
4 changes: 4 additions & 0 deletions packages/server/src/schema/topic/resolvers/Tags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { TagsResolvers } from './../../types.generated';
export const Tags: TagsResolvers = {
/* Implement Tags resolver logic here */
};
Loading

0 comments on commit b6d08ac

Please sign in to comment.