Created
January 16, 2025 18:16
-
-
Save ajeetkumarrauniyar/d81ae6333b6ad7aa2d27df90720e7279 to your computer and use it in GitHub Desktop.
Sample DataSet Schema for Social Media Analytics Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/models/Post.ts | |
| import mongoose from 'mongoose'; | |
| const PostSchema = new mongoose.Schema({ | |
| postId: { | |
| type: String, | |
| required: true, | |
| unique: true, | |
| }, | |
| postType: { | |
| type: String, | |
| required: true, | |
| enum: ['text', 'image', 'video', 'link'], | |
| }, | |
| content: { | |
| type: String, | |
| required: true, | |
| }, | |
| engagement: { | |
| likes: { type: Number, default: 0 }, | |
| shares: { type: Number, default: 0 }, | |
| comments: { type: Number, default: 0 }, | |
| }, | |
| metadata: { | |
| platform: String, | |
| audience: Object, | |
| hashtags: [String], | |
| }, | |
| createdAt: { | |
| type: Date, | |
| default: Date.now, | |
| }, | |
| updatedAt: { | |
| type: Date, | |
| default: Date.now, | |
| }, | |
| }); | |
| export default mongoose.models.Post || mongoose.model('Post', PostSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment