diff --git a/.commandcode/taste/taste/taste.md b/.commandcode/taste/taste/taste.md index c8e17be..209106b 100644 --- a/.commandcode/taste/taste/taste.md +++ b/.commandcode/taste/taste/taste.md @@ -95,6 +95,10 @@ er-ui/app/(drawer)/(tabs)/home/index.tsx, I want similar here") and expects the - For analysis documents, expects a consistent naming pattern following the established convention (`user_ui_dpsk.md` → `admin_ui_dpsk.md`, i.e., `{app}_dpsk.md` at the repo root) rather than an ad-hoc filename — "make another md file with same naming pattern"; the `_dpsk.md` suffix also applies to cross-cutting topic analyses (e.g., `repeat_types_dpsk.md` for the repeated-types scan). Confidence: 0.9 - When commissioning a cross-cutting audit/analysis, expects the scan to span the entire monorepo in one pass — every app, the backend, AND the shared packages (e.g., "scan the entire @apps/user-ui/ @apps/admin-ui/ @apps/backend/ and also entire @packages/") — not just one app or one area. Confidence: 0.65 - Values type-level hygiene alongside runtime structures: wants repeated type declarations across the monorepo hunted down and classified (identical duplicates, near-identical/unifiable shapes, same-name-different-shape collisions) and documented in a report before any refactor, rather than fixing types piecemeal. Confidence: 0.6 + +- Requires the parallel DB-helper packages (db_helper_sqlite and db_helper_postgres) to not duplicate type definitions: they must share one canonical set of types and emit exactly the same data shape, since they represent the same business entities on different backends — stated directly: "they shouldn't duplicate types. They should emit exactly same type of data. They should share the types." Confidence: 0.9 + +- When the two DB-helper implementations diverge at the data-model level (sqlite is SKU-based with skuIds; the dormant postgres collapsed the SKU tier into productIds), the live/canonical model wins: the sqlite/SKU model — which packages/shared already standardizes on — is the source of truth and the dormant postgres helper is to be aligned/migrated to it (up to and including schema-level changes so even row types match), not the reverse. Confidence: 0.75 e changes. Confidence: 0.95 er-ui/app/(drawer)/(tabs)/home/index.tsx, I want similar here") and expects the agent to mirror that pattern exactly, including details like item counts and container styling. Confidence: 0.9 als) rather than introducing new brand palettes; approval of a redesign's layout/composition does not imply approval of color or theme changes. Confidence: 0.95 diff --git a/apps/backend/src/middleware/auth.middleware.ts b/apps/backend/src/middleware/auth.middleware.ts index 71af065..9a0989d 100644 --- a/apps/backend/src/middleware/auth.middleware.ts +++ b/apps/backend/src/middleware/auth.middleware.ts @@ -4,18 +4,6 @@ import { getStaffUserById, isUserSuspended } from '@/src/dbService'; import { ApiError } from '@/src/lib/api-error'; import { getEncodedJwtSecret } from '@/src/lib/env-exporter'; -interface UserContext { - userId: number; - name?: string; - email?: string; - mobile?: string; -} - -interface StaffContext { - id: number; - name: string; -} - export const authenticateUser = async (c: Context, next: Next) => { try { const authHeader = c.req.header('authorization'); diff --git a/change-log.txt b/change-log.txt index f374d1c..b851b47 100644 --- a/change-log.txt +++ b/change-log.txt @@ -632,3 +632,63 @@ Verification: - grep across apps + packages: zero references to any removed legacy type name or the token-types module. - CreateCouponPayload intact; its only importers (admin-ui coupons/edit/[id].tsx + src/components/CouponForm.tsx) unchanged. - Pre-existing tsc error in coupons/edit/[id].tsx:92 (`skuIds` not in CreateCouponPayload) untouched and unrelated (predates this change; CreateCouponPayload body preserved byte-for-byte). + +[2026-09-03 20:03:29] DELETE unused types (no consumers repo-wide; scanner: scripts/dead-code/unused-types.js; ambient .d.ts declarations excluded by design). +NOTE: date rollover — this entry and deletions performed 2026-09-03. + +=== apps/backend/src/middleware/auth.middleware.ts === +- removed interface UserContext (lines 7-12): + interface UserContext { + userId: number; + name?: string; + email?: string; + mobile?: string; + } +- removed interface StaffContext (lines 14-17): + interface StaffContext { + id: number; + name: string; + } + (file types context vars via hono's ContextVariableMap augmentation in types/hono.d.ts — those ambient declarations KEPT, they are consumed by hono's type system, not by name) + +=== packages/shared/types/coupon.types.ts === +- removed interface ReservedCoupon (lines 21-25): + export interface ReservedCoupon extends Coupon { + secretCode: string; + redeemedUserId: number | null; + redeemedAt: Date | null; + } + +=== packages/shared/types/user.ts === +- removed interface UserAvailabilityEntry (lines 339-345) — transitively dead (only consumer was UserAvailabilityResponse): + export interface UserAvailabilityEntry { + id: number; + price: string; + marketPrice: string | null; + flashPrice: string | null; + isFlashAvailable: boolean; + isOutOfStock: boolean; + isSuspended: boolean; + } +- removed interface UserAvailabilityResponse (lines 347-350): + export interface UserAvailabilityResponse { + availability: UserAvailabilityEntry[]; + count: number; + } + +=== packages/ui/src/components/use-pick-image.tsx === +- removed interface BaseProps (lines 5-8): + interface BaseProps { + label?: string; + multiple: boolean; + } +- removed interface ImageInfo (lines 22-36) — 15-field expo ImagePicker asset mirror, never referenced (picker assets are spread as any) + (live hook + its Props type kept; file has 7 consumers) + +[2026-09-03 20:06:30] COMPLETED unused-type deletion: 7 types removed across 4 files. +- auth.middleware.ts: UserContext, StaffContext (kept hono.d.ts ContextVariableMap — ambient module augmentation, consumed by hono's type system) +- shared/coupon.types.ts: ReservedCoupon +- shared/user.ts: UserAvailabilityResponse + UserAvailabilityEntry (transitively dead — only consumer was the removed response type) +- ui/use-pick-image.tsx: BaseProps, ImageInfo +Verification: zero leftover references repo-wide; tsc baselines unchanged — backend 11, packages/ui 924, user-ui 106, admin-ui 122 (all pre-existing). +Scanner limitation noted: same-name declarations across files (e.g. Props, Order) can mask per-copy deadness via word-boundary matching; those require import-graph resolution and were not touched. diff --git a/packages/shared/types/coupon.types.ts b/packages/shared/types/coupon.types.ts index 4f4c0a8..c89afe2 100644 --- a/packages/shared/types/coupon.types.ts +++ b/packages/shared/types/coupon.types.ts @@ -21,12 +21,6 @@ export interface Coupon { createdBy: number; } -export interface ReservedCoupon extends Coupon { - secretCode: string; - redeemedUserId: number | null; - redeemedAt: Date | null; -} - export interface CouponValidationResult { valid: boolean; message?: string; diff --git a/packages/shared/types/user.ts b/packages/shared/types/user.ts index e98bd3f..6eed4c5 100644 --- a/packages/shared/types/user.ts +++ b/packages/shared/types/user.ts @@ -336,21 +336,6 @@ export interface UserSlotAvailability { isOutOfStock: boolean; } -export interface UserAvailabilityEntry { - id: number; - price: string; - marketPrice: string | null; - flashPrice: string | null; - isFlashAvailable: boolean; - isOutOfStock: boolean; - isSuspended: boolean; -} - -export interface UserAvailabilityResponse { - availability: UserAvailabilityEntry[]; - count: number; -} - export interface UserDeliverySlot { id: number; deliveryTime: Date; diff --git a/packages/ui/src/components/use-pick-image.tsx b/packages/ui/src/components/use-pick-image.tsx index 9982d6c..2ef52db 100644 --- a/packages/ui/src/components/use-pick-image.tsx +++ b/packages/ui/src/components/use-pick-image.tsx @@ -2,11 +2,6 @@ import React from "react"; import * as DocumentPicker from "expo-document-picker"; import * as ImagePicker from "expo-image-picker"; -interface BaseProps { - label?: string; - multiple: boolean; -} - // interface Props { // setFile: (file: DocumentPicker.DocumentPickerAsset | null) => void; // label?: string; @@ -19,22 +14,6 @@ type Props = { multiple: boolean; }; -interface ImageInfo { - assetId?: string | null; - base64?: string | null; - duration?: number | null; - exif?: Record | null; - fileName?: string | null; - fileSize?: number; - height?: number; - mimeType?: string | null; - name?: string | null; - rotation?: number | null; - type?: string; - uri: string; - width?: number; -} - function usePickImage({ setFile, multiple = false }: Props) { // const { setFile } = props; const handlePickFile = async () => {