Skip to content

Commit

Permalink
feat: upgrade mongoose to 8.8.2 (#604)
Browse files Browse the repository at this point in the history
feat: upgrade mongoose to v8.8.2
  • Loading branch information
ecshreve authored Nov 22, 2024
1 parent a65aabe commit 43242e0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
44 changes: 28 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"graphql-compose": "^9.0.11",
"graphql-compose-mongoose": "^10.0.0",
"graphql-depth-limit": "^1.1.0",
"mongoose": "^8.5.4",
"mongoose": "^8.8.2",
"morgan": "^1.10.0",
"node-fetch": "^3.1.1",
"redis": "^4.7.0",
Expand Down
6 changes: 3 additions & 3 deletions src/graphql/resolvers/common.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AbilityScoreModel from '../../models/abilityScore/index.js';
import EquipmentCategoryModel from '../../models/equipmentCategory/index.js';
import { AreaOfEffect, Choice, DifficultyClass } from '../../models/common/types';
import { Equipment } from '../../models/equipment/types';
import { DifficultyClass, AreaOfEffect, Choice } from '../../models/common/types';
import EquipmentCategoryModel from '../../models/equipmentCategory/index.js';
import SpellModel from '../../models/spell/index.js';

export const equipmentBaseFieldResolvers = {
Expand Down Expand Up @@ -259,7 +259,7 @@ export type ResolvedDC = {
};
export const resolveDc = async (dc: DifficultyClass) => {
const resolvedDc: ResolvedDC = {
type: (await AbilityScoreModel.findOne({ index: dc.dc_type.index }).lean()) || '',
type: (await AbilityScoreModel.findOne({ index: dc.dc_type.index }).lean())?.name || '',
success: dc.success_type.toUpperCase(),
};

Expand Down
10 changes: 5 additions & 5 deletions src/graphql/resolvers/featureResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ const Feature = {
const prerequisiteToReturn = { ...prerequisite };

if ('feature' in prerequisite && 'feature' in prerequisiteToReturn) {
prerequisiteToReturn.feature =
(await FeatureModel.findOne({
url: prerequisite.feature,
}).lean()) || '';
const foundFeature = await FeatureModel.findOne({
url: prerequisite.feature,
}).lean();
prerequisiteToReturn.feature = foundFeature?.url || prerequisite.feature;
}

if ('spell' in prerequisite && 'spell' in prerequisiteToReturn) {
prerequisiteToReturn.spell =
(await SpellModel.findOne({ url: prerequisite.spell }).lean()) || '';
(await SpellModel.findOne({ url: prerequisite.spell }).lean())?.url || prerequisite.spell;
}

return prerequisiteToReturn;
Expand Down

0 comments on commit 43242e0

Please sign in to comment.