Skip to content

feat: add location field to user profile #49

@PiyushRaval247

Description

@PiyushRaval247

Summary

Add a location field to the user profile to allow developers to showcase their city or country.

Contexts

Currently, the user profile supports fields like bio, company, and role, but lacks a space for geographical location. Adding a location field enhances the professional profile aspect of DevCard, making it easier for users to identify where their contacts are based. This field should be optional and integrated across the backend, shared types, and mobile UI.

Tasks

  • Backend: Update apps/backend/prisma/schema.prisma to include location String? in the User model.
  • Backend: Generate and apply a new migration: npx prisma migrate dev --name add_location_to_user.
  • Backend: Update updateProfileSchema in apps/backend/src/utils/validators.ts to include an optional location field (max 100 chars).
  • Backend: Update profiles.ts routes to include location in the select blocks for GET /me and PUT /me.
  • Shared: Update User, UpdateProfilePayload, PublicProfile, and PublicCard interfaces in packages/shared/src/types.ts to include location: string | null.
  • Mobile: Update the ProfileData interface and UI in apps/mobile/src/screens/DevCardViewScreen.tsx to display the location near the role/company information.

Acceptance Criteria

  • Users can successfully save and update their location via the profile update API.
  • The location is correctly returned in profile and public card fetch responses.
  • Zod validation prevents locations longer than 100 characters.
  • The field is optional and defaults to null if not provided.
  • The mobile app displays a location icon/text on the profile card when data is present.

Area

backend / mobile / shared

Difficulty

Low

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions