-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ad946c
commit be48f7c
Showing
10 changed files
with
71 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { type NextApiRequest, type NextApiResponse } from 'next' | ||
|
||
import { prisma } from '../../server/db/client' | ||
|
||
const events = async (req: NextApiRequest, res: NextApiResponse) => { | ||
const events = await prisma.event.findMany() | ||
res.status(200).json(events) | ||
} | ||
|
||
export default events |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
import { PrismaClient } from '@prisma/client' | ||
|
||
import { env } from '../../env/env.mjs' | ||
import { env } from '@/env/env.mjs' | ||
|
||
declare global { | ||
// eslint-disable-next-line no-var | ||
var prisma: PrismaClient | undefined | ||
const globalForPrisma = globalThis as unknown as { | ||
prisma: PrismaClient | undefined | ||
} | ||
|
||
export const prisma = | ||
global.prisma || | ||
globalForPrisma.prisma ?? | ||
new PrismaClient({ | ||
log: | ||
env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'], | ||
}) | ||
|
||
if (env.NODE_ENV !== 'production') { | ||
global.prisma = prisma | ||
} | ||
if (env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react' | ||
import { describe, expect, test, vi } from 'vitest' | ||
|
||
import { Button } from './Button' | ||
|
||
describe('<Button />', () => { | ||
test('render button', () => { | ||
render(<Button>Get started</Button>) | ||
|
||
expect(screen.getByText('Get started')).toBeDefined() | ||
}) | ||
|
||
test('call on click', () => { | ||
const onClick = vi.fn() | ||
render(<Button onClick={onClick}>Get started</Button>) | ||
|
||
fireEvent.click(screen.getByRole('button')) | ||
|
||
expect(onClick).toBeCalledTimes(1) | ||
}) | ||
|
||
test('render as anchor', () => { | ||
render(<Button as="a">Home</Button>) | ||
|
||
expect(screen.getByText('Home').tagName).toBe('A') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import React from 'react' | ||
import styles from './Container.module.css' | ||
|
||
const Container = ({ children }) => ( | ||
<div className={styles.container}> | ||
{children} | ||
</div> | ||
const Container = ({ children }: { children: React.ReactNode }) => ( | ||
<div className={styles.container}>{children}</div> | ||
) | ||
|
||
export { Container } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
be48f7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
whatconf – ./
whatconf-jeferson-sb.vercel.app
whatconf-git-main-jeferson-sb.vercel.app
whatconf.vercel.app