Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
ff455b0
added some express route testing
anlhu Feb 13, 2024
b48bb03
moved entity files
mialaniz Feb 13, 2024
a7bdd52
setup for first typeorm test
anlhu Feb 13, 2024
2d017b0
user/proj test works, get/add methods
anlhu Feb 14, 2024
5054608
add remove method
anlhu Feb 14, 2024
7c030d3
Merge pull request #7 from adhocmaster/minor-ui-changes
arthurrfoy Feb 14, 2024
855c66b
delete MyProject
anlhu Feb 15, 2024
6714b31
Merge pull request #9 from adhocmaster/typeorm_files
anlhu Feb 15, 2024
09d2d5c
Added Function for saveReleasePlan
mialaniz Feb 16, 2024
9db112f
Added More Comments
mialaniz Feb 16, 2024
19528e3
Update data_model.md
adhocmaster Feb 16, 2024
76ab3a3
Merge branch 'main' of https://github.com/adhocmaster/ScrumMate
adhocmaster Feb 16, 2024
8136bba
Update data_model.md
adhocmaster Feb 16, 2024
d651fa5
Update data_model.md
adhocmaster Feb 16, 2024
49fa452
Added Functions for Saving Release Plan
mialaniz Feb 17, 2024
c8fdab6
reconfigure data models to meet sponsor requirements
anlhu Feb 17, 2024
3806f1b
deviating from sponsor's diagram, using subclasses instead of one bac…
anlhu Feb 17, 2024
0da28ea
finished up rest of entities, formatting
anlhu Feb 17, 2024
4166507
format entities, add missing methods, complete TypeORM Tests for savi…
anlhu Feb 18, 2024
8eb0692
trying to add postgres containter to the github actions
anlhu Feb 18, 2024
9aa0728
route api works, but file in wrong place
anlhu Feb 19, 2024
e181ec1
Merge pull request #11 from adhocmaster/typeorm_files
mialaniz Feb 19, 2024
653b34d
Added Function for saveReleasePlan
mialaniz Feb 16, 2024
e76b179
Added More Comments
mialaniz Feb 16, 2024
203cbc8
Added Functions for Saving Release Plan
mialaniz Feb 17, 2024
38c07a4
route api works, but file in wrong place
anlhu Feb 19, 2024
31fefd6
Merge branch 'load-versions' of github.com:adhocmaster/ScrumMate into…
anlhu Feb 19, 2024
5587a5c
update data-source wit hnew entities
anlhu Feb 19, 2024
e9d5adb
fix import
anlhu Feb 19, 2024
9c68d27
moved router back to controllers/, still works with postman
anlhu Feb 19, 2024
ab8600e
formatting
anlhu Feb 19, 2024
ba3d572
'tests' done for saving a release plan, but must be commented out
anlhu Feb 20, 2024
f4c8a4c
revert code to just create a new release. Comment out 'test'
anlhu Feb 20, 2024
70e5f5a
undoing some of michael's things for this PR
anlhu Feb 20, 2024
832c3e2
undoing more
anlhu Feb 20, 2024
abf9409
move to router folder
anlhu Feb 20, 2024
cccc3c6
Merge pull request #12 from adhocmaster/load-versions
arthurrfoy Feb 20, 2024
5eaee5c
router for fetching previous releases done
anlhu Feb 20, 2024
00c6463
comment out everything in index for PR
anlhu Feb 20, 2024
e1ed82b
Merge pull request #13 from adhocmaster/actually-load-release-versions
arthurrfoy Feb 20, 2024
5c7f061
initial code for save release
anlhu Feb 20, 2024
a472553
successfully saves release columns in postman, missing relationals
anlhu Feb 20, 2024
57adba6
add possible future code for create_release
anlhu Feb 20, 2024
ceed35a
add comment for saving sprints
anlhu Feb 20, 2024
d8b14c3
.
Feb 20, 2024
33b6652
commenting out things
anlhu Feb 20, 2024
0100a47
Merge pull request #14 from adhocmaster/save-release-andrew
mialaniz Feb 20, 2024
aefe12e
copy
Feb 20, 2024
c1b1cdd
Merge branch 'main' into releaseCopy
anlhu Feb 20, 2024
24bb0b6
Update create_release.ts, fix merge
anlhu Feb 20, 2024
3841b1c
Update create_release.ts, fix dup import
anlhu Feb 20, 2024
1defdc9
Merge pull request #15 from adhocmaster/releaseCopy
anlhu Feb 20, 2024
1d7c0f2
new api user, project. format release. some not nullable columns added
anlhu Feb 21, 2024
5d9bdbe
move fetch, formatting
anlhu Feb 21, 2024
53950d4
fix tests, less strict not nullable
anlhu Feb 21, 2024
8d90c6f
roles and sprint, formatting to user, release, proj
anlhu Feb 21, 2024
4e3a11e
todo router, fix sprint
anlhu Feb 21, 2024
992b80f
formatting, commentting, app use routers
anlhu Feb 21, 2024
f85b0fb
user controller
Feb 21, 2024
360d72c
supertest
anlhu Feb 21, 2024
3e1f83c
supertest types
anlhu Feb 21, 2024
2e68305
formatting, clear db after
anlhu Feb 21, 2024
78f0150
routing
Feb 22, 2024
71109e7
WIP, but updated Nav Bar, Sidebar, and parts of the Release Plan
echen70 Feb 23, 2024
635e68f
added Backlog ui, Sprints ui WIP
echen70 Feb 23, 2024
e0ceb90
adding button for backlog
tanyagyanmote Feb 23, 2024
b92405b
drag/drop work
mialaniz Feb 25, 2024
b3670d3
fix path, comment out old, formatting, fix imports
anlhu Feb 25, 2024
e65ee10
adding
Feb 25, 2024
6174570
refactored view release plan page
echen70 Feb 25, 2024
2460b04
adding
Feb 25, 2024
1eb7d40
Database wrapper starter code and tests
anlhu Feb 26, 2024
a5391da
add user methods and tests to database class
anlhu Feb 26, 2024
a2b3cda
project methods and tests
anlhu Feb 26, 2024
2344694
release methods
anlhu Feb 26, 2024
a2ed414
role methods, no tests
anlhu Feb 26, 2024
b4c6e7f
sprint methods, no tests
anlhu Feb 26, 2024
8d1931e
comment for TODO methods but no implementation. Do it after fixing TO…
anlhu Feb 26, 2024
badc001
Merge branch 'remaining-api' into data-source-wrapper
anlhu Feb 26, 2024
39c5bb4
Merge pull request #17 from adhocmaster/data-source-wrapper
arthurrfoy Feb 26, 2024
ff1037a
Changes to Functions
mialaniz Feb 26, 2024
bbafd87
updating backlog
tanyagyanmote Feb 26, 2024
47a61bf
make express tests pass. do we want to include /api/ in our routers?
anlhu Feb 27, 2024
4788b30
remove log
anlhu Feb 27, 2024
f45b202
moved tests into directories
anlhu Feb 27, 2024
a84b22f
Merge pull request #18 from adhocmaster/rename-todo
anlhu Feb 27, 2024
c622309
remove extra await
anlhu Feb 27, 2024
2b4eff1
disable logging
anlhu Feb 27, 2024
836c4b9
run in a single thread instead of multiple, so tests dont collide hop…
anlhu Feb 27, 2024
eec247f
tests terminate despite async methods not finishing. Probably before/…
anlhu Feb 27, 2024
c114ec1
Merge pull request #16 from adhocmaster/remaining-api
arthurrfoy Feb 27, 2024
108daa6
user controllers use Database
anlhu Feb 27, 2024
d8f6562
project controllers
anlhu Feb 27, 2024
a15351e
role controllers with db
anlhu Feb 27, 2024
615d8a5
sprint controllers with db
anlhu Feb 27, 2024
d45f6af
todo controller with db
anlhu Feb 27, 2024
fed9f7b
renaming todo files to backlogItem
anlhu Feb 27, 2024
682cefe
make sure dont erase previous relations
anlhu Feb 27, 2024
16061ee
made sprints scrollable when there are more user stories
echen70 Feb 27, 2024
96a22ad
new errors, helper methds, backlog errors
anlhu Feb 28, 2024
f23dce1
still need to catch errors for project, release, roles, sprints
anlhu Feb 28, 2024
aed674b
refactor all try/catch into one error Wrapper
anlhu Feb 28, 2024
6e75a85
Merge pull request #20 from adhocmaster/response-codes
arthurrfoy Feb 28, 2024
208f440
Merge pull request #19 from adhocmaster/wrapper-in-API
arthurrfoy Feb 28, 2024
2c82db2
tests
Feb 29, 2024
d53b259
test
Feb 29, 2024
c489e9e
Navbar Feature
mialaniz Feb 29, 2024
e3f41fd
WIP, but updated Nav Bar, Sidebar, and parts of the Release Plan
echen70 Feb 23, 2024
354edf8
added Backlog ui, Sprints ui WIP
echen70 Feb 23, 2024
14ade9f
drag/drop work
mialaniz Feb 25, 2024
56bfa3d
Changes to Functions
mialaniz Feb 26, 2024
0557a7d
Navbar Feature
mialaniz Feb 29, 2024
6be7c8e
Merge branch 'drag_drop' of github.com:adhocmaster/ScrumMate into dra…
anlhu Feb 29, 2024
08fb5a1
new getname function
anlhu Feb 29, 2024
7758d05
tests
Feb 29, 2024
367f717
await the function in wrapper
anlhu Feb 29, 2024
4719442
close server
anlhu Feb 29, 2024
4e0c6de
fix endpoint
anlhu Feb 29, 2024
0c3057b
make tests pass by commenting out last team code
anlhu Feb 29, 2024
97b92de
icons can be toggled
anlhu Feb 29, 2024
49d92ac
Added the correct end points
mialaniz Mar 1, 2024
63efbd7
sign -in
Mar 1, 2024
bdc4292
Merge branch 'wrapper-in-API' of github.com-school:adhocmaster/ScrumM…
Mar 1, 2024
8611c49
moved commits from Revisions bc rebase doesnt allow login. Also, copy…
anlhu Mar 1, 2024
c356583
made sprint look like design
echen70 Mar 1, 2024
2bfbed1
Merge pull request #23 from adhocmaster/new-release-plan-ui
echen70 Mar 1, 2024
0bea309
Merge pull request #22 from adhocmaster/revisions-new-branch
anlhu Mar 1, 2024
b0327b7
Merge branch 'new-release-plan-ui' of github.com:adhocmaster/ScrumMat…
anlhu Mar 1, 2024
d51c9db
add sidebar stuff for demo. already in main
anlhu Mar 1, 2024
1676de1
made font size smaller, made the user story text turn to ... if too long
echen70 Mar 1, 2024
8fae5d9
changed font size to 14
echen70 Mar 1, 2024
41d2ddb
changed ... for user stories
echen70 Mar 1, 2024
a35b087
made icons smaller to fit the smaller font size
echen70 Mar 1, 2024
bd6d15f
moved the truncate function and update the height of the card
echen70 Mar 1, 2024
054ec46
Merge branch 'main' into new-release-plan-ui
anlhu Mar 2, 2024
509933e
Merge pull request #25 from adhocmaster/new-release-plan-ui
echen70 Mar 2, 2024
3ec5085
Actually fix the syntax error this time
anlhu Mar 2, 2024
d9f1313
Merge pull request #27 from adhocmaster/fix-fix-syntax-error
anlhu Mar 2, 2024
665a547
sanity check + backlog +
tanyagyanmote Mar 2, 2024
ec5999c
fix syntax tests
anlhu Mar 2, 2024
2629e50
adding
Mar 2, 2024
2667a19
initialize user, project, 2 releases
anlhu Mar 2, 2024
10e3c41
new package, using a fake email now
anlhu Mar 2, 2024
e0c4835
commmiting before switching brach quickly
anlhu Mar 2, 2024
8b0bfe4
can add new release plans
anlhu Mar 2, 2024
7cf5cfc
loads list in reverse, format is correct
anlhu Mar 2, 2024
5299fd3
working on api with goal/problem/version number
anlhu Mar 2, 2024
d68420e
added getRelease API, unable to switch pages when clicking on sidebar
anlhu Mar 2, 2024
3f2a1be
works???
anlhu Mar 2, 2024
110df0d
Added Endpoints
mialaniz Mar 2, 2024
caa0c22
delete all from db every time so its fresh
anlhu Mar 2, 2024
4b7e70a
Merge branch 'main' into drag_drop
anlhu Mar 2, 2024
e0ecc13
new code to fetch the most recent release as the default
anlhu Mar 2, 2024
8c3712c
test
Mar 2, 2024
c1e0356
open to most recent release
anlhu Mar 2, 2024
d6d18e3
tests
Mar 2, 2024
4ad8d2e
Merge pull request #28 from adhocmaster/connect-with-backend
arthurrfoy Mar 2, 2024
d534f10
test
Mar 2, 2024
d283ee6
test
Mar 2, 2024
227ed92
remove console loging
Mar 2, 2024
2d3c071
Merge branch 'main' into wrapper-in-API
anlhu Mar 2, 2024
0a7303e
Update project.ts, undo newProject in endpoint
anlhu Mar 2, 2024
5c8ecc7
Update project.ts, remove userId from creating project
anlhu Mar 2, 2024
ed28f8a
Merge pull request #32 from adhocmaster/wrapper-in-API
anlhu Mar 2, 2024
103079e
Merge branch 'main' into drag_drop
anlhu Mar 2, 2024
5831c41
Merge pull request #29 from adhocmaster/drag_drop
anlhu Mar 2, 2024
6dad0c2
fix initialized user
anlhu Mar 3, 2024
fe0b15b
can reach the dashboard without failure
anlhu Mar 3, 2024
595d780
fixed sidebar api calls, all is working now!
anlhu Mar 3, 2024
2660398
readd the api to get project name, but navbar cannot call it
anlhu Mar 3, 2024
b785318
Merge pull request #34 from adhocmaster/fix-merge-issues
mialaniz Mar 3, 2024
e040462
delete old files, moving db to the db folder
anlhu Mar 3, 2024
15a0015
implemented the wrapper, removed the old db. Wont work
anlhu Mar 3, 2024
fbec859
working tests, just userRepo working for now
anlhu Mar 3, 2024
6bf3039
rest of the repositories
anlhu Mar 3, 2024
633654f
comment out old auth code to pass CI
anlhu Mar 3, 2024
d05023c
fix import in index
anlhu Mar 3, 2024
5f80428
Merge branch 'main' into repos
anlhu Mar 3, 2024
d59185f
Update index.ts, import auth again
anlhu Mar 3, 2024
c20b384
clean up files
anlhu Mar 3, 2024
36c6c7d
Merge pull request #35 from adhocmaster/repos
arthurrfoy Mar 3, 2024
542a11e
Merge branch 'main' into new-release-plan-ui
anlhu Mar 3, 2024
e3b9133
get the sprints api
anlhu Mar 4, 2024
a243a9c
working, just testing to make sure sprints are in tact
anlhu Mar 4, 2024
c0faa05
last test, some refactor
anlhu Mar 4, 2024
7cb477e
new api + one new test
anlhu Mar 5, 2024
19560ef
Merge pull request #37 from adhocmaster/reorder-sprints-backend
arthurrfoy Mar 5, 2024
928d418
Merge pull request #38 from adhocmaster/delete-sprints
arthurrfoy Mar 5, 2024
3158aa8
adding
Mar 5, 2024
0adbe39
reorder
Mar 5, 2024
8954aea
WIP adding delete sprints
echen70 Mar 7, 2024
d8f6874
add test to ensure the release is also updated
anlhu Mar 7, 2024
0ef8469
more tests for sprints
anlhu Mar 7, 2024
bbd6f29
fix foreach async
anlhu Mar 7, 2024
121dcc5
fix other foreach with async await
anlhu Mar 7, 2024
f00c40a
WIP added updating the sprint number when deleting a sprint
echen70 Mar 7, 2024
c1426f8
minor refactoring
echen70 Mar 7, 2024
522ad40
fix delete sprint API by moving backlog items back to release backlog…
anlhu Mar 7, 2024
db89cae
Merge branch 'deleteSprints' of github.com:adhocmaster/ScrumMate into…
anlhu Mar 7, 2024
5d5b455
cleaned up code a little
echen70 Mar 7, 2024
c52421c
added a confirmation menu before deletion
echen70 Mar 7, 2024
c7c1a99
cleaned up code
echen70 Mar 7, 2024
0902906
changed layout of side buttons for sprints
echen70 Mar 8, 2024
eb01d9e
sanity check
tanyagyanmote Mar 8, 2024
6eeffd1
fixing width
tanyagyanmote Mar 8, 2024
d4b6b26
renamed file to match functionality
echen70 Mar 8, 2024
ec03ca2
aligning
tanyagyanmote Mar 9, 2024
19c5fe5
adding story points
tanyagyanmote Mar 9, 2024
56c53b5
Merge pull request #48 from adhocmaster/deleteSprints
arthurrfoy Mar 9, 2024
7350a48
Merge branch 'main' into new-release-plan-ui
anlhu Mar 9, 2024
94ffec2
Merge pull request #33 from adhocmaster/new-release-plan-ui
mialaniz Mar 9, 2024
cbd1c95
remove repos from db, split datasourcewrapper by data model
anlhu Mar 10, 2024
9d0bc36
switch display to new one when adding/making a copy, updates sidebar …
anlhu Mar 10, 2024
7436455
delete redundant old code for new version number
anlhu Mar 10, 2024
5d4b904
some changes to readme in root
anlhu Mar 10, 2024
08a843f
finish root readme
anlhu Mar 10, 2024
c5079e1
Merge pull request #51 from adhocmaster/fix-sidebar
anlhu Mar 10, 2024
caed220
root readme file more info, postgres
anlhu Mar 10, 2024
1defffe
backend documentation
anlhu Mar 10, 2024
fe339e3
deleted unused files and refactored frontend
echen70 Mar 10, 2024
2682a9d
changed organization structure of the components
echen70 Mar 10, 2024
bfbf8da
all changes to copy sprints and stories and backlog. Needs refactoring
anlhu Mar 12, 2024
86b4ac8
Create api_documentation.md
arthurrfoy Mar 12, 2024
5bbb6c8
Update api_documentation.md
arthurrfoy Mar 12, 2024
92f0533
Update api_documentation.md
arthurrfoy Mar 12, 2024
1e990e0
Update api_documentation.md
arthurrfoy Mar 13, 2024
e79caab
Update api_documentation.md
arthurrfoy Mar 13, 2024
ade3519
Update api_documentation.md
arthurrfoy Mar 13, 2024
7dbdfb5
Update api_documentation.md
arthurrfoy Mar 13, 2024
cb49439
Merge pull request #58 from adhocmaster/api-documentation
anlhu Mar 13, 2024
4eabedc
testing
tanyagyanmote Mar 13, 2024
45664ce
Update README.md
tanyagyanmote Mar 13, 2024
ffc2130
Merge pull request #53 from adhocmaster/document-project
anlhu Mar 13, 2024
035c070
Merge pull request #60 from adhocmaster/frontend-fixes
anlhu Mar 13, 2024
a1f9226
refactored
anlhu Mar 13, 2024
f9989c6
refactor if statement
anlhu Mar 13, 2024
fb6f96a
Merge pull request #49 from adhocmaster/refactor-backend
arthurrfoy Mar 13, 2024
0b92704
Merge pull request #57 from adhocmaster/copy-sprints
arthurrfoy Mar 13, 2024
a3cf616
fixing
tanyagyanmote Mar 13, 2024
85e4aeb
updated with alignment changes
echen70 Mar 13, 2024
50141dc
Merge branch 'main' of https://github.com/adhocmaster/ScrumMate into …
echen70 Mar 13, 2024
87f27f5
Merge pull request #55 from adhocmaster/remove-prev-team-code
echen70 Mar 13, 2024
a2003e2
Added add_sprints
mialaniz Mar 13, 2024
a00ec3a
Changed Variables
mialaniz Mar 13, 2024
48395c9
less required for backend create
anlhu Mar 14, 2024
21282dc
Merge branch 'add_sprint_new' of github.com:adhocmaster/ScrumMate int…
anlhu Mar 14, 2024
5c07a0a
test
mialaniz Mar 14, 2024
3138966
fix json pass in, add default values
anlhu Mar 14, 2024
f27dad6
Add Sprint
mialaniz Mar 14, 2024
6048930
Add Sprints New
mialaniz Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file modified .DS_Store
Binary file not shown.
52 changes: 52 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on: [push, workflow_dispatch]

