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> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>20180413.0</string> <string>20180413.1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>

View File

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

View File

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

View File

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

View File

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