<file_sep>const dynamoose = require('dynamoose');
const Schema = dynamoose.Schema;

module.exports = new Schema({
    SearchTerm: {
        type: String,
        hashKey: true
    },
    StatName: {
        type: String,
        rangeKey: true,
        index: true
    },
    Tweets: {
        type: 'list',
        list: [{
            type: 'map',
            map: {
                hashtags: {
                    type: [String]
                },
                has_media: {
                    type: Boolean,
                    default: false
                },
                parent_tweet_id: {
                    type: String
                },
                is_replied: {
                    type: Boolean,
                    default: false
                },
                url: {
                    type: String
                },
                is_reply_to: {
                    type: Boolean,
                    default: false
                },
                video_url: {
                    type: String
                },
                replies: {
                    type: Number
                },
                screen_name: {
                    type: String 
                },
                user_id: {
                    type: String
                },
                img_urls: {
                    type: [String]
                },
                html: {
                    type: String
                },
                links: {
                    type: [String]
                },
                reply_to_users: {
                    type: [String]
                },
                id: {
                    type: String
                },
                text: {
                    type: String
                },
                timestamp_epochs: {
                    type: Number
                },
                retweets: {
                    type: Number
                },
                username: {
                    type: String
                },
                timestamp: {
                    type: String
                },
                likes: {
                    type: Number
                }
            }
        }]
    }},
    {
        useDocumentTypes: true,
        throughput: {read: 15, write: 5}
    }
);<file_sep>class TweetDTO {
    constructor(rawTweetObj) {
        this.screen_name = rawTweetObj.screen_name;
        this.username = rawTweetObj.username;
        this.html = rawTweetObj.html;
        this.url = rawTweetObj.url;
        this.time = rawTweetObj.time.format('LLLL');
        this.timestamp = rawTweetObj.timestamp+'Z';
        this.likes = rawTweetObj.likes;
        this.replies = rawTweetObj.replies;
        this.retweets = rawTweetObj.retweets;
        this.avatar_img = rawTweetObj.avatar_img;
        return this;
    }
}
module.exports = TweetDTO;<file_sep>class UserDTO {
    constructor(rawTweetObj) {
        this.screen_name = rawTweetObj.screen_name;
        this.username = rawTweetObj.username;
        this.tweet_time = rawTweetObj.time.format('LLLL');
        this.avatar_img = rawTweetObj.avatar_img;
        return this;
    }
}
module.exports = UserDTO;