Skip to content

docs(business-card): add implementation and test plans for business card notes#5

Merged
sirily11 merged 3 commits intomainfrom
copilot/add-business-card-support
Mar 3, 2026
Merged

docs(business-card): add implementation and test plans for business card notes#5
sirily11 merged 3 commits intomainfrom
copilot/add-business-card-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

Documentation-only plan for supporting business card notes alongside regular-text-note, plus a new add-contact action type. No implementation changes.

docs/BUSINESS_CARD_PLAN.md

  • Data model: BusinessCard struct (firstName, lastName, email, phone, company, jobTitle, website, address) stored as JSON column on notes table
  • New action type: AddContactAction (type: "add-contact") — any note can include a button to save contact info to the user's address book
  • Backend changes: Schema updates (notes.ts), Zod validation (notes.ts), preview page rendering, migration for business_card column
  • iOS changes: ActionEditorView add-contact form, NoteEditorView type picker + business card fields, view model updates, Contacts framework integration
  • File change summary: Every file requiring modification with code snippets

Example of the new action in the discriminated union:

export const ActionSchema = z.discriminatedUnion("type", [
  URLActionSchema,
  WifiActionSchema,
  AddContactActionSchema, // new
]);

docs/BUSINESS_CARD_TEST_PLAN.md

  • Unit tests: Model serialization (5), action union (5), view model behavior (7)
  • UI tests: CRUD flows (4), action editor (4), type picker (3), mixed actions (1)
  • Test data: Sample JSON payloads and accessibility identifiers table
Original prompt

Create a plan to support business card beside the regular text note. Business card can be added to contact as well. Need contact info, title, company, first name, last name, email, and so on.

Also add support for the action to add contact action. This is docs only, no actual implementation. Modify both frontend and backend. List files need to be modified and code snippets for each modification.

Create test plan for frontend as well. Docs only.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rxnote Ready Ready Preview, Comment Mar 3, 2026 6:11am

Request Review

@autopilot-project-manager autopilot-project-manager bot added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 3, 2026
Co-authored-by: sirily11 <32106111+sirily11@users.noreply.github.com>
…ssibility identifier

Co-authored-by: sirily11 <32106111+sirily11@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for business card alongside regular text notes Add business card note type and add-contact action implementation plan Mar 3, 2026
@sirily11 sirily11 marked this pull request as ready for review March 3, 2026 07:47
Copilot AI review requested due to automatic review settings March 3, 2026 07:47
@autopilot-project-manager autopilot-project-manager bot changed the title Add business card note type and add-contact action implementation plan docs(business-card): add implementation and test plans for business card notes Mar 3, 2026
@sirily11 sirily11 enabled auto-merge (squash) March 3, 2026 07:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation-only planning for introducing a new business card note type and a new add-contact note action, plus an iOS-focused frontend test plan to guide future implementation work.

Changes:

  • Added an implementation plan covering backend schema/Zod/OpenAPI changes and iOS UI/view-model updates for business-card notes and add-contact actions.
  • Added an iOS frontend test plan (unit + UI) with sample payloads and proposed accessibility identifiers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
docs/BUSINESS_CARD_PLAN.md End-to-end implementation plan (backend + iOS) with suggested file touch points and code snippets.
docs/BUSINESS_CARD_TEST_PLAN.md iOS unit/UI test plan, including sample API payloads and a proposed accessibility identifier list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| `backend/app/api/v1/notes/route.ts` | No direct changes needed (Zod schemas handle validation automatically) |
| `backend/app/api/v1/notes/[id]/route.ts` | No direct changes needed (Zod schemas handle validation automatically) |
| `drizzle/migrations/` | New migration file for `business_card` column |
| `backend/next.openapi.json` | Regenerated via `./scripts/openapi-generate.sh` |
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the “File Change Summary”, backend/next.openapi.json is listed as being regenerated, but it’s actually the generator configuration checked into the repo; the generated spec is backend/public/openapi.json (gitignored). Updating this row will avoid confusion about which files are expected to change in an implementation PR.

Suggested change
| `backend/next.openapi.json` | Regenerated via `./scripts/openapi-generate.sh` |
| `backend/next.openapi.json` | Update OpenAPI generator config; run `./scripts/openapi-generate.sh` to regenerate `backend/public/openapi.json` (gitignored) |

Copilot uses AI. Check for mistakes.
Comment on lines +311 to +321
| `business-card-first-name` | First name text field |
| `business-card-last-name` | Last name text field |
| `business-card-email` | Email text field |
| `business-card-phone` | Phone text field |
| `business-card-company` | Company text field |
| `business-card-job-title` | Job title text field |
| `business-card-website` | Website text field |
| `business-card-address` | Address text field |
| `action-type-add-contact` | Add Contact segment in action type picker |
| `contact-first-name` | First name field in action editor |
| `contact-last-name` | Last name field in action editor |
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessibility identifier names in the test plan don’t match the existing convention used in the app (fields/buttons typically end with -field / -button, e.g. note-title-field, note-save-button in RxNote/RxNote/Views/Notes/NoteEditorView.swift). Consider renaming these planned identifiers (e.g. business-card-first-name-field, contact-first-name-field, etc.) to stay consistent and reduce UI test brittleness.

