diff --git a/apps/backend/src/modules/rating/formatter.ts b/apps/backend/src/modules/rating/formatter.ts index 1bf257fcf..c3320eea4 100644 --- a/apps/backend/src/modules/rating/formatter.ts +++ b/apps/backend/src/modules/rating/formatter.ts @@ -3,14 +3,15 @@ import { Rating, AggregatedRatings, Metric, - Category -} from './typedefs/rating'; + Category, + Semester +} from '../../generated-types/graphql'; // mongo -> graphql (models -> typedefs) export const formatUserRating = (rating: RatingType): Rating => ({ subject: rating.subject, courseNumber: rating.courseNumber, - semester: rating.semester, + semester: rating.semester as Semester, year: rating.year, class: rating.class, @@ -22,7 +23,7 @@ export const formatUserRating = (rating: RatingType): Rating => ({ // does mongo always return an array? single return val vs multiple val export const formatUserRatings = (ratings: any[]): Rating[] => { - return ratings.map(formatUserRatings); + return ratings.map(formatUserRating); }; // grandparent group by class -> done diff --git a/packages/common/src/models/rating.ts b/packages/common/src/models/rating.ts index 17c766070..8ba571c37 100644 --- a/packages/common/src/models/rating.ts +++ b/packages/common/src/models/rating.ts @@ -28,7 +28,7 @@ const ratingSchema = new Schema({ required: true, }, year: { - type: String, + type: Number, required: true, }, class: {