Skip to content

Instantly share code, notes, and snippets.

@bogoslavskiy
Created March 5, 2020 18:34
Show Gist options
  • Save bogoslavskiy/3caba751cfdcfa4e07cbd464fc9503e9 to your computer and use it in GitHub Desktop.
Save bogoslavskiy/3caba751cfdcfa4e07cbd464fc9503e9 to your computer and use it in GitHub Desktop.
import * as mongoose from 'mongoose';
export interface DeviceTokenDocument extends mongoose.Document {
user_id: string;
token: string;
devicePlatform?: string;
deviceYear?: string;
systemVersion?: string;
}
const schema = new mongoose.Schema<DeviceTokenDocument>(
{
user_id: {
type: String,
required: true
},
token: {
type: String,
required: true
},
devicePlatform: {
type: String
},
deviceName: {
type: String
},
deviceYear: {
type: String
},
systemVersion: {
type: String
}
},
{ versionKey: false }
);
schema.index({ user_id: 1 });
export default mongoose.model<DeviceTokenDocument>('DeviceToken', schema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment