-
Notifications
You must be signed in to change notification settings - Fork 5
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 #52 from feliciagan/profilepic
- Loading branch information
Showing
21 changed files
with
1,810 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
coverage | ||
node_modules | ||
tests | ||
.env* | ||
|
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
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 |
---|---|---|
|
@@ -14,5 +14,11 @@ ADMIN_USERNAME=administrator | |
ADMIN_EMAIL=[email protected] | ||
ADMIN_PASSWORD=Admin@123 | ||
|
||
# firebase | ||
FIREBASE_PROJECT_ID=FIREBASE_PROJECT_ID | ||
FIREBASE_PRIVATE_KEY=FIREBASE_PRIVATE_KEY | ||
FIREBASE_CLIENT_EMAIL=FIREBASE_CLIENT_EMAIL | ||
FIREBASE_STORAGE_BUCKET=FIREBASE_STORAGE_BUCKET | ||
|
||
# origins for cors | ||
ORIGINS=http://localhost:5173,http://127.0.0.1:5173 |
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,12 +1,12 @@ | ||
# User Service Guide | ||
|
||
> If you have not set-up either a local or cloud MongoDB, go [here](../) first before proceding. | ||
> If you have not set-up either a local or cloud MongoDB, as well as Firebase, go [here](../) first before proceding. | ||
## Setting-up | ||
|
||
1. In the `user-service` directory, create a copy of the `.env.sample` file and name it `.env`. | ||
|
||
2. Update `MONGO_CLOUD_URI`, `MONGO_LOCAL_URI`, `JWT_SECRET`. | ||
2. Update `MONGO_CLOUD_URI`, `MONGO_LOCAL_URI`, `FIREBASE_PROJECT_ID`, `FIREBASE_PRIVATE_KEY`, `FIREBASE_CLIENT_EMAIL`, `FIREBASE_STORAGE_BUCKET`, `JWT_SECRET`. | ||
|
||
3. A default admin account (`email: [email protected]` and `password: Admin@123`) wil be created. If you wish to change the default credentials, update them in `.env`. Alternatively, you can also edit your credentials and user profile after you have created the default account. | ||
|
||
|
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,14 @@ | ||
import admin from "firebase-admin"; | ||
|
||
admin.initializeApp({ | ||
credential: admin.credential.cert({ | ||
projectId: process.env.FIREBASE_PROJECT_ID, | ||
privateKey: process.env.FIREBASE_PRIVATE_KEY?.replace(/\\n/g, "\n"), | ||
clientEmail: process.env.FIREBASE_CLIENT_EMAIL, | ||
} as admin.ServiceAccount), | ||
storageBucket: process.env.FIREBASE_STORAGE_BUCKET, | ||
}); | ||
|
||
const bucket = admin.storage().bucket(); | ||
|
||
export { bucket }; |
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,6 @@ | ||
import multer from "multer"; | ||
|
||
const storage = multer.memoryStorage(); | ||
const upload = multer({ storage }).single("profilePic"); | ||
|
||
export { upload }; |
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
Oops, something went wrong.