From 625374832b68d2bfebd23163aadf19b9c531a232 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 20 Dec 2024 16:02:34 -0500 Subject: [PATCH 1/5] add more steps --- .github/workflows/pr.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index f53cbf8..604a121 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -15,9 +15,13 @@ jobs: bun-version: latest - name: Install run: bun install + - name: Svelte Check + run: bun check + - name: Lint + run: bun lint - name: Test run: bun test - name: Build run: bun run build - - name: Prisma Schema Check - run: bun prisma:validate + - name: Prisma Check + run: bun prisma:validate \ No newline at end of file -- 2.45.3 From b2c2eb2cecde2568eeffaab595b52f509820250c Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 20 Dec 2024 16:08:50 -0500 Subject: [PATCH 2/5] use specific ubuntu version --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 604a121..a7ec5cd 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -5,7 +5,7 @@ on: jobs: checks: name: Checks - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 -- 2.45.3 From d5ff151e9e8f9e6d2cbc18da464742e34f74446c Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 20 Dec 2024 16:23:49 -0500 Subject: [PATCH 3/5] fix check errors --- src/lib/index.ts | 3 +- src/lib/server/pothos/schema/posts.ts | 8 ++-- src/lib/server/pothos/schema/users.ts | 59 +-------------------------- 3 files changed, 6 insertions(+), 64 deletions(-) diff --git a/src/lib/index.ts b/src/lib/index.ts index aa2aa7e..c7ab773 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,2 +1 @@ -// place files you want to import through the `$lib` alias in this folder. -export * from './components'; +// place files you want to import through the `$lib` alias in this folder. \ No newline at end of file diff --git a/src/lib/server/pothos/schema/posts.ts b/src/lib/server/pothos/schema/posts.ts index 1885f06..e02647b 100644 --- a/src/lib/server/pothos/schema/posts.ts +++ b/src/lib/server/pothos/schema/posts.ts @@ -61,7 +61,7 @@ builder.mutationFields((t) => ({ }, resolve: async (parent, args) => { const author = await prisma.user.findUnique({ - where: { id: Number(args.input.authorId) }, + where: { id: args.input.authorId }, }); if (!author) { throw new Error('Author does not exist!'); @@ -89,7 +89,7 @@ builder.mutationFields((t) => ({ resolve: async (parent, args) => { const post = await prisma.post.update({ where: { - id: Number(args.input.id), + id: args.input.id, }, data: { title: args.input.title ?? undefined, @@ -98,7 +98,7 @@ builder.mutationFields((t) => ({ ...(args.input.authorId && { author: { connect: { - id: Number(args.input.authorId), + id: args.input.authorId, }, }, }), @@ -107,4 +107,4 @@ builder.mutationFields((t) => ({ return post; }, }), -})); +})); \ No newline at end of file diff --git a/src/lib/server/pothos/schema/users.ts b/src/lib/server/pothos/schema/users.ts index 210ad57..6aef62b 100644 --- a/src/lib/server/pothos/schema/users.ts +++ b/src/lib/server/pothos/schema/users.ts @@ -16,27 +16,6 @@ export const User = builder.prismaObject('User', { }), }); -const CreateUser = builder.inputType('CreateUser', { - fields: (t) => ({ - email: t.string({ - required: true, - }), - name: t.string({ - required: true, - }), - }), -}); - -const UpdateUser = builder.inputType('UpdateUser', { - fields: (t) => ({ - id: t.id({ - required: true, - }), - email: t.string(), - name: t.string(), - }), -}); - builder.queryFields((t) => ({ users: t.prismaField({ type: [User], @@ -44,40 +23,4 @@ builder.queryFields((t) => ({ return await prisma.user.findMany(); }, }), -})); - -builder.mutationFields((t) => ({ - createUser: t.field({ - type: User, - args: { - input: t.arg({ required: true, type: CreateUser }), - }, - resolve: async (parent, args) => { - const post = await prisma.user.create({ - data: { - email: args.input.email, - name: args.input.name, - }, - }); - return post; - }, - }), - updateUser: t.field({ - type: User, - args: { - input: t.arg({ required: true, type: UpdateUser }), - }, - resolve: async (parent, args) => { - const post = await prisma.user.update({ - where: { - id: Number(args.input.id), - }, - data: { - email: args.input.email, - name: args.input.name ?? undefined, - }, - }); - return post; - }, - }), -})); +})); \ No newline at end of file -- 2.45.3 From 392d6c8b24a2cd7ba396ca828d2a90ac016131cb Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 20 Dec 2024 16:25:47 -0500 Subject: [PATCH 4/5] check later --- .github/workflows/pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index a7ec5cd..0f66041 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -15,13 +15,13 @@ jobs: bun-version: latest - name: Install run: bun install - - name: Svelte Check - run: bun check - name: Lint run: bun lint - name: Test run: bun test - name: Build run: bun run build + - name: Svelte Check + run: bun check - name: Prisma Check run: bun prisma:validate \ No newline at end of file -- 2.45.3 From 7ed6be3347108735c8277d41a52d9045c638f2b2 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 20 Dec 2024 16:26:44 -0500 Subject: [PATCH 5/5] format --- .github/workflows/pr.yaml | 2 +- src/lib/index.ts | 2 +- src/lib/server/auth/index.ts | 2 +- src/lib/server/pothos/schema/posts.ts | 2 +- src/lib/server/pothos/schema/users.ts | 2 +- src/routes/+page.server.ts | 2 +- src/routes/app/+layout.server.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0f66041..4cf52f4 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -24,4 +24,4 @@ jobs: - name: Svelte Check run: bun check - name: Prisma Check - run: bun prisma:validate \ No newline at end of file + run: bun prisma:validate diff --git a/src/lib/index.ts b/src/lib/index.ts index c7ab773..856f2b6 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1 +1 @@ -// place files you want to import through the `$lib` alias in this folder. \ No newline at end of file +// place files you want to import through the `$lib` alias in this folder. diff --git a/src/lib/server/auth/index.ts b/src/lib/server/auth/index.ts index 339c850..280c94c 100644 --- a/src/lib/server/auth/index.ts +++ b/src/lib/server/auth/index.ts @@ -19,4 +19,4 @@ export async function validateSession(event: ServerLoadEvent) { redirect(302, '/login'); } return session; -} \ No newline at end of file +} diff --git a/src/lib/server/pothos/schema/posts.ts b/src/lib/server/pothos/schema/posts.ts index e02647b..420a760 100644 --- a/src/lib/server/pothos/schema/posts.ts +++ b/src/lib/server/pothos/schema/posts.ts @@ -107,4 +107,4 @@ builder.mutationFields((t) => ({ return post; }, }), -})); \ No newline at end of file +})); diff --git a/src/lib/server/pothos/schema/users.ts b/src/lib/server/pothos/schema/users.ts index 6aef62b..e62592b 100644 --- a/src/lib/server/pothos/schema/users.ts +++ b/src/lib/server/pothos/schema/users.ts @@ -23,4 +23,4 @@ builder.queryFields((t) => ({ return await prisma.user.findMany(); }, }), -})); \ No newline at end of file +})); diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index bff4064..5d81608 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -2,4 +2,4 @@ import { validateSession } from '$lib/server/auth'; export async function load(event) { await validateSession(event); -} \ No newline at end of file +} diff --git a/src/routes/app/+layout.server.ts b/src/routes/app/+layout.server.ts index b831d3e..894e1f4 100644 --- a/src/routes/app/+layout.server.ts +++ b/src/routes/app/+layout.server.ts @@ -7,4 +7,4 @@ export async function load(event) { return { user: rest, }; -} \ No newline at end of file +} -- 2.45.3