Suggested change
| `business-card-first-name` | First name text field |
| `business-card-last-name` | Last name text field |
| `business-card-email` | Email text field |
| `business-card-phone` | Phone text field |
| `business-card-company` | Company text field |
| `business-card-job-title` | Job title text field |
| `business-card-website` | Website text field |
| `business-card-address` | Address text field |
| `action-type-add-contact` | Add Contact segment in action type picker |
| `contact-first-name` | First name field in action editor |
| `contact-last-name` | Last name field in action editor |
| `business-card-first-name-field` | First name text field |
| `business-card-last-name-field` | Last name text field |
| `business-card-email-field` | Email text field |
| `business-card-phone-field` | Phone text field |
| `business-card-company-field` | Company text field |
| `business-card-job-title-field` | Job title text field |
| `business-card-website-field` | Website text field |
| `business-card-address-field` | Address text field |
| `action-type-add-contact` | Add Contact segment in action type picker |
| `contact-first-name-field` | First name field in action editor |
| `contact-last-name-field` | Last name field in action editor |

Copilot uses AI. Check for mistakes.
Comment on lines +340 to +344
<MapPin className="h-4 w-4" />
{note.businessCard.address}
</p>
)}
</div>
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the preview page snippet, MapPin is referenced for the address row but isn’t included in the shown lucide-react import. Since the snippet is labeled “additions only” and the real file already imports MapPin, consider updating the snippet to only add the new icons (e.g., Contact, Mail, etc.) or explicitly include MapPin so the example compiles as-written.

Suggested change
<MapPin className="h-4 w-4" />
{note.businessCard.address}
</p>
)}
</div>
{note.businessCard.address}
</p>
)}
</div>
</div>

Copilot uses AI. Check for mistakes.
Comment on lines +269 to +279
### 3. Database Migration

A new Drizzle migration is required to add the `business_card` column and update the `type` column constraint.

```sql
-- drizzle migration (generated via `bun run db:push` or drizzle-kit generate)
ALTER TABLE notes ADD COLUMN business_card TEXT DEFAULT NULL;
```

> Because SQLite stores enums as plain text, no ALTER is needed for the `type` column — the enum constraint is enforced at the application layer by Drizzle/Zod.

Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration section says it will “update the type column constraint”, but the SQL shown only adds business_card, and a few lines later notes that no ALTER is needed for type. Suggest rewording this section to avoid implying a DB-level enum constraint change in SQLite (or show the actual change if one is intended).

Copilot uses AI. Check for mistakes.
.describe("Note type"),
note: z.string().nullable().optional().describe("Markdown note content"),
businessCard: BusinessCardSchema.nullable().optional()
.describe("Business card data (required when type is business-card)"),
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text says businessCard is “required when type is business-card”, but the proposed Zod NoteInsertSchema/NoteUpdateSchema keeps businessCard optional and doesn’t add a conditional refinement. Either add a Zod refinement to enforce businessCard presence when type === "business-card" (and optionally enforce note presence for text notes), or adjust the wording to match the actual validation behavior.

Suggested change
.describe("Business card data (required when type is business-card)"),
.describe("Business card data (used when type is business-card)"),

Copilot uses AI. Check for mistakes.
Comment on lines +388 to +389
./scripts/openapi-generate.sh # Regenerate backend/next.openapi.json
./scripts/ios-update-openapi.sh # Regenerate Swift OpenAPI client types
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenAPI regeneration note is inaccurate: backend/next.openapi.json is the next-openapi-gen config file, while the generated spec is written to backend/public/openapi.json (per outputDir/outputFile in backend/next.openapi.json, and it’s gitignored in backend/.gitignore). Please update the command comment and/or referenced path accordingly.

Suggested change
./scripts/openapi-generate.sh # Regenerate backend/next.openapi.json
./scripts/ios-update-openapi.sh # Regenerate Swift OpenAPI client types
./scripts/openapi-generate.sh # Regenerate backend/public/openapi.json (OpenAPI spec)
./scripts/ios-update-openapi.sh # Regenerate Swift OpenAPI client types from the updated spec

Copilot uses AI. Check for mistakes.
Comment on lines +388 to +389
./scripts/openapi-generate.sh # Regenerate backend/next.openapi.json
./scripts/ios-update-openapi.sh # Regenerate Swift OpenAPI client types
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor but important: the plan suggests running ./scripts/openapi-generate.sh, but the current script in this repo contains a hard-coded absolute path (so it won’t work for other developers/CI). Consider updating the doc to instead reference cd backend && bun run openapi:generate (or fixing the script separately and keeping the doc).

Suggested change
./scripts/openapi-generate.sh # Regenerate backend/next.openapi.json
./scripts/ios-update-openapi.sh # Regenerate Swift OpenAPI client types
cd backend && bun run openapi:generate # Regenerate backend/next.openapi.json
./scripts/ios-update-openapi.sh # Regenerate Swift OpenAPI client types

Copilot uses AI. Check for mistakes.
@sirily11 sirily11 merged commit 5e2e6ec into main Mar 3, 2026
13 checks passed
@sirily11 sirily11 deleted the copilot/add-business-card-support branch March 3, 2026 08:13
@sirily11
Copy link
Copy Markdown
Contributor

sirily11 commented Mar 3, 2026

🎉 This PR is included in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants