Skip to content

BaseCard and UserCard schema improvements + local dynamodb smoke tests - #48

Open
cboiteux2765 wants to merge 1 commit into
mainfrom
ddb-schema
Open

BaseCard and UserCard schema improvements + local dynamodb smoke tests#48
cboiteux2765 wants to merge 1 commit into
mainfrom
ddb-schema

Conversation

@cboiteux2765

Copy link
Copy Markdown
Contributor

Description

Adds the BaseCard/UserCard persistence contract and a server-side DynamoDB implementation for saving and resetting vocabulary cards.

  • Replaces the legacy flat frontend card type with typed BaseCard, UserCard, nested content, annotations, and warnings contracts.
  • Defines the lookup Lambda response contract as { card: BaseCard } and updates the lookup UI to consume it.
  • Adds POST /api/cards to create a user-owned card from an already-available BaseCard, without calling the lookup Lambda.
  • Adds POST /api/cards/:cardId/reset to restore editable content from the stored BaseCard while preserving userId, cardId, createdAt, baseRef, notes, and warnings.
  • Uses the low-level DynamoDB SDK and explicit JSON-to-AttributeValue conversion (S, N, BOOL, M, L, and NULL).
  • Adds local DynamoDB smoke tests in TypeScript and Boto3, plus setup and test documentation.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

How did you test this?

With DynamoDB Local running at http://127.0.0.1:8000:

cd frontend
$env:DYNAMODB_ENDPOINT = 'http://127.0.0.1:8000'
npm run dynamodb:smoke
py -3.12 scripts/dynamodb_boto3_smoke.py

Results:

  • npm run build completed successfully.
  • The TypeScript smoke test created local BaseCards and UserCards tables, saved a sample BaseCard-derived UserCard, printed the raw DynamoDB wrappers, simulated an incorrect definition, and verified reset restored the BaseCard definition while retaining the user note.
  • The Boto3 smoke test directly inserted the BaseCard and converted UserCard with the low-level put_item API. It verified content is an M, content.definitions is an L, definition text is an S, and revision is an N.
  • The AWS SDK emitted a non-blocking Node 20 future-support warning; it did not affect either test.

Checklist

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • New and existing unit tests pass locally with my changes.

Next steps

  • Implement or update the deployed word-lookup Lambda to return the shared { card: BaseCard } payload.
  • Configure AWS_REGION, USER_CARDS_TABLE_NAME, and BASE_CARDS_TABLE_NAME, then grant the deployed server runtime least-privilege DynamoDB access.
  • Add an authenticated end-to-end test for lookup Lambda -> save endpoint -> UserCards -> reset endpoint -> BaseCards.
  • Wire the saved-cards UI to the new UserCard API and expose save/reset actions in the interface.
  • Add request validation beyond the current structural BaseCard check before production rollout.

GenAI usage

  • What model(s) did you use? Codex (GPT-5).
  • Percent of AI-written code? Approximately 90%; reviewed and tested locally.
  • Any drawbacks? Generated code still requires review for project-specific IAM, deployment configuration, validation policy, and API compatibility. Actual end-to-end testing will be done when Lambda works and returns dictionary words put into the baseCard schema.
  • Main prompt summary: Implement the supplied BaseCard/UserCard schemas, DynamoDB storage conversion, save/reset endpoints, and local DynamoDB tests without depending on the lookup Lambda.

@netlify

netlify Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploy Preview for lingolm ready!

Name Link
🔨 Latest commit 494d2fd
🔍 Latest deploy log https://app.netlify.com/projects/lingolm/deploys/6a78e9060ef67f000821fb6b
😎 Deploy Preview https://deploy-preview-48--lingolm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@cboiteux2765 cboiteux2765 changed the title schema improvements + dynamodb test BaseCard and UserCard schema improvements + local dynamodb smoke tests Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant