Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ap0nia committed May 23, 2024
2 parents 8b855e7 + c085d1e commit 58b407c
Show file tree
Hide file tree
Showing 149 changed files with 5,390 additions and 14,900 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.cdk.staging
.docusaurus
cdk.out
coverage
build
Expand Down
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.json", "./apps/docs/tsconfig.json"],
project: ["./tsconfig.json"],
sourceType: "module",
},
plugins: ["import", "@typescript-eslint"],
Expand Down Expand Up @@ -38,7 +38,7 @@ const config = {
},
],
},
ignorePatterns: ["docusaurus.config.js", "*.cjs"],
ignorePatterns: ["*.cjs"],
env: {
es2020: true,
node: true,
Expand Down
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior

<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior

<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)

<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->

1.
2.
3.
4.

## Context

<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment

<!--- Include as many relevant details about the environment you experienced the bug in -->

- Environment name and version:
- Operating system and version:
- Link to your project, or a minimal reproducible example:
41 changes: 41 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
27 changes: 1 addition & 26 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

environment:
name: production
url: https://api-next.peterportal.org
url: https://anteaterapi.com

steps:
- name: Checkout repository
Expand All @@ -53,31 +53,6 @@ jobs:

- name: Deploy API CloudFormation stack
run: pnpm --filter="@apps/api" cdk-app deploy

deploy-documentation:
name: Deploy documentation CloudFormation stack and production environment

runs-on: ubuntu-latest

environment:
name: production-docs
url: https://docs.api-next.peterportal.org

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm

- name: Install dependencies
run: pnpm install -P false --frozen-lockfile

- name: Build documentation
run: pnpm build --filter="@apps/docs"

- name: Deploy documentation CloudFormation stack
run: pnpm --filter="@tools/cdk" docs deploy
deploy-services:
name: Deploy services CloudFormation stack and production environment

Expand Down
29 changes: 1 addition & 28 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

environment:
name: staging-${{ github.event.pull_request.number }}
url: https://staging-${{ github.event.pull_request.number }}.api-next.peterportal.org
url: https://staging-${{ github.event.pull_request.number }}.anteaterapi.com

steps:
- name: Checkout repository
Expand All @@ -57,30 +57,3 @@ jobs:

- name: Deploy API CloudFormation stack
run: pnpm --filter="@apps/api" cdk-app deploy

deploy-documentation:
name: Deploy documentation CloudFormation stack and staging environment for pull request

if: (!contains(github.event.pull_request.labels.*.name, 'no deploy'))

runs-on: ubuntu-latest

environment:
name: staging-${{ github.event.pull_request.number }}-docs
url: https://staging-${{ github.event.pull_request.number }}-docs.api-next.peterportal.org

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build documentation
run: pnpm build --filter="@apps/docs"

- name: Deploy documentation CloudFormation stack
run: pnpm --filter="@tools/cdk" docs deploy
30 changes: 0 additions & 30 deletions .github/workflows/destroy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,3 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
environment: staging-${{ github.event.pull_request.number }}
onlyDeactivateDeployments: true

destroy-documentation:
name: Destroy documentation CloudFormation stack and staging environment for pull request

if: (github.event.action == 'labeled' && github.event.label.name == 'no deploy') || github.event.action == 'closed'

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build documentation
run: pnpm build --filter="@apps/docs"

- name: Destroy documentation CloudFormation stack
run: pnpm --filter="@tools/cdk" docs destroy

- name: Set documentation staging environment as inactive
uses: strumwolf/delete-deployment-environment@a4825dd9648c57da8437a4885c3fcad58beac69c # v3.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: staging-${{ github.event.pull_request.number }}-docs
onlyDeactivateDeployments: true
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,3 @@ tools/grades-updater/outputData

# grades-updater logs
tools/grades-updater/logs

# docusaurus
.docusaurus
build/
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.cdk.staging
.docusaurus
cdk.out
coverage
build
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contributing to PeterPortal API
# Contributing to Anteater API

