Skip to content

Commit

Permalink
Merge branch 'master' into test-serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
mehallhm authored Nov 11, 2024
2 parents 33d52df + a5d14a0 commit 7c6b712
Show file tree
Hide file tree
Showing 90 changed files with 4,502 additions and 4,498 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ module.exports = {
// "airbnb-base",
// "airbnb-typescript/base",
// Overrides AirBnB styles; keep in this order
"plugin:prettier/recommended",
// "plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
ecmaVersion: 2021,
},
plugins: ["@typescript-eslint/eslint-plugin", "deprecation", "prettier"],
plugins: ["@typescript-eslint/eslint-plugin", "deprecation" /*"prettier"*/],
rules: {
// // "@typescript-eslint/explicit-function-return-type": "off",
// // "@typescript-eslint/explicit-module-boundary-types": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
ports:
- 5432:5432
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.1.0
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
env:
discovery.type: single-node
ports:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "22"
- uses: bahmutov/npm-install@v1
- name: Linting
run: yarn lint
Expand All @@ -42,7 +42,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "22"
- uses: bahmutov/npm-install@v1
- name: Checks for duplicate definitions in the yarn lockfile
run: yarn yarn-deduplicate --fail
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "22"
- uses: bahmutov/npm-install@v1

- run: yarn unittest --coverage
Expand All @@ -44,7 +44,7 @@ jobs:
ports:
- 5432:5432
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.1.0
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
env:
discovery.type: single-node
ports:
Expand All @@ -59,7 +59,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "22"
- uses: bahmutov/npm-install@v1

- run: yarn db:migrate
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
ports:
- 5432:5432
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.1.0
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
env:
discovery.type: single-node
ports:
Expand All @@ -112,7 +112,7 @@ jobs:
- name: install node
uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "22"

- uses: bahmutov/npm-install@v1

Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn pretty-quick --staged && yarn eslint --no-error-on-unmatched-pattern --fix $(git diff --name-only HEAD | grep -E '\\.(js|ts)$' | xargs)
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
22
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build environment
FROM node:16-alpine as build
FROM node:22-alpine as build
WORKDIR /app
# Install deps
COPY package.json /app/package.json
Expand All @@ -26,12 +26,9 @@ RUN apk update && apk add wget && rm -rf /var/cache/apk/* \
&& wget "https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem"
ENV dbCertPath /app/rds-ca-2019-root.pem

# Required for Prisma compatibility since Node 16.16
RUN apk add --update --no-cache openssl1.1-compat

ENV NODE_ENV=prod

ENTRYPOINT ["/app/entrypoint.sh"]

EXPOSE 4000 8080
CMD ["yarn", "prod"]
CMD ["yarn", "prod"]
2 changes: 1 addition & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
],
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-proposal-class-properties"],
"plugins": [],
"ignore": ["node_modules"]
}
16 changes: 8 additions & 8 deletions graphql/resolvers/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const serializeValues = (results: PrismaCourse[]): Course[] => {

const getLatestClassOccurrence = async (
subject: string,
classId: string
classId: string,
): Promise<Course> => {
const result: PrismaCourse | null = await prisma.course.findFirst({
where: { subject, classId },
Expand All @@ -35,7 +35,7 @@ const getLatestClassOccurrence = async (
extensions: {
code: "COURSE_NOT_FOUND",
},
}
},
);
}
return HydrateCourseSerializer.serializeCourse(result);
Expand All @@ -45,7 +45,7 @@ const getBulkClassOccurrences = async (
input: Array<{
subject: string;
classId: string;
}>
}>,
): Promise<Course[]> => {
const results: PrismaCourse[] = await prisma.course.findMany({
where: { OR: input },
Expand All @@ -57,7 +57,7 @@ const getBulkClassOccurrences = async (

const getAllClassOccurrences = async (
subject: string,
classId: string
classId: string,
): Promise<Course[]> => {
const results = await prisma.course.findMany({
where: { subject, classId },
Expand All @@ -71,7 +71,7 @@ const getAllClassOccurrences = async (
const getClassOccurrence = async (
termId: string,
subject: string,
classId: string
classId: string,
): Promise<Course> => {
const result: PrismaCourse | null = await prisma.course.findUnique({
where: {
Expand All @@ -87,7 +87,7 @@ const getClassOccurrence = async (
extensions: {
code: "COURSE_NOT_FOUND",
},
}
},
);
}

Expand All @@ -107,7 +107,7 @@ const getClassOccurrenceById = async (id: string): Promise<Course> => {
extensions: {
code: "COURSE_NOT_FOUND",
},
}
},
);
}
return HydrateCourseSerializer.serializeCourse(result);
Expand All @@ -125,7 +125,7 @@ const getSectionById = async (id: string): Promise<Section> => {
extensions: {
code: "SECTION_NOT_FOUND",
},
}
},
);
}
const resSec: Section = HydrateCourseSerializer.serializeSection(result); // this mutates res
Expand Down
2 changes: 1 addition & 1 deletion graphql/resolvers/major.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const noResultsError = (recordType): never => {
};

const getLatestMajorOccurrence = async (
majorId: string
majorId: string,
): Promise<PrismaMajor> => {
const majors: PrismaMajor[] = await prisma.major.findMany({
where: { majorId: majorId },
Expand Down
8 changes: 4 additions & 4 deletions graphql/resolvers/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const resolvers = {
Query: {
search: async (
parent,
args: SearchArgs
args: SearchArgs,
): Promise<SearchResultItemConnection> => {
const { offset = 0, first = 10 } = args;
const results = await searcher.search(
Expand All @@ -48,8 +48,8 @@ const resolvers = {
classIdRange: args.classIdRange,
honors: args.honors,
},
identity
)
identity,
),
);

const hasNextPage = offset + first < results.resultCount;
Expand All @@ -59,7 +59,7 @@ const resolvers = {
nodes: results.searchContent.map((r) =>
r.type === "employee"
? r.employee
: { ...r.class, sections: r.sections }
: { ...r.class, sections: r.sections },
),
pageInfo: {
hasNextPage,
Expand Down
Loading

0 comments on commit 7c6b712

Please sign in to comment.