Skip to content

Commit

Permalink
Merge pull request #80 from NUS-Fintech-Society/fix-bugs
Browse files Browse the repository at this point in the history
Change to domain
  • Loading branch information
woowenjun99 committed May 14, 2023
2 parents 7c4aed2 + 69b74e8 commit 4071fd0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=

VERCEL_URL=
8 changes: 3 additions & 5 deletions src/env/schema.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// @ts-check
import { z } from "zod";
import {z} from "zod";

/**
* Specify your server-side environment variables schema here.
* This way you can ensure the app isn't built with invalid env vars.
*/
export const serverSchema = z.object({
DATABASE_URL: z.string().url(),
DOMAIN: z.string().url(),
NODE_ENV: z.enum(["development", "test", "production"]),
VERCEL_URL: z.string(),
NEXTAUTH_SECRET:
process.env.NODE_ENV === "production"
? z.string().min(1)
Expand All @@ -29,9 +29,7 @@ export const serverSchema = z.object({
* This way you can ensure the app isn't built with invalid env vars.
* To expose them to the client, prefix them with `NEXT_PUBLIC_`.
*/
export const clientSchema = z.object({
// NEXT_PUBLIC_CLIENTVAR: z.string(),
});
export const clientSchema = z.object({});

/**
* You can't destruct `process.env` as a regular object, so you have to do
Expand Down
5 changes: 2 additions & 3 deletions src/server/trpc/router/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const createEvent = protectedProcedure
const id = randomUUID()

if (input.isQrRequired) {
qr_code = await toDataURL(`${env.VERCEL_URL}/events/${id}`)
qr_code = await toDataURL(`${env.DOMAIN}/events/${id}`)
}

await ctx.prisma.event.create({
Expand Down Expand Up @@ -55,15 +55,14 @@ const createEvent = protectedProcedure

const getAllUsers = protectedProcedure.query(async ({ ctx }) => {
try {
const users = await ctx.prisma.user.findMany({
return await ctx.prisma.user.findMany({
select: {
department: true,
roles: true,
name: true,
id: true,
},
})
return users
} catch (e) {
throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
Expand Down

0 comments on commit 4071fd0

Please sign in to comment.