20260607 - login, add scene, add hotspot
This commit is contained in:
@@ -37,6 +37,28 @@ const sceneSchema = new mongoose.Schema({
|
||||
sharedWith: [{
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
}],
|
||||
hotspots: [{
|
||||
pitch: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
yaw: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
trim: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
trim: true
|
||||
},
|
||||
targetSceneId: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Scene'
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
timestamps: true
|
||||
|
||||
@@ -22,16 +22,15 @@ const userSchema = new mongoose.Schema({
|
||||
});
|
||||
|
||||
// Hash password before saving
|
||||
userSchema.pre('save', async function (next) {
|
||||
userSchema.pre('save', async function () {
|
||||
if (!this.isModified('password')) {
|
||||
return next();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const salt = await bcrypt.genSalt(10);
|
||||
this.password = await bcrypt.hash(this.password, salt);
|
||||
next();
|
||||
} catch (error) {
|
||||
next(error);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user