Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Endpoint #8

Merged
merged 8 commits into from
Nov 3, 2024
Merged

User Endpoint #8

merged 8 commits into from
Nov 3, 2024

Conversation

kjgilder
Copy link
Collaborator

New user endpoint to add users into the Mongo database. (can adjust the schema as necessary moving forward)

Copy link

gitguardian bot commented Oct 28, 2024

⚠️ GitGuardian has uncovered 7 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14289319 Triggered MongoDB Credentials 5572247 api/src/routes/user.ts View secret
14313940 Triggered MongoDB Credentials 7dd384f api/.env View secret
14289319 Triggered MongoDB Credentials 7dd384f api/.env View secret
14289319 Triggered MongoDB Credentials 8402e02 api/src/routes/workshopid.ts View secret
14289319 Triggered MongoDB Credentials 7b8bd6e api/src/routes/user.ts View secret
14289319 Triggered MongoDB Credentials 7b8bd6e api/src/routes/workshop.ts View secret
14289319 Triggered MongoDB Credentials 5d4099f api/.env View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

api/.env Outdated
@@ -1 +1 @@
MONGO_URI=mongodb+srv://User2:[email protected].mongodb.net/FlatFairDB?retryWrites=true&w=majority&appName=Bare-Bones
MONGO_URI=mongodb+srv://kjgilder:[email protected].mongodb.net/?retryWrites=true&w=majority&appName=PWWUsers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventually we will wanna switch to a DB they own but for now this is great

api/package.json Outdated
@@ -2,11 +2,11 @@
"name": "api",
"version": "1.0.0",
"description": "",
"main": "src/index.ts",
"main": "src/index.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait did we change it to js

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we changed it to ts, whats in main for this file is how it should be

Copy link
Collaborator

@lolitaroz lolitaroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great to me! awesome job! one thing i'll say is that idk abt changing the package json to look at javascript rather than typescript, let's wait for @charlotteconze to look at it too and we can merge!!

api/package.json Outdated
@@ -2,11 +2,11 @@
"name": "api",
"version": "1.0.0",
"description": "",
"main": "src/index.ts",
"main": "src/index.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we changed it to ts, whats in main for this file is how it should be

const mongoURI = "mongodb+srv://kjgilder:[email protected]/?retryWrites=true&w=majority&appName=PWWUsers"
mongoose.connect(mongoURI)
.then(() => console.log("Connected to MongoDB"))
.catch((error) => console.error("Failed to connect to MongoDB:", error))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import dbConnect from "./config/dbConnect"
dbConnect()

using this will remove the need for this code because its already in /config/dbConnect

"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"moduleResolution": "node",
"typeRoots": ["./node_modules/@types"]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is fine? idk what it does

@lolitaroz
Copy link
Collaborator

looks good, we should probably not push the .env file though and instead text each other the API keys

Copy link
Collaborator

@lolitaroz lolitaroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome !!!

@lolitaroz lolitaroz merged commit 74ff905 into main Nov 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants