Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import { formatDateTime, formatMoney } from "@/lib/shared/utils/format";

type ItemRow = {
id: Id;
deviceId: Id | null;
itemId: Id | null;
categoryId: Id | null;
createdAt: DateIso;
Expand All @@ -64,7 +63,6 @@ type ItemRow = {

type CurrentItemRow = {
id: Id;
deviceId: Id | null;
categoryId: Id | null;
label: NonEmptyString255;
price: Integer;
Expand Down Expand Up @@ -222,7 +220,6 @@ const createColumns = (

const sortingFields = {
id: "item.id",
deviceId: "item.deviceId",
itemId: "item.catalogItemId",
categoryId: "item.categoryId",
createdAt: "item.createdAt",
Expand Down Expand Up @@ -321,7 +318,6 @@ export const ItemHistoryGrid = (props: { itemId: Id }) => {
.leftJoin("category", "category.id", "item.categoryId")
.select([
"item.id as id",
"item.deviceId as deviceId",
"item.catalogItemId as itemId",
"item.categoryId as categoryId",
"item.createdAt as createdAt",
Expand Down
1 change: 0 additions & 1 deletion app/admin/(private)/invoices/detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,6 @@ export default function Home() {
.selectFrom("item")
.select([
"item.id as id",
"item.deviceId as deviceId",
"item.categoryId as categoryId",
"item.catalogItemId as catalogItemId",
"item.label as label",
Expand Down
1 change: 0 additions & 1 deletion app/admin/(private)/menus/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default function Home() {
.selectFrom("item")
.select([
"item.id as id",
"item.deviceId as deviceId",
"item.categoryId as categoryId",
"item.catalogItemId as itemId",
"item.label as label",
Expand Down
1 change: 0 additions & 1 deletion app/admin/(private)/menus/menu-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type MenuItemState = {
item: {
id: Id | null;
categoryId: Id | null;
deviceId: Id | null;
label: NonEmptyString255;
price: Integer;
currency: Currency;
Expand Down
4 changes: 0 additions & 4 deletions components/pos/pos-items.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { motion } from "framer-motion";
import { useAtomValue } from "jotai";
import { PackageOpenIcon, PlusCircleIcon, Search } from "lucide-react";
import { useRouter, useSearchParams } from "next/navigation";
import type React from "react";
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { accountAtom } from "@/atoms/account";
import { PosDial } from "@/components/pos/pos-dial";
import { Card, CardContent } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
Expand Down Expand Up @@ -39,7 +37,6 @@ export const PosItems: React.FC<{
const variant = searchParams.get("variant") ?? "list";
const id = searchParams.get("id") ?? "";
const { addItem } = useBill();
const account = useAtomValue(accountAtom);

return (
<Tabs value={variant} className="flex w-full flex-col gap-4">
Expand Down Expand Up @@ -76,7 +73,6 @@ export const PosItems: React.FC<{
onSubmit={async (value) => {
const item = await createItem({ evolu })({
item: {
deviceId: account.device.id,
catalogItemId: null,
label: NonEmptyString255(t("pos:items.unknownItem")),
price: moneyCodec.decode({
Expand Down
1 change: 0 additions & 1 deletion hooks/use-pos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const posBillQuery = createQuery<PosBill>((db) =>
eb
.selectFrom("item")
.select([
"item.deviceId as deviceId",
"item.label as label",
"item.price as price",
"item.currency as currency",
Expand Down
6 changes: 4 additions & 2 deletions lib/evolu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const Weekday = {

const ItemSchema = {
id: TableIdSchema,
deviceId: TableIdSchema.nullable(),
label: NonEmptyString255Schema,
// Stored in minor units for `priceCurrency` (e.g. cents, satoshis).
price: IntegerSchema,
Expand All @@ -118,7 +117,10 @@ export const AppSchema = {
browserName: z.string().nullable(),
osName: z.string().nullable(),
},
catalogItem: ItemSchema,
catalogItem: {
...ItemSchema,
deviceId: TableIdSchema.nullable(),
},
item: {
...ItemSchema,
// Link to the original catalog item.
Expand Down
5 changes: 1 addition & 4 deletions lib/invoice/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ export const createInvoice =
originalItemLineIds.delete(lineItem.id);

const item = await createItem(deps)({
item: {
...lineItem.item,
deviceId: invoice.deviceId,
},
item: lineItem.item,
});

deps.evolu.upsert("invoiceItemLine", {
Expand Down
1 change: 0 additions & 1 deletion lib/item/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const createItemId = (item: Omit<EvoluSchemaType["item"], "id">) => {
return createIdFromString(
stableStringify(
pick(item, [
"deviceId",
"label",
"price",
"unitOfMeasure",
Expand Down
Loading