env:
CI: false # to not treat warnings as failures

jobs:
build:

runs-on: ubuntu-latest

services:
postgres:
image: postgres

env:
POSTGRES_PASSWORD: test
POSTGRES_USER: test
POSTGRES_DB: test

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

strategy:
matrix:
node-version: [21]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm install && (cd frontend && npm install) && (cd backend && npm install)

- run: (cd backend && npm run build)
- run: (cd backend && npm test --watchAll)

- run: (cd frontend && npm run build)
# - run: (cd frontend && npm test --watchAll)
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Getting Started with Create React App
# Getting Started with Scrum Tools

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This project was initially bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

This is a fork from [Scrum_Tool](https://github.com/SlugScrum/Scrum_Tool) by a previous team who worked on it as part of UCSC's CSE115d course.

It is now being worked on by a new team of students as part of UCSC's CSE115b/c courses.

## Postgres

To run the backend, you should download and install the [Postgres](https://www.postgresql.org/) database. We used v16.2, but other versions will likely work too. For development purposes, we expect there to be a database called `test` and a user with username and password `test` who has full permissions to access this database.

We have seen issues with the Docker container for Postgres and when running the project from WSL. One workaround to this is to download Postgres directly to your system and running the project your operating system's terminal (e.g. Powershell).

## Available Scripts

Expand All @@ -11,21 +21,25 @@ In the project directory, you can run:
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

Alternatively, you can run `npm start` in the frontend and backend directories separately.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`
![Node.js Cl](https://github.com/adhocmaster/ScrumMate/actions/workflows/node.js.yml/badge.svg)

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

Currently, there are only backend tests, located in the `backend/tests` directory.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
The build is minified and the filenames include the hashes.

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

Expand All @@ -39,9 +53,17 @@ Instead, it will copy all the configuration files and the transitive dependencie

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More
## File structure

The project is separated into separate frontend and backend projects, located in the `frontend/` and `backend/` directories. Each directory is its own node project. They will each start their own servers. The frontend will make API calls to the backend, and the backend will host the API and respond to API calls. The root directory contains some packages used in both the frontend and backend, as well as some documentation and files for GitHub automated tests.

## More information

There are READMEs in both the fronend and backend directories which contain more information about their respective projects. Please see them for more information.

## Learn More About Create React App

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started), although the project has now been modified extensively from it.

To learn React, check out the [React documentation](https://reactjs.org/).

Expand Down
Binary file added backend/.DS_Store
Binary file not shown.
76 changes: 76 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Scrum Tools Backend
This is the backend folder for the Scrum Project Management tool. The backend is written in Typescript and is divided among several directories. This README will describe what is in each

Before running the backend, run the command ` npm i ` to install all required libraries and packages. Also make sure you have Postgres installed, with a database named `test`, a user with username and password `test`, and make sure the user has permissions for the database `test`. You may have more difficulty if you do not install and run the database and node on your system directly (we have run into issues with Postgres docker container and WSL).

## `backend/`

There are some config files and package managing files here. You may need to update package.json as you add more packages. If you to, you should push your changes so others can install the dependencies.

We do not have a node_modules directory here because the packages can be installed on your system from the package.json file. We may add it at the end in case those modules are no longer available one day.

### `backend/src`

I will explain the directories in order from the lowest level of abstraction to the highest. That is, from the TypeORM methods to the Express routers.

The data-source file creates a connection from TypeORM to the `test` Postgres database using the same username and password we created before. If you ever add more data models or entities, you will have to add it to the list of entities here.

The index file is like the `main.c` file for node projects. Right now, it initializes some data for development purposes, but we will want to delete it when delivering the app. All it needs to do is start up the TypeORM connection and Express. API calls will handle the rest.

### `backend/src/entity`

This directory contains our "data models," or Entities as they are called in TypeORM. Each file contains a class with TypeORM decorators (the @ things) which mark the class as an entity, or a field as a column or a relation. These entities are the only objects you can save and fetch from TypeORM.

### `backend/src/db`

This directory contains the classes needed to create a singleton database class for all other classes to access. The database itself is in database.ts, but the code mostly resides in the `dataSourceWrappers/` and `repositories/` directories. Both are divided up by entity type.

DataSourceWrappers are classes which bundle methods that interact directly with TypeOrm. These are typically finders/fetchers that get a specific thing, but which might vary a lot in implementation between ORMs. These were used in place of directly accessing TypeORM for dependency inversion. See the section at the bottom about Switching out the database for more information. Methods here will throw an error if things go wrong. See the helper section for more information about that. These wrappers are only accessible to repositories.

Repositories are classes which bundle methods that are needed by the API, but don't need to interact directly with the ORM. They might perform a fetch, and then modify information, and then some save operations. They have access to all the dataSourceWrappers and call them as needed. They also contain direct function calls to their corresponding type's dataSourceWrapper. This is done because sometimes, an API just needs to perform a find operation, which is at the dataSourceWrapper level. If you ever add new methods to a dataSourceWrapper which directly goes to an API call, then you will need to have the wrapper's corresponding repository call it. These repositories are fields of the database. Then when you need to access the database, you just access the relevant repository first.

### `backend/src/controllers`

If you are not familiar with Express, you can think of *routers* as the address which API calls go to, and *controllers* as the functions that actually execute when a router is used.

In this directory you will find the controllers for different entities. They are organized by the entity that you would call the controller from. For example, `getProjects` is a controller in the users file because you would want to access a user's projects, even though the returned object is a project. Maybe a better organization would be sorting them by return type, since this is a little ambiguous.

Controllers typically need to get an instance of the singleton database, parse the request body and/or parameters, verify the input, and call the corresponding database function. Then it might need to do a little bit of manipulation, but it should be relatively simple.

Here you will see return statuses as well. See the helper section for more information about that.

### `backend/src/middleware`

If you are not familiar with Express, you can think of *middleware* as code which is executed before or after a controller is executed. Here, we defin the type for a user and perform some verification steps before a controller is called so that users cannot make API calls to other user's data.

### `backend/src/helpers`

This directory is for helper methods that may span multiple directories.

The main file of interest here is the errors.ts file. Here, we define some new Errors for our dataSourceWrappers to throw. Then, we also have an errorWrapper function. If you are not familiar with Javascript or a functional language like Haskell, it is essentially taking in a function as input and will return a function as output, but doesnt actually run this output function yet. Instead, it returns a function where it can be called as a controller, and the function is placed into a try/catch statement.

The reason for this is because routers take a function as input. Without the errorWrapper, we would have to have error checking in every controller function. However, now we can pass the controller function as input, and if any errors are thrown, they are probably by the dataSourceWrapper by TypeORM. We then catch those in the dataSourceWrappers and throw our own errors afterwards so we can catch and interpret them in the wrapper. Each error contains a return code as well, so we can send the return status to the router rather than relying on the controller to.

### `backend/src/router`

Finally, the router directory contains the Express routers. The routers are organized exactly like the controllers, so you can find the controller more easily. Each router defines some type of request (post, get, etc), an endpoint (the url looking part), some middleware, and then the controller. Some routers have middleware from the `helpers` section to veryify users. Each controller is wrapped in an errorWrapper, which is explained in the `helpers` section.

In index.ts, we export the routers as together, and will import them in `backend/index.ts`. That file will also prepend an "api/" to all the router endpoints.

### `backend/tests`

These tests mirror the directories in `backend/src` and have about 70% coverage. It is recommended that you continue to add unit tests to this directory as you extend the backend.

These can be run **from the backend directory** by running `npm test`. You can choose a specific test by passing a third argument. For example, like `npm test router/user`.

Behind the scenes, this is running the `jest` command. You can modify this command in package.json under the `"scripts": "test"` field. You might want to do this if the tests change or if you ever want to generate a coverage report.

# Switching out the database

The team we inherited the project from built the backend using MongoDB. Unfortunately, they did not manage to refactor their backend to have dependency inversion, so when we were tasked with switching to a relational database, we decided to restart the backend from scratch. Fortunately, you will not have to suffer as we did.

If you need to switch out the database, you have a few options.

If it is a type of database supported by TypeORM (see their [website](https://typeorm.io/#installation) for a full list of supported database drivers), then you are in luck. You can probably just change the database type in data-source.ts and maybe make a few modifications to the Entities, depending on what is supported.

If it is not, then do not worry. You may need to change some type around in the backend files, but the bulk of the code should still work. If you can, try to repurpose the classes in the entities directory. You may need to remove the decorators. The bulk of your work will be rewriting the classes in src/db/dataSourceWrapper. Each class contains a handful of functions, most of which are trivial to rewrite with a different ORM. Beware the save function, which has some special behaviors, such as rejecting when some conditions (like nullable: false or unique: true) on columns in the entities are not met. It also creates a unique id if one is not given, among other things. This may be a little more finicky if your new ORM does not support these features, but most good ones should.
6 changes: 6 additions & 0 deletions backend/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
transform: {'^.+\\.ts?$': 'ts-jest'},
testEnvironment: 'node',
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
};
1 change: 0 additions & 1 deletion backend/node_modules/.bin/acorn

This file was deleted.

17 changes: 0 additions & 17 deletions backend/node_modules/.bin/acorn.cmd

This file was deleted.

28 changes: 0 additions & 28 deletions backend/node_modules/.bin/acorn.ps1

This file was deleted.

1 change: 0 additions & 1 deletion backend/node_modules/.bin/mime

This file was deleted.

17 changes: 0 additions & 17 deletions backend/node_modules/.bin/mime.cmd

This file was deleted.

28 changes: 0 additions & 28 deletions backend/node_modules/.bin/mime.ps1

This file was deleted.

1 change: 0 additions & 1 deletion backend/node_modules/.bin/nodemon

This file was deleted.

17 changes: 0 additions & 17 deletions backend/node_modules/.bin/nodemon.cmd

This file was deleted.

28 changes: 0 additions & 28 deletions backend/node_modules/.bin/nodemon.ps1

This file was deleted.

1 change: 0 additions & 1 deletion backend/node_modules/.bin/nodetouch

This file was deleted.

17 changes: 0 additions & 17 deletions backend/node_modules/.bin/nodetouch.cmd

This file was deleted.

Loading