Skip to content

Commit 060ba5b

Browse files
committed
Update
1 parent 9398fcb commit 060ba5b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/[username]/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ const page = async ({ params: { username } }) => {
4545
try {
4646
await connectDb();
4747
await RecentProfiles.findOneAndUpdate(
48-
{ username: userInfo.username.toLowerCase() },
48+
{ username },
4949
{
5050
name: userInfo.name ?? userInfo.username,
51-
username: userInfo.username.toLowerCase(),
51+
username: userInfo.username,
5252
following: userInfo.following.totalCount,
5353
followers: userInfo.followers.totalCount,
5454
avatarUrl: userInfo.avatarUrl,

models/RecentProfiles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import mongoose from 'mongoose';
33
const RecentProfilesSchema = new mongoose.Schema(
44
{
55
name: { type: String },
6-
username: { type: String, required: true, unique: true },
6+
username: { type: String, required: true, unique: true, lowercase: true, trim: true },
77
following: { type: String, required: true },
88
followers: { type: String, required: true },
99
avatarUrl: { type: String, required: true },
1010
},
1111
{ timestamps: true },
1212
);
1313

14-
export default mongoose.models.RecentProfiles || mongoose.model('RecentProfiles', RecentProfilesSchema);
14+
export default mongoose.models.RecentProfiles || mongoose.model('RecentProfiles', RecentProfilesSchema);

0 commit comments

Comments
 (0)