Data Models
User Models
User (Complete Model)
interface User {
_id: string; // MongoDB ObjectId, read-only
username: string; // Unique username, max 20 characters
email: string; // Unique email address, max 50 characters
role: "admin" | "user"; // User role, read-only, default: "user"
firstName?: string; // Optional first name, max 20 characters
lastName?: string; // Optional last name, max 20 characters
socialLinks: {
website?: string; // Optional website URL, max 100 characters
facebook?: string; // Optional Facebook URL, max 100 characters
instagram?: string; // Optional Instagram URL, max 100 characters
linkedin?: string; // Optional LinkedIn URL, max 100 characters
x?: string; // Optional X (Twitter) URL, max 100 characters
youtube?: string; // Optional YouTube URL, max 100 characters
};
createdAt: string; // ISO 8601 timestamp, read-only
updatedAt: string; // ISO 8601 timestamp, read-only
}UserInputRequired (Registration/Login)
UserUpdateInput (Profile Updates)
Blog Models
Blog (Complete Model)
BlogInput (Creation)
BlogUpdateInput (Updates)
Comment Models
Comment (Complete Model)
CommentInput (Creation)
Response Models
Paginated Responses
PaginatedUsers
PaginatedBlogs
Authentication Responses
AccessTokenResponse
LoginResponse
Error Models
ErrorResponse (General Errors)
ValidationErrorResponse (Input Validation)
Data Types and Formats
MongoDB ObjectId
ISO 8601 Timestamps
URLs
File Uploads
Model Relationships
User β Blogs (One-to-Many)
Blog β Comments (One-to-Many)
User β Comments (One-to-Many)
User β Likes (Many-to-Many)
Field Validation Summary
Field
Type
Required
Max Length
Format
Unique
TypeScript Definitions
Last updated