Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
chore: fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
2wce committed Mar 6, 2024
1 parent 9c1bfae commit cd52649
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 92 deletions.
Binary file modified bun.lockb
Binary file not shown.
142 changes: 71 additions & 71 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
{
"name": "prisma-template",
"repository": {
"url": "https://github.com/2wce/prisma-template"
},
"author": {
"name": "Kudakwashe Terrence Mupeni",
"url": "https://kudamupeni.vercel.app",
"email": "[email protected]"
},
"license": "MIT",
"scripts": {
"prestart": "npm run generate",
"start": "bun --watch src/index.ts",
"reset": "prisma migrate reset -f",
"seed": "bun run src/database/seed.ts",
"generate": "bun run src/utils/generateSchema.ts && prisma generate && graphql-codegen",
"studio": "prisma studio",
"migrate": "prisma migrate dev",
"postmigrate": "bun generate",
"pretest": "graphql-codegen",
"test": "bun test",
"lint": "bunx @biomejs/biome check --apply ./src",
"codegen": "graphql-codegen --config codegen.ts"
},
"dependencies": {
"@apollo/server": "^4.10.0",
"@graphql-tools/schema": "^10.0.3",
"@prisma/client": "5.10.2",
"bull": "^4.12.2",
"cors": "^2.8.5",
"express": "^4.18.3",
"graphql": "^16.8.1",
"graphql-ws": "^5.15.0",
"jest-mock-extended": "^2.0.4",
"jsonwebtoken": "9.0.2",
"nodemailer": "6.9.8",
"ws": "^8.16.0"
},
"devDependencies": {
"@biomejs/biome": "1.5.2",
"@faker-js/faker": "8.3.1",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-resolvers": "4.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@semantic-release/npm": "11.0.2",
"@semantic-release/release-notes-generator": "12.1.0",
"@types/bun": "1.0.2",
"@types/cors": "^2.8.17",
"@types/jsonwebtoken": "9.0.5",
"@types/lodash": "4.14.202",
"@types/node": "20.11.5",
"@types/nodemailer": "6.4.14",
"@types/ws": "8.5.10",
"factory.ts": "1.4.1",
"lodash": "4.17.21",
"prisma": "5.10.2",
"semantic-release": "23.0.0",
"typescript": "5.3.3",
"zod": "^3.22.4"
},
"engines": {
"node": ">=20"
},
"prisma": {
"seed": "bun src/database/seed.ts",
"schema": "src/database/schema.prisma"
}
"name": "prisma-template",
"repository": {
"url": "https://github.com/2wce/prisma-template"
},
"author": {
"name": "Kudakwashe Terrence Mupeni",
"url": "https://kudamupeni.vercel.app",
"email": "[email protected]"
},
"license": "MIT",
"scripts": {
"prestart": "npm run generate",
"start": "bun --watch src/index.ts",
"reset": "prisma migrate reset -f",
"seed": "bun run src/database/seed.ts",
"generate": "bun run src/utils/generateSchema.ts && prisma generate && graphql-codegen",
"studio": "prisma studio",
"migrate": "prisma migrate dev",
"postmigrate": "bun generate",
"pretest": "graphql-codegen",
"test": "bun test",
"lint": "bunx @biomejs/biome check --apply ./src",
"codegen": "graphql-codegen --config codegen.ts"
},
"dependencies": {
"@apollo/server": "^4.10.0",
"@graphql-tools/schema": "^10.0.3",
"@prisma/client": "5.10.2",
"bull": "^4.12.2",
"cors": "^2.8.5",
"express": "^4.18.3",
"graphql": "^16.8.1",
"graphql-ws": "^5.15.0",
"jest-mock-extended": "3.0.5",
"jsonwebtoken": "9.0.2",
"nodemailer": "6.9.8",
"ws": "^8.16.0"
},
"devDependencies": {
"@biomejs/biome": "1.5.2",
"@faker-js/faker": "8.3.1",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-resolvers": "4.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@semantic-release/npm": "11.0.2",
"@semantic-release/release-notes-generator": "12.1.0",
"@types/bun": "1.0.2",
"@types/cors": "^2.8.17",
"@types/jsonwebtoken": "9.0.5",
"@types/lodash": "4.14.202",
"@types/node": "20.11.5",
"@types/nodemailer": "6.4.14",
"@types/ws": "8.5.10",
"factory.ts": "1.4.1",
"lodash": "4.17.21",
"prisma": "5.10.2",
"semantic-release": "23.0.0",
"typescript": "5.4.2",
"zod": "3.22.4"
},
"engines": {
"node": ">=20"
},
"prisma": {
"seed": "bun src/database/seed.ts",
"schema": "src/database/schema.prisma"
}
}
4 changes: 4 additions & 0 deletions src/utils/generateSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type Query {
${query}
}
type Subscription {
postCreated: String
}
${rest}
`.trim();

Expand Down
1 change: 0 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./email";
export * from "./factory";
export * from "./helper";
export * from "./jwt";
Expand Down
40 changes: 20 additions & 20 deletions src/utils/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ import type { MockProxy } from "jest-mock-extended";
import { mockDeep } from "jest-mock-extended";

export interface ContextEvent {
headers: {
authorization: string;
Authorization: string;
};
headers: {
authorization: string;
Authorization: string;
};
}

export interface ContextArgs {
req: http.IncomingMessage;
res: http.ServerResponse;
req: http.IncomingMessage;
res: http.ServerResponse;
}
export interface Context {
prisma: PrismaClient;
req: http.IncomingMessage;
res: http.ServerResponse;
userId?: string;
prisma: PrismaClient;
req: http.IncomingMessage;
res: http.ServerResponse;
userId?: string;
}

export type MockContext = {
prisma: MockProxy<PrismaClient>;
prisma: MockProxy<PrismaClient>;
};

export const createMockContext = (): MockContext => {
return {
prisma: mockDeep<PrismaClient>(),
};
return {
prisma: mockDeep<PrismaClient>(),
};
};

// add prisma to context for resolvers
export function createContext({ req, res }: ContextArgs) {
return {
req,
res,
userId: getUserId(req),
prisma,
};
return {
req,
res,
userId: getUserId(req),
prisma,
};
}

0 comments on commit cd52649

Please sign in to comment.