Skip to content

Commit c4af2d5

Browse files
authored
Feat: Init cloud functions (#547)
* feat(functions): initialize Firebase Cloud Functions * chore: run formatter * fix(functions): update logic to ascending-sort ordering * docs: add and update READMEs * fix(README): fix formatting * fix(README): fix inline notes formatting * chore: run formatter
1 parent 6c0e2c0 commit c4af2d5

File tree

23 files changed

+4041
-2240
lines changed

23 files changed

+4041
-2240
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"dbaeumer.vscode-eslint",
2323
"esbenp.prettier-vscode",
2424
"oderwat.indent-rainbow",
25-
"mhutchie.git-graph"
25+
"mhutchie.git-graph",
26+
"kenomaru.thunder"
2627
]
2728
}
2829
},

.github/labeler.yml

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
# Add 'root' label to any root file changes
2-
# Quotation marks are required for the leading asterisk
3-
root:
4-
- changed-files:
5-
- any-glob-to-any-file: '*'
6-
7-
# Add 'Documentation' label to any change to .md files within the entire repository
8-
Documentation:
9-
- changed-files:
10-
- any-glob-to-any-file: '**/*.md'
11-
12-
# Add 'source' label to any change to src files within the source dir
13-
source:
14-
- all:
15-
- changed-files:
16-
- any-glob-to-any-file: 'src/**/*'
17-
18-
# Add 'pages' label to any changes within the entire repository
19-
pages:
20-
- changed-files:
21-
- any-glob-to-any-file: 'pages/**/*'
22-
23-
# Add 'public' label to any changes within the entire repository
24-
public:
25-
- changed-files:
26-
- any-glob-to-any-file: 'public/**/*'
27-
28-
# Add 'globals' label to any changes within the entire repository
29-
globals:
30-
- changed-files:
31-
- any-glob-to-any-file: 'globals/**/*'
32-
33-
# Add 'firebase' label to any changes within the entire repository
34-
firebase:
35-
- changed-files:
36-
- any-glob-to-any-file: 'firebase/**/*'
37-
38-
# Add 'context' label to any changes within the entire repository
39-
context:
40-
- changed-files:
41-
- any-glob-to-any-file: 'context/**/*'
42-
43-
# Add 'workflows' label to any changes within the entire repository
44-
workflows:
45-
- changed-files:
46-
- any-glob-to-any-file: '.github/**/*'
47-
48-
# Add 'devcontainer' label to any changes within the entire repository
49-
devcontainer:
50-
- changed-files:
51-
- any-glob-to-any-file: '.devcontainer/**/*'
52-
53-
# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
54-
feature:
55-
- head-branch: ['^feature', 'feature']
56-
57-
# Add 'release' label to any PR that is opened against the `main` branch
58-
release:
59-
- base-branch: 'main'
1+
# Add 'root' label to any root file changes
2+
# Quotation marks are required for the leading asterisk
3+
root:
4+
- changed-files:
5+
- any-glob-to-any-file: '*'
6+
7+
# Add 'Documentation' label to any change to .md files within the entire repository
8+
Documentation:
9+
- changed-files:
10+
- any-glob-to-any-file: '**/*.md'
11+
12+
# Add 'source' label to any change to src files within the source dir
13+
source:
14+
- all:
15+
- changed-files:
16+
- any-glob-to-any-file: 'src/**/*'
17+
18+
# Add 'pages' label to any changes within the entire repository
19+
pages:
20+
- changed-files:
21+
- any-glob-to-any-file: 'pages/**/*'
22+
23+
# Add 'public' label to any changes within the entire repository
24+
public:
25+
- changed-files:
26+
- any-glob-to-any-file: 'public/**/*'
27+
28+
# Add 'globals' label to any changes within the entire repository
29+
globals:
30+
- changed-files:
31+
- any-glob-to-any-file: 'globals/**/*'
32+
33+
# Add 'firebase' label to any changes within the entire repository
34+
firebase:
35+
- changed-files:
36+
- any-glob-to-any-file: 'firebase/**/*'
37+
38+
# Add 'context' label to any changes within the entire repository
39+
context:
40+
- changed-files:
41+
- any-glob-to-any-file: 'context/**/*'
42+
43+
# Add 'workflows' label to any changes within the entire repository
44+
workflows:
45+
- changed-files:
46+
- any-glob-to-any-file: '.github/**/*'
47+
48+
# Add 'devcontainer' label to any changes within the entire repository
49+
devcontainer:
50+
- changed-files:
51+
- any-glob-to-any-file: '.devcontainer/**/*'
52+
53+
# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
54+
feature:
55+
- head-branch: ['^feature', 'feature']
56+
57+
# Add 'release' label to any PR that is opened against the `main` branch
58+
release:
59+
- base-branch: 'main'

.github/workflows/greetings.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Greetings
2-
3-
on: [pull_request_target, issues]
4-
5-
jobs:
6-
greeting:
7-
runs-on: ubuntu-latest
8-
permissions:
9-
issues: write
10-
pull-requests: write
11-
steps:
12-
- uses: actions/first-interaction@v1
13-
with:
14-
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
issue-message: "Congratulations on your first issue! We will look into it!"
16-
pr-message: "Congratulations on your first PR! We will be reviewing it! "
1+
name: Greetings
2+
3+
on: [pull_request_target, issues]
4+
5+
jobs:
6+
greeting:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
steps:
12+
- uses: actions/first-interaction@v1
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
issue-message: 'Congratulations on your first issue! We will look into it!'
16+
pr-message: 'Congratulations on your first PR! We will be reviewing it! '

.github/workflows/label.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
# This workflow will triage pull requests and apply a label based on the
2-
# paths that are modified in the pull request.
3-
#
4-
# To use this workflow, you will need to set up a .github/labeler.yml
5-
# file with configuration. For more information, see:
6-
# https://github.com/actions/labeler
7-
8-
name: Labeler
9-
on: [pull_request_target]
10-
11-
jobs:
12-
label:
13-
14-
runs-on: ubuntu-latest
15-
permissions:
16-
contents: read
17-
pull-requests: write
18-
19-
steps:
20-
- name: Checkout code
21-
uses: actions/checkout@v4
22-
- name: Add label
23-
uses: actions/labeler@v5
24-
with:
25-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
1+
# This workflow will triage pull requests and apply a label based on the
2+
# paths that are modified in the pull request.
3+
#
4+
# To use this workflow, you will need to set up a .github/labeler.yml
5+
# file with configuration. For more information, see:
6+
# https://github.com/actions/labeler
7+
8+
name: Labeler
9+
on: [pull_request_target]
10+
11+
jobs:
12+
label:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
- name: Add label
22+
uses: actions/labeler@v5
23+
with:
24+
repo-token: '${{ secrets.GITHUB_TOKEN }}'

