-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from BUMETCS673/hw97_update_db_ids_numeric
Change ID schemas to be numeric instead of string
- Loading branch information
Showing
2 changed files
with
17 additions
and
8 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 |
---|---|---|
|
@@ -12,17 +12,25 @@ async function init() { | |
// await Goal.deleteMany({}) | ||
|
||
let goal1 = new Goal({ | ||
goalId: "G10001", | ||
goalId: 50001, | ||
type: "sleep", | ||
targetValue: 8, | ||
unit: "hours", | ||
createdAt: "2024-09-10", | ||
progress: [{date: new Date("2024-09-11"), value: 7.5}, | ||
{date: new Date("2024-09-12"), value: 8}] | ||
}) | ||
|
||
let goal2 = new Goal({ | ||
goalId: 50002, | ||
type: "steps", | ||
targetValue: 9000, | ||
unit: "steps", | ||
// will use defaults for createdAt and progress | ||
}) | ||
|
||
let user1 = new User({ | ||
userId: "U10001", | ||
userId: 10001, | ||
email: "[email protected]", | ||
passwordHashed: "pa55w0rd", | ||
name: "John Smith", | ||
|
@@ -31,7 +39,7 @@ async function init() { | |
}) | ||
|
||
let user2 = new User({ | ||
userId: "U10002", | ||
userId: 10002, | ||
email: "[email protected]", | ||
passwordHashed: "b0st0nuniversity", | ||
name: "Jane Doe", | ||
|
@@ -42,7 +50,8 @@ async function init() { | |
await Promise.all([ | ||
user1.save(), | ||
user2.save(), | ||
goal1.save() | ||
goal1.save(), | ||
goal2.save() | ||
]) | ||
|
||
let users = await User.find({}) | ||
|