-
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.
Merge pull request #25 from imrashb/feat-authentication
feat: Authentication with Firebase, favorites
- Loading branch information
Showing
47 changed files
with
13,530 additions
and
191 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "horairets-a8b7e" | ||
} | ||
} |
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,19 @@ | ||
name: Deploy Firebase Functions | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deploy Firebase Cloud Functions | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
- run: npm i && npm i -g firebase-tools | ||
- run: cd functions && npm i | ||
- run: firebase deploy --token $FIREBASE_TOKEN | ||
env: | ||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} |
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,36 @@ | ||
{ | ||
"emulators": { | ||
"singleProjectMode": true, | ||
"auth": { | ||
"port": 9099 | ||
}, | ||
"ui": { | ||
"enabled": true | ||
}, | ||
"firestore": { | ||
"port": 9098 | ||
}, | ||
"functions": { | ||
"port": 9100 | ||
} | ||
}, | ||
"functions": [ | ||
{ | ||
"source": "functions", | ||
"codebase": "default", | ||
"ignore": [ | ||
"node_modules", | ||
".git", | ||
"firebase-debug.log", | ||
"firebase-debug.*.log" | ||
], | ||
"predeploy": [ | ||
"npm --prefix \"$RESOURCE_DIR\" run lint" | ||
] | ||
} | ||
], | ||
"firestore": { | ||
"rules": "firestore.rules", | ||
"indexes": "firestore.indexes.json" | ||
} | ||
} |
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,4 @@ | ||
{ | ||
"indexes": [], | ||
"fieldOverrides": [] | ||
} |
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,9 @@ | ||
rules_version = '2'; | ||
service cloud.firestore { | ||
match /databases/{database}/documents { | ||
match /users/{userId} { | ||
allow read, write: if request.auth != null && request.auth.uid == userId; | ||
} | ||
|
||
} | ||
} |
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,28 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
"ecmaVersion": 2018, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"google", | ||
], | ||
rules: { | ||
"no-restricted-globals": ["error", "name", "length"], | ||
"prefer-arrow-callback": "error", | ||
"quotes": ["error", "double", { "allowTemplateLiterals": true }], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["**/*.spec.*"], | ||
env: { | ||
mocha: true, | ||
}, | ||
rules: {}, | ||
}, | ||
], | ||
globals: {}, | ||
}; |
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 @@ | ||
node_modules/ |
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,27 @@ | ||
const functions = require("firebase-functions"); | ||
const admin = require("firebase-admin"); | ||
|
||
admin.initializeApp(); | ||
|
||
exports.createUser = functions.auth.user().onCreate((user) => { | ||
const firestore = admin.firestore(); | ||
const document = firestore.collection("users").doc(user.uid); | ||
const data = { | ||
uid: user.uid, | ||
}; | ||
return document.set(data); | ||
}); | ||
|
||
exports.deleteUser = functions.auth.user().onDelete((user) => { | ||
const firestore = admin.firestore(); | ||
const document = firestore.collection("users").doc(user.uid); | ||
return document.delete(); | ||
}); | ||
|
||
// // Create and deploy your first functions | ||
// // https://firebase.google.com/docs/functions/get-started | ||
// | ||
// exports.helloWorld = functions.https.onRequest((request, response) => { | ||
// functions.logger.info("Hello logs!", {structuredData: true}); | ||
// response.send("Hello from Firebase!"); | ||
// }); |
Oops, something went wrong.