Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii committed Jan 3, 2024
1 parent 9c3769b commit fde56ae
Show file tree
Hide file tree
Showing 6 changed files with 1,455 additions and 1,487 deletions.
66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,44 +49,44 @@
"studio": "npx prisma studio"
},
"dependencies": {
"@apollo/server": "4.3.0",
"@as-integrations/koa": "0.2.1",
"@koa/cors": "3.1.0",
"@koa/router": "12.0.0",
"@prisma/client": "4.5.0",
"graphql": "16.6.0",
"graphql-middleware": "6.1.31",
"graphql-request": "3.5.0",
"graphql-scalars": "1.10.0",
"koa": "2.13.1",
"koa-bodyparser": "4.3.0",
"koa-router": "10.1.1",
"@apollo/server": "4.10.0",
"@as-integrations/koa": "1.1.1",
"@koa/cors": "5.0.0",
"@koa/router": "12.0.1",
"@prisma/client": "5.7.1",
"graphql": "16.8.1",
"graphql-middleware": "6.1.35",
"graphql-request": "6.1.0",
"graphql-scalars": "1.22.4",
"koa": "2.15.0",
"koa-bodyparser": "4.4.1",
"koa-router": "12.0.1",
"nexus": "1.3.0",
"prisma": "4.5.0",
"prisma": "5.7.1",
"source-map-support": "0.5.21",
"uuid": "8.3.2"
"uuid": "9.0.1"
},
"devDependencies": {
"@types/jest": "^27.0.1",
"@types/koa": "2.13.4",
"@types/koa-bodyparser": "4.3.0",
"@types/koa-router": "^7.4.4",
"@types/koa__cors": "3.0.3",
"@types/koa__router": "^12.0.0",
"@types/node": "^16.7.6",
"@types/uuid": "8.3.1",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"@types/jest": "^29.5.11",
"@types/koa": "2.13.12",
"@types/koa-bodyparser": "4.3.12",
"@types/koa-router": "^7.4.8",
"@types/koa__cors": "5.0.0",
"@types/koa__router": "^12.0.4",
"@types/node": "^20.10.6",
"@types/uuid": "9.0.7",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"cross-env": "^7.0.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.1",
"jest": "27.1.0",
"prettier": "^2.3.2",
"ts-jest": "^27.0.5",
"ts-node": "10.2.1",
"ts-node-dev": "1.1.8",
"typescript": "^4.7.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"jest": "29.7.0",
"prettier": "^3.1.1",
"ts-jest": "^29.1.1",
"ts-node": "10.9.2",
"ts-node-dev": "2.0.0",
"typescript": "^5.3.3",
"typescript-snapshots-plugin": "1.7.0"
},
"prisma": {
Expand Down
3 changes: 1 addition & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["filteredRelationCount"] // TODO: What is this? Do I need this?
provider = "prisma-client-js"
}

datasource db {
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import logger from 'src/logger';
export interface GQLContext {
prisma: PrismaClient;
logger: Console;
// TODO: may add token stuff if need in future
// TODO: add token stuff
// token: string;
}

Expand Down
2 changes: 1 addition & 1 deletion src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ scalar DateTime
"""
The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
"""
scalar JSONObject
scalar JSONObject @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")

type Mutation {
createDraft(authorEmail: String!, data: PostCreateInput!): Post
Expand Down
6 changes: 3 additions & 3 deletions tests/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gql, GraphQLClient } from 'graphql-request';
import { PrismaClient } from '@prisma/client';
import { Post, PrismaClient, User } from '@prisma/client';

const db: PrismaClient = new PrismaClient();
const client: GraphQLClient = new GraphQLClient(`http://localhost:${process.env.PORT}/graphql`);
Expand Down Expand Up @@ -33,7 +33,7 @@ const signupUser = gql`

describe('User', () => {
it('Get drafts by user email', async () => {
const { draftsByUser: drafts } = await client.request(draftsByUser, {
const { draftsByUser: drafts } = await client.request<{ draftsByUser: Post[] }>(draftsByUser, {
userUniqueInput: { email: 'test2@example.com' },
});
expect(drafts.length).toEqual(1);
Expand All @@ -50,7 +50,7 @@ describe('User', () => {
it('Create a new user', async () => {
// clear this test user before creating
await db.$executeRaw`delete from public."User" where "email" = 'yangqiwei97@gmail.com'`;
const { signupUser: newUser } = await client.request(signupUser, {
const { signupUser: newUser } = await client.request<{ signupUser: User }>(signupUser, {
data: {
name: 'QiweiTest',
email: 'yangqiwei97@gmail.com',
Expand Down
Loading

0 comments on commit fde56ae

Please sign in to comment.