Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump jsonwebtoken from 8.5.1 to 9.0.0 #47

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
8c3b8a3
Fetching and using the bearer token
emilkovacev Jul 23, 2022
4891453
Create postman-setup.md
emilkovacev Jul 23, 2022
76ba7bd
Additional authentication setup steps
emilkovacev Jul 23, 2022
af15826
Delete .DS_Store
emilkovacev Sep 21, 2022
4835cf9
Merge pull request #3 from makeopensource/remove-ds-store
jessehartloff Sep 22, 2022
9a379cc
Added non-implemented schema members
emilkovacev Sep 28, 2022
f94bfb5
added types to schema doc
emilkovacev Sep 28, 2022
c5284c0
fixed markdown checklist syntax
emilkovacev Sep 28, 2022
01e41dc
Merge pull request #5 from emilkovacev/master
jessehartloff Sep 28, 2022
e65a160
Merge pull request #1 from emilkovacev/postman-setup-docs
jessehartloff Sep 28, 2022
086614b
Merge pull request #2 from emilkovacev/setup-auth-docs
jessehartloff Sep 28, 2022
1a18285
Move schema to docs folder; Add released field to AssignmentProblemScore
jessehartloff Sep 28, 2022
b4200ef
Merge pull request #6 from makeopensource/documentation
emilkovacev Sep 28, 2022
e451fba
[Dependencies] Update deps to resolve vulns
WeirdAlex03 Oct 5, 2022
a1e5c9a
[Documentation] Fix project referred to as example
WeirdAlex03 Oct 5, 2022
c811186
docs(README): Capitalize header on line 12
WeirdAlex03 Oct 12, 2022
7fe5c18
docs(README): Clean up spelling/formatting errors
WeirdAlex03 Oct 12, 2022
cd05c24
Merge pull request #16 from WeirdAlex03/WeirdAlex03/issue15
jessehartloff Oct 12, 2022
77d57c0
Merge branch 'master' into WeirdAlex03/issue18
jessehartloff Oct 12, 2022
15deaab
Bump passport-saml from 3.2.1 to 3.2.2
dependabot[bot] Oct 12, 2022
6e078f5
ci(GH Actions): Initial basic build & test
WeirdAlex03 Oct 12, 2022
ab6cf9e
ci(GH Actions): Remove Node v14 from tests
WeirdAlex03 Oct 12, 2022
e1445e1
ci(GH Actions): Disable fail-fast, new format run
WeirdAlex03 Oct 12, 2022
9220a68
ci(GH Actions): Fix format run
WeirdAlex03 Oct 12, 2022
43fcf4b
ci(GH Actions): Add Docker setup to build and test
WeirdAlex03 Oct 12, 2022
cb5c42a
ci(GH Actions): Edit docker run command
WeirdAlex03 Oct 12, 2022
0f47927
ci(GH Actions): Separate test, add annotations
WeirdAlex03 Oct 13, 2022
02d5519
ci(GH Actions): Fix test action
WeirdAlex03 Oct 13, 2022
e675f11
ci(GH Actions): Restructure actions into one file
WeirdAlex03 Oct 14, 2022
a2624cf
ci(GH Actions): Fix actions again
WeirdAlex03 Oct 14, 2022
16e4c42
ci(GH Actions): Clean up action runs
WeirdAlex03 Oct 14, 2022
ddc6ce6
test(GH Actions): Ex. of failing test, formatting
WeirdAlex03 Oct 14, 2022
810bf9a
Bump @xmldom/xmldom from 0.7.5 to 0.7.6
dependabot[bot] Oct 17, 2022
eeb7386
Merge pull request #25 from makeopensource/dependabot/npm_and_yarn/xm…
jessehartloff Oct 19, 2022
fe8665d
Merge pull request #19 from WeirdAlex03/WeirdAlex03/issue18
jessehartloff Oct 19, 2022
7254b05
Merge pull request #20 from makeopensource/dependabot/npm_and_yarn/pa…
jessehartloff Oct 19, 2022
052d51b
Merge pull request #26 from UBAutograding/master
emilkovacev Oct 19, 2022
46c88c0
ci(GH Actions): Formatter needs to commit results
WeirdAlex03 Oct 19, 2022
3e7a255
ci(GH Actions): Looks good, actually committing
WeirdAlex03 Oct 19, 2022
5412e59
ci(GH Actions): Try different method to commit
WeirdAlex03 Oct 19, 2022
c2e2b25
Merge 5412e59a36bb1685e7bb51ee5d906e6b55cafdf5 into b4200ef1bd89f3e84…
WeirdAlex03 Oct 19, 2022
2f80b8a
style: run formatter
WeirdAlex03 Oct 19, 2022
a2f07be
ci(GH Actions): Different commit technique
WeirdAlex03 Oct 19, 2022
0c35121
ci(GH Actions): Fix checkout to work with commit
WeirdAlex03 Oct 19, 2022
bec0ff1
style: run formatter
github-actions[bot] Oct 19, 2022
c84da63
test(GH Actions): It works, undo broken test
WeirdAlex03 Oct 19, 2022
66084d4
ci(GH Actions): Formatter needs to commit results
WeirdAlex03 Oct 19, 2022
20e571a
Merge branch 'master' into issue22
WeirdAlex03 Oct 19, 2022
641e9da
Merge pull request #23 from WeirdAlex03/issue22
jessehartloff Oct 26, 2022
b422558
Added to docs
emilkovacev Nov 16, 2022
a59642b
Merge pull request #42 from emilkovacev/master
jessehartloff Nov 30, 2022
a7536dc
build(deps): bump jsonwebtoken from 8.5.1 to 9.0.0
dependabot[bot] Dec 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
85 changes: 85 additions & 0 deletions .github/workflows/pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: PR Review

