-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sandbox for user model + fix body bg
- Loading branch information
1 parent
5a27797
commit 9a2e6b4
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './useUserModel' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import mongooseConnect from '../database/mongooseConnect' | ||
import UserModel from '../database/models/User' | ||
|
||
async function getUserById(userId: string) { | ||
try { | ||
await mongooseConnect() | ||
const user = await UserModel.findById(userId) | ||
if (!user) { | ||
throw new Error('User not found') | ||
} | ||
return user | ||
} catch (error) { | ||
console.error('Error fetching user:', error) | ||
throw error | ||
} | ||
} | ||
|
||
getUserById('66f5a0d1d72e444d6a7e01df').then((user) => { | ||
console.log('user:', user) | ||
return | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
:root { | ||
--background-color-light: rgb(255, 255, 255); | ||
--background-color-dark: black; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--background-color: var(--background-color-dark); | ||
} | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
--background-color: var(--background-color-light); | ||
} | ||
} | ||
|
||
body { | ||
background-color: rgb(58, 58, 58); | ||
background-color: var(--background-color); | ||
} |