DevByte-Community / DevByte-Community/Community-API-Backend

Add Social Contacts Feature to User Profiles

Abierto
#75 0 comentarios 0 reacciones 0 asignados Ver en GitHub
good first issue
Lenguaje dominante
JavaScript
Estrellas
2
Forks
11
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Ticket ID: USER-CONTACTS-001
Priority: Medium

**Feature Description**

Add social media/contact links (GitHub, LinkedIn, Twitter, etc.) to user profiles using a JSONB column in the users table. Enable users to manage their public contact information and display it in community exploration pages.

**Acceptance Criteria**

1. Database Migration
```
sql

-- Add JSONB column to users table
ALTER TABLE users
ADD COLUMN contacts JSONB DEFAULT '[]'::jsonb,
ADD COLUMN bio TEXT DEFAULT '',
ADD COLUMN location VARCHAR(100) DEFAULT '';

-- Create index for efficient querying
CREATE INDEX idx_users_contacts ON users USING gin(contacts);
```

2. Contact Schema Structure

- Each contact in the JSONB array must follow this structure:
```
json

{
"platform": "github",
"url": "https://github.com/username"
}

Supported Platforms:

github, linkedin, twitter, portfolio, website

discord, behance, dribbble, medium, youtube

instagram, facebook, stackoverflow, devto
```

3. Updated Endpoints
`GET /api/v1/users/:id/profile`

- Include contacts, bio, location in response

- Filter contacts: only show isPublic: true for non-owner viewers

`PATCH /api/v1/users/profile (Enhanced)`

- Extend existing endpoint to handle:

- contacts array validation and update

- bio field (max 500 characters)

- location field (max 100 characters)

4. Validation Rules

- Contacts Array:

- Must be an array (max 10 items)

- Each contact must have platform and url

- platform must be from supported list

- url must be valid URL format

- Bio: Max 500 characters, optional

- Location: Max 100 characters, optional

5. Response Format

User Profile Response:
```
json

{
"success": true,
"message": "User profile retrieved successfully",
"user": {
"id": "uuid",
"fullName": "Aisha Patel",
"bio": "Crafting pixel-perfect interfaces...",
"location": "Lagos, Nigeria",
"profilePicture": "url",
"contacts": [
{
"platform": "github",
"url": "https://github.com/aishapatel",
"username": "aishapatel",
"isPublic": true
}
],
"stats": {
"projects": 11,
"contributions": 178,
"joinedDate": "May 2023"
}
}
}
```

6. Testing

- Unit tests for contact validation

- Integration tests for profile endpoints

- Test maximum array size enforcement

7. Documentation Updates

Update Swagger/OpenAPI documentation

🚀 Success Metrics

All existing users automatically have empty contacts array

Profile pages load with contacts in < 200ms

Contact updates succeed with proper validation

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.