Created
March 5, 2020 18:34
-
-
Save bogoslavskiy/3caba751cfdcfa4e07cbd464fc9503e9 to your computer and use it in GitHub Desktop.
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
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