Fix index issue

This commit is contained in:
John Lyon-Smith
2018-04-13 09:54:53 -07:00
parent bdc80c5b01
commit dc15a4bc60
5 changed files with 63 additions and 39 deletions

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>20180413.0</string>
<string>20180413.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@@ -1,6 +1,6 @@
export const versionInfo = {
version: '1.0.0',
fullVersion: '1.0.0-20180413.0',
fullVersion: '1.0.0-20180413.1',
title: 'Deighton AR System',
copyright: '© 2018, Kingston Software Solutions.',
supportEmail: 'support@kss.us.com',

View File

@@ -1,38 +1,62 @@
import { Schema } from 'mongoose'
import { regExpPattern } from 'regexp-pattern'
import { Schema } from "mongoose"
import { regExpPattern } from "regexp-pattern"
export let userSchema = new Schema({
_id: { type: Schema.Types.ObjectId, required: true, auto: true },
loginToken: { type: String, index: true, unique: true, sparse: true },
passwordHash: {
type: {
hash: String,
salt: String,
keyLength: Number,
hashMethod: String,
iterations: Number
}
export let userSchema = new Schema(
{
_id: { type: Schema.Types.ObjectId, required: true, auto: true },
loginToken: {
type: String,
index: true,
unique: true,
partialFilterExpression: { loginToken: { $type: "string" } },
},
passwordHash: {
type: {
hash: String,
salt: String,
keyLength: Number,
hashMethod: String,
iterations: Number,
},
},
email: {
type: String,
match: regExpPattern.email,
required: true,
index: true,
unique: true,
},
newEmail: { type: String, match: regExpPattern.email },
thumbnailImageId: { type: Schema.Types.ObjectId },
emailToken: {
type: {
value: {
type: String,
index: true,
unique: true,
partialFilterExpression: { emailToken: { $type: "string" } },
},
created: Date,
},
},
passwordToken: {
type: {
value: {
type: String,
index: true,
unique: true,
partialFilterExpression: { passwordToken: { $type: "string" } },
},
created: Date,
},
},
firstName: { type: String, required: true },
lastName: { type: String, required: true },
administrator: { type: Boolean, required: true },
team: Schema.Types.ObjectId,
},
email: { type: String, match: regExpPattern.email, required: true, index: true, unique: true },
newEmail: { type: String, match: regExpPattern.email },
thumbnailImageId: { type: Schema.Types.ObjectId },
emailToken: {
type: {
value: { type: String, index: true, unique: true, sparse: true },
created: Date
}
},
passwordToken: {
type: {
value: { type: String, index: true, unique: true, sparse: true },
created: Date
}
},
firstName: { type: String, required: true },
lastName: { type: String, required: true },
administrator: { type: Boolean, required: true },
team: Schema.Types.ObjectId,
}, { timestamps: true, id: false })
{ timestamps: true, id: false }
)
userSchema.methods.toClient = function(authUser) {
if (!authUser) {
@@ -42,13 +66,13 @@ userSchema.methods.toClient = function(authUser) {
let user = {
_id: this._id,
email: this.email,
emailValidated: (!!this.emailToken !== true),
emailValidated: !!this.emailToken !== true,
imageId: this.imageId,
thumbnailImageId: this.thumbnailImageId,
firstName: this.firstName,
lastName: this.lastName,
administrator: this.administrator,
team: this.team
team: this.team,
}
return user

View File

@@ -16,7 +16,7 @@
minor: 0,
patch: 0,
build: 20180413,
revision: 0,
revision: 1,
sequence: 1,
tz: "America/Los_Angeles",
title: "Deighton AR System",

View File

@@ -1,6 +1,6 @@
export const versionInfo = {
version: '1.0.0',
fullVersion: '1.0.0-20180413.0',
fullVersion: '1.0.0-20180413.1',
title: 'Deighton AR System',
copyright: '© 2018, Kingston Software Solutions.',
supportEmail: 'support@kss.us.com',