Skip to content

Story 1: Project data model + CRUD API #1230

Description

@jeromehardaway

Epic: #1155
Story Points: 5
Priority: High
Dependencies: none (foundation for this epic)

User Story

As a veteran building my portfolio
I want my projects stored on my account
So that I can manage them once and surface them anywhere on the platform

Acceptance Criteria

  • Add a Project model to prisma/schema.prisma with a one-to-many relation from User (fields: id, userId, title, summary, repoUrl, liveUrl, techTags as a JSON string matching the existing User.skills pattern, imageUrl, order, createdAt, updatedAt)
  • Generate a migration (npx prisma migrate dev --name add_project_model)
  • CRUD API under src/pages/api/user/projects/: GET (list own), POST (create), PATCH /[id], DELETE /[id]
  • All routes wrapped with requireAuth from @/lib/rbac; ownership enforced (a user can only mutate their own projects)
  • Input validation (title required; URL fields validated; tag count/length capped)
  • @swagger JSDoc block on each route so it shows in /api-docs

Technical Notes

  • Use the Prisma singleton import prisma from "@/lib/prisma" — never new PrismaClient() per file
  • Store techTags as a JSON string to match User.skills rather than a join table
  • Mirror the src/lib/project.ts static-project shape where practical so the showcase can reuse types

Definition of Done

  • Migration runs clean; npm run typecheck, npm run lint, npm test, npm run build pass
  • Vitest coverage for create/list/update/delete + ownership rejection (403) + validation failure (400)
  • Code reviewed and merged

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureenhancementintermediateRequires moderate codebase familiarity; multi-file or design judgment

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions