From 397158699a91b32bd1311d2ff9950f39a7676c3c Mon Sep 17 00:00:00 2001 From: Swetha Charles Date: Tue, 6 Dec 2022 20:11:01 +0000 Subject: [PATCH 01/22] Update README with volunteer form --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c165f76..3d1978f 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A [NestJS](https://nestjs.com/) API server with [Jest](https://jestjs.io/) testing. +If you'd like to help Chayn by tackling any of our open Github issues, please get in touch with us to express your interest in volunteering via [this form](https://forms.gle/qXfDdPgJxYwvMmVP7). We'll get back to you to schedule an onboarding call. + ## Development Note: if you just want to run the backend service locally and not do any development work on it, you can instead skip to the section on how to run it in a Docker container. From 09c546c9a9a228ffc797a317e12edd31a96c0583 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:22:04 -0400 Subject: [PATCH 02/22] Update README.md --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d1978f..0c27c4b 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,17 @@ ![GitHub Actions CI workflow badge](https://github.com/chaynHQ/ysm-backend/workflows/YSM%20Backend%20CI%20pipeline/badge.svg) -A [NestJS](https://nestjs.com/) API server with [Jest](https://jestjs.io/) testing. +Your Story Matters (YSM) is a digital companion for survivors of sexual assault launched in 2019. Formerly called YANA (You Are Not Alone) and funded by Nesta and the UK Department of Digital, Culture, Media and Sport through the Tech to Connect Challenge, YSM has curated content including recovery, moving through trauma, accessing justice through the law, stories of resilience, and allows survivors the option to create an account and save their journey. + +**Currently in active development.** + +## Support Us + +YSM is created by Chayn a global volunteer network with over 400 volunteers from 15 countries. If you like what you see and you want to join our team of volunteers get in touch. Or you can [donate](https://www.paypal.me/chaynhq); all proceeds go to improving YSM and building more tools and resources at ChaynHQ. -If you'd like to help Chayn by tackling any of our open Github issues, please get in touch with us to express your interest in volunteering via [this form](https://forms.gle/qXfDdPgJxYwvMmVP7). We'll get back to you to schedule an onboarding call. +# YSM Backend + +A [NestJS](https://nestjs.com/) API server with [Jest](https://jestjs.io/) testing. ## Development From 53a5bab267819b5e694e0200b0feed03ca256d26 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Wed, 30 Aug 2023 19:13:33 -0400 Subject: [PATCH 03/22] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01daaa6..0989c19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: test-and-build: name: 'Test and build' - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest defaults: run: From d71c9efff8cca10777ec864df85698e9ebad3d87 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:30:52 -0400 Subject: [PATCH 04/22] Create SECURITY.md Add security policy --- SECURITY.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..f5aac1c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,26 @@ +# Chayn Security Policy + +## Report a Vulnerability + +To report a security issue, please email techcommunity@chayn.co with the following information: + +1. **The Chayn product** with the vulnerability. +2. **A short summary of the problem.** Make the impact and severity as clear as possible. For example: An unsafe deserialization vulnerability allows any unauthenticated user to execute arbitrary code on the server. +3. Complete instructions, including specific configuration details, to **reproduce the vulnerability.** + + Optional information to include if applicable: +- Propose a remediation suggestion if you have one. Make it clear that this is just a suggestion, as the maintainer might have a better idea to fix the issue. +- Credit: List all researchers who contributed to this disclosure. If you found the vulnerability with a specific tool, you can also credit this tool. +- Contact information for further collaboration. If the vulernerability is accepted, we will be happy to collaborate with you, and review your fix to make sure that all corner cases are covered. + +You will receive an email from us confirming we have received your bug report. + +## Disclosure Policy + +Chayn is dedicated to working closely with the open source community and with projects that are affected by a vulnerability, in order to protect users and ensure a coordinated disclosure. + +If the project team responds and agrees the issue poses a security risk, we will work with the project security team or maintainers to communicate the vulnerability in detail, and agree on the process for public disclosure. Responsibility for developing and releasing a patch lies firmly with the project team, though we aim to facilitate this by providing detailed information about the vulnerability. + +Our disclosure deadline for publicly disclosing a vulnerability is: 90 days after the first report to the project team. + +We **appreciate the hard work** contributors and maintainers put into fixing vulnerabilities and understand that sometimes more time is required to properly address an issue. We want project maintainers and contributors to succeed and because of that we are always open to discuss our disclosure policy to fit your specific requirements, when warranted. From 69a10f8b78a8b3e4c039d619d9364486fc193347 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:31:46 -0400 Subject: [PATCH 05/22] Update issue templates Add blank issue, feature request, and bug report issue templates. --- .../ISSUE_TEMPLATE/blank-issue-template.md | 19 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/blank-issue-template.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/blank-issue-template.md b/.github/ISSUE_TEMPLATE/blank-issue-template.md new file mode 100644 index 0000000..90f2b35 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank-issue-template.md @@ -0,0 +1,19 @@ +--- +name: Blank Issue Template +about: The standard issue template for Chayn +title: '' +labels: '' +assignees: '' + +--- + +### Overview +Clearly state the purpose of this issue, ideally in 2 sentences or less. +For example: *_We need to do X for Y reason._* + +### Action Items +List research to be done or the steps to be completed. +Note: If the steps can be divided into tasks for more than one person, we recommend dividing it up into separate issues, or assigning it as a pair programming task. + +### Resources +Provide links to resources that may help solve or better understand with this issue. This can include external sites with solutions, documentation, etc. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..97eb6e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,18 @@ +--- +name: Feature request +about: Suggest an idea +title: '' +labels: '' +assignees: '' + +--- + +### Is your feature request related to a problem? +Please provide a clear and concise description of what the problem is. +*Ex. I'm always frustrated when [...]* + +### Describe a solution: +If applicable, please a detailed description of what you want to see or build to fix the problem. Include who wants it (e.g. yourself, a survivor, volunteer, developer, organization, etc.), and what value you think this will bring. + +### Additional context and resources: +Add any other context, documents, links, screenshots about the feature request here. Please be detailed! From 37b77f5e322be584ea6aa37250b869860aacd931 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:41:12 -0400 Subject: [PATCH 06/22] Update issue templates with bug report template Add bug report issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..7e77003 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. +*Please do not report security vulnerabilities here. To report security vulnerabilities, please follow our Security Policy instructions:* https://github.com/chaynHQ/ysm-backend/security/policy + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. From 4bf5417f9355fd5e9f9ffa26c3f34a48c2494b90 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:45:55 -0400 Subject: [PATCH 07/22] Add CODE_OF_CONDUCT.md Add Code of Conduct file, as noted in this issue: https://github.com/chaynHQ/ysm-backend/issues/70 --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..3737188 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +techcommunity@chayn.co. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From 76308a3ac04969e001fa39ccd2569d47289258ec Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Tue, 10 Oct 2023 20:38:59 -0400 Subject: [PATCH 08/22] Update README.md New Getting Involved section which channels interested volunteers to our Getting Involved Guide, and removes link to outdated tech volunteer form --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c27c4b..7ce79d9 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,22 @@ Your Story Matters (YSM) is a digital companion for survivors of sexual assault **Currently in active development.** -## Support Us +## Get Involved + +If you would like to help Chayn and receive special access to our organization and volunteer opportunities, please [visit our Getting Involved guide](https://chayn.notion.site/Get-involved-423c067536f3426a88005de68f0cab19). We'll get back to you to schedule an onboarding call. Other ways to get involved and support us are [donating](https://www.paypal.me/chaynhq), starring this repo and making an open-source contribution here on GitHub, and supporting us on social media! + +Our social medias: + +Website - [Chayn](https://www.chayn.co/) + +Twitter - [@ChaynHQ](https://twitter.com/ChaynHQ) + +Instagram - [@chaynhq](https://www.instagram.com/chaynhq/) + +Youtube - [Chayn Team](https://www.youtube.com/channel/UC5_1Ci2SWVjmbeH8_USm-Bg) + +LinkedIn - [@chayn](https://www.linkedin.com/company/chayn) -YSM is created by Chayn a global volunteer network with over 400 volunteers from 15 countries. If you like what you see and you want to join our team of volunteers get in touch. Or you can [donate](https://www.paypal.me/chaynhq); all proceeds go to improving YSM and building more tools and resources at ChaynHQ. # YSM Backend From 76cfee3d4818ac4bb7a1e0186a090ad73b8404cd Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:45:05 -0400 Subject: [PATCH 09/22] Create CONTRIBUTING.md --- CONTRIBUTING.md | 169 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5b4d3cd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,169 @@ +# How to Contribute to Chayn ⭐ + +First off, thank you so much for taking the time to contribute! + +We ❀️ our contributors! + +While Chayn is hybrid between paid staff and volunteers now, we cherish our volunteers for helping to create Chayn and keep us going! We hope to give back more than our contributors give. Please do not hesitate to give us feedback, so we can learn how to make this experience better for you. 😊 You can include feedback in your pull request, GitHub issue, or [this anonymous form](https://forms.gle/17GQpeHc4G1Mgdf3A). + +**This guide below assumes you are an open-source contributor and NOT an official Chayn volunteer that has already completed the onboarding process. If you would like to become an official tech volunteer with Chayn, please [visit our Getting Involved Guide](https://www.notion.so/chayn/Get-involved-423c067536f3426a88005de68f0cab19?pvs=4). As an official Chayn volunteer, you will receive professional onboarding onto our platforms and more opportunities to volunteer outside of GitHub contributions!** + +Next, let's get started... πŸŽ‰ + +# New Contributor Guide + +If you are new to GitHub and git version control, here are some resources to help you get started: + +- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github) +- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git) +- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) +- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests) + +## What kind of contributions does Chayn want? + +Chayn is open to all kinds of contributions, such as: + +- no-code (improved documentation and translations) +- additional software tests +- code of any kind (enhancements, new features, maintenance) + +Just no spamming (such as unwanted, minor documentation and HTML/CSS changes) please! + +# The Contribution Process: +### Contribution Process Outline: +1. [Read the README and Code of Conduct](#1-read-the-readme-and-code-of-conduct) +2. [Claim an Issue](#2-claim-an-issue) +3. [Fork the Repo and Create a New Branch](#3-fork-the-repo-and-create-a-new-branch) +4. [Commit Changes Using Open-Source Standards](#4-commit-changes-using-open-source-standards) +5. [Sync Fork if Needed](#5-sync-your-fork-if-needed) +6. [Push Changes to GitHub](#6-push-changes-to-github) +7. [Make a Pull Request to Chayn](#7--make-a-pull-request-to-chayn) + +## 1. **Read the README and Code of Conduct:**. +To learn the foundations of the project, please read the project's [README](/README.md). Contributing means you have agreed to our [Code of Conduct](/CODE_OF_CONDUCT.md) + +**Note: If you are making no-code changes in the README or any other markdown / text files, it may not be required to follow all of these steps in our Contributing Guide. Instead, you may edit these files and submit a PR directly in GitHub, without setting up environment variables and or requiring tests to pass in your fork.** + +## 2. **Claim an Issue:** +**Please ask to be assigned an issue, this helps us keep track of contributor progress. We may deny your PR if the issue is already assigned to someone who asked.** + - **If creating an issue:** + Check that your issue doesn't already exist and follow our issue templates for creating new issues. + - **If contributing to an existing issue:** + Please comment on it asking for the issue to be assigned to you. + +**Check Issue Labels:** + - Scan our issue `labels` to find issues that suit you: + - The `good first issue` label is for problems or updates we think are ideal for beginners. + - The `moderate` label is for problems or updates that may take 1-2 days and will require some knowledge of the codebase. + - The `advanced` is for problems or updates that may take more time, say around 2-4 days. These will require more in-depth knowledge of the codebase. + - We suggest starting with a `good first issue` to get comfortable with the codebase before moving on. + +**How We Manage Issues:** + - Issues can be assigned to multiple people if everyone agrees to collaborate! + - Consider if an issue would be best broken up into multiple, smaller issues. If so, feel free to create those issues! + - If an assigned issue is abandoned, we will unassign the issue after tagging you if we receive no response. + - If you can no longer complete an issue you're assigned to, we understand life happens! Please comment on the issue and we will unassign you. + - For complex issues, please report your progress in the issue discussions by tagging the issue author or Chayn maintainer who assigned you, and ticking off the checkboxes in the issue description. + +**If you need more clarifying information about the issue, please tag us (issue author or Chayn maintainer who assigned the issue to you) to ask questions in the issues discussions at any point during your contribution. We are happy to help! You will hear back from us within 3 days, and we are online daily during Hacktober.** + +## 3. **Fork the Repo and Create a New Branch:** + + - Fork the Chayn repo you want to make changes on, then create a new feature branch on your fork. This new branch will be where you make changes. + - Name your new branch with a label (check the issue labels) and description, such as `dependencies/update-node` + - Alternatively, you may name the branch with your GitHub name and descriptive title, such as `chayntech/update-node` +## 4. **Commit Changes Using Open-Source Standards:** +Follow the following open-source standards for structuring and formatting your commits and commit messages: + +**Commit Message Structure:** +- **Commit Title**: (< 50 char) first line is the commit title. This should be capitalized and contain a short, one-line summary. +- Blank line to separate title from body. This ensures β€œgit log” can parse logs correctly. +- **Commit Description**: (< 72 char) explains the **why** of a commit rather than **how.** +- See [link](https://cbea.ms/git-commit/) for more detail on structuring commits. + +**Commit Formatting:** +- To keep commit messages readable, your commit message should wrap text to avoid long, single lines of text. +- Keep commits small and distinct. A PR can have multiple commits, but only if each commit is distinctive and relevant in the PR. +- Check that no secrets and no unwanted, irrelevant files are being commited. Update `.gitignore` as needed. + +## 5. **Sync Your Fork if Needed:** +If the Chayn repo you forked from (the upstream repo) is updated, you will need to pull these changes from upstream before you push. One way to tell if the upstream repo has been updated is if there is a message displayed when viewing your forked repo in GitHub that says something like "This branch is 1 commit behind chayn:bloom-frontend". + +To update your fork, first sync your forked default branch (main, master, or develop branch depending on the project) and then merge those changes into your feature branch. Always make sure that your default branch is up-to-date first before your feature branch. *Note: there are many methods of syncing forks and updating branches, this documentation will focus on the git merging method because rebasing comes with more risks to unintentionally overwriting git history. Please see the additional resources listed at the end of this section for more info.* + +To sync with upstream changes, first sync your default branch by running the commands below or [following this guide on syncing in the GitHub UI](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-branch-from-the-web-ui). +``` +# Add a new remote upstream repository +git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git + +# Verify remote upstream +git remote -v + +# Sync your fork +git fetch upstream + +# Switch to default branch +git checkout main + +# Merge upstream with main branch +git merge upstream/main +``` +Next, merge the updated default branch into your feature branch. + +If you used the GitHub UI to sync the default branch of your remote fork, you will need to `git pull` those changes into your local default branch. Then, merge those changes into your feature branch: +``` +# Checkout default branch +git checkout main + +# Pull changes from your remote +git pull + +# Switch to feature branch +git checkout FEATURE-BRANCH + +# Merge changes in main into feature branch +git merge main +``` +If you used the command line to sync your local forked repo with the upstream repo, switch to your feature branch and merge the updated default branch into it: +``` +# Switch to your feature branch +git checkout FEATURE-BRANCH + +# Merge default branch into feature branch +git merge main +``` +Use `git log` to check that commits have been updated. In your feature branch history, you should see the updated commits pulled from upstream, then your new commit, followed by a merge commit. Please resolve any merge conflicts (resources below) and let us know if you have any questions. + +**Helpful Resources for Updating Forks:** +- [GitHub Docs: About Merge Methods](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/about-merge-methods-on-github) +- [GitHub Docs: Resolving Merge Conflicts on GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-on-github) +- [GitHub Docs: Configuring a Remote Repo for a Fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-repository-for-a-fork) +- [FreeCodeCamp: How to Sync Your Fork with the Original Git Repo](https://www.freecodecamp.org/news/how-to-sync-your-fork-with-the-original-git-repository/) + + +## 6. **Push Changes to GitHub:** +Push your changes to your remote, forked repo. +**Before pushing changes, check for the following:** +- Your change have brief, descriptive code comments explaining your code. +- Check that your tests pass. Note: Some tests may need to be ran multiple times before they pass, thank you for your patience as we are upgrading our app's performance. +- Run our linters on updated files to ensure uniform code formatting. +- Ensure that no secret tokens are being pushed to GitHub! Files containing secrets should be listed in `.gitignore` +- When finished making commits, push your changes to your remote fork branch. + +## 7 . **Make a Pull Request to Chayn:** + + - Make sure to link your corresponding issue in your PR's description and follow the PR templates instructions. + - Include detailed and concise explanations of the changes you made. + - Include images in the description, if applicable. + - Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so a maintainer can update the branch for a merge. + - Be available for discussions that may arise and to make [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) that may be required before merging. + - Once the review has passed, it will merge to the *develop* branch. + - To deploy, look at project readme for project specific instructions. + +### Get merged and celebrate! πŸŽ‰ + +Woohoo! Once your PR is merged, your changes will be public on GitHub! + +Thank you for contributing to Chayn! πŸ‘ + +**If you enjoyed the contributing to Chayn, give our repo a star to help our projects reach more developers like you!** ⭐ From c10884c0980e02b715647f3d02a145e93f7ea875 Mon Sep 17 00:00:00 2001 From: kyleecodes Date: Tue, 17 Oct 2023 21:49:39 -0400 Subject: [PATCH 10/22] Update README: listed required env var vs. optional --- .gitignore | 4 +- .vscode/extensions.json | 8 ---- .vscode/settings.json | 27 ----------- Dockerfile | 4 +- README.md | 100 ++++++++++++++++++++++++++++------------ 5 files changed, 74 insertions(+), 69 deletions(-) delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 8106a43..21b23c4 100644 --- a/.gitignore +++ b/.gitignore @@ -27,14 +27,14 @@ lerna-debug.log* *.sublime-workspace # IDE - VSCode -.vscode/* +/.vscode !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +# Local env files .env.local -.env .env.development .env.development.local .env.test.local diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 9433034..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"], - "unwantedRecommendations": [ - "hookyqr.beautify", - "dbaeumer.jshint", - "ms-vscode.vscode-typescript-tslint-plugin" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 5cdeed2..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "javascript.format.enable": false, - "javascript.validate.enable": false, - "typescript.format.enable": false, - "eslint.enable": true, - "eslint.format.enable": true, - "eslint.packageManager": "yarn", - "eslint.alwaysShowStatus": true, - "eslint.validate": ["typescript", "javascript"], - "[javascript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint" - }, - "[typescript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "editor.formatOnPaste": true, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "editor.codeActionsOnSave": { - "source.organizeImports": true, - "source.fixAll": true - }, - "typescript.tsdk": "node_modules/typescript/lib" -} diff --git a/Dockerfile b/Dockerfile index b67a73f..88fbdb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # First stage: build server app -FROM node:12 as builder +FROM node:14 as builder ENV NODE_ENV=development WORKDIR /app COPY . . @@ -7,7 +7,7 @@ RUN yarn install --frozen-lockfile --non-interactive RUN yarn build # Second stage: leaner image to deploy and run the built app -FROM node:12-alpine +FROM node:14-alpine ENV NODE_ENV=production WORKDIR /app COPY --from=builder /app/package.json /app/yarn.lock ./ diff --git a/README.md b/README.md index 7ce79d9..5402f23 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,10 @@ -# YSM Backend - -![GitHub Actions CI workflow badge](https://github.com/chaynHQ/ysm-backend/workflows/YSM%20Backend%20CI%20pipeline/badge.svg) +# Your Story Matters (YSM) Your Story Matters (YSM) is a digital companion for survivors of sexual assault launched in 2019. Formerly called YANA (You Are Not Alone) and funded by Nesta and the UK Department of Digital, Culture, Media and Sport through the Tech to Connect Challenge, YSM has curated content including recovery, moving through trauma, accessing justice through the law, stories of resilience, and allows survivors the option to create an account and save their journey. -**Currently in active development.** - ## Get Involved -If you would like to help Chayn and receive special access to our organization and volunteer opportunities, please [visit our Getting Involved guide](https://chayn.notion.site/Get-involved-423c067536f3426a88005de68f0cab19). We'll get back to you to schedule an onboarding call. Other ways to get involved and support us are [donating](https://www.paypal.me/chaynhq), starring this repo and making an open-source contribution here on GitHub, and supporting us on social media! +If you would like to help Chayn and receive special access to our organization and volunteer opportunities, please [visit our Getting Involved guide](https://chayn.notion.site/Get-involved-423c067536f3426a88005de68f0cab19). We'll get back to you to schedule an onboarding call. Other ways to get involved and support us are [donating](https://www.paypal.me/chaynhq), starring this repo and making an open-source contribution here on GitHub, and supporting us on social media! Our social medias: @@ -22,41 +18,82 @@ Youtube - [Chayn Team](https://www.youtube.com/channel/UC5_1Ci2SWVjmbeH8_USm-Bg) LinkedIn - [@chayn](https://www.linkedin.com/company/chayn) - # YSM Backend -A [NestJS](https://nestjs.com/) API server with [Jest](https://jestjs.io/) testing. +![GitHub Actions CI workflow badge](https://github.com/chaynHQ/ysm-backend/workflows/YSM%20Backend%20CI%20pipeline/badge.svg) + +A NestJS API server with Jest testing. + +This repo serves just the YSM backend, find YSM's frontend code here: https://github.com/chaynHQ/ysm + +**Currently in active development.** + +## How to Contribute: + +Before making a contribution, please follow our Contributing Guidelines in [CONTRIBUTING.md](/CONTRIBUTING.md). + +Happy coding! ⭐ ## Development -Note: if you just want to run the backend service locally and not do any development work on it, you can instead skip to the section on how to run it in a Docker container. +**RECOMMENDED: You may skip ahead to the [Running as a Docker Container Locally section below](#running-as-a-docker-container-locally) if you just want to run the backend service locally and not do any development work on it.** ### Prerequisites -- NodeJS v12+ +- NodeJS v14+ - Yarn v1.21+ +### Technologies Used: + +- [NestJS](https://nestjs.com/) - Node.js web framework +- [Jest](https://jestjs.io/) - JavaScript testing +- [Firebase](https://firebase.google.com/) - user authentication and analytics +- [Rollbar](https://rollbar.com/) - error reporting +- [StoryBlok](https://www.storyblok.com/) - headless CMS for pages and courses content +- [Heroku](https://www.heroku.com/) - build, deploy and operate staging and production apps +- [GitHub Actions](https://github.com/features/actions) - CI pipeline + ### Set up local env config -Certain config values are required to run the server. +For local development, create a new **`.env.development`** file and add the following environment variables: -For local development, create a new **`.env.development`** file and add in the following: +If you're an official Chayn volunteer, please get in touch with the team for access to the environment variables. -```shell -STORYBLOK_TOKEN={value} # The API token from Storyblok (must have 'draft' access) +``` +# The API token from Storyblok (must have 'draft' access) +STORYBLOK_TOKEN= + +# The service account JSON object serialised into a string and then base64 encoded +FIREBASE_SERVICE_ACCOUNT={value} -FIREBASE_SERVICE_ACCOUNT={value} # The service account JSON object serialised into a string and then base64 encoded +# OPTIONAL: comma separated list of email addresses for users allowed to access preview mode (for viewing draft content from Storyblok) +CONTENT_EDITOR_EMAILS= -CONTENT_EDITOR_EMAILS={value} # Optional. A comma separated list of email addresses of the users that are allowed to access preview mode (for viewing draft content from Storyblok) +# OPTIONAL: when running in `dev` mode. Either set this to the Rollbar server token, or to `false` to disable. +ROLLBAR_TOKEN={value} -ROLLBAR_TOKEN={value} # Optional when running in `dev` mode. Either set this to the Rollbar server token, or to `false` to disable. -ROLLBAR_ENV=local-dev # Required in `production` mode or if `ROLLBAR_TOKEN` is set. +# OPTIONAL: required in `production` mode or if `ROLLBAR_TOKEN` is set. +ROLLBAR_ENV=local-dev -RATE_LIMIT_WINDOW_MS={value} # Optional. The window of time (in milliseconds) for the rate limiting to apply. -RATE_LIMIT_MAX=(value) # Optional. The max number of requests (per IP address) within the window of time (above). +# OPTIONAL: The window of time (in milliseconds) for the rate limiting to apply. +RATE_LIMIT_WINDOW_MS={value} + +# OPTIONAL: The max number of requests (per IP address) within the window of time (above). +RATE_LIMIT_MAX=(value) +``` + +**If creating new environment variables:** + +- Check if the new environment variable must be added the [ci.yml](.github/workflows/ci.yml) file. +- Note that new environment variables must be added to Heroku before release to production. Please tag staff in your issue if creating new environment variables. + +### Install dependencies + +```bash +yarn ``` -#### Env config for tests +### Set up local env config for tests Tests will use a separate `.env.test` file which should already be present. @@ -72,12 +109,6 @@ FIREBASE_SERVICE_ACCOUNT={value} # Same as in .env.development - the service ac FIREBASE_WEB_API_KEY={value} # Special API key just for use in e2e tests - found in the settings page for the Firebase project ``` -### Install dependencies - -```bash -yarn -``` - ### Run locally ```bash @@ -140,16 +171,17 @@ DEBUG=axios yarn start:dev Note: the `axios-debug-log` library used to provide this logging has only been added as a dev dependency, so this will not work in production environments. -## Running as a Docker container locally +# Running as a Docker Container Locally You may want to run the backend service in a Docker container if: 1. You don't intend to do any development work on it and just need a running service for the frontend to access. 1. You want to test that the Docker image works as expected, e.g. if you've made any changes to the `Dockerfile`. -First, ensure you have the Docker service installed and running on your machine. More info on how to do this: . +**Steps to run the docker container locally:** -Then, follow the section on setting up your local env config, above. Note that you don't need to follow any other instructions from the previous sections (like having the prerequisites, installing dependencies, etc.) as the Docker build process will do all this for you. +1. Ensure you have the Docker service installed and running on your machine. More info on how to do this: . +2. Follow the directions above on [setting up your local env config](#set-up-local-env-config). Note that you don't need to follow any other instructions from the previous sections (like having the prerequisites, installing dependencies, etc.) as the Docker build process will do all this for you. Then, build the image: @@ -170,3 +202,11 @@ curl -v http://localhost:3000/api/resources ``` … or opening the URL in your browser. It should show the JSON output of the `/resources` API. + +# License + +This project uses the [MIT License](/LICENSE). + +YSM and all of Chayn's projects are open-source. + +While the core tech stack included here is open-source, some external integrations used in this project may require subscriptions. From f6e3f4569e6daa27e305e4bbc39b71fdbc5ebf38 Mon Sep 17 00:00:00 2001 From: Kylee Fields <43586156+kyleecodes@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:54:18 -0400 Subject: [PATCH 11/22] Create pull_request_template.md --- .github/pull_request_template.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..20dda8e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,10 @@ +### Issue link / number: + +### What changes did you make? + +### Why did you make the changes? + +