.github/workflows/stale.yml

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
1-
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2-
#
3-
# You can adjust the behavior by modifying this file.
4-
# For more information, see:
5-
# https://github.com/actions/stale
6-
name: Mark stale issues and pull requests
7-
8-
on:
9-
schedule:
10-
- cron: '36 0 * * *'
11-
12-
jobs:
13-
stale:
14-
15-
runs-on: ubuntu-latest
16-
permissions:
17-
issues: write
18-
pull-requests: write
19-
20-
steps:
21-
- uses: actions/stale@v9
22-
with:
23-
repo-token: ${{ secrets.GITHUB_TOKEN }}
24-
stale-issue-label: 'no-issue-activity'
25-
stale-pr-label: 'no-pr-activity'
26-
exempt-issue-labels: Not Stale
27-
exempt-pr-labels: Not Stale
28-
stale-issue-message: >
29-
This issue is stale because it has been open for 60 days with no
30-
activity.
31-
stale-pr-message: >
32-
This pull request is stale because it has been open for 60 days
33-
with no activity.
34-
days-before-close: -1
1+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2+
#
3+
# You can adjust the behavior by modifying this file.
4+
# For more information, see:
5+
# https://github.com/actions/stale
6+
name: Mark stale issues and pull requests
7+
8+
on:
9+
schedule:
10+
- cron: '36 0 * * *'
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
19+
steps:
20+
- uses: actions/stale@v9
21+
with:
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
stale-issue-label: 'no-issue-activity'
24+
stale-pr-label: 'no-pr-activity'
25+
exempt-issue-labels: Not Stale
26+
exempt-pr-labels: Not Stale
27+
stale-issue-message: >
28+
This issue is stale because it has been open for 60 days with no
29+
activity.
30+
stale-pr-message: >
31+
This pull request is stale because it has been open for 60 days
32+
with no activity.
33+
days-before-close: -1

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ yarn build
8181
yarn dev
8282
```
8383

84-
***Note***: A cloud-based Firebase project must still exist in order to run the emulator locally in this manner. Simply create a blank/empty [Firebase](https://firebase.google.com/) project using a Google account for this purpose, and then populate file `website/.env` accordingly with corresponding API key and project information from Firebase (see `website/example.env` for additional reference, as well as `website/__seed__/README.md` for more information regarding seeding a cloud-based Firebase Firestore database).
84+
> [!NOTE]
85+
> A cloud-based Firebase project must still exist in order to run the emulator locally in this manner. Simply create a blank/empty [Firebase](https://firebase.google.com/) project using a Google account for this purpose, and then populate file `website/.env` accordingly with corresponding API key and project information from Firebase (see `website/example.env` for additional reference, as well as `website/__seed__/README.md` for more information regarding seeding a cloud-based Firebase Firestore database).
8586
8687
Open `http://localhost:3000` with your browser to see the result. The local data will be seeded from scratch. Furthermore, you can use the local auth service by simply logging in via any of the provided services (e.g., Google) with auto-generated credentials, which will simulate a logged in user account.
8788

__seed__/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ recentsData
1515
1616
reviewsData
1717
/{courseId}
18-
/{year}-{SemesterTerm}/data: <TPayloadReviews>
18+
/{year}-{SemesterTerm}
19+
/data: <TPayloadReviews>
1920
2021
usersData
2122
/{userId}: <User>
2223
```
23-
24-
***N.B.*** The canonical path format for Firebase Firestore is `{collectionName}/{documentId}/{subCollectionName}/{subDocumentId}/...` and so on, with the path terminating at a (sub)document.
24+
> [!NOTE]
25+
> The canonical path format for Firebase Firestore is `{collectionName}/{documentId}/{subCollectionName}/{subDocumentId}/...` and so on, with the path terminating at a (sub)document.
2526
2627
## Seeding a Firebase project
2728

28-
***Note***: All paths indicated in this section are relative to the top-level directory (i.e., `website`). Furthermore, all commands (i.e., `yarn ...`) should also be issued from the top-level directory accordingly.
29+
> [!NOTE]
30+
> All paths indicated in this section are relative to the top-level directory (i.e., `website`). Furthermore, all commands (i.e., `yarn ...`) should also be issued from the top-level directory accordingly.
2931
3032
### Seeding or updating a cloud Firebase project
3133

@@ -35,7 +37,8 @@ To seed the data in a development cloud-based Firebase Firestore database, defin
3537
yarn fb:seed-db-cloud
3638
```
3739

38-
***NOTE***: Do **NOT** use this method in **production**!!! Production Firebase database must be updated manually via the Firebase UI/console; otherwise, this seeding approach will wipe all of the live data **without** ability to recover it!
40+
> [!WARNING]
41+
> Do **NOT** use this method in **production**!!! Production Firebase database must be updated manually via the Firebase UI/console; otherwise, this seeding approach will wipe all of the live data **without** ability to recover it!
3942
4043
### Seeding or updating local *Firebase Emulator Suite*
4144

@@ -78,7 +81,8 @@ This will update the corresponding files in directory `/__seed__/firebase-seed`.
7881

7982
## Adding a new course
8083

81-
***Note***: All paths indicated here are relative to the top-level directory (i.e., `website`).
84+
> [!NOTE]
85+
> All paths indicated here are relative to the top-level directory (i.e., `website`).
8286
8387
To add a new course, update the following files:
8488

0 commit comments

Comments
 (0)