Skip to content

Commit

Permalink
Merge pull request #4 from Wilcolab/user-features
Browse files Browse the repository at this point in the history
User-features
  • Loading branch information
PetrAhtimirov authored Jan 9, 2025
2 parents 3765cd7 + 61b9df0 commit f206af7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ var UserSchema = new mongoose.Schema(
favorites: [{ type: mongoose.Schema.Types.ObjectId, ref: "Item" }],
following: [{ type: mongoose.Schema.Types.ObjectId, ref: "User" }],
hash: String,
salt: String
salt: String,
isVerified: {
type: Boolean,
default: false
}
},
{ timestamps: true }
);
Expand Down Expand Up @@ -75,7 +79,8 @@ UserSchema.methods.toAuthJSON = function() {
token: this.generateJWT(),
bio: this.bio,
image: this.image,
role: this.role
role: this.role,
isVerified: this.isVerified
};
};

Expand All @@ -85,7 +90,8 @@ UserSchema.methods.toProfileJSONFor = function(user) {
bio: this.bio,
image:
this.image || "https://static.productionready.io/images/smiley-cyrus.jpg",
following: user ? user.isFollowing(this._id) : false
following: user ? user.isFollowing(this._id) : false,
isVerified: this.isVerified
};
};

Expand Down

0 comments on commit f206af7

Please sign in to comment.