Thank you for your interest in contributing to PeterPortal API!
Thank you for your interest in contributing to Anteater API!

Our Contributor's Guide has moved [here](https://docs.api-next.peterportal.org/docs/contributors-guide/getting-started).
Our Contributor's Guide has moved [here](https://docs.icssc.club/anteaterapi/contributors-guide/getting-started).
14 changes: 10 additions & 4 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Contributors are listed below in alphabetical order of their GitHub username.

## [Legacy API](https://github.com/icssc/peterportal-public-api) Contributors

API-Next contributors who have also contributed to the Legacy API are not listed here.
Contributors to Anteater API who have also contributed to the Legacy API are not listed here.

- Akshay ([@akins1](https://github.com/akins1))
- Audrey Lam ([@alam7989](https://github.com/alam7989))
Expand All @@ -32,17 +32,23 @@ API-Next contributors who have also contributed to the Legacy API are not listed
- Tianjiao Huang ([@tjhu](https://github.com/tjhu))
- Ye Min Aung ([@ym-aung](https://github.com/ym-aung))

## API-Next Contributors
## Anteater API Contributors

An up-to-date list of contributors to this repository is available [here](https://github.com/icssc/peterportal-api-next/graphs/contributors).
An up-to-date list of individuals who have contributed code to this repository is available [here](https://github.com/icssc/peterportal-api-next/graphs/contributors). This list also includes individuals who have contributed in other ways, including (but not limited to) creating issues, providing feedback, etc.

- Dalton Adcock ([@adcockdalton](https://github.com/adcockdalton))
- Alexander Liu ([@alexanderl19](https://github.com/alexanderl19))
- Andrew Wang ([@andrew-wang0](https://github.com/andrew-wang0))
- Brian Vo ([@ap0nia](https://github.com/ap0nia))
- Benson Jing ([@bensonjing](https://github.com/bensonjing))
- Brian Vo ([@bevm0](https://github.com/bevm0))
- Christopher Kwong ([@ChrisK-wong](https://github.com/ChrisK-wong))
- Daniel Boghossian ([@Dg155](https://github.com/Dg155))
- Ethan Deng ([@ethand605](https://github.com/ethand605))
- Kevin Wu ([@KevinWu098](https://github.com/KevinWu098))
- Yizhen Liu ([@imliuyzh](https://github.com/imliuyzh))
- Jordan Yee ([@jordany33](https://github.com/jordany33))
- Minh Nguyen ([@MinhxNguyen7](https://github.com/MinhxNguyen7))
- Randy Huynh ([@RandyHuynh5815](https://github.com/RandyHuynh5815))
- Sanskar Mishra ([@sanskarm7](https://github.com/sanskarm7))
- Frederick Dong ([@Voark](https://github.com/Voark))
- Yasper De Jong ([@y-dejong](https://github.com/y-dejong))
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
![PeterPortal API logo banner](apps/docs/static/img/banner.png)

## ℹ️ About

PeterPortal API is a student-developed and maintained project that aims to provide software developers with easy access to publicly available data from the University of California, Irvine. This includes but is not limited to information on courses, instructors, past grade distributions, and much more.

The _Next_ version of the PeterPortal API is rewritten from the ground up, with special emphasis placed on providing a superior experience for developers and users. This will help to further our mission of encouraging fellow student developers to create open-source applications that benefit the Anteater community.
Anteater API (formerly PeterPortal API _Next_) is a student-developed and maintained project that aims to provide software developers with easy access to publicly available data from the University of California, Irvine. This includes but is not limited to information on courses, instructors, past grade distributions, and much more.

## 🔨 Built with

Expand All @@ -18,7 +14,7 @@ The _Next_ version of the PeterPortal API is rewritten from the ground up, with

## 📖 Documentation

Our documentation can be found [here](https://docs.api-next.peterportal.org).
Our documentation can be found [here](https://docs.icssc.club/anteaterapi).

## 🤝 Contributing

Expand Down
29 changes: 21 additions & 8 deletions apps/api/bronya.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { App, Stack, Duration } from "aws-cdk-lib/core";
import { config } from "dotenv";
import type { BuildOptions } from "esbuild";

import { normalizeCourse } from "./src/lib/utils";
import { normalizeCourse, normalizeStudyRoom } from "./src/lib/utils";

const prisma = new PrismaClient();

Expand Down Expand Up @@ -88,7 +88,7 @@ const prismaQueryEngineFile = "libquery_engine-linux-arm64-openssl-3.0.x.so.node
/**
* Namespace for virtual files.
*/
const namespace = "peterportal-api-next:virtual";
const namespace = "anteater-api:virtual";

/**
* Shared ESBuild options.
Expand Down Expand Up @@ -121,6 +121,10 @@ export const esbuildOptions: BuildOptions = {
path: args.path,
namespace,
}));
build.onResolve({ filter: /virtual:studyRooms/ }, (args) => ({
path: args.path,
namespace,
}));
build.onLoad({ filter: /virtual:courses/, namespace }, async () => ({
contents: `export const courses = ${JSON.stringify(
Object.fromEntries(
Expand All @@ -133,6 +137,13 @@ export const esbuildOptions: BuildOptions = {
Object.fromEntries((await prisma.instructor.findMany()).map((x) => [x.ucinetid, x])),
)}`,
}));
build.onLoad({ filter: /virtual:studyRooms/, namespace }, async () => ({
contents: `export const studyRooms = ${JSON.stringify(
Object.fromEntries(
(await prisma.studyRoom.findMany()).map(normalizeStudyRoom).map((x) => [x.id, x]),
),
)}`,
}));
},
},
],
Expand Down Expand Up @@ -235,9 +246,9 @@ function getStage() {
* in order to support development functionality.
*/
export async function main(): Promise<App> {
const id = "peterportal-api-next";
const id = "anteater-api";

const zoneName = "peterportal.org";
const zoneName = "anteaterapi.com";

const app = new App();

Expand Down Expand Up @@ -269,6 +280,7 @@ export async function main(): Promise<App> {
statusCode: "500",
templates: {
"application/json": JSON.stringify({
success: false,
timestamp: "$context.requestTime",
requestId: "$context.requestId",
statusCode: 500,
Expand All @@ -283,6 +295,7 @@ export async function main(): Promise<App> {
statusCode: "404",
templates: {
"application/json": JSON.stringify({
success: false,
timestamp: "$context.requestTime",
requestId: "$context.requestId",
statusCode: 404,
Expand Down Expand Up @@ -318,20 +331,20 @@ export async function main(): Promise<App> {

// Set up the custom domain name and A record for the API.
synthesized.api.addDomainName(`${id}-${stage}-domain`, {
domainName: `${stage === "prod" ? "" : `${stage}.`}api-next.peterportal.org`,
domainName: `${stage === "prod" ? "" : `${stage}.`}anteaterapi.com`,
certificate: Certificate.fromCertificateArn(
synthesized.api,
"peterportal-cert",
"anteaterapi-cert",
process.env.CERTIFICATE_ARN ?? "",
),
});

new ARecord(synthesized.api, `${id}-${stage}-a-record`, {
zone: HostedZone.fromHostedZoneAttributes(synthesized.api, "peterportal-hosted-zone", {
zone: HostedZone.fromHostedZoneAttributes(synthesized.api, "anteaterapi-hosted-zone", {
zoneName,
hostedZoneId: process.env.HOSTED_ZONE_ID ?? "",
}),
recordName: `${stage === "prod" ? "" : `${stage}.`}api-next`,
recordName: `${stage === "prod" ? "" : `${stage}`}`,
target: RecordTarget.fromAlias(new ApiGateway(synthesized.api)),
});

Expand Down
Loading

0 comments on commit 58b407c

Please sign in to comment.