summary refs log tree commit diff
path: root/src/db/schemas/userSchema.js
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-05-29 06:17:12 +0200
committerRory& <root@rory.gay>2025-05-29 06:17:12 +0200
commit5ab3cbaa54642ada07085d1e0aa2e984dec1849a (patch)
tree51b7cc22c9db8b0fb290bf6dc1e27d7a695039d5 /src/db/schemas/userSchema.js
parentMove middlewares out of start.js (diff)
downloadnodejs-final-assignment-5ab3cbaa54642ada07085d1e0aa2e984dec1849a.tar.xz
Allow unfree in nix flake, add mongodb-compass to devShell closure, basic mongo attempt, add test register route
Diffstat (limited to 'src/db/schemas/userSchema.js')
-rw-r--r--src/db/schemas/userSchema.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/db/schemas/userSchema.js b/src/db/schemas/userSchema.js
new file mode 100644

index 0000000..eaddb08 --- /dev/null +++ b/src/db/schemas/userSchema.js
@@ -0,0 +1,14 @@ +import { model, Schema } from "mongoose"; + +export const userSchema = new Schema({ + username: { + type: String, + required: true, + unique: true, + trim: true, + }, +}); + +export const User = model("user", userSchema); + +console.log("[MONGODB] User schema initialized successfully!");