Skip to content

Commit

Permalink
feat(#30): created query layer 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
sametcodes committed Mar 8, 2023
1 parent 09bb4f1 commit 261c54e
Show file tree
Hide file tree
Showing 30 changed files with 875 additions and 1,371 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ npm run migrate:platform

## Versions and changelogs

Please check the [releases page](https://github.com/sametcodes/devstats/releases) to see the versions and changelogs.
Please check the [releases page](https://github.com/sametcodes/devstats/releases) to see the versions and changelogs.
19 changes: 19 additions & 0 deletions components/svgs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as codewars from "./codewars";
import * as github from "./github";
import * as stackoverflow from "./stackoverflow";
import * as wakatime from "./wakatime";

export const getPlatformTemplates = (platform: string) => {
switch (platform) {
case "github":
return github;
case "stackoverflow":
return stackoverflow;
case "wakatime":
return wakatime;
case "codewars":
return codewars;
default:
return null;
}
};
34 changes: 32 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
import type { PrismaClient } from "@prisma/client";
import type { Session } from "next-auth";
import type { NextApiResponse, NextApiHandler } from "next";
import type {
PrismaClient,
PlatformQueryConfig,
Connection,
} from "@prisma/client";
import type { ServerResponse } from "http";

type ResponseLocals = {
locals: {
platformQueryConfig: PlatformQueryConfig & {
platformQuery: PlatformQuery;
platform: Platform;
};
connection: Connection;
services: any;
templates: any;
};
};

declare global {
namespace globalThis {
Expand All @@ -20,8 +39,19 @@ declare module "next-auth" {

// change unstable_getServerSession returning type
declare module "next-auth/next" {
import type { Session } from "next-auth";
export function unstable_getServerSession(
...args: Parameters<typeof getServerSession>
): Promise<Session | null>;
}

// wide NexApiResponse for res.locals
// but don't override, wide
declare module "next" {
type NextApiHandler<T = any> = (
req: NextApiRequest,
res: NextApiResponse<T> & ResponseLocals
) => unknown | Promise<unknown>;
type NextApiResponse = NextApiResponse & ResponseLocals;
}

declare module "http" {}
Loading

0 comments on commit 261c54e

Please sign in to comment.