This commit is contained in:
Aerilyn Weber 2026-05-14 19:59:42 +09:00
parent a1801af63b
commit d2a7e652b3
16 changed files with 113 additions and 92 deletions

View file

@ -52,7 +52,7 @@ function toPriceRecordResponse(rawDoc: unknown) {
price: doc.price,
currency: doc.currency,
quantity: doc.quantity,
unit: doc.unit,
unit: doc.unit as import('@meshitrack/shared').ServingUnit,
pricePerUnit: doc.pricePerUnit,
date: toIso(doc.date),
...(doc.receiptImageUrl ? { receiptImageUrl: doc.receiptImageUrl } : {}),

View file

@ -6,7 +6,7 @@ import type {
} from '@meshitrack/shared';
export class ShoppingListsRepository {
public async create(data: CreateShoppingListInput & { householdId: string; createdBy: string; status: string }) {
public async create(data: any) {
const list = new ShoppingListModel(data);
const saved = await list.save();
return saved.toObject();

View file

@ -308,11 +308,11 @@ export default fp(
// 4. Persist Collaborative WebSocket Handshakes
app.route({
method: 'GET',
url: '/api/v1/households/:householdId/shopping-lists/:id/sync',
websocket: true,
handler: (socket, request) => {
app.get(
'/api/v1/households/:householdId/shopping-lists/:id/sync',
{ websocket: true },
(connection: any, request: any) => {
const socket = connection.socket;
const listId = request.params.id;
// Setup connection context
@ -323,7 +323,7 @@ export default fp(
request.log.info({ listId }, 'Active client joined shopping list sync channel');
socket.on('message', async (messageBuffer) => {
socket.on('message', async (messageBuffer: any) => {
try {
const payload = JSON.parse(messageBuffer.toString());
@ -367,7 +367,7 @@ export default fp(
request.log.info({ listId }, 'Client severed sync handshake connection');
});
}
});
);
},
{
name: 'shopping-lists-routes',

View file

@ -255,8 +255,8 @@ export class ShoppingListsService {
quantity: item.quantity,
unit: item.unit as ServingUnit,
purchasePrice: item.actualPrice || undefined,
storeId: item.storeId || list.preferredStoreId || undefined,
notes: item.notes,
storeId: (item.storeId || list.preferredStoreId || undefined) as string | undefined,
notes: item.notes || undefined,
},
householdId,
userId
@ -264,14 +264,14 @@ export class ShoppingListsService {
addedCount++;
// 2. Log final point-in-time pricing ledger entry if user input final price
if (item.actualPrice !== undefined && item.actualPrice > 0) {
if (item.actualPrice != null && item.actualPrice > 0) {
const storeId = item.storeId || list.preferredStoreId;
if (storeId) {
await this.pricesService.recordPrice(
{
productId: item.productId,
storeId,
price: item.actualPrice,
storeId: storeId as string,
price: item.actualPrice as number,
quantity: item.quantity,
unit: item.unit as ServingUnit,
currency: 'USD',