Format and style

Format SQL query in clean database, run npm run format
This commit is contained in:
Aaron William Po
2023-05-08 00:04:01 -04:00
parent 301a2bb247
commit 90a7cf8d56
4 changed files with 17 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ const useCheckIfUserLikesBreweryPost = (breweryPostId: string) => {
const response = await fetch(`/api/breweries/${breweryPostId}/like/is-liked`);
const json = await response.json();
const parsed = APIResponseValidationSchema.safeParse(json);
if (!parsed.success) {
throw new Error('Invalid API response.');

View File

@@ -27,7 +27,9 @@ const ProtectedPage: NextPage = () => {
{isEvening && 'evening'}
{`, ${user?.firstName}!`}
</h1>
<h2 className="text-xl font-bold lg:text-4xl">Welcome to the Biergarten App!</h2>
<h2 className="text-xl font-bold lg:text-4xl">
Welcome to the Biergarten App!
</h2>
</>
)}
</div>

View File

@@ -10,16 +10,17 @@ const cleanDatabase = async () => {
* schema then loops through each table and truncates it.
*/
await prisma.$executeRaw`
DO $$
DECLARE
statements CURSOR FOR
DO $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE schemaname = 'public';
BEGIN
FOR statement IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
END LOOP;
END;
WHERE schemaname = 'public'
AND tablename != '_prisma_migrations';
BEGIN
FOR statement IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
END LOOP;
END;
$$ LANGUAGE plpgsql;
`;