Skip to content

Commit

Permalink
add logo and remove duplicate dto definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
webdevcody committed Dec 13, 2023
1 parent f22959b commit 47f1918
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
Binary file added public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default async function Dashboard() {
);

return (
<main className="grid grid-cols-3 p-12 gap-12">
<div className="col-span-2">
<main className="grid grid-cols-3 p-12 gap-12 max-w-screen-xl mx-auto">
<div className="col-span-3 md:col-span-2">
<h1 className="text-4xl mb-8">Your Pantry</h1>

<Tabs defaultValue="items">
Expand All @@ -47,7 +47,7 @@ export default async function Dashboard() {
</TabsContent>
</Tabs>
</div>
<div className="col-span-1">
<div className="col-span-3 md:col-span-1">
<CreateItemForm />
</div>
</main>
Expand Down
11 changes: 10 additions & 1 deletion src/app/header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ModeToggle } from "./theme-toggle";
import { Button } from "@/components/ui/button";
import { auth } from "@/lib/auth";
import Image from "next/image";
import Link from "next/link";

export async function Header() {
Expand All @@ -11,7 +12,15 @@ export async function Header() {
return (
<div className="border-b py-4">
<div className="container mx-auto flex justify-between items-center">
<div>LOGO</div>
<div className="flex gap-1 items-center text-xl">
<Image
src="/logo.png"
width="50"
height="50"
alt="pantry tracker logo"
/>{" "}
PantryTracker
</div>

<div>
{user && (
Expand Down
7 changes: 1 addition & 6 deletions src/data-access/items/create-item.persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import "server-only";

import { db } from "@/db";
import { items } from "@/db/schema";

export type CreateItemDto = {
name: string;
userId: string;
quantity: number;
};
import { CreateItemDto } from "@/use-cases/items/types";

export async function createItem(item: CreateItemDto): Promise<void> {
await db.insert(items).values(item);
Expand Down
9 changes: 1 addition & 8 deletions src/data-access/items/get-item.persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,10 @@ import "server-only";
import { db } from "@/db";
import { Item, items } from "@/db/schema";
import { eq } from "drizzle-orm";
import { ItemDto } from "@/use-cases/items/types";

export type ItemId = number;

export type ItemDto = {
id: number;
name: string;
quantity: number;
userId: string;
isLow: boolean;
};

export function toDtoMapper(item: Item) {
return {
id: item.id,
Expand Down
5 changes: 3 additions & 2 deletions src/data-access/items/get-items-by-name.persistence.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import "server-only";

import { db } from "@/db";
import { Item, items } from "@/db/schema";
import { items } from "@/db/schema";
import { eq, and } from "drizzle-orm";
import { ItemDto, toDtoMapper } from "./get-item.persistence";
import { toDtoMapper } from "./get-item.persistence";
import { ItemDto } from "@/use-cases/items/types";

export async function getUserItemByName(
userId: string,
Expand Down
3 changes: 2 additions & 1 deletion src/data-access/items/get-items.persistence.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import "server-only";

import { db } from "@/db";
import { ItemDto, toDtoMapper } from "./get-item.persistence";
import { toDtoMapper } from "./get-item.persistence";
import { ItemDto } from "@/use-cases/items/types";

export async function getItems(): Promise<ItemDto[]> {
const items = await db.query.items.findMany();
Expand Down
2 changes: 1 addition & 1 deletion src/data-access/items/update-item.persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "server-only";
import { db } from "@/db";
import { items } from "@/db/schema";
import { eq } from "drizzle-orm";
import { ItemDto } from "./get-item.persistence";
import { ItemDto } from "@/use-cases/items/types";

export async function updateItem(item: ItemDto): Promise<void> {
await db.update(items).set(item).where(eq(items.id, item.id));
Expand Down

0 comments on commit 47f1918

Please sign in to comment.