feat(pos): implement integrated full-screen POS point-of-sale system with inventory deduction and thermal receipt
This commit is contained in:
1 parent
b585277214
commit
5796e4d868
10 files changed
+1549
-23
No files matched your search
@@ -66,4 +66,34 @@ export const customersRoute = new Elysia({ prefix: "/customers" })
|
||||
pointsDelta: t.Number(),
|
||||
reason: t.Optional(t.String())
|
||||
})
|
||||
})
|
||||
.post("/", async ({ body, set }) => {
|
||||
try {
|
||||
const { displayName, phone, email } = body as { displayName?: string, phone?: string, email?: string };
|
||||
|
||||
// Auto-generate a unique lineUserId placeholder for in-store/POS customers
|
||||
const lineUserId = `POS_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
|
||||
|
||||
const newCustomer = await prisma.customer.create({
|
||||
data: {
|
||||
lineUserId,
|
||||
displayName: displayName || "ลูกค้าหน้าร้าน",
|
||||
phone: phone || null,
|
||||
email: email || null,
|
||||
points: 0
|
||||
}
|
||||
});
|
||||
return newCustomer;
|
||||
} catch (err: any) {
|
||||
console.error("[Customers] Create error:", err);
|
||||
set.status = 400;
|
||||
return { error: err.message || "Failed to create customer" };
|
||||
}
|
||||
}, {
|
||||
body: t.Object({
|
||||
displayName: t.Optional(t.String()),
|
||||
phone: t.Optional(t.String()),
|
||||
email: t.Optional(t.String())
|
||||
})
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user