mock-data.js
│
├── 📋 USER_ROLES (Constants)
│ ├── USER: 'user'
│ ├── ADMIN: 'admin'
│ ├── PREMIUM: 'premium'
│ └── RECRUITER: 'recruiter'
│
├── 👥 users (Array)
│ └── [User Object]
│ ├── userID: string
│ ├── userRole: string (USER_ROLES.*)
│ ├── firstName: string
│ ├── lastName: string
│ ├── email: string
│ ├── headline: string
│ ├── location: string
│ ├── profileImage: string (URL)
│ ├── coverImage: string (URL)
│ ├── connectionsCount: number
│ ├── followersCount: number
│ ├── about: string
│ ├── experience: Array
│ │ └── [Experience Object]
│ │ ├── title: string
│ │ ├── company: string
│ │ ├── location: string
│ │ ├── startDate: string (YYYY-MM)
│ │ ├── endDate: string | null
│ │ ├── current: boolean
│ │ └── description: string
│ ├── education: Array
│ │ └── [Education Object]
│ │ ├── school: string
│ │ ├── degree: string
│ │ ├── field: string
│ │ ├── startDate: string (YYYY)
│ │ └── endDate: string (YYYY)
│ ├── skills: Array<string>
│ └── endorsements: Object
│ └── { skillName: count }
│
├── 👤 currentUser (Object)
│ └── (Reference to users[0])
│
├── 📝 posts (Array)
│ └── [Post Object]
│ ├── postID: string
│ ├── authorID: string
│ ├── author: Object
│ │ ├── firstName: string
│ │ ├── lastName: string
│ │ ├── headline: string
│ │ └── profileImage: string (URL)
│ ├── content: string
│ ├── createdAt: string (ISO 8601)
│ ├── updatedAt: string (ISO 8601)
│ ├── media: Array
│ │ └── [Media Object]
│ │ ├── type: string ('image' | 'video')
│ │ ├── url: string
│ │ └── alt: string
│ ├── likes: Object
│ │ ├── count: number
│ │ └── users: Array<string> (userIDs)
│ ├── comments: Object
│ │ ├── count: number
│ │ └── items: Array
│ │ └── [Comment Object]
│ │ ├── commentID: string
│ │ ├── authorID: string
│ │ ├── author: Object
│ │ │ ├── firstName: string
│ │ │ ├── lastName: string
│ │ │ └── profileImage: string
│ │ ├── content: string
│ │ ├── createdAt: string (ISO 8601)
│ │ └── likes: Object
│ │ ├── count: number
│ │ └── users: Array<string>
│ ├── shares: Object
│ │ ├── count: number
│ │ └── users: Array<string> (userIDs)
│ └── type: string ('post' | 'article' | 'job' | 'event')
│
├── 🤝 connections (Array)
│ └── [Connection Object]
│ ├── connectionID: string
│ ├── userID: string
│ ├── connectedUserID: string
│ ├── status: string ('connected' | 'pending' | 'blocked')
│ ├── connectedAt: string (ISO 8601) | null
│ └── mutualConnections: number
│
├── 💼 jobs (Array)
│ └── [Job Object]
│ ├── jobID: string
│ ├── title: string
│ ├── company: Object
│ │ ├── name: string
│ │ ├── logo: string (URL)
│ │ └── location: string
│ ├── location: string
│ ├── type: string ('Full-time' | 'Part-time' | 'Contract')
│ ├── postedAt: string (ISO 8601)
│ ├── applicants: number
│ ├── description: string
│ ├── requirements: Array<string>
│ ├── salary: Object
│ │ ├── min: number
│ │ ├── max: number
│ │ └── currency: string
│ ├── postedBy: string (userID)
│ └── skills: Array<string>
│
├── 🏢 companies (Array)
│ └── [Company Object]
│ ├── companyID: string
│ ├── name: string
│ ├── industry: string
│ ├── size: string
│ ├── location: string
│ ├── website: string (URL)
│ ├── logo: string (URL)
│ ├── description: string
│ ├── employees: number
│ ├── followers: number
│ └── specialties: Array<string>
│
├── 🔔 notifications (Array)
│ └── [Notification Object]
│ ├── notificationID: string
│ ├── userID: string
│ ├── type: string ('like' | 'comment' | 'connection_request' | 'job_recommendation' | 'message')
│ ├── title: string
│ ├── message: string
│ ├── createdAt: string (ISO 8601)
│ ├── read: boolean
│ ├── relatedID: string
│ └── relatedType: string ('post' | 'comment' | 'user' | 'job')
│
├── 💬 messages (Array)
│ └── [Message Object]
│ ├── messageID: string
│ ├── conversationID: string
│ ├── senderID: string
│ ├── receiverID: string
│ ├── content: string
│ ├── createdAt: string (ISO 8601)
│ └── read: boolean
│
└── 🛠️ Helper Functions
├── getUserByID(userID: string) => User | undefined
├── getPostsByUserID(userID: string) => Array<Post>
├── getConnectionsByUserID(userID: string) => Array<Connection>
├── getJobsByCompany(companyName: string) => Array<Job>
├── getNotificationsByUserID(userID: string) => Array<Notification>
└── getUnreadNotificationsCount(userID: string) => number
Description: List of all users in the system
Sample count: 5 users
Structure:
users = [
{
// Basic information
userID: 'user-001', // Unique ID
userRole: 'user', // Role: user | admin | premium | recruiter
firstName: 'John',
lastName: 'Doe',
email: 'john.doe@example.com',
headline: 'Senior Software Engineer at Tech Corp',
location: 'San Francisco, CA',
// Images
profileImage: 'https://...', // Profile image URL
coverImage: 'https://...', // Cover image URL
// Statistics
connectionsCount: 542, // Number of connections
followersCount: 1200, // Number of followers
// Detailed information
about: '...', // About description
// Work experience
experience: [
{
title: 'Senior Software Engineer',
company: 'Tech Corp',
location: 'San Francisco, CA',
startDate: '2020-01', // Format: YYYY-MM
endDate: null, // null if currently working
current: true,
description: '...'
}
],
// Education
education: [
{
school: 'Stanford University',
degree: 'Bachelor of Science',
field: 'Computer Science',
startDate: '2013', // Format: YYYY
endDate: '2017'
}
],
// Skills
skills: ['JavaScript', 'React', 'Node.js'],
// Endorsements (skill confirmations)
endorsements: {
'JavaScript': 45, // Number of endorsements
'React': 38
}
}
]Description: List of posts in the feed
Sample count: 5 posts
Structure:
posts = [
{
postID: 'post-001',
authorID: 'user-002', // Author ID
// Author information (embedded)
author: {
firstName: 'Sarah',
lastName: 'Johnson',
headline: 'Product Manager...',
profileImage: 'https://...'
},
// Content
content: 'Excited to share...',
createdAt: '2024-01-15T10:30:00Z',
updatedAt: '2024-01-15T10:30:00Z',
// Attached media
media: [
{
type: 'image', // 'image' | 'video'
url: 'https://...',
alt: 'Product launch screenshot'
}
],
// Likes
likes: {
count: 245,
users: ['user-001', 'user-003'] // List of userIDs who liked
},
// Comments
comments: {
count: 18,
items: [
{
commentID: 'comment-001',
authorID: 'user-001',
author: { ... },
content: 'Congratulations!...',
createdAt: '2024-01-15T11:00:00Z',
likes: {
count: 12,
users: ['user-002']
}
}
]
},
// Shares
shares: {
count: 32,
users: ['user-003'] // List of userIDs who shared
},
// Post type
type: 'post' // 'post' | 'article' | 'job' | 'event'
}
]Description: Connection relationships between users
Structure:
connections = [
{
connectionID: 'conn-001',
userID: 'user-001', // Main user
connectedUserID: 'user-002', // Connected user
status: 'connected', // 'connected' | 'pending' | 'blocked'
connectedAt: '2023-06-15T10:00:00Z', // Connection time
mutualConnections: 45 // Number of mutual connections
}
]Description: List of job postings
Sample count: 3 jobs
Structure:
jobs = [
{
jobID: 'job-001',
title: 'Senior Full Stack Engineer',
// Company information
company: {
name: 'Tech Corp',
logo: 'https://...',
location: 'San Francisco, CA'
},
location: 'San Francisco, CA (Hybrid)',
type: 'Full-time', // 'Full-time' | 'Part-time' | 'Contract'
postedAt: '2024-01-10T08:00:00Z',
applicants: 45, // Number of applicants
description: 'We are looking for...',
requirements: [
'5+ years of experience...',
'Strong knowledge of...'
],
// Salary
salary: {
min: 150000,
max: 200000,
currency: 'USD'
},
postedBy: 'user-003', // Poster ID (recruiter)
skills: ['React', 'Node.js', 'TypeScript']
}
]Description: Company information
Structure:
companies = [
{
companyID: 'company-001',
name: 'Tech Corp',
industry: 'Technology',
size: '1001-5000', // Company size
location: 'San Francisco, CA',
website: 'https://techcorp.example.com',
logo: 'https://...',
description: 'Leading technology company...',
employees: 2500, // Number of employees
followers: 50000, // Number of followers
specialties: [ // Specialties
'Software Development',
'Cloud Services',
'AI/ML'
]
}
]Description: Notifications for users
Structure:
notifications = [
{
notificationID: 'notif-001',
userID: 'user-001', // User receiving notification
type: 'like', // 'like' | 'comment' | 'connection_request' | 'job_recommendation' | 'message'
title: 'Sarah Johnson liked your post',
message: 'Sarah Johnson liked your post about...',
createdAt: '2024-01-11T08:30:00Z',
read: false, // Whether read
relatedID: 'post-005', // Related object ID
relatedType: 'post' // 'post' | 'comment' | 'user' | 'job'
}
]Description: Messages between users
Structure:
messages = [
{
messageID: 'msg-001',
conversationID: 'conv-001', // Conversation ID
senderID: 'user-002',
receiverID: 'user-001',
content: 'Hey John! Great work...',
createdAt: '2024-01-11T10:00:00Z',
read: true // Whether read
}
]- Description: Get user information by ID
- Parameters:
userID- User ID - Returns:
User | undefined
- Description: Get all posts by a user
- Parameters:
userID- User ID - Returns:
Array<Post>
- Description: Get connection list of a user (only status = 'connected')
- Parameters:
userID- User ID - Returns:
Array<Connection>
- Description: Get all jobs from a company
- Parameters:
companyName- Company name - Returns:
Array<Job>
- Description: Get all notifications for a user
- Parameters:
userID- User ID - Returns:
Array<Notification>
- Description: Count unread notifications for a user
- Parameters:
userID- User ID - Returns:
number
┌─────────┐
│ Users │
└────┬────┘
│
├───┐
│ │
▼ ▼
┌─────────────┐ ┌──────────────┐
│ Posts │ │ Connections │
│ │ │ │
│ authorID ───┼────┼─► userID │
│ │ │ │
│ likes.users │ │ connectedUser│
│ comments │ │ │
└─────────────┘ └──────────────┘
│
│
▼
┌─────────────┐
│ Comments │
│ │
│ authorID ───┼────┐
│ │ │
│ likes.users │ │
└─────────────┘ │
│
┌─────────────┐ │
│ Jobs │ │
│ │ │
│ postedBy ───┼────┘
│ │
│ company │
└─────────────┘
│
│
▼
┌─────────────┐
│ Companies │
└─────────────┘
┌─────────────┐
│Notifications│
│ │
│ userID ─────┼────┐
│ relatedID │ │
│ relatedType │ │
└─────────────┘ │
│
┌─────────────┐ │
│ Messages │ │
│ │ │
│ senderID ───┼────┘
│ receiverID ─┼────┘
└─────────────┘
// Import all
import mockData from '~/apis/mock-data.js'
// Import specific
import { users, posts, getUserByID } from '~/apis/mock-data.js'// Get current user
const currentUser = mockData.currentUser
// Get user by ID
const user = getUserByID('user-002')
// Get user's posts
const userPosts = getPostsByUserID('user-001')
// Get connections
const connections = getConnectionsByUserID('user-001')
// Get unread notifications
const unreadCount = getUnreadNotificationsCount('user-001')- All timestamps use ISO 8601 format (UTC)
userID,postID,commentID, etc. are unique strings- Arrays can be empty
[]or contain multiple items - Objects can have
nullvalues for optional fields - Media URLs are placeholders, can be replaced with actual URLs