Compare commits

..

2 commits

Author SHA1 Message Date
shafi54
e5d9de33d7 enh 2026-08-12 22:26:20 +05:30
shafi54
25f3fb099c enh 2026-08-12 16:26:49 +05:30
7 changed files with 1554 additions and 13 deletions

View file

@ -4,7 +4,8 @@
"Shell(npx tsc --noEmit --skipLibCheck src/trpc/apis/common-apis/common.ts 2 >& 1)", "Shell(npx tsc --noEmit --skipLibCheck src/trpc/apis/common-apis/common.ts 2 >& 1)",
"Shell(npx tsc --noEmit 2 >& 1)", "Shell(npx tsc --noEmit 2 >& 1)",
"Shell(grep:*)", "Shell(grep:*)",
"Shell(npx tsc --noEmit -p packages/shared/tsconfig.json 2 >& 1)" "Shell(npx tsc --noEmit -p packages/shared/tsconfig.json 2 >& 1)",
"Shell(cp:*)"
], ],
"deny": [], "deny": [],
"defaultMode": "default" "defaultMode": "default"

View file

@ -1,6 +1,7 @@
# Taste # Taste
- Prefers that the agent not run typechecks; instead, read the project's AGENTS.md for instructions on what to do/not do before finalizing work. Confidence: 0.9 - Prefers that the agent not run typechecks; instead, read the project's AGENTS.md for instructions on what to do/not do before finalizing work. Confidence: 0.9
- Prefers detailed analysis and explicit error/mistake checking before executing git operations (e.g., merges), rather than just performing the action. Confidence: 0.6 - Prefers detailed analysis and explicit error/mistake checking before executing git operations (e.g., merges), rather than just performing the action. Confidence: 0.6
- Do not run `git stash` or other destructive git operations that would discard or modify working-tree changes without explicit permission. Confidence: 0.9
- When removing unused code (e.g., an unused tRPC procedure), prefers a complete cleanup: also remove internal helper methods used only by it, associated types, re-exports, orphaned hook/API files and their shared types, and even commented-out imports, leaving zero remaining references. Confidence: 0.9 - When removing unused code (e.g., an unused tRPC procedure), prefers a complete cleanup: also remove internal helper methods used only by it, associated types, re-exports, orphaned hook/API files and their shared types, and even commented-out imports, leaving zero remaining references. Confidence: 0.9
- Before removing or deciding on code, likes to first verify where it is actually used across the codebase (asks questions like "where is X used"), rather than removing based on assumption. Confidence: 0.4 - Before removing or deciding on code, likes to first verify where it is actually used across the codebase (asks questions like "where is X used"), rather than removing based on assumption. Confidence: 0.4
- Prefers light/pastel colors for randomized or accent UI elements (e.g., tabs, chips). Confidence: 0.7 - Prefers light/pastel colors for randomized or accent UI elements (e.g., tabs, chips). Confidence: 0.7
@ -11,3 +12,10 @@
- Prefers using icons from Hicons (rather than custom/hand-authored SVGs or other icon libraries). Confidence: 0.9 - Prefers using icons from Hicons (rather than custom/hand-authored SVGs or other icon libraries). Confidence: 0.9
- When a feature or page is repurposed, wants file names, route names, and code references renamed to match the new purpose (not just UI content/icons). Confidence: 0.8 - When a feature or page is repurposed, wants file names, route names, and code references renamed to match the new purpose (not just UI content/icons). Confidence: 0.8
- Wants analysis findings and plans persisted in a markdown file before any implementation begins, with explicit confirmation that implementation is paused until instructed. Confidence: 0.8 - Wants analysis findings and plans persisted in a markdown file before any implementation begins, with explicit confirmation that implementation is paused until instructed. Confidence: 0.8
- When changing cache or storage keys, wants both the read and write paths verified to use the same single source of truth (e.g., a shared `CACHE_STORAGE_KEYS` constant). Confidence: 0.8
- In React Native with react-native-paper's `Text` component (wrapped as `MyText`), prefers avoiding mixed string/expression children; use template literals to produce a single string child to prevent "Text strings must be rendered within a <Text> component" warnings. Confidence: 0.8
- When requesting test plans, expects exhaustive coverage across all relevant apps/screens/routes, including every functionality and every edge case. Confidence: 0.9
- Prefers test case documentation to be structured with preconditions, steps, explicit "things to test" checklist, and expected results. Confidence: 0.7
- Prefers test plans written for a non-technical audience, using plain-language, click-by-click instructions ("tap this", "type that", "check there") rather than technical terms or API names. Confidence: 0.9
- When updating or creating a document, prefers the agent first compare it against existing source documents, identify missing items or gaps, and add them in the same established format. Confidence: 0.9
- Dislikes nested headers in mobile/drawer navigation; prefers a single, shared header (e.g., the drawer header) and relies on device back buttons or gestures for returning to previous screens. Confidence: 0.9

