Updating the message model

Next, we are going to update our message model. We are going to save the labels, safe search result, and Cloudinary upload details, as well in the message. These values will be populated only for an image upload and not a text upload. Update server\models\message.ts as follows:

// SNIPP SNIPPimport * as mongoose from 'mongoose';const Schema = mongoose.Schema;const messageSchema = new Schema({   // SNIPP SNIPP   labels: [{         type: Schema.Types.Mixed,         default: []   }],   cloudinaryProps: {         type: Schema.Types.Mixed   },   safeSearchProps: {         type: Schema.Types.Mixed   }});const Message = mongoose.model('Message', messageSchema);export default Message;// SNIPP SNIPP

Get Google Cloud AI Services Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.