Skip to content

Commit

Permalink
Isaac/merge main release (#88)
Browse files Browse the repository at this point in the history
* Add Jest testing (#63)

* Initial boilerplate setup

* Add ArticleFactory, TestingDBConnection, FactoryUtils, placeholder article test file

* Add test cases on getAllArticles

* Create PublicationFactory, add tests for getAllArticles, getArticlesByPublicationID(s), getArticlesByPublicationSlug(s)

* Add hooks

* Update README

* Add pr changes

* Add pr changes

* Add tests for incrementShoutouts, searchArticle, getArticlesAfterDate

* Add publication tests and refactor factory files

* Remove test db open message

* Update src/tests/article.test.ts

Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Update src/tests/data/ArticleFactory.ts

Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Refactor code

* Refactor byDate

Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>
Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Add Docstrings to Test Factory Functions (#64)

* Initial boilerplate setup

* Add ArticleFactory, TestingDBConnection, FactoryUtils, placeholder article test file

* Add test cases on getAllArticles

* Create PublicationFactory, add tests for getAllArticles, getArticlesByPublicationID(s), getArticlesByPublicationSlug(s)

* Add hooks

* Update README

* Add pr changes

* Add pr changes

* Add tests for incrementShoutouts, searchArticle, getArticlesAfterDate

* Add publication tests and refactor factory files

* Remove test db open message

* Update src/tests/article.test.ts

Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Update src/tests/data/ArticleFactory.ts

Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Refactor code

* Refactor byDate

* Add docstrings

Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>
Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Update README.md

* Implement community board models (#65)

* Implemented community board models

- implemented Flyer and Organization models for community board feature
- modified User model
- updated typescript version to 4.0.5 to resolve es lint issue

* Revert package.json changes

- reverted package.json changes that are addressed in a different pr

* Add magazines to weekly debrief (#66)

* Implemented community board models

- implemented Flyer and Organization models for community board feature
- modified User model
- updated typescript version to 4.0.5 to resolve es lint issue

* Implemented weekly debrief magazines

- added magazines to weekly debrief feature
- updated user and weekly debrief models to allow tracking of read magazines
- updated logic in user and weekly debrief controllers to enable reading of magazines

* Revert package.json changes

- reverted package.json changes back to the original file
- added additional rules to eslintrc to suppress es lint warnings

* Create jest testing for magazines

- added jest test cases for magazines

* Implement jest testing for User

- implemented unit testing for UserRepo
- indirectly test Weekly Debrief with User unit tests

* Update gitignore

- updated gitignore file to include secrets folder

* Implement reshuffle articles (#68)

* Add Docstrings to Test Factory Functions (#64)

* Initial boilerplate setup

* Add ArticleFactory, TestingDBConnection, FactoryUtils, placeholder article test file

* Add test cases on getAllArticles

* Create PublicationFactory, add tests for getAllArticles, getArticlesByPublicationID(s), getArticlesByPublicationSlug(s)

* Add hooks

* Update README

* Add pr changes

* Add pr changes

* Add tests for incrementShoutouts, searchArticle, getArticlesAfterDate

* Add publication tests and refactor factory files

* Remove test db open message

* Update src/tests/article.test.ts

Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Update src/tests/data/ArticleFactory.ts

Co-authored-by: Archit Mehta <4architmehta@gmail.com>

* Refactor code

* Refactor byDate

* Add docstrings

Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>
Co-authored-by: Archit Mehta <4architmehta@gmail.com>

Implement shuffle article function

try to implement reshuffling with aggregate

* Implement reshuffling of articles

* Revert package.json, update eslint and update .gitignore to match main branch

---------

Co-authored-by: Kidus Zegeye <51487468+kidzegeye@users.noreply.github.com>

* Implement magazine search (#69)

* Implement magazine search

- implemented searching for magazines

* update magazinerepo

* Add unit test for magazine search

- created unit test for MagazineRepo.searchMagazine

* Convert result of shuffling resolver to ArticleModel (#71)

* Add 3 new publications (Cornell Daily Sun, Collective X, and Cornell Healthcare Review) to publications.js (#70)

* Resolve merge conflicts in publications.json (keep release version) (#76)

* Kidus/filter articles (#48)

* Add covid filter to all article query functions

* Add filtering capability

* Fix getArticleById filter

* Create filter migration script

* Finish migration script

* Add toggle for filtering enforcement

* Implement PR changes

Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>

* Fix BRSN's url

* Migrate bookmark resolver and update User Repo & Entity

* Resolve remaining merge conflicts

* Implement chronological sorting

* Update prod deployment script

* Remove unused MagazineURL index from Magazine DB

* Add no rules to publications.json

* Remove trailing comma

---------

Co-authored-by: Kidus Zegeye <51487468+kidzegeye@users.noreply.github.com>
Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>
Co-authored-by: Archit404Error <4architmehta@gmail.com>

* Revert "Resolve merge conflicts in publications.json (keep release version) (#76)" (#77)

This reverts commit eccf00c.

* fix merge conflicts (#78)

* Kidus/filter articles (#48)

* Add covid filter to all article query functions

* Add filtering capability

* Fix getArticleById filter

* Create filter migration script

* Finish migration script

* Add toggle for filtering enforcement

* Implement PR changes

Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>

* Fix BRSN's url

* Migrate bookmark resolver and update User Repo & Entity

* Resolve remaining merge conflicts

* Implement chronological sorting

* Update prod deployment script

* Remove unused MagazineURL index from Magazine DB

* Add no rules to publications.json

* Remove trailing comma

---------

Co-authored-by: Kidus Zegeye <51487468+kidzegeye@users.noreply.github.com>
Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>
Co-authored-by: Archit404Error <4architmehta@gmail.com>

* Implement community board [1/7] (#81)

* Begin implementing FlyerRepo

- implemented basic FlyerRepo functions
- updated Flyer model to support uploading in app instead of through a google form

* Implement flyers for community board

- alphabetized imports and fields
- finished implementing flyers for community board

* Address pr review comments

- addressed pr review comments
- removed redundant filtering in FlyerRepo
- added checks for null return values in FlyerRepo
- alphabetized imports and exports

* Add imageURL field to Magazine entity. (#73)

* Add no rules to volume-backend's publications.json (#82)

* Implement community board (flyer tests) [2/7] (#84)

* Begin implementing FlyerRepo

- implemented basic FlyerRepo functions
- updated Flyer model to support uploading in app instead of through a google form

* Implement flyers for community board

- alphabetized imports and fields
- finished implementing flyers for community board

* Implement jest testing for flyers

- created jest unit testing for FlyerRepo
- created FlyerFactory to help with jest testing

* Remove isFiltered field from Flyer entity

- removed redundant isFiltered field from Flyer entity (already checked in microservice)
- updated FlyerRepo and jest testing to reflect changes

* Alphabetize imports and exports

- alphabetized imports and exports in FlyerRepo, flyer.test, and FlyerFactory

* Revert merge conflict changes

- reverted merge conflict changes (accept incoming when actually wanted to keep current)

* Address review comments

- alphabetize imports
- add unit test cases for FlyerRepo including searching for 0 flyers and maximum limit in response
- added unit test case for FlyerRepo.getTrendingFlyers

* Address review comments (Shungo)

- added spaces between test cases

* Implement community board organizations (#85)

- resolve merge conflicts in Flyer.ts and FlyerFactory.ts
- update Organization model
- implement logic in OrganizationRepo
- implement queries and mutations in OrganizationResolver

* Implement community board (organization tests) [4/7] (#86)

* Implement community board organizations

- resolve merge conflicts in Flyer.ts and FlyerFactory.ts
- update Organization model
- implement logic in OrganizationRepo
- implement queries and mutations in OrganizationResolver

* Implement jest testing for organizations

- implemented jest testing for community board organizations
- created organizations.json with 3 onboarded organizations
- added FlyerResolver and OrganizationResolver to app.ts

---------

Co-authored-by: Kidus Zegeye <51487468+kidzegeye@users.noreply.github.com>
Co-authored-by: Kidus Zegeye <kmz25@cornell.edu>
Co-authored-by: Archit Mehta <4architmehta@gmail.com>
Co-authored-by: Shungo Najima <sn685@cornell.edu>
Co-authored-by: Sasha Loayza <104698418+SashaLoayza@users.noreply.github.com>
  • Loading branch information
6 people authored Apr 29, 2023
1 parent f6ff7b8 commit feec506
Show file tree
Hide file tree
Showing 42 changed files with 17,706 additions and 10,117 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unused-vars': 0,
'semi-style': ['error', 'last'],
'import/named': 0,
'import/prefer-default-export': 0,
},
// This gets rid of weird react error for non-react project
settings: {
Expand Down
1 change: 1 addition & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run jest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ nohup.out
*/certificates/*
Makefile
start.sh
*secrets*

# ignore database dumps
dump/
dump/
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# volume-backend
# volume-backend

An open-sourced backend for Volume, a news aggregator for Cornell's publications
and magazines. Made by [Cornell AppDev](cornellappdev.com).
and magazines. Made by [Cornell AppDev](cornellappdev.com).

Tech stack:

1. Typescript/Node.js
2. MongoDB
3. GraphQL

## Installation
## Installation

To run this project, you must have [Node.js](https://nodejs.org/en/download/) and [Typescript](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html) installed on your machine.
To run this project, you must have [Node.js](https://nodejs.org/en/download/) and [Typescript](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html) installed on your machine.

Clone the project with

`git clone https://github.com/cuappdev/volume-backend.git`

After cloning the project `cd` into the new directory and install dependencies with
After cloning the project `cd` into the new directory run

`git config core.hooksPath .github/hooks`

and install dependencies with

`npm install`

Expand All @@ -28,9 +33,13 @@ To run the project, use

Make sure `MongoDB` is installed. [See installation guide](https://docs.mongodb.com/manual/installation/).

To view your database, enter your terminal and run
To run MongoDB on a MacOS device, run

`brew services start mongodb-community@6.0` (6.0 may be outdated, check website for updated version).

and connect MongoSH to a running instance using

`mongo`
`mongosh`

From here, you can interact with your database by typing `use <db_name>`.

Expand All @@ -44,4 +53,4 @@ We recommend using [`direnv`](https://direnv.net/). To set up, run the following

## Configuration(optional)

We recommend using ESLint and Prettier for linting/formatting. If you are using VSCode, they can be downloaded directly through the Extensions panel. Run ESLint on the codebase with `npm run lint` and Prettier with `npm run format`.
We recommend using ESLint and Prettier for linting/formatting. If you are using VSCode, they can be downloaded directly through the Extensions panel. Run ESLint on the codebase with `npm run lint` and Prettier with `npm run format`.
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: [
'src/'
],
transformIgnorePatterns: ['<rootDir>/node_modules/'],
moduleFileExtensions: ['js', 'ts'],
maxWorkers: 1,
};
1 change: 0 additions & 1 deletion migrate-mongo-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const config = {
mongodb: {
// TODO Change (or review) the url to your MongoDB:
url: "mongodb://localhost:27017",

// TODO Change this to your database name:
databaseName: "volume",

Expand Down
20 changes: 20 additions & 0 deletions organizations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"organizations": [{
"bio": "",
"name": "Women in Stem at Cornell",
"slug": "wicc",
"websiteURL": "https://wicc.cornell.edu/#/"
}, {
"bio": "",
"name": "AppDev",
"slug": "appdev",
"websiteURL": "https://www.cornellappdev.com/"
},
{
"bio": "",
"name": "Badminton Club",
"slug": "badminton",
"websiteURL": "https://cornellbadminton.com/"
}
]
}
Loading

0 comments on commit feec506

Please sign in to comment.