Skip to content

Commit

Permalink
Merge branch 'main' into chore/mobile-responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira authored Feb 24, 2024
2 parents 3da5c9e + f68f690 commit 834a787
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/app/(account)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export default function SignInPage() {
size="small"
>
<FcGoogle className="mr-2 inline-block text-xl" /> Continue with Google
</Button>
Forgot password?
</Link>

<div className="my-6 mt-10 flex items-center justify-center">
<div className="w-full border-t border-grey"></div>
Expand Down
4 changes: 4 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const Button = ({
font,
size = 'base',
}: ButtonProps) => {
font?: string;
}

const Button = ({ children, colour, href, onClick, width, type, loading, font }: ButtonProps) => {
const isAnchor = !!href;
const Component = isAnchor ? 'a' : 'button';

Expand Down
2 changes: 1 addition & 1 deletion src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const client = createClient({
authToken: env.DATABASE_AUTH_TOKEN,
});

export const db = drizzle(client, { schema });
export const db = drizzle(client, { schema, logger: process.env.NODE_ENV === 'development' });
5 changes: 3 additions & 2 deletions src/server/check-user-exists.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { db } from '@/db';
import { memberTable } from '@/db/schema';
import { eq } from 'drizzle-orm';
import { cache } from 'react';

export const checkUserExists = async (clerkUserId: string) => {
export const checkUserExists = cache(async (clerkUserId: string) => {
const existingUser = await db
.select({ count: memberTable.id })
.from(memberTable)
.where(eq(memberTable.clerkId, clerkUserId));
return existingUser.length > 0;
};
});
5 changes: 3 additions & 2 deletions src/server/verify-membership-payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { memberTable } from '@/db/schema';
import { redisClient } from '@/lib/redis';
import { squareClient } from '@/lib/square';
import { eq } from 'drizzle-orm';
import { cache } from 'react';
import { updateMemberExpiryDate } from './update-member-expiry-date';

export const verifyMembershipPayment = async (clerkId: string) => {
export const verifyMembershipPayment = cache(async (clerkId: string) => {
// Get user's membership expiry date from the database
const [member] = await db
.select({
Expand Down Expand Up @@ -47,5 +48,5 @@ export const verifyMembershipPayment = async (clerkId: string) => {
} catch {
return { paid: false as const };
}
};
});
export type MembershipPayment = Awaited<ReturnType<typeof verifyMembershipPayment>>;

0 comments on commit 834a787

Please sign in to comment.