on: [ pull_request, workflow_dispatch ]

jobs:
build:
name: Build

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]
# 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'
- name: Prepare environment
run: |
docker run --name typeorm-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=typescript_api -e POSTGRES_USER=typescript_user -d postgres
npm ci
npm run generate-config
npm run typeorm -- migration:run
- name: Build project
run: npm run build


test:
name: Run tests

needs: build

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'
- name: Prepare environment
run: |
docker run --name typeorm-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=typescript_api -e POSTGRES_USER=typescript_user -d postgres
npm ci
npm run generate-config
npm run typeorm -- migration:run
- name: Build project
run: npm run build
- name: Run tests
uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


format:
name: Run formatter

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'
- name: Prepare environment
run: npm ci
- name: Run formatter
run: npm run format
- name: Commit results
uses: EndBug/add-and-commit@v9
with:
message: 'style: run formatter'
default_author: github_actions
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Typescript Example Project
# devU API

This is an API for the v4 autograder. The main purpose of this project is to act as an in-between for the containers doing the autograding, and the users submitting assignments.

Expand All @@ -9,7 +9,7 @@ This is an API for the v4 autograder. The main purpose of this project is to act

For now the only reason we're including docker is to more easily control the development database. In the future we may very well dockerize the api itself for ease of development and deployment, but for now this writeup is expecting it to be running directly on your machine via node.

## Running the project locally
## Running the Project Locally

### Getting Everything Started

