From 8f81d251d40f04af8940089138007284909f3152 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Fri, 27 Dec 2024 18:10:42 -0800 Subject: [PATCH] Setup graphql endpoints for 2014 --- .../resolvers/abilityScoreResolver.ts | 4 +- .../resolvers/ammunitionResolver.ts | 0 .../{ => 2014}/resolvers/armorResolver.ts | 4 +- .../resolvers/backgroundResolver.ts | 12 ++--- .../{ => 2014}/resolvers/classResolver.ts | 16 +++--- .../resolvers/classSpecificResolver.ts | 2 +- src/graphql/{ => 2014}/resolvers/common.ts | 10 ++-- .../resolvers/equipmentCategoryResolver.ts | 12 ++--- .../equipmentMultipleItemResolver.ts | 2 +- .../resolvers/equipmentOptionResolver.ts | 2 +- .../resolvers/expertiseOptionResolver.ts | 2 +- .../{ => 2014}/resolvers/featResolver.ts | 4 +- .../{ => 2014}/resolvers/featureResolver.ts | 16 +++--- .../{ => 2014}/resolvers/gearResolver.ts | 0 .../resolvers/iEquipmentBaseResolver.ts | 2 +- .../resolvers/iEquipmentResolver.ts | 2 +- .../{ => 2014}/resolvers/iGearResolver.ts | 2 +- .../{ => 2014}/resolvers/languageResolver.ts | 2 +- .../{ => 2014}/resolvers/levelResolver.ts | 8 +-- .../{ => 2014}/resolvers/magicItemResolver.ts | 2 +- .../resolvers/magicShoolResolver.ts | 2 +- .../resolvers/monsterActionOptionResolver.ts | 2 +- .../{ => 2014}/resolvers/monsterResolver.ts | 20 +++---- .../{ => 2014}/resolvers/packResolver.ts | 4 +- .../resolvers/proficiencyOptionResolver.ts | 2 +- .../resolvers/proficiencyRaceResolver.ts | 4 +- .../resolvers/proficiencyReferenceResolver.ts | 8 +-- .../resolvers/proficiencyResolver.ts | 16 +++--- .../{ => 2014}/resolvers/queryResolver.ts | 54 +++++++++---------- .../{ => 2014}/resolvers/raceResolver.ts | 12 ++--- .../{ => 2014}/resolvers/rootResolvers.ts | 0 .../{ => 2014}/resolvers/ruleResolver.ts | 4 +- .../resolvers/scalars/actionCountResolver.ts | 0 .../scalars/areaOfEffectTypeFilter.ts | 0 .../resolvers/scalars/enumFilterResolver.ts | 0 .../resolvers/scalars/floatFilterResolver.ts | 0 .../resolvers/scalars/intFilterResolver.ts | 0 .../scalars/languageScriptFilterResolver.ts | 0 .../scalars/monsterSubtypeFilterResolver.ts | 0 .../scalars/monsterTypeFilterResolver.ts | 0 .../scalars/proficiencyTypeFilterResolver.ts | 0 .../resolvers/scalars/sizeFilterResolver.ts | 0 .../scalars/spellAttackTypeFilterResolver.ts | 0 .../resolvers/scalars/stringFilterResolver.ts | 0 .../{ => 2014}/resolvers/skillResolver.ts | 4 +- .../resolvers/spellPrerequisiteResolver.ts | 4 +- .../{ => 2014}/resolvers/spellResolver.ts | 14 ++--- .../startingEquipmentOptionSetResolver.ts | 2 +- .../{ => 2014}/resolvers/subclassResolver.ts | 8 +-- .../resolvers/subclassSpecificResolver.ts | 2 +- .../{ => 2014}/resolvers/subraceResolver.ts | 12 ++--- .../{ => 2014}/resolvers/toolResolver.ts | 4 +- .../{ => 2014}/resolvers/traitResolver.ts | 20 +++---- .../{ => 2014}/resolvers/vehicleResolver.ts | 4 +- .../{ => 2014}/resolvers/weaponResolver.ts | 8 +-- src/graphql/{ => 2014}/schema.ts | 2 +- src/graphql/{ => 2014}/typeDefs.graphql | 0 src/graphql/2024/.keepme | 0 src/middleware/apolloServer.ts | 2 +- src/server.ts | 8 +++ 60 files changed, 167 insertions(+), 159 deletions(-) rename src/graphql/{ => 2014}/resolvers/abilityScoreResolver.ts (83%) rename src/graphql/{ => 2014}/resolvers/ammunitionResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/armorResolver.ts (69%) rename src/graphql/{ => 2014}/resolvers/backgroundResolver.ts (84%) rename src/graphql/{ => 2014}/resolvers/classResolver.ts (92%) rename src/graphql/{ => 2014}/resolvers/classSpecificResolver.ts (91%) rename src/graphql/{ => 2014}/resolvers/common.ts (94%) rename src/graphql/{ => 2014}/resolvers/equipmentCategoryResolver.ts (81%) rename src/graphql/{ => 2014}/resolvers/equipmentMultipleItemResolver.ts (83%) rename src/graphql/{ => 2014}/resolvers/equipmentOptionResolver.ts (85%) rename src/graphql/{ => 2014}/resolvers/expertiseOptionResolver.ts (85%) rename src/graphql/{ => 2014}/resolvers/featResolver.ts (76%) rename src/graphql/{ => 2014}/resolvers/featureResolver.ts (88%) rename src/graphql/{ => 2014}/resolvers/gearResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/iEquipmentBaseResolver.ts (80%) rename src/graphql/{ => 2014}/resolvers/iEquipmentResolver.ts (73%) rename src/graphql/{ => 2014}/resolvers/iGearResolver.ts (70%) rename src/graphql/{ => 2014}/resolvers/languageResolver.ts (75%) rename src/graphql/{ => 2014}/resolvers/levelResolver.ts (76%) rename src/graphql/{ => 2014}/resolvers/magicItemResolver.ts (77%) rename src/graphql/{ => 2014}/resolvers/magicShoolResolver.ts (76%) rename src/graphql/{ => 2014}/resolvers/monsterActionOptionResolver.ts (83%) rename src/graphql/{ => 2014}/resolvers/monsterResolver.ts (91%) rename src/graphql/{ => 2014}/resolvers/packResolver.ts (75%) rename src/graphql/{ => 2014}/resolvers/proficiencyOptionResolver.ts (82%) rename src/graphql/{ => 2014}/resolvers/proficiencyRaceResolver.ts (71%) rename src/graphql/{ => 2014}/resolvers/proficiencyReferenceResolver.ts (61%) rename src/graphql/{ => 2014}/resolvers/proficiencyResolver.ts (74%) rename src/graphql/{ => 2014}/resolvers/queryResolver.ts (91%) rename src/graphql/{ => 2014}/resolvers/raceResolver.ts (89%) rename src/graphql/{ => 2014}/resolvers/rootResolvers.ts (100%) rename src/graphql/{ => 2014}/resolvers/ruleResolver.ts (77%) rename src/graphql/{ => 2014}/resolvers/scalars/actionCountResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/areaOfEffectTypeFilter.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/enumFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/floatFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/intFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/languageScriptFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/monsterSubtypeFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/monsterTypeFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/proficiencyTypeFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/sizeFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/spellAttackTypeFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/scalars/stringFilterResolver.ts (100%) rename src/graphql/{ => 2014}/resolvers/skillResolver.ts (57%) rename src/graphql/{ => 2014}/resolvers/spellPrerequisiteResolver.ts (67%) rename src/graphql/{ => 2014}/resolvers/spellResolver.ts (83%) rename src/graphql/{ => 2014}/resolvers/startingEquipmentOptionSetResolver.ts (83%) rename src/graphql/{ => 2014}/resolvers/subclassResolver.ts (81%) rename src/graphql/{ => 2014}/resolvers/subclassSpecificResolver.ts (92%) rename src/graphql/{ => 2014}/resolvers/subraceResolver.ts (82%) rename src/graphql/{ => 2014}/resolvers/toolResolver.ts (71%) rename src/graphql/{ => 2014}/resolvers/traitResolver.ts (89%) rename src/graphql/{ => 2014}/resolvers/vehicleResolver.ts (69%) rename src/graphql/{ => 2014}/resolvers/weaponResolver.ts (80%) rename src/graphql/{ => 2014}/schema.ts (79%) rename src/graphql/{ => 2014}/typeDefs.graphql (100%) create mode 100644 src/graphql/2024/.keepme diff --git a/src/graphql/resolvers/abilityScoreResolver.ts b/src/graphql/2014/resolvers/abilityScoreResolver.ts similarity index 83% rename from src/graphql/resolvers/abilityScoreResolver.ts rename to src/graphql/2014/resolvers/abilityScoreResolver.ts index 855e75e6..50011b6f 100644 --- a/src/graphql/resolvers/abilityScoreResolver.ts +++ b/src/graphql/2014/resolvers/abilityScoreResolver.ts @@ -1,4 +1,4 @@ -import SkillModel from '../../models/2014/skill/index.js'; +import SkillModel from '../../../models/2014/skill/index.js'; import { coalesceFilters, getMongoSortDirection, @@ -6,7 +6,7 @@ import { SortQuery, QueryParams, } from './common.js'; -import { AbilityScore } from '../../models/2014/abilityScore/types.js'; +import { AbilityScore } from '../../../models/2014/abilityScore/types.js'; const AbilityScoreResolver = { skills: async (abilityScore: AbilityScore, args: QueryParams) => { diff --git a/src/graphql/resolvers/ammunitionResolver.ts b/src/graphql/2014/resolvers/ammunitionResolver.ts similarity index 100% rename from src/graphql/resolvers/ammunitionResolver.ts rename to src/graphql/2014/resolvers/ammunitionResolver.ts diff --git a/src/graphql/resolvers/armorResolver.ts b/src/graphql/2014/resolvers/armorResolver.ts similarity index 69% rename from src/graphql/resolvers/armorResolver.ts rename to src/graphql/2014/resolvers/armorResolver.ts index 9f9f9f62..6c1a3e4a 100644 --- a/src/graphql/resolvers/armorResolver.ts +++ b/src/graphql/2014/resolvers/armorResolver.ts @@ -1,5 +1,5 @@ -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; import { equipmentFieldResolvers } from './common.js'; const Armor = { diff --git a/src/graphql/resolvers/backgroundResolver.ts b/src/graphql/2014/resolvers/backgroundResolver.ts similarity index 84% rename from src/graphql/resolvers/backgroundResolver.ts rename to src/graphql/2014/resolvers/backgroundResolver.ts index ae90bf50..1dade4f9 100644 --- a/src/graphql/resolvers/backgroundResolver.ts +++ b/src/graphql/2014/resolvers/backgroundResolver.ts @@ -1,8 +1,8 @@ -import AlignmentModel from '../../models/2014/alignment/index.js'; -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import EquipmentModel from '../../models/2014/equipment/index.js'; -import LanguageModel from '../../models/2014/language/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; +import AlignmentModel from '../../../models/2014/alignment/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; +import LanguageModel from '../../../models/2014/language/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; import { coalesceFilters, resolveChoice, @@ -10,7 +10,7 @@ import { QueryParams, } from './common.js'; -import { Background } from '../../models/2014/background/types.js'; +import { Background } from '../../../models/2014/background/types.js'; const Background = { starting_equipment: async (background: Background, args: QueryParams) => { diff --git a/src/graphql/resolvers/classResolver.ts b/src/graphql/2014/resolvers/classResolver.ts similarity index 92% rename from src/graphql/resolvers/classResolver.ts rename to src/graphql/2014/resolvers/classResolver.ts index bf45fb93..df397e56 100644 --- a/src/graphql/resolvers/classResolver.ts +++ b/src/graphql/2014/resolvers/classResolver.ts @@ -1,9 +1,9 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import EquipmentModel from '../../models/2014/equipment/index.js'; -import LevelModel from '../../models/2014/level/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import SubclassModel from '../../models/2014/subclass/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; +import LevelModel from '../../../models/2014/level/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import SubclassModel from '../../../models/2014/subclass/index.js'; import { coalesceFilters, resolveChoice, @@ -13,8 +13,8 @@ import { QueryParams, } from './common.js'; -import { Class } from '../../models/2014/class/types.js'; -import { Option } from '../../models/2014/common/types.js'; +import { Class } from '../../../models/2014/class/types.js'; +import { Option } from '../../../models/2014/common/types.js'; const resolveEquipmentOption: any = async (option: Option) => { if (option.option_type === 'counted_reference') { diff --git a/src/graphql/resolvers/classSpecificResolver.ts b/src/graphql/2014/resolvers/classSpecificResolver.ts similarity index 91% rename from src/graphql/resolvers/classSpecificResolver.ts rename to src/graphql/2014/resolvers/classSpecificResolver.ts index 1f194cc2..d1806ae2 100644 --- a/src/graphql/resolvers/classSpecificResolver.ts +++ b/src/graphql/2014/resolvers/classSpecificResolver.ts @@ -1,4 +1,4 @@ -import { ClassSpecific as ClassSpecificType } from '../../models/2014/level/types'; +import { ClassSpecific as ClassSpecificType } from '../../../models/2014/level/types'; const ClassSpecific = { __resolveType(specific: ClassSpecificType) { diff --git a/src/graphql/resolvers/common.ts b/src/graphql/2014/resolvers/common.ts similarity index 94% rename from src/graphql/resolvers/common.ts rename to src/graphql/2014/resolvers/common.ts index 2883d661..4388939e 100644 --- a/src/graphql/resolvers/common.ts +++ b/src/graphql/2014/resolvers/common.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import { AreaOfEffect, Choice, DifficultyClass } from '../../models/2014/common/types.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import SpellModel from '../../models/2014/spell/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import { AreaOfEffect, Choice, DifficultyClass } from '../../../models/2014/common/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import SpellModel from '../../../models/2014/spell/index.js'; export const equipmentBaseFieldResolvers = { equipment_category: async (equipment: Equipment) => diff --git a/src/graphql/resolvers/equipmentCategoryResolver.ts b/src/graphql/2014/resolvers/equipmentCategoryResolver.ts similarity index 81% rename from src/graphql/resolvers/equipmentCategoryResolver.ts rename to src/graphql/2014/resolvers/equipmentCategoryResolver.ts index 122b6f58..cf82d0ce 100644 --- a/src/graphql/resolvers/equipmentCategoryResolver.ts +++ b/src/graphql/2014/resolvers/equipmentCategoryResolver.ts @@ -1,11 +1,11 @@ -import EquipmentModel from '../../models/2014/equipment/index.js'; -import MagicItemModel from '../../models/2014/magicItem/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; +import MagicItemModel from '../../../models/2014/magicItem/index.js'; import { coalesceFilters, coalesceSort, resolveContainsStringFilter } from './common.js'; -import { EquipmentCategory } from '../../models/2014/equipmentCategory/types.js'; -import { MagicItem } from '../../models/2014/magicItem/types.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; -import { Order, SortQuery } from './common'; +import { EquipmentCategory } from '../../../models/2014/equipmentCategory/types.js'; +import { MagicItem } from '../../../models/2014/magicItem/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; +import { Order, SortQuery } from './common.js'; type Args = { name?: string; diff --git a/src/graphql/resolvers/equipmentMultipleItemResolver.ts b/src/graphql/2014/resolvers/equipmentMultipleItemResolver.ts similarity index 83% rename from src/graphql/resolvers/equipmentMultipleItemResolver.ts rename to src/graphql/2014/resolvers/equipmentMultipleItemResolver.ts index a15bab3c..347eaac7 100644 --- a/src/graphql/resolvers/equipmentMultipleItemResolver.ts +++ b/src/graphql/2014/resolvers/equipmentMultipleItemResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/2014/common/types'; +import { Option } from '../../../models/2014/common/types'; const EquipmentMultipleItem = { __resolveType(option: Option) { diff --git a/src/graphql/resolvers/equipmentOptionResolver.ts b/src/graphql/2014/resolvers/equipmentOptionResolver.ts similarity index 85% rename from src/graphql/resolvers/equipmentOptionResolver.ts rename to src/graphql/2014/resolvers/equipmentOptionResolver.ts index 562b85ee..a82d36c8 100644 --- a/src/graphql/resolvers/equipmentOptionResolver.ts +++ b/src/graphql/2014/resolvers/equipmentOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/2014/common/types'; +import { Option } from '../../../models/2014/common/types'; const EquipmentOption = { __resolveType(option: Option) { diff --git a/src/graphql/resolvers/expertiseOptionResolver.ts b/src/graphql/2014/resolvers/expertiseOptionResolver.ts similarity index 85% rename from src/graphql/resolvers/expertiseOptionResolver.ts rename to src/graphql/2014/resolvers/expertiseOptionResolver.ts index e95ab34f..333c6496 100644 --- a/src/graphql/resolvers/expertiseOptionResolver.ts +++ b/src/graphql/2014/resolvers/expertiseOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/2014/common/types'; +import { Option } from '../../../models/2014/common/types'; const ExpertiseOption = { __resolveType(option: Option) { diff --git a/src/graphql/resolvers/featResolver.ts b/src/graphql/2014/resolvers/featResolver.ts similarity index 76% rename from src/graphql/resolvers/featResolver.ts rename to src/graphql/2014/resolvers/featResolver.ts index a535369b..3011ecf9 100644 --- a/src/graphql/resolvers/featResolver.ts +++ b/src/graphql/2014/resolvers/featResolver.ts @@ -1,6 +1,6 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; -import { Feat } from '../../models/2014/feat/types.js'; +import { Feat } from '../../../models/2014/feat/types.js'; const Feat = { prerequisites: async (feat: Feat) => { diff --git a/src/graphql/resolvers/featureResolver.ts b/src/graphql/2014/resolvers/featureResolver.ts similarity index 88% rename from src/graphql/resolvers/featureResolver.ts rename to src/graphql/2014/resolvers/featureResolver.ts index 2bc4b725..859ff8c4 100644 --- a/src/graphql/resolvers/featureResolver.ts +++ b/src/graphql/2014/resolvers/featureResolver.ts @@ -1,13 +1,13 @@ -import ClassModel from '../../models/2014/class/index.js'; -import FeatureModel from '../../models/2014/feature/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import SpellModel from '../../models/2014/spell/index.js'; -import SubclassModel from '../../models/2014/subclass/index.js'; +import ClassModel from '../../../models/2014/class/index.js'; +import FeatureModel from '../../../models/2014/feature/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import SpellModel from '../../../models/2014/spell/index.js'; +import SubclassModel from '../../../models/2014/subclass/index.js'; import { resolveChoice } from './common.js'; -import { Feature } from '../../models/2014/feature/types.js'; -import { Proficiency } from '../../models/2014/proficiency/types.js'; -import { Option } from '../../models/2014/common/types.js'; +import { Feature } from '../../../models/2014/feature/types.js'; +import { Proficiency } from '../../../models/2014/proficiency/types.js'; +import { Option } from '../../../models/2014/common/types.js'; type FeatureSpecific = { subfeature_options?: { diff --git a/src/graphql/resolvers/gearResolver.ts b/src/graphql/2014/resolvers/gearResolver.ts similarity index 100% rename from src/graphql/resolvers/gearResolver.ts rename to src/graphql/2014/resolvers/gearResolver.ts diff --git a/src/graphql/resolvers/iEquipmentBaseResolver.ts b/src/graphql/2014/resolvers/iEquipmentBaseResolver.ts similarity index 80% rename from src/graphql/resolvers/iEquipmentBaseResolver.ts rename to src/graphql/2014/resolvers/iEquipmentBaseResolver.ts index 36440342..2ed91ada 100644 --- a/src/graphql/resolvers/iEquipmentBaseResolver.ts +++ b/src/graphql/2014/resolvers/iEquipmentBaseResolver.ts @@ -1,5 +1,5 @@ import { resolveEquipmentType } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const IEquipmentBase = { __resolveType(equipment: Equipment) { diff --git a/src/graphql/resolvers/iEquipmentResolver.ts b/src/graphql/2014/resolvers/iEquipmentResolver.ts similarity index 73% rename from src/graphql/resolvers/iEquipmentResolver.ts rename to src/graphql/2014/resolvers/iEquipmentResolver.ts index b8c672c9..519b9a68 100644 --- a/src/graphql/resolvers/iEquipmentResolver.ts +++ b/src/graphql/2014/resolvers/iEquipmentResolver.ts @@ -1,5 +1,5 @@ import { resolveEquipmentType } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const IEquipment = { __resolveType(equipment: Equipment) { diff --git a/src/graphql/resolvers/iGearResolver.ts b/src/graphql/2014/resolvers/iGearResolver.ts similarity index 70% rename from src/graphql/resolvers/iGearResolver.ts rename to src/graphql/2014/resolvers/iGearResolver.ts index 5cfe5602..7b9af028 100644 --- a/src/graphql/resolvers/iGearResolver.ts +++ b/src/graphql/2014/resolvers/iGearResolver.ts @@ -1,5 +1,5 @@ import { resolveGearType } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const IGear = { __resolveType(gear: Equipment) { diff --git a/src/graphql/resolvers/languageResolver.ts b/src/graphql/2014/resolvers/languageResolver.ts similarity index 75% rename from src/graphql/resolvers/languageResolver.ts rename to src/graphql/2014/resolvers/languageResolver.ts index 08828804..bc57e7c9 100644 --- a/src/graphql/resolvers/languageResolver.ts +++ b/src/graphql/2014/resolvers/languageResolver.ts @@ -1,4 +1,4 @@ -import { Language } from '../../models/2014/language/types'; +import { Language } from '../../../models/2014/language/types'; const Language = { type: (language: Language) => language.type.toUpperCase(), diff --git a/src/graphql/resolvers/levelResolver.ts b/src/graphql/2014/resolvers/levelResolver.ts similarity index 76% rename from src/graphql/resolvers/levelResolver.ts rename to src/graphql/2014/resolvers/levelResolver.ts index 2521fd9d..51e38c36 100644 --- a/src/graphql/resolvers/levelResolver.ts +++ b/src/graphql/2014/resolvers/levelResolver.ts @@ -1,6 +1,6 @@ -import ClassModel from '../../models/2014/class/index.js'; -import FeatureModel from '../../models/2014/feature/index.js'; -import SubclassModel from '../../models/2014/subclass/index.js'; +import ClassModel from '../../../models/2014/class/index.js'; +import FeatureModel from '../../../models/2014/feature/index.js'; +import SubclassModel from '../../../models/2014/subclass/index.js'; import { coalesceFilters, getMongoSortDirection, @@ -9,7 +9,7 @@ import { SortQuery, } from './common.js'; -import { Level } from '../../models/2014/level/types.js'; +import { Level } from '../../../models/2014/level/types.js'; const Level = { class: async (level: Level) => await ClassModel.findOne({ index: level.class.index }).lean(), diff --git a/src/graphql/resolvers/magicItemResolver.ts b/src/graphql/2014/resolvers/magicItemResolver.ts similarity index 77% rename from src/graphql/resolvers/magicItemResolver.ts rename to src/graphql/2014/resolvers/magicItemResolver.ts index 94c720a6..d4536261 100644 --- a/src/graphql/resolvers/magicItemResolver.ts +++ b/src/graphql/2014/resolvers/magicItemResolver.ts @@ -1,5 +1,5 @@ import { equipmentBaseFieldResolvers } from './common.js'; -import { MagicItem } from '../../models/2014/magicItem/types.js'; +import { MagicItem } from '../../../models/2014/magicItem/types.js'; const MagicItem = { ...equipmentBaseFieldResolvers, diff --git a/src/graphql/resolvers/magicShoolResolver.ts b/src/graphql/2014/resolvers/magicShoolResolver.ts similarity index 76% rename from src/graphql/resolvers/magicShoolResolver.ts rename to src/graphql/2014/resolvers/magicShoolResolver.ts index c0fc084d..7df7c565 100644 --- a/src/graphql/resolvers/magicShoolResolver.ts +++ b/src/graphql/2014/resolvers/magicShoolResolver.ts @@ -1,5 +1,5 @@ import { resolveSpells, SpellQuery } from './common.js'; -import { MagicSchool } from '../../models/2014/magicSchool/types.js'; +import { MagicSchool } from '../../../models/2014/magicSchool/types.js'; const MagicSchool = { spells: async (school: MagicSchool, args: SpellQuery) => diff --git a/src/graphql/resolvers/monsterActionOptionResolver.ts b/src/graphql/2014/resolvers/monsterActionOptionResolver.ts similarity index 83% rename from src/graphql/resolvers/monsterActionOptionResolver.ts rename to src/graphql/2014/resolvers/monsterActionOptionResolver.ts index 5699e04f..ce44200c 100644 --- a/src/graphql/resolvers/monsterActionOptionResolver.ts +++ b/src/graphql/2014/resolvers/monsterActionOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/2014/common/types'; +import { Option } from '../../../models/2014/common/types'; const MonsterActionOption = { __resolveType(option: Option) { diff --git a/src/graphql/resolvers/monsterResolver.ts b/src/graphql/2014/resolvers/monsterResolver.ts similarity index 91% rename from src/graphql/resolvers/monsterResolver.ts rename to src/graphql/2014/resolvers/monsterResolver.ts index 5235170b..f5fc9d8c 100644 --- a/src/graphql/resolvers/monsterResolver.ts +++ b/src/graphql/2014/resolvers/monsterResolver.ts @@ -1,15 +1,15 @@ import { levelObjectToArray, resolveChoice, resolveDc } from './common.js'; -import ConditionModel from '../../models/2014/condition/index.js'; -import DamageTypeModel from '../../models/2014/damageType/index.js'; -import EquipmentModel from '../../models/2014/equipment/index.js'; -import MonsterModel from '../../models/2014/monster/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import SpellModel from '../../models/2014/spell/index.js'; - -import { Monster, ActionUsage, SpecialAbilityUsage } from '../../models/2014/monster/types.js'; -import { DamageType } from '../../models/2014/damageType/types.js'; -import { Damage } from '../../models/2014/common/types.js'; +import ConditionModel from '../../../models/2014/condition/index.js'; +import DamageTypeModel from '../../../models/2014/damageType/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; +import MonsterModel from '../../../models/2014/monster/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import SpellModel from '../../../models/2014/spell/index.js'; + +import { Monster, ActionUsage, SpecialAbilityUsage } from '../../../models/2014/monster/types.js'; +import { DamageType } from '../../../models/2014/damageType/types.js'; +import { Damage } from '../../../models/2014/common/types.js'; const resolveUsage = (usage: ActionUsage | SpecialAbilityUsage) => { const resolvedUsage: Record = { diff --git a/src/graphql/resolvers/packResolver.ts b/src/graphql/2014/resolvers/packResolver.ts similarity index 75% rename from src/graphql/resolvers/packResolver.ts rename to src/graphql/2014/resolvers/packResolver.ts index 8f2217de..0d94d3ed 100644 --- a/src/graphql/resolvers/packResolver.ts +++ b/src/graphql/2014/resolvers/packResolver.ts @@ -1,6 +1,6 @@ -import EquipmentModel from '../../models/2014/equipment/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; import { gearFieldResolvers } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const Pack = { ...gearFieldResolvers, diff --git a/src/graphql/resolvers/proficiencyOptionResolver.ts b/src/graphql/2014/resolvers/proficiencyOptionResolver.ts similarity index 82% rename from src/graphql/resolvers/proficiencyOptionResolver.ts rename to src/graphql/2014/resolvers/proficiencyOptionResolver.ts index 9f7da0e6..e5c8cd19 100644 --- a/src/graphql/resolvers/proficiencyOptionResolver.ts +++ b/src/graphql/2014/resolvers/proficiencyOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/2014/common/types'; +import { Option } from '../../../models/2014/common/types'; const ProficiencyOption = { __resolveType(option: Option) { diff --git a/src/graphql/resolvers/proficiencyRaceResolver.ts b/src/graphql/2014/resolvers/proficiencyRaceResolver.ts similarity index 71% rename from src/graphql/resolvers/proficiencyRaceResolver.ts rename to src/graphql/2014/resolvers/proficiencyRaceResolver.ts index adf80257..99f9894e 100644 --- a/src/graphql/resolvers/proficiencyRaceResolver.ts +++ b/src/graphql/2014/resolvers/proficiencyRaceResolver.ts @@ -1,5 +1,5 @@ -import { Race } from '../../models/2014/race/types'; -import { Subrace } from '../../models/2014/subrace/types'; +import { Race } from '../../../models/2014/race/types'; +import { Subrace } from '../../../models/2014/subrace/types'; const ProficiencyRace = { __resolveType(proficiencyRace: Race | Subrace) { diff --git a/src/graphql/resolvers/proficiencyReferenceResolver.ts b/src/graphql/2014/resolvers/proficiencyReferenceResolver.ts similarity index 61% rename from src/graphql/resolvers/proficiencyReferenceResolver.ts rename to src/graphql/2014/resolvers/proficiencyReferenceResolver.ts index 5b77cfea..2d57dfa8 100644 --- a/src/graphql/resolvers/proficiencyReferenceResolver.ts +++ b/src/graphql/2014/resolvers/proficiencyReferenceResolver.ts @@ -1,9 +1,9 @@ import { resolveEquipmentType } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; -import { EquipmentCategory } from '../../models/2014/equipmentCategory/types.js'; -import { AbilityScore } from '../../models/2014/abilityScore/types.js'; -import { Skill } from '../../models/2014/skill/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; +import { EquipmentCategory } from '../../../models/2014/equipmentCategory/types.js'; +import { AbilityScore } from '../../../models/2014/abilityScore/types.js'; +import { Skill } from '../../../models/2014/skill/types.js'; const ProficiencyReference = { __resolveType(reference: Equipment | EquipmentCategory | AbilityScore | Skill) { diff --git a/src/graphql/resolvers/proficiencyResolver.ts b/src/graphql/2014/resolvers/proficiencyResolver.ts similarity index 74% rename from src/graphql/resolvers/proficiencyResolver.ts rename to src/graphql/2014/resolvers/proficiencyResolver.ts index e66a46ac..6ad11121 100644 --- a/src/graphql/resolvers/proficiencyResolver.ts +++ b/src/graphql/2014/resolvers/proficiencyResolver.ts @@ -1,13 +1,13 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import ClassModel from '../../models/2014/class/index.js'; -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import EquipmentModel from '../../models/2014/equipment/index.js'; -import RaceModel from '../../models/2014/race/index.js'; -import SkillModel from '../../models/2014/skill/index.js'; -import SubraceModel from '../../models/2014/subrace/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import ClassModel from '../../../models/2014/class/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; +import RaceModel from '../../../models/2014/race/index.js'; +import SkillModel from '../../../models/2014/skill/index.js'; +import SubraceModel from '../../../models/2014/subrace/index.js'; import { coalesceFilters, resolveContainsStringFilter, QueryParams } from './common.js'; -import { Proficiency } from '../../models/2014/proficiency/types.js'; +import { Proficiency } from '../../../models/2014/proficiency/types.js'; const Proficiency = { classes: async (proficiency: Proficiency, args: QueryParams) => { diff --git a/src/graphql/resolvers/queryResolver.ts b/src/graphql/2014/resolvers/queryResolver.ts similarity index 91% rename from src/graphql/resolvers/queryResolver.ts rename to src/graphql/2014/resolvers/queryResolver.ts index 1a7288e4..39cb6146 100644 --- a/src/graphql/resolvers/queryResolver.ts +++ b/src/graphql/2014/resolvers/queryResolver.ts @@ -7,33 +7,33 @@ import { resolveSpells, } from './common.js'; -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import AlignmentModel from '../../models/2014/alignment/index.js'; -import BackgroundModel from '../../models/2014/background/index.js'; -import ClassModel from '../../models/2014/class/index.js'; -import ConditionModel from '../../models/2014/condition/index.js'; -import DamageTypeModel from '../../models/2014/damageType/index.js'; -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import EquipmentModel from '../../models/2014/equipment/index.js'; -import FeatModel from '../../models/2014/feat/index.js'; -import FeatureModel from '../../models/2014/feature/index.js'; -import LanguageModel from '../../models/2014/language/index.js'; -import LevelModel from '../../models/2014/level/index.js'; -import MagicItemModel from '../../models/2014/magicItem/index.js'; -import MagicSchoolModel from '../../models/2014/magicSchool/index.js'; -import MonsterModel from '../../models/2014/monster/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import RaceModel from '../../models/2014/race/index.js'; -import RuleModel from '../../models/2014/rule/index.js'; -import RuleSectionModel from '../../models/2014/ruleSection/index.js'; -import SkillModel from '../../models/2014/skill/index.js'; -import SpellModel from '../../models/2014/spell/index.js'; -import SubclassModel from '../../models/2014/subclass/index.js'; -import SubraceModel from '../../models/2014/subrace/index.js'; -import TraitModel from '../../models/2014/trait/index.js'; -import WeaponPropertyModel from '../../models/2014/weaponProperty/index.js'; - -import { SpellQuery, SortQuery } from './common'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import AlignmentModel from '../../../models/2014/alignment/index.js'; +import BackgroundModel from '../../../models/2014/background/index.js'; +import ClassModel from '../../../models/2014/class/index.js'; +import ConditionModel from '../../../models/2014/condition/index.js'; +import DamageTypeModel from '../../../models/2014/damageType/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import EquipmentModel from '../../../models/2014/equipment/index.js'; +import FeatModel from '../../../models/2014/feat/index.js'; +import FeatureModel from '../../../models/2014/feature/index.js'; +import LanguageModel from '../../../models/2014/language/index.js'; +import LevelModel from '../../../models/2014/level/index.js'; +import MagicItemModel from '../../../models/2014/magicItem/index.js'; +import MagicSchoolModel from '../../../models/2014/magicSchool/index.js'; +import MonsterModel from '../../../models/2014/monster/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import RaceModel from '../../../models/2014/race/index.js'; +import RuleModel from '../../../models/2014/rule/index.js'; +import RuleSectionModel from '../../../models/2014/ruleSection/index.js'; +import SkillModel from '../../../models/2014/skill/index.js'; +import SpellModel from '../../../models/2014/spell/index.js'; +import SubclassModel from '../../../models/2014/subclass/index.js'; +import SubraceModel from '../../../models/2014/subrace/index.js'; +import TraitModel from '../../../models/2014/trait/index.js'; +import WeaponPropertyModel from '../../../models/2014/weaponProperty/index.js'; + +import { SpellQuery, SortQuery } from './common.js'; const Query = { async abilityScore(_: any, args: Record) { diff --git a/src/graphql/resolvers/raceResolver.ts b/src/graphql/2014/resolvers/raceResolver.ts similarity index 89% rename from src/graphql/resolvers/raceResolver.ts rename to src/graphql/2014/resolvers/raceResolver.ts index 3a7df56b..207aa13e 100644 --- a/src/graphql/resolvers/raceResolver.ts +++ b/src/graphql/2014/resolvers/raceResolver.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import LanguageModel from '../../models/2014/language/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import SubraceModel from '../../models/2014/subrace/index.js'; -import TraitModel from '../../models/2014/trait/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import LanguageModel from '../../../models/2014/language/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import SubraceModel from '../../../models/2014/subrace/index.js'; +import TraitModel from '../../../models/2014/trait/index.js'; import { coalesceFilters, resolveChoice, @@ -10,7 +10,7 @@ import { QueryParams, } from './common.js'; -import { Race } from '../../models/2014/race/types.js'; +import { Race } from '../../../models/2014/race/types.js'; const Race = { ability_bonuses: async (race: Race) => { diff --git a/src/graphql/resolvers/rootResolvers.ts b/src/graphql/2014/resolvers/rootResolvers.ts similarity index 100% rename from src/graphql/resolvers/rootResolvers.ts rename to src/graphql/2014/resolvers/rootResolvers.ts diff --git a/src/graphql/resolvers/ruleResolver.ts b/src/graphql/2014/resolvers/ruleResolver.ts similarity index 77% rename from src/graphql/resolvers/ruleResolver.ts rename to src/graphql/2014/resolvers/ruleResolver.ts index 393c8e2c..679a79aa 100644 --- a/src/graphql/resolvers/ruleResolver.ts +++ b/src/graphql/2014/resolvers/ruleResolver.ts @@ -1,6 +1,6 @@ -import RuleSectionModel from '../../models/2014/ruleSection/index.js'; +import RuleSectionModel from '../../../models/2014/ruleSection/index.js'; import { coalesceFilters, resolveContainsStringFilter, QueryParams } from './common.js'; -import { Rule } from '../../models/2014/rule/types.js'; +import { Rule } from '../../../models/2014/rule/types.js'; const Rule = { subsections: async (rule: Rule, args: QueryParams) => { diff --git a/src/graphql/resolvers/scalars/actionCountResolver.ts b/src/graphql/2014/resolvers/scalars/actionCountResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/actionCountResolver.ts rename to src/graphql/2014/resolvers/scalars/actionCountResolver.ts diff --git a/src/graphql/resolvers/scalars/areaOfEffectTypeFilter.ts b/src/graphql/2014/resolvers/scalars/areaOfEffectTypeFilter.ts similarity index 100% rename from src/graphql/resolvers/scalars/areaOfEffectTypeFilter.ts rename to src/graphql/2014/resolvers/scalars/areaOfEffectTypeFilter.ts diff --git a/src/graphql/resolvers/scalars/enumFilterResolver.ts b/src/graphql/2014/resolvers/scalars/enumFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/enumFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/enumFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/floatFilterResolver.ts b/src/graphql/2014/resolvers/scalars/floatFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/floatFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/floatFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/intFilterResolver.ts b/src/graphql/2014/resolvers/scalars/intFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/intFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/intFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/languageScriptFilterResolver.ts b/src/graphql/2014/resolvers/scalars/languageScriptFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/languageScriptFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/languageScriptFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/monsterSubtypeFilterResolver.ts b/src/graphql/2014/resolvers/scalars/monsterSubtypeFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/monsterSubtypeFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/monsterSubtypeFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/monsterTypeFilterResolver.ts b/src/graphql/2014/resolvers/scalars/monsterTypeFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/monsterTypeFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/monsterTypeFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/proficiencyTypeFilterResolver.ts b/src/graphql/2014/resolvers/scalars/proficiencyTypeFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/proficiencyTypeFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/proficiencyTypeFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/sizeFilterResolver.ts b/src/graphql/2014/resolvers/scalars/sizeFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/sizeFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/sizeFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/spellAttackTypeFilterResolver.ts b/src/graphql/2014/resolvers/scalars/spellAttackTypeFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/spellAttackTypeFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/spellAttackTypeFilterResolver.ts diff --git a/src/graphql/resolvers/scalars/stringFilterResolver.ts b/src/graphql/2014/resolvers/scalars/stringFilterResolver.ts similarity index 100% rename from src/graphql/resolvers/scalars/stringFilterResolver.ts rename to src/graphql/2014/resolvers/scalars/stringFilterResolver.ts diff --git a/src/graphql/resolvers/skillResolver.ts b/src/graphql/2014/resolvers/skillResolver.ts similarity index 57% rename from src/graphql/resolvers/skillResolver.ts rename to src/graphql/2014/resolvers/skillResolver.ts index 240c1ecb..b7ed9b3d 100644 --- a/src/graphql/resolvers/skillResolver.ts +++ b/src/graphql/2014/resolvers/skillResolver.ts @@ -1,5 +1,5 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import { Skill } from '../../models/2014/skill/types.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import { Skill } from '../../../models/2014/skill/types.js'; const SkillResolver = { ability_score: async (skill: Skill) => diff --git a/src/graphql/resolvers/spellPrerequisiteResolver.ts b/src/graphql/2014/resolvers/spellPrerequisiteResolver.ts similarity index 67% rename from src/graphql/resolvers/spellPrerequisiteResolver.ts rename to src/graphql/2014/resolvers/spellPrerequisiteResolver.ts index 511f4f66..010630c9 100644 --- a/src/graphql/resolvers/spellPrerequisiteResolver.ts +++ b/src/graphql/2014/resolvers/spellPrerequisiteResolver.ts @@ -1,5 +1,5 @@ -import { Level } from '../../models/2014/level/types'; -import { Feature } from '../../models/2014/feature/types'; +import { Level } from '../../../models/2014/level/types'; +import { Feature } from '../../../models/2014/feature/types'; const SpellPrerequisite = { __resolveType(prerequisite: Level | Feature) { diff --git a/src/graphql/resolvers/spellResolver.ts b/src/graphql/2014/resolvers/spellResolver.ts similarity index 83% rename from src/graphql/resolvers/spellResolver.ts rename to src/graphql/2014/resolvers/spellResolver.ts index d1a3d873..0cee39f9 100644 --- a/src/graphql/resolvers/spellResolver.ts +++ b/src/graphql/2014/resolvers/spellResolver.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import ClassModel from '../../models/2014/class/index.js'; -import DamageTypeModel from '../../models/2014/damageType/index.js'; -import MagicSchoolModel from '../../models/2014/magicSchool/index.js'; -import SubclassModel from '../../models/2014/subclass/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import ClassModel from '../../../models/2014/class/index.js'; +import DamageTypeModel from '../../../models/2014/damageType/index.js'; +import MagicSchoolModel from '../../../models/2014/magicSchool/index.js'; +import SubclassModel from '../../../models/2014/subclass/index.js'; import { coalesceFilters, levelObjectToArray, @@ -11,8 +11,8 @@ import { QueryParams, } from './common.js'; -import { Spell } from '../../models/2014/spell/types.js'; -import { DamageType } from '../../models/2014/damageType/types.js'; +import { Spell } from '../../../models/2014/spell/types.js'; +import { DamageType } from '../../../models/2014/damageType/types.js'; type SpellDamage = { damage_type?: DamageType; diff --git a/src/graphql/resolvers/startingEquipmentOptionSetResolver.ts b/src/graphql/2014/resolvers/startingEquipmentOptionSetResolver.ts similarity index 83% rename from src/graphql/resolvers/startingEquipmentOptionSetResolver.ts rename to src/graphql/2014/resolvers/startingEquipmentOptionSetResolver.ts index dfcc55b2..a0f9a07f 100644 --- a/src/graphql/resolvers/startingEquipmentOptionSetResolver.ts +++ b/src/graphql/2014/resolvers/startingEquipmentOptionSetResolver.ts @@ -1,4 +1,4 @@ -import { OptionSet } from '../../models/2014/common/types'; +import { OptionSet } from '../../../models/2014/common/types'; const StartingEquipmentOptionSet = { __resolveType(optionSet: OptionSet) { diff --git a/src/graphql/resolvers/subclassResolver.ts b/src/graphql/2014/resolvers/subclassResolver.ts similarity index 81% rename from src/graphql/resolvers/subclassResolver.ts rename to src/graphql/2014/resolvers/subclassResolver.ts index 5e9de12f..2fe16043 100644 --- a/src/graphql/resolvers/subclassResolver.ts +++ b/src/graphql/2014/resolvers/subclassResolver.ts @@ -1,9 +1,9 @@ -import ClassModel from '../../models/2014/class/index.js'; -import FeatureModel from '../../models/2014/feature/index.js'; -import LevelModel from '../../models/2014/level/index.js'; +import ClassModel from '../../../models/2014/class/index.js'; +import FeatureModel from '../../../models/2014/feature/index.js'; +import LevelModel from '../../../models/2014/level/index.js'; import { resolveSpells, SpellQuery } from './common.js'; -import { Subclass } from '../../models/2014/subclass/types.js'; +import { Subclass } from '../../../models/2014/subclass/types.js'; const Subclass = { class: async (subclass: Subclass) => diff --git a/src/graphql/resolvers/subclassSpecificResolver.ts b/src/graphql/2014/resolvers/subclassSpecificResolver.ts similarity index 92% rename from src/graphql/resolvers/subclassSpecificResolver.ts rename to src/graphql/2014/resolvers/subclassSpecificResolver.ts index 371dbee8..26ae8ccd 100644 --- a/src/graphql/resolvers/subclassSpecificResolver.ts +++ b/src/graphql/2014/resolvers/subclassSpecificResolver.ts @@ -1,4 +1,4 @@ -import { SubclassSpecific as SubclassSpecificType } from '../../models/2014/level/types'; +import { SubclassSpecific as SubclassSpecificType } from '../../../models/2014/level/types'; const SubclassSpecific = { __resolveType(specific: SubclassSpecificType) { diff --git a/src/graphql/resolvers/subraceResolver.ts b/src/graphql/2014/resolvers/subraceResolver.ts similarity index 82% rename from src/graphql/resolvers/subraceResolver.ts rename to src/graphql/2014/resolvers/subraceResolver.ts index 37efea33..e5e4512f 100644 --- a/src/graphql/resolvers/subraceResolver.ts +++ b/src/graphql/2014/resolvers/subraceResolver.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import LanguageModel from '../../models/2014/language/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import RaceModel from '../../models/2014/race/index.js'; -import TraitModel from '../../models/2014/trait/index.js'; +import AbilityScoreModel from '../../../models/2014/abilityScore/index.js'; +import LanguageModel from '../../../models/2014/language/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import RaceModel from '../../../models/2014/race/index.js'; +import TraitModel from '../../../models/2014/trait/index.js'; import { coalesceFilters, resolveChoice, @@ -10,7 +10,7 @@ import { QueryParams, } from './common.js'; -import { Subrace } from '../../models/2014/subrace/types.js'; +import { Subrace } from '../../../models/2014/subrace/types.js'; const Subrace = { ability_bonuses: async (subrace: Subrace) => { diff --git a/src/graphql/resolvers/toolResolver.ts b/src/graphql/2014/resolvers/toolResolver.ts similarity index 71% rename from src/graphql/resolvers/toolResolver.ts rename to src/graphql/2014/resolvers/toolResolver.ts index 3d941f2e..1280ac7d 100644 --- a/src/graphql/resolvers/toolResolver.ts +++ b/src/graphql/2014/resolvers/toolResolver.ts @@ -1,7 +1,7 @@ -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; import { equipmentFieldResolvers } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const Tool = { ...equipmentFieldResolvers, diff --git a/src/graphql/resolvers/traitResolver.ts b/src/graphql/2014/resolvers/traitResolver.ts similarity index 89% rename from src/graphql/resolvers/traitResolver.ts rename to src/graphql/2014/resolvers/traitResolver.ts index 2a8f47de..6047f668 100644 --- a/src/graphql/resolvers/traitResolver.ts +++ b/src/graphql/2014/resolvers/traitResolver.ts @@ -7,16 +7,16 @@ import { resolveContainsStringFilter, } from './common.js'; -import DamageTypeModel from '../../models/2014/damageType/index.js'; -import ProficiencyModel from '../../models/2014/proficiency/index.js'; -import RaceModel from '../../models/2014/race/index.js'; -import SpellModel from '../../models/2014/spell/index.js'; -import SubraceModel from '../../models/2014/subrace/index.js'; -import TraitModel from '../../models/2014/trait/index.js'; -import LanguageModel from '../../models/2014/language/index.js'; - -import { ResolvedDC, QueryParams } from './common'; -import { Trait, Usage } from '../../models/2014/trait/types.js'; +import DamageTypeModel from '../../../models/2014/damageType/index.js'; +import ProficiencyModel from '../../../models/2014/proficiency/index.js'; +import RaceModel from '../../../models/2014/race/index.js'; +import SpellModel from '../../../models/2014/spell/index.js'; +import SubraceModel from '../../../models/2014/subrace/index.js'; +import TraitModel from '../../../models/2014/trait/index.js'; +import LanguageModel from '../../../models/2014/language/index.js'; + +import { ResolvedDC, QueryParams } from './common.js'; +import { Trait, Usage } from '../../../models/2014/trait/types.js'; type TraitSpecificClient = { breath_weapon?: { diff --git a/src/graphql/resolvers/vehicleResolver.ts b/src/graphql/2014/resolvers/vehicleResolver.ts similarity index 69% rename from src/graphql/resolvers/vehicleResolver.ts rename to src/graphql/2014/resolvers/vehicleResolver.ts index 68816504..af46880f 100644 --- a/src/graphql/resolvers/vehicleResolver.ts +++ b/src/graphql/2014/resolvers/vehicleResolver.ts @@ -1,7 +1,7 @@ -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; import { equipmentFieldResolvers } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const Vehicle = { ...equipmentFieldResolvers, diff --git a/src/graphql/resolvers/weaponResolver.ts b/src/graphql/2014/resolvers/weaponResolver.ts similarity index 80% rename from src/graphql/resolvers/weaponResolver.ts rename to src/graphql/2014/resolvers/weaponResolver.ts index 6319dbcc..27c33fbc 100644 --- a/src/graphql/resolvers/weaponResolver.ts +++ b/src/graphql/2014/resolvers/weaponResolver.ts @@ -1,6 +1,6 @@ -import DamageTypeModel from '../../models/2014/damageType/index.js'; -import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; -import WeaponPropertyModel from '../../models/2014/weaponProperty/index.js'; +import DamageTypeModel from '../../../models/2014/damageType/index.js'; +import EquipmentCategoryModel from '../../../models/2014/equipmentCategory/index.js'; +import WeaponPropertyModel from '../../../models/2014/weaponProperty/index.js'; import { coalesceFilters, equipmentFieldResolvers, @@ -8,7 +8,7 @@ import { QueryParams, } from './common.js'; -import { Equipment } from '../../models/2014/equipment/types.js'; +import { Equipment } from '../../../models/2014/equipment/types.js'; const Weapon = { ...equipmentFieldResolvers, diff --git a/src/graphql/schema.ts b/src/graphql/2014/schema.ts similarity index 79% rename from src/graphql/schema.ts rename to src/graphql/2014/schema.ts index b5c4bf0b..16d20d55 100644 --- a/src/graphql/schema.ts +++ b/src/graphql/2014/schema.ts @@ -4,7 +4,7 @@ import { readFileSync } from 'fs'; import resolvers from './resolvers/rootResolvers.js'; const typeDefs = readFileSync( - path.resolve(process.cwd(), 'src', 'graphql', 'typeDefs.graphql'), + path.resolve(process.cwd(), 'src', 'graphql', '2014', 'typeDefs.graphql'), 'utf-8' ); const schema = makeExecutableSchema({ typeDefs, resolvers }); diff --git a/src/graphql/typeDefs.graphql b/src/graphql/2014/typeDefs.graphql similarity index 100% rename from src/graphql/typeDefs.graphql rename to src/graphql/2014/typeDefs.graphql diff --git a/src/graphql/2024/.keepme b/src/graphql/2024/.keepme new file mode 100644 index 00000000..e69de29b diff --git a/src/middleware/apolloServer.ts b/src/middleware/apolloServer.ts index 9d9ae25d..d5d59059 100644 --- a/src/middleware/apolloServer.ts +++ b/src/middleware/apolloServer.ts @@ -1,7 +1,7 @@ import { ApolloServer } from '@apollo/server'; import { ApolloServerPluginCacheControl } from '@apollo/server/plugin/cacheControl'; import depthLimit from 'graphql-depth-limit'; -import schema from '../graphql/schema.js'; +import schema from '../graphql/2014/schema.js'; const createApolloMiddleware = async () => { const server = new ApolloServer({ diff --git a/src/server.ts b/src/server.ts index 7189befa..ef4d94c9 100644 --- a/src/server.ts +++ b/src/server.ts @@ -51,6 +51,14 @@ export default async () => { context: async ({ req }) => ({ token: req.headers.token }), }) ); + app.use( + '/graphql/2014', + cors(), + bodyParser.json(), + expressMiddleware(apolloMiddleware, { + context: async ({ req }) => ({ token: req.headers.token }), + }) + ); // Register routes app.get('/', (req, res) => {