260222:1053 20260222 refactor specs/ #1 03-Data-and-Storage
All checks were successful
Build and Deploy / deploy (push) Successful in 1m0s
All checks were successful
Build and Deploy / deploy (push) Successful in 1m0s
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
# Session History: Drawing Module Refactor v1.7.0
|
||||
|
||||
**Date:** 2025-12-25
|
||||
**Session ID:** cdbb2d6b-1fab-459e-8ec9-e864bd30b308
|
||||
|
||||
---
|
||||
|
||||
## Objective
|
||||
Refactor Drawing module (backend & frontend) to align with `lcbp3-v1.7.0-schema.sql`, specifically for AS Built Drawings.
|
||||
|
||||
---
|
||||
|
||||
## Changes Made
|
||||
|
||||
### Backend
|
||||
|
||||
#### Entities Updated
|
||||
| File | Changes |
|
||||
| ------------------------------------ | --------------------------------------------------- |
|
||||
| `asbuilt-drawing.entity.ts` | Added `mainCategoryId`, `subCategoryId` + relations |
|
||||
| `asbuilt-drawing-revision.entity.ts` | Added `legacyDrawingNumber` |
|
||||
|
||||
#### New Files Created
|
||||
| File | Description |
|
||||
| -------------------------------------------- | ----------------------------------- |
|
||||
| `dto/create-asbuilt-drawing.dto.ts` | Create AS Built with first revision |
|
||||
| `dto/create-asbuilt-drawing-revision.dto.ts` | Add revision to existing AS Built |
|
||||
| `dto/search-asbuilt-drawing.dto.ts` | Search with pagination |
|
||||
| `asbuilt-drawing.service.ts` | CRUD service |
|
||||
| `asbuilt-drawing.controller.ts` | REST controller |
|
||||
|
||||
#### Module Updated
|
||||
- `drawing.module.ts` - Registered new entities, service, controller
|
||||
|
||||
#### New API Endpoints
|
||||
| Method | Path | Description |
|
||||
| ------ | --------------------------------- | ------------ |
|
||||
| POST | `/drawings/asbuilt` | Create |
|
||||
| POST | `/drawings/asbuilt/:id/revisions` | Add revision |
|
||||
| GET | `/drawings/asbuilt` | List |
|
||||
| GET | `/drawings/asbuilt/:id` | Get by ID |
|
||||
| DELETE | `/drawings/asbuilt/:id` | Delete |
|
||||
|
||||
---
|
||||
|
||||
### Frontend
|
||||
|
||||
#### Types Updated
|
||||
| File | Changes |
|
||||
| ------------------------------------------ | ------------------------------------------------------------------- |
|
||||
| `types/drawing.ts` | `AsBuiltDrawing` interface: added `mainCategoryId`, `subCategoryId` |
|
||||
| `types/dto/drawing/asbuilt-drawing.dto.ts` | Added category IDs |
|
||||
|
||||
#### Components Updated
|
||||
| File | Changes |
|
||||
| ------------------------------------- | ------------------------------------------------------- |
|
||||
| `components/drawings/upload-form.tsx` | AS_BUILT form: added category selectors, title required |
|
||||
| `components/drawings/list.tsx` | `projectId` now required prop |
|
||||
| `app/(dashboard)/drawings/page.tsx` | Added project selector dropdown |
|
||||
|
||||
#### Hooks Updated
|
||||
| File | Changes |
|
||||
| ---------------------- | -------------------------------- |
|
||||
| `hooks/use-drawing.ts` | Fixed toast message for AS_BUILT |
|
||||
|
||||
---
|
||||
|
||||
## Verification Results
|
||||
|
||||
| Component | Command | Result |
|
||||
| --------- | ------------ | --------- |
|
||||
| Backend | `pnpm build` | ✅ Success |
|
||||
| Frontend | `pnpm build` | ✅ Success |
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
- AS Built Drawings use same category structure as Shop Drawings (`shop_drawing_main_categories`, `shop_drawing_sub_categories`)
|
||||
- No existing data in `asbuilt_drawings` table, no migration needed
|
||||
- Pre-existing lint warnings (`any` types) in `upload-form.tsx` not addressed in this session
|
||||
Reference in New Issue
Block a user