View file

@ -25,12 +25,12 @@ interface PersistedCache<T> {
} }
const CACHE_STORAGE_KEYS = { const CACHE_STORAGE_KEYS = {
products: 'cache:products', products: 'cache_products',
stores: 'cache:stores', stores: 'cache_stores',
slots: 'cache:slots', slots: 'cache_slots',
banners: 'cache:banners', banners: 'cache_banners',
availability: 'cache:availability', availability: 'cache_availability',
storeProducts: (storeId: number) => `cache:store:${storeId}`, storeProducts: (storeId: number) => `cache_store_${storeId}`,
} as const } as const
async function readPersistedCache<T>(key: string): Promise<PersistedCache<T> | null> { async function readPersistedCache<T>(key: string): Promise<PersistedCache<T> | null> {

View file

@ -606,7 +606,11 @@ export async function rebalanceSlots(slotIds: number[]): Promise<AdminRebalanceS
with: { with: {
orderItems: { orderItems: {
with: { with: {
sku: true, sku: {
with: {
marketStats: true,
},
},
}, },
}, },
couponUsages: { couponUsages: {
@ -619,14 +623,15 @@ export async function rebalanceSlots(slotIds: number[]): Promise<AdminRebalanceS
const processedOrdersData = ordersList.map((order: any) => { const processedOrdersData = ordersList.map((order: any) => {
let newTotal = order.orderItems.reduce((acc: number, item: any) => { let newTotal = order.orderItems.reduce((acc: number, item: any) => {
const latestPrice = +item.sku.price const latestPrice = +(item.sku?.marketStats?.ourPrice ?? 0)
const amount = latestPrice * Number(item.quantity) const amount = latestPrice * Number(item.quantity)
return acc + amount return acc + amount
}, 0) }, 0)
order.orderItems.forEach((item: any) => { order.orderItems.forEach((item: any) => {
item.price = item.sku.price const latestPrice = item.sku?.marketStats?.ourPrice
item.discountedPrice = item.sku.price item.price = latestPrice
item.discountedPrice = latestPrice
}) })
const coupon = order.couponUsages[0]?.coupon const coupon = order.couponUsages[0]?.coupon

View file

@ -267,9 +267,28 @@ export async function getAddressByIdAndUser(
} }
export async function getProductById(skuId: number) { export async function getProductById(skuId: number) {
return db.query.productSkus.findFirst({ const sku = await db.query.productSkus.findFirst({
where: eq(productSkus.id, skuId), where: eq(productSkus.id, skuId),
with: {
marketStats: true,
product: true,
},
}) })
if (!sku) {
return null
}
const marketStats = sku.marketStats
return {
...sku,
price: marketStats?.ourPrice ? String(marketStats.ourPrice) : '0',
marketPrice: marketStats?.marketPrice ? String(marketStats.marketPrice) : null,
flashPrice: marketStats?.flashPrice ? String(marketStats.flashPrice) : null,
isFlashAvailable: marketStats?.isFlashAvailable ?? false,
isOutOfStock: marketStats?.isOutOfStock ?? false,
}
} }
export async function checkUserSuspended(userId: number): Promise<boolean> { export async function checkUserSuspended(userId: number): Promise<boolean> {

View file

@ -141,9 +141,28 @@ export async function getProductReviews(productId: number, limit: number, offset
} }
export async function getProductById(skuId: number) { export async function getProductById(skuId: number) {
return db.query.productSkus.findFirst({ const sku = await db.query.productSkus.findFirst({
where: eq(productSkus.id, skuId), where: eq(productSkus.id, skuId),
with: {
marketStats: true,
product: true,
},
}) })
if (!sku) {
return null
}
const marketStats = sku.marketStats
return {
...sku,
price: marketStats?.ourPrice ? String(marketStats.ourPrice) : '0',
marketPrice: marketStats?.marketPrice ? String(marketStats.marketPrice) : null,
flashPrice: marketStats?.flashPrice ? String(marketStats.flashPrice) : null,
isFlashAvailable: marketStats?.isFlashAvailable ?? false,
isOutOfStock: marketStats?.isOutOfStock ?? false,
}
} }
export async function createProductReview( export async function createProductReview(

1489
test-plan-neo.md Normal file

File diff suppressed because it is too large Load diff