Expand All @@ -25,7 +25,7 @@ docker run \
-d postgres
```

Install all node dependancies. All of the database environment variables can change, and can be set as environment variables on your machine if you want to overwrite the defaults
Install all node dependencies. All of the database environment variables can change, and can be set as environment variables on your machine if you want to overwrite the defaults

```
npm install
Expand All @@ -37,7 +37,6 @@ Run the setup script to create local development auth keys. These are used in lo
npm run generate-config
```


Run the initial migrations to setup our DB schema

```
Expand Down Expand Up @@ -76,13 +75,13 @@ Use [Azure Data Studio](https://docs.microsoft.com/en-us/sql/azure-data-studio/d

### Local Auth Providers

If you're looking for more information on how to setup auth for your developement environment, check out more info [here](./docs/localAuth.md)
If you're looking for more information on how to setup auth for your development environment, check out more info [here](./docs/localAuth.md)

## Working in the Project

This project is built using

- [Typescript](https://www.typescriptlang.org/) - A superset of JavaScript. The language of the applciation
- [Typescript](https://www.typescriptlang.org/) - A superset of JavaScript. The language of the application
- [Express](https://expressjs.com/) - A Node REST framework.
- [TypeORM](https://typeorm.io/#/) - A Typescript ORM (manages the DB and all DB calls)

Expand All @@ -101,7 +100,7 @@ In express, all of the functions added after the route's path are considered mid
Express's middleware is always a function with three arguments

```typescript
function middlwareName(req: Reques, res: Response, next: NextFunction)
function middlewareName(req: Request, res: Response, next: NextFunction)
```

Here's what you need to know:
Expand Down Expand Up @@ -130,7 +129,7 @@ Let's take this from the top
- Controllers: deals with setting status codes, and directing to services. For the most part, controllers should be the last piece of middleware in the chain.
- Services: Workhorse of the application. Deals with all major application logic and database calls

The database models live outside of this control flow as they don't deal with any buisness logic. However services will use them to access the database. You can largely think of the models as a 1:1 map to database tables.
The database models live outside of this control flow as they don't deal with any business logic. However services will use them to access the database. You can largely think of the models as a 1:1 map to database tables.

### Shared Modules

Expand Down Expand Up @@ -168,7 +167,7 @@ npm test

Keep in mind that when testing, jest is looking for `*.test.ts` files, so be sure to include the `.test` portion in those filenames.

If durring development, you want to only run a single test file (via command line), you can do so by adding a string to the end of the test command. That string will be used as a regex against the filename(s). So as an example, if we wanted to run all of the controller tests, you could do so by:
If during development, you want to only run a single test file (via command line), you can do so by adding a string to the end of the test command. That string will be used as a regex against the filename(s). So as an example, if we wanted to run all of the controller tests, you could do so by:

```
npm test "controller"
Expand Down Expand Up @@ -210,7 +209,7 @@ npm run typeorm -- migration:revert

### Configuration Options

Most of the API's configuraiton options live in a file called `environment.ts`. That file is bootstrapped at startup using the [config library]https://www.npmjs.com/package/config), as well as some environment variables.
Most of the API's configuration options live in a file called `environment.ts`. That file is bootstrapped at startup using the [config library](https://www.npmjs.com/package/config), as well as some environment variables.

What this means for you (the developer) is that you can control certain api options via environment variables at runtime, or by using your `config/default.yml`. To see which `environment.ts` options support using environment variables directly, open that file and see which are using `process.env.*`; everything else should be configurable via your `default.yml`

Expand All @@ -236,7 +235,7 @@ import Routers
import Utils
```

The important thing here is once you get into the modules (models/ controllers/ routers/ etc), import them alphebetically with a single empty line inbetween them.
The important thing here is once you get into the modules (models/ controllers/ routers/ etc), import them alphabetically with a single empty line in between them.

## Production Builds

Expand Down
119 changes: 119 additions & 0 deletions docs/SCHEMA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Entities

- [x] [User](#user)
- [x] [Course](#course)
- [x] [UserCourse](#usercourse)
- [x] [Assignment](#assignment)
- [x] [Submission](#submission)
- [x] [AssignmentProblem](#assignmentproblem)
- [ ] [SubmissionProblemScore](#submissionproblemscore)
- [ ] [SubmissionScore](#submissionscore)
- [ ] [AssignmentScore](#assignmentscore)
- [ ] [CategoryScore](#categoryscore)
- [ ] [Category](#category)
- [ ] [CourseScore](#coursescore)

# Entity Details

### Generic Entity Attributes

- id
- createdAt
- updatedAt
- deletedAt

### User

_Student user for devu_

- email: string
- externalId: foreign_key
- preferredName: string

### Course

- name: string
- semester: string
- number: string _ex: cse220_
- startDate: ?
- endDate: ?

### UserCourse

_Links a user to a course_

- userId: foreign_key
- courseId: foreign_key
- level: ?
- dropped: boolean

### Assignment

- courseId: foreign_key
- name: string
- startDate: ?
- dueDate: ?
- endDate: ?
- gradingType: ?
- categoryName: ?
- description: string
- maxFileSize: ?
- maxSubmissions: ?
- disableHandins: boolean

### Submission

- courseId: foreign_key
- assignmentId: foreign_key
- userId: foreign_key
- content: ?
- type: ?
- submitterIp: ?
- submittedBy: ?
- orignalSubmissionId: ?

### AssignmentProblem

- assignmentId: foreign_key
- problemName: ?
- maxScore: ?

**------ Everything above this line exists in the code. Everything below needs to be built ------**

### SubmissionProblemScore

- submissionId: foreign_key
- assignmentProblemId: foreign_key
- score: ?
- feedback: ?
- released: ?

### SubmissionScore

- submissionId: foreign_key
- score: ?
- feedback: ?
- released: ?

### AssignmentScore

- assignmentId: foreign_key
- userId: foreign_key
- score: ?

### CategoryScore

- categoryId: foreign_key
- userId: foreign_key
- _missing attributes_

### Category

- courseId: foreign_key
- _missing attributes_

### CourseScore

- courseId: foreign_key
- userId: foreign_key
- _missing attributes_
Loading