From 94e384dc9c22c96d82c0f25c594c5d0f342d3aac Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Wed, 25 Dec 2024 15:27:51 -0800 Subject: [PATCH 1/8] feat(models): All current models are switched to the `2014-` prefixed ones --- docker-compose.yml | 6 ++---- src/models/abilityScore/index.ts | 2 +- src/models/alignment/index.ts | 2 +- src/models/background/index.ts | 2 +- src/models/class/index.ts | 2 +- src/models/collection/index.ts | 2 +- src/models/condition/index.ts | 2 +- src/models/damageType/index.ts | 2 +- src/models/equipment/index.ts | 2 +- src/models/equipmentCategory/index.ts | 2 +- src/models/feat/index.ts | 2 +- src/models/feature/index.ts | 2 +- src/models/language/index.ts | 2 +- src/models/level/index.ts | 2 +- src/models/magicItem/index.ts | 2 +- src/models/magicSchool/index.ts | 2 +- src/models/monster/index.ts | 2 +- src/models/proficiency/index.ts | 2 +- src/models/race/index.ts | 2 +- src/models/rule/index.ts | 2 +- src/models/ruleSection/index.ts | 2 +- src/models/skill/index.ts | 2 +- src/models/spell/index.ts | 2 +- src/models/subclass/index.ts | 2 +- src/models/subrace/index.ts | 2 +- src/models/trait/index.ts | 2 +- src/models/weaponProperty/index.ts | 2 +- 27 files changed, 28 insertions(+), 30 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2991464b..3f2d669b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,7 @@ -version: '3.8' - services: db: - image: ghcr.io/5e-bits/5e-database:latest - # build: ../5e-database + # image: ghcr.io/5e-bits/5e-database:latest + build: ../5e-database ports: - '27017:27017' diff --git a/src/models/abilityScore/index.ts b/src/models/abilityScore/index.ts index a6839a1e..cb44b196 100644 --- a/src/models/abilityScore/index.ts +++ b/src/models/abilityScore/index.ts @@ -12,4 +12,4 @@ const AbilityScoreSchema = new Schema({ url: { type: String, index: true }, }); -export default model('AbilityScore', AbilityScoreSchema, 'ability-scores'); +export default model('AbilityScore', AbilityScoreSchema, '2014-ability-scores'); diff --git a/src/models/alignment/index.ts b/src/models/alignment/index.ts index 1c719a80..b7fcb0d4 100644 --- a/src/models/alignment/index.ts +++ b/src/models/alignment/index.ts @@ -10,4 +10,4 @@ const AlignmentSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Alignment', AlignmentSchema, 'alignments'); +export default model('Alignment', AlignmentSchema, '2014-alignments'); diff --git a/src/models/background/index.ts b/src/models/background/index.ts index e4aacc87..a76729f5 100644 --- a/src/models/background/index.ts +++ b/src/models/background/index.ts @@ -30,4 +30,4 @@ const BackgroundSchema = new Schema({ flaws: ChoiceSchema, }); -export default model('Background', BackgroundSchema, 'backgrounds'); +export default model('Background', BackgroundSchema, '2014-backgrounds'); diff --git a/src/models/class/index.ts b/src/models/class/index.ts index 01a93314..e1594a1b 100644 --- a/src/models/class/index.ts +++ b/src/models/class/index.ts @@ -60,4 +60,4 @@ const ClassSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Class', ClassSchema, 'classes'); +export default model('Class', ClassSchema, '2014-classes'); diff --git a/src/models/collection/index.ts b/src/models/collection/index.ts index 32060ad6..bce0c348 100644 --- a/src/models/collection/index.ts +++ b/src/models/collection/index.ts @@ -6,4 +6,4 @@ const CollectionSchema = new Schema({ index: { type: String, index: true }, }); -export default model('Collection', CollectionSchema, 'collections'); +export default model('Collection', CollectionSchema, '2014-collections'); diff --git a/src/models/condition/index.ts b/src/models/condition/index.ts index 09e86107..ef6a7912 100644 --- a/src/models/condition/index.ts +++ b/src/models/condition/index.ts @@ -9,4 +9,4 @@ const ConditionSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Condition', ConditionSchema, 'conditions'); +export default model('Condition', ConditionSchema, '2014-conditions'); diff --git a/src/models/damageType/index.ts b/src/models/damageType/index.ts index 9af79696..50455b85 100644 --- a/src/models/damageType/index.ts +++ b/src/models/damageType/index.ts @@ -9,4 +9,4 @@ const DamageTypeSchema = new Schema({ url: { type: String, index: true }, }); -export default model('DamageType', DamageTypeSchema, 'damage-types'); +export default model('DamageType', DamageTypeSchema, '2014-damage-types'); diff --git a/src/models/equipment/index.ts b/src/models/equipment/index.ts index b12ac466..2cc7d3cc 100644 --- a/src/models/equipment/index.ts +++ b/src/models/equipment/index.ts @@ -92,4 +92,4 @@ const EquipmentSchema = new Schema({ weight: { type: Number, index: true }, }); -export default model('Equipment', EquipmentSchema, 'equipment'); +export default model('Equipment', EquipmentSchema, '2014-equipment'); diff --git a/src/models/equipmentCategory/index.ts b/src/models/equipmentCategory/index.ts index c83a08b4..ff32b9a9 100644 --- a/src/models/equipmentCategory/index.ts +++ b/src/models/equipmentCategory/index.ts @@ -10,4 +10,4 @@ const EquipmentCategorySchema = new Schema({ url: { type: String, index: true }, }); -export default model('EquipmentCategory', EquipmentCategorySchema, 'equipment-categories'); +export default model('EquipmentCategory', EquipmentCategorySchema, '2014-equipment-categories'); diff --git a/src/models/feat/index.ts b/src/models/feat/index.ts index 7c3ec2b2..59692d07 100644 --- a/src/models/feat/index.ts +++ b/src/models/feat/index.ts @@ -17,4 +17,4 @@ const FeatSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Feat', FeatSchema, 'feats'); +export default model('Feat', FeatSchema, '2014-feats'); diff --git a/src/models/feature/index.ts b/src/models/feature/index.ts index 597b66fb..7fd4bdb4 100644 --- a/src/models/feature/index.ts +++ b/src/models/feature/index.ts @@ -50,4 +50,4 @@ const FeatureSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Feature', FeatureSchema, 'features'); +export default model('Feature', FeatureSchema, '2014-features'); diff --git a/src/models/language/index.ts b/src/models/language/index.ts index f0b70bd3..6b5905d3 100644 --- a/src/models/language/index.ts +++ b/src/models/language/index.ts @@ -12,4 +12,4 @@ const LanguageSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Language', LanguageSchema, 'languages'); +export default model('Language', LanguageSchema, '2014-languages'); diff --git a/src/models/level/index.ts b/src/models/level/index.ts index db7f3495..5bea0276 100644 --- a/src/models/level/index.ts +++ b/src/models/level/index.ts @@ -103,4 +103,4 @@ const LevelSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Level', LevelSchema, 'levels'); +export default model('Level', LevelSchema, '2014-levels'); diff --git a/src/models/magicItem/index.ts b/src/models/magicItem/index.ts index c3036b20..e3c1636f 100644 --- a/src/models/magicItem/index.ts +++ b/src/models/magicItem/index.ts @@ -20,4 +20,4 @@ const MagicItemSchema = new Schema({ variant: Boolean, }); -export default model('MagicItem', MagicItemSchema, 'magic-items'); +export default model('MagicItem', MagicItemSchema, '2014-magic-items'); diff --git a/src/models/magicSchool/index.ts b/src/models/magicSchool/index.ts index efcc3b3d..b204fe71 100644 --- a/src/models/magicSchool/index.ts +++ b/src/models/magicSchool/index.ts @@ -9,4 +9,4 @@ const MagicSchoolSchema = new Schema({ url: { type: String, index: true }, }); -export default model('MagicSchool', MagicSchoolSchema, 'magic-schools'); +export default model('MagicSchool', MagicSchoolSchema, '2014-magic-schools'); diff --git a/src/models/monster/index.ts b/src/models/monster/index.ts index f7d05feb..b2ca5093 100644 --- a/src/models/monster/index.ts +++ b/src/models/monster/index.ts @@ -199,4 +199,4 @@ const Monster = new Schema({ xp: { type: Number, index: true }, }); -export default model('Monster', Monster, 'monsters'); +export default model('Monster', Monster, '2014-monsters'); diff --git a/src/models/proficiency/index.ts b/src/models/proficiency/index.ts index 615e76f5..6582dcc9 100644 --- a/src/models/proficiency/index.ts +++ b/src/models/proficiency/index.ts @@ -21,4 +21,4 @@ const ProficiencySchema = new Schema({ url: { type: String, index: true }, }); -export default model('Proficiency', ProficiencySchema, 'proficiencies'); +export default model('Proficiency', ProficiencySchema, '2014-proficiencies'); diff --git a/src/models/race/index.ts b/src/models/race/index.ts index c87fcefa..f950e340 100644 --- a/src/models/race/index.ts +++ b/src/models/race/index.ts @@ -29,4 +29,4 @@ const RaceSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Race', RaceSchema, 'races'); +export default model('Race', RaceSchema, '2014-races'); diff --git a/src/models/rule/index.ts b/src/models/rule/index.ts index 77d0556b..f170d738 100644 --- a/src/models/rule/index.ts +++ b/src/models/rule/index.ts @@ -11,4 +11,4 @@ const RuleSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Rule', RuleSchema, 'rules'); +export default model('Rule', RuleSchema, '2014-rules'); diff --git a/src/models/ruleSection/index.ts b/src/models/ruleSection/index.ts index 5ba1eda8..5d17f1e1 100644 --- a/src/models/ruleSection/index.ts +++ b/src/models/ruleSection/index.ts @@ -9,4 +9,4 @@ const RuleSectionSchema = new Schema({ url: { type: String, index: true }, }); -export default model('RuleSection', RuleSectionSchema, 'rule-sections'); +export default model('RuleSection', RuleSectionSchema, '2014-rule-sections'); diff --git a/src/models/skill/index.ts b/src/models/skill/index.ts index 9286635d..4813e08c 100644 --- a/src/models/skill/index.ts +++ b/src/models/skill/index.ts @@ -11,4 +11,4 @@ const SkillSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Skill', SkillSchema, 'skills'); +export default model('Skill', SkillSchema, '2014-skills'); diff --git a/src/models/spell/index.ts b/src/models/spell/index.ts index 5b4361d3..1f2f3c14 100644 --- a/src/models/spell/index.ts +++ b/src/models/spell/index.ts @@ -44,4 +44,4 @@ const Spell = new Schema({ url: { type: String, index: true }, }); -export default model('Spell', Spell, 'spells'); +export default model('Spell', Spell, '2014-spells'); diff --git a/src/models/subclass/index.ts b/src/models/subclass/index.ts index a64a4cf9..cc78c037 100644 --- a/src/models/subclass/index.ts +++ b/src/models/subclass/index.ts @@ -28,4 +28,4 @@ const SubclassSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Subclass', SubclassSchema, 'subclasses'); +export default model('Subclass', SubclassSchema, '2014-subclasses'); diff --git a/src/models/subrace/index.ts b/src/models/subrace/index.ts index 0991a71a..b4c9b3df 100644 --- a/src/models/subrace/index.ts +++ b/src/models/subrace/index.ts @@ -21,4 +21,4 @@ const Subrace = new Schema({ url: { type: String, index: true }, }); -export default model('Subrace', Subrace, 'subraces'); +export default model('Subrace', Subrace, '2014-subraces'); diff --git a/src/models/trait/index.ts b/src/models/trait/index.ts index f25841e1..3d46c525 100644 --- a/src/models/trait/index.ts +++ b/src/models/trait/index.ts @@ -60,4 +60,4 @@ const TraitSchema = new Schema({ url: { type: String, index: true }, }); -export default model('Trait', TraitSchema, 'traits'); +export default model('Trait', TraitSchema, '2014-traits'); diff --git a/src/models/weaponProperty/index.ts b/src/models/weaponProperty/index.ts index 33e55ae1..acf502f3 100644 --- a/src/models/weaponProperty/index.ts +++ b/src/models/weaponProperty/index.ts @@ -9,4 +9,4 @@ const WeaponPropertySchema = new Schema({ url: { type: String, index: true }, }); -export default model('WeaponProperty', WeaponPropertySchema, 'weapon-properties'); +export default model('WeaponProperty', WeaponPropertySchema, '2014-weapon-properties'); From 06aaef0502a8cddf56f17b6f1c0c27832deec7b1 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Wed, 25 Dec 2024 15:30:14 -0800 Subject: [PATCH 2/8] refactor(models): Move all current modesl under 2014 folder --- src/controllers/api/abilityScoreController.ts | 2 +- src/controllers/api/alignmentController.ts | 2 +- src/controllers/api/backgroundController.ts | 2 +- src/controllers/api/classController.ts | 12 +- src/controllers/api/conditionController.ts | 2 +- src/controllers/api/damageTypeController.ts | 2 +- .../api/equipmentCategoryController.ts | 2 +- src/controllers/api/equipmentController.ts | 2 +- src/controllers/api/featController.ts | 2 +- src/controllers/api/featureController.ts | 2 +- src/controllers/api/languageController.ts | 2 +- src/controllers/api/magicItemController.ts | 2 +- src/controllers/api/magicSchoolController.ts | 2 +- src/controllers/api/monsterController.ts | 4 +- src/controllers/api/proficiencyController.ts | 2 +- src/controllers/api/raceController.ts | 8 +- src/controllers/api/ruleController.ts | 2 +- src/controllers/api/ruleSectionController.ts | 2 +- src/controllers/api/skillController.ts | 2 +- src/controllers/api/spellController.ts | 4 +- src/controllers/api/subclassController.ts | 6 +- src/controllers/api/subraceController.ts | 6 +- src/controllers/api/traitController.ts | 2 +- .../api/weaponPropertyController.ts | 2 +- src/controllers/apiController.ts | 4 +- src/graphql/resolvers/abilityScoreResolver.ts | 10 +- src/graphql/resolvers/armorResolver.ts | 4 +- src/graphql/resolvers/backgroundResolver.ts | 28 ++-- src/graphql/resolvers/classResolver.ts | 52 +++---- .../resolvers/classSpecificResolver.ts | 2 +- src/graphql/resolvers/common.ts | 10 +- .../resolvers/equipmentCategoryResolver.ts | 14 +- .../equipmentMultipleItemResolver.ts | 2 +- .../resolvers/equipmentOptionResolver.ts | 2 +- .../resolvers/expertiseOptionResolver.ts | 2 +- src/graphql/resolvers/featResolver.ts | 10 +- src/graphql/resolvers/featureResolver.ts | 16 +- .../resolvers/iEquipmentBaseResolver.ts | 2 +- src/graphql/resolvers/iEquipmentResolver.ts | 2 +- src/graphql/resolvers/iGearResolver.ts | 2 +- src/graphql/resolvers/languageResolver.ts | 2 +- src/graphql/resolvers/levelResolver.ts | 14 +- src/graphql/resolvers/magicItemResolver.ts | 2 +- src/graphql/resolvers/magicShoolResolver.ts | 2 +- .../resolvers/monsterActionOptionResolver.ts | 2 +- src/graphql/resolvers/monsterResolver.ts | 48 +++--- src/graphql/resolvers/packResolver.ts | 10 +- .../resolvers/proficiencyOptionResolver.ts | 2 +- .../resolvers/proficiencyRaceResolver.ts | 4 +- .../resolvers/proficiencyReferenceResolver.ts | 8 +- src/graphql/resolvers/proficiencyResolver.ts | 25 ++- src/graphql/resolvers/queryResolver.ts | 144 +++++++----------- src/graphql/resolvers/raceResolver.ts | 32 ++-- src/graphql/resolvers/ruleResolver.ts | 6 +- src/graphql/resolvers/skillResolver.ts | 4 +- .../resolvers/spellPrerequisiteResolver.ts | 4 +- src/graphql/resolvers/spellResolver.ts | 14 +- .../startingEquipmentOptionSetResolver.ts | 2 +- src/graphql/resolvers/subclassResolver.ts | 14 +- .../resolvers/subclassSpecificResolver.ts | 2 +- src/graphql/resolvers/subraceResolver.ts | 24 +-- src/graphql/resolvers/toolResolver.ts | 9 +- src/graphql/resolvers/traitResolver.ts | 32 ++-- src/graphql/resolvers/vehicleResolver.ts | 9 +- src/graphql/resolvers/weaponResolver.ts | 10 +- src/models/{ => 2014}/abilityScore/index.ts | 2 +- src/models/{ => 2014}/abilityScore/types.d.ts | 0 src/models/{ => 2014}/alignment/index.ts | 0 src/models/{ => 2014}/alignment/types.d.ts | 0 src/models/{ => 2014}/background/index.ts | 2 +- src/models/{ => 2014}/background/types.d.ts | 0 src/models/{ => 2014}/class/index.ts | 2 +- src/models/{ => 2014}/class/types.d.ts | 0 src/models/{ => 2014}/collection/index.ts | 0 src/models/{ => 2014}/collection/types.d.ts | 0 src/models/{ => 2014}/common/index.ts | 0 src/models/{ => 2014}/common/types.d.ts | 0 src/models/{ => 2014}/condition/index.ts | 0 src/models/{ => 2014}/condition/types.d.ts | 0 src/models/{ => 2014}/damageType/index.ts | 0 src/models/{ => 2014}/damageType/types.d.ts | 0 src/models/{ => 2014}/equipment/index.ts | 2 +- src/models/{ => 2014}/equipment/types.d.ts | 0 .../{ => 2014}/equipmentCategory/index.ts | 2 +- .../{ => 2014}/equipmentCategory/types.d.ts | 0 src/models/{ => 2014}/feat/index.ts | 2 +- src/models/{ => 2014}/feat/types.d.ts | 0 src/models/{ => 2014}/feature/index.ts | 2 +- src/models/{ => 2014}/feature/types.d.ts | 0 src/models/{ => 2014}/language/index.ts | 0 src/models/{ => 2014}/language/types.d.ts | 0 src/models/{ => 2014}/level/index.ts | 2 +- src/models/{ => 2014}/level/types.d.ts | 0 src/models/{ => 2014}/magicItem/index.ts | 2 +- src/models/{ => 2014}/magicItem/types.d.ts | 0 src/models/{ => 2014}/magicSchool/index.ts | 0 src/models/{ => 2014}/magicSchool/types.d.ts | 0 src/models/{ => 2014}/monster/index.ts | 2 +- src/models/{ => 2014}/monster/types.d.ts | 0 src/models/{ => 2014}/proficiency/index.ts | 2 +- src/models/{ => 2014}/proficiency/types.d.ts | 0 src/models/{ => 2014}/race/index.ts | 2 +- src/models/{ => 2014}/race/types.d.ts | 0 src/models/{ => 2014}/rule/index.ts | 2 +- src/models/{ => 2014}/rule/types.d.ts | 0 src/models/{ => 2014}/ruleSection/index.ts | 0 src/models/{ => 2014}/ruleSection/types.d.ts | 0 src/models/{ => 2014}/skill/index.ts | 2 +- src/models/{ => 2014}/skill/types.d.ts | 0 src/models/{ => 2014}/spell/index.ts | 2 +- src/models/{ => 2014}/spell/types.d.ts | 0 src/models/{ => 2014}/subclass/index.ts | 2 +- src/models/{ => 2014}/subclass/types.d.ts | 0 src/models/{ => 2014}/subrace/index.ts | 2 +- src/models/{ => 2014}/subrace/types.d.ts | 0 src/models/{ => 2014}/trait/index.ts | 2 +- src/models/{ => 2014}/trait/types.d.ts | 0 src/models/{ => 2014}/weaponProperty/index.ts | 0 .../{ => 2014}/weaponProperty/types.d.ts | 0 .../api/abilityScoreController.test.ts | 2 +- .../controllers/api/classController.test.ts | 12 +- .../api/conditionController.test.ts | 2 +- .../api/damageTypeController.test.ts | 2 +- .../api/equipmentCategoryController.test.ts | 2 +- .../api/equipmentController.test.ts | 2 +- .../controllers/api/featController.test.ts | 2 +- .../controllers/api/featureController.test.ts | 2 +- .../api/languageController.test.ts | 2 +- .../api/magicItemController.test.ts | 2 +- .../api/magicSchoolController.test.ts | 2 +- .../controllers/api/monsterController.test.ts | 2 +- .../api/proficiencyController.test.ts | 2 +- .../controllers/api/raceController.test.ts | 8 +- .../api/ruleSectionController.test.ts | 2 +- .../controllers/api/rulesController.test.ts | 2 +- .../controllers/api/skillController.test.ts | 2 +- .../controllers/api/spellController.test.ts | 2 +- .../api/subclassController.test.ts | 6 +- .../controllers/api/subraceController.test.ts | 6 +- .../controllers/api/traitController.test.ts | 2 +- .../api/weaponPropertyController.test.ts | 2 +- src/tests/controllers/apiController.test.ts | 2 +- .../controllers/simpleController.test.ts | 2 +- src/util/prewarmCache.ts | 10 +- 144 files changed, 367 insertions(+), 414 deletions(-) rename src/models/{ => 2014}/abilityScore/index.ts (92%) rename src/models/{ => 2014}/abilityScore/types.d.ts (100%) rename src/models/{ => 2014}/alignment/index.ts (100%) rename src/models/{ => 2014}/alignment/types.d.ts (100%) rename src/models/{ => 2014}/background/index.ts (94%) rename src/models/{ => 2014}/background/types.d.ts (100%) rename src/models/{ => 2014}/class/index.ts (98%) rename src/models/{ => 2014}/class/types.d.ts (100%) rename src/models/{ => 2014}/collection/index.ts (100%) rename src/models/{ => 2014}/collection/types.d.ts (100%) rename src/models/{ => 2014}/common/index.ts (100%) rename src/models/{ => 2014}/common/types.d.ts (100%) rename src/models/{ => 2014}/condition/index.ts (100%) rename src/models/{ => 2014}/condition/types.d.ts (100%) rename src/models/{ => 2014}/damageType/index.ts (100%) rename src/models/{ => 2014}/damageType/types.d.ts (100%) rename src/models/{ => 2014}/equipment/index.ts (99%) rename src/models/{ => 2014}/equipment/types.d.ts (100%) rename src/models/{ => 2014}/equipmentCategory/index.ts (90%) rename src/models/{ => 2014}/equipmentCategory/types.d.ts (100%) rename src/models/{ => 2014}/feat/index.ts (92%) rename src/models/{ => 2014}/feat/types.d.ts (100%) rename src/models/{ => 2014}/feature/index.ts (98%) rename src/models/{ => 2014}/feature/types.d.ts (100%) rename src/models/{ => 2014}/language/index.ts (100%) rename src/models/{ => 2014}/language/types.d.ts (100%) rename src/models/{ => 2014}/level/index.ts (99%) rename src/models/{ => 2014}/level/types.d.ts (100%) rename src/models/{ => 2014}/magicItem/index.ts (93%) rename src/models/{ => 2014}/magicItem/types.d.ts (100%) rename src/models/{ => 2014}/magicSchool/index.ts (100%) rename src/models/{ => 2014}/magicSchool/types.d.ts (100%) rename src/models/{ => 2014}/monster/index.ts (99%) rename src/models/{ => 2014}/monster/types.d.ts (100%) rename src/models/{ => 2014}/proficiency/index.ts (93%) rename src/models/{ => 2014}/proficiency/types.d.ts (100%) rename src/models/{ => 2014}/race/index.ts (95%) rename src/models/{ => 2014}/race/types.d.ts (100%) rename src/models/{ => 2014}/rule/index.ts (92%) rename src/models/{ => 2014}/rule/types.d.ts (100%) rename src/models/{ => 2014}/ruleSection/index.ts (100%) rename src/models/{ => 2014}/ruleSection/types.d.ts (100%) rename src/models/{ => 2014}/skill/index.ts (92%) rename src/models/{ => 2014}/skill/types.d.ts (100%) rename src/models/{ => 2014}/spell/index.ts (97%) rename src/models/{ => 2014}/spell/types.d.ts (100%) rename src/models/{ => 2014}/subclass/index.ts (93%) rename src/models/{ => 2014}/subclass/types.d.ts (100%) rename src/models/{ => 2014}/subrace/index.ts (93%) rename src/models/{ => 2014}/subrace/types.d.ts (100%) rename src/models/{ => 2014}/trait/index.ts (98%) rename src/models/{ => 2014}/trait/types.d.ts (100%) rename src/models/{ => 2014}/weaponProperty/index.ts (100%) rename src/models/{ => 2014}/weaponProperty/types.d.ts (100%) diff --git a/src/controllers/api/abilityScoreController.ts b/src/controllers/api/abilityScoreController.ts index 4b807c1e..784927a3 100644 --- a/src/controllers/api/abilityScoreController.ts +++ b/src/controllers/api/abilityScoreController.ts @@ -1,4 +1,4 @@ -import AbilityScore from '../../models/abilityScore/index.js'; +import AbilityScore from '../../models/2014/abilityScore/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(AbilityScore); diff --git a/src/controllers/api/alignmentController.ts b/src/controllers/api/alignmentController.ts index 5ae7217e..60645334 100644 --- a/src/controllers/api/alignmentController.ts +++ b/src/controllers/api/alignmentController.ts @@ -1,4 +1,4 @@ -import Alignment from '../../models/alignment/index.js'; +import Alignment from '../../models/2014/alignment/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Alignment); diff --git a/src/controllers/api/backgroundController.ts b/src/controllers/api/backgroundController.ts index d58a3f9b..0abbfca1 100644 --- a/src/controllers/api/backgroundController.ts +++ b/src/controllers/api/backgroundController.ts @@ -1,4 +1,4 @@ -import Background from '../../models/background/index.js'; +import Background from '../../models/2014/background/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Background); diff --git a/src/controllers/api/classController.ts b/src/controllers/api/classController.ts index 3514b100..47381d3b 100644 --- a/src/controllers/api/classController.ts +++ b/src/controllers/api/classController.ts @@ -2,13 +2,13 @@ import { Request, Response, NextFunction } from 'express'; import { ResourceList, escapeRegExp } from '../../util/index.js'; -import Class from '../../models/class/index.js'; -import Feature from '../../models/feature/index.js'; -import Level from '../../models/level/index.js'; -import Proficiency from '../../models/proficiency/index.js'; +import Class from '../../models/2014/class/index.js'; +import Feature from '../../models/2014/feature/index.js'; +import Level from '../../models/2014/level/index.js'; +import Proficiency from '../../models/2014/proficiency/index.js'; import SimpleController from '../simpleController.js'; -import Spell from '../../models/spell/index.js'; -import Subclass from '../../models/subclass/index.js'; +import Spell from '../../models/2014/spell/index.js'; +import Subclass from '../../models/2014/subclass/index.js'; const simpleController = new SimpleController(Class); interface ShowLevelsForClassQuery { diff --git a/src/controllers/api/conditionController.ts b/src/controllers/api/conditionController.ts index 7816aab6..ebde94ac 100644 --- a/src/controllers/api/conditionController.ts +++ b/src/controllers/api/conditionController.ts @@ -1,4 +1,4 @@ -import Condition from '../../models/condition/index.js'; +import Condition from '../../models/2014/condition/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Condition); diff --git a/src/controllers/api/damageTypeController.ts b/src/controllers/api/damageTypeController.ts index 7a3e05ae..e389b661 100644 --- a/src/controllers/api/damageTypeController.ts +++ b/src/controllers/api/damageTypeController.ts @@ -1,4 +1,4 @@ -import DamageType from '../../models/damageType/index.js'; +import DamageType from '../../models/2014/damageType/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(DamageType); diff --git a/src/controllers/api/equipmentCategoryController.ts b/src/controllers/api/equipmentCategoryController.ts index e9bb28d5..2da9c825 100644 --- a/src/controllers/api/equipmentCategoryController.ts +++ b/src/controllers/api/equipmentCategoryController.ts @@ -1,4 +1,4 @@ -import EquipmentCategory from '../../models/equipmentCategory/index.js'; +import EquipmentCategory from '../../models/2014/equipmentCategory/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(EquipmentCategory); diff --git a/src/controllers/api/equipmentController.ts b/src/controllers/api/equipmentController.ts index c92a66aa..bf3534e8 100644 --- a/src/controllers/api/equipmentController.ts +++ b/src/controllers/api/equipmentController.ts @@ -1,4 +1,4 @@ -import Equipment from '../../models/equipment/index.js'; +import Equipment from '../../models/2014/equipment/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Equipment); diff --git a/src/controllers/api/featController.ts b/src/controllers/api/featController.ts index fa31ef2a..b37b0207 100644 --- a/src/controllers/api/featController.ts +++ b/src/controllers/api/featController.ts @@ -1,4 +1,4 @@ -import Feat from '../../models/feat/index.js'; +import Feat from '../../models/2014/feat/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Feat); diff --git a/src/controllers/api/featureController.ts b/src/controllers/api/featureController.ts index 85cec169..a1a130bc 100644 --- a/src/controllers/api/featureController.ts +++ b/src/controllers/api/featureController.ts @@ -1,4 +1,4 @@ -import Feature from '../../models/feature/index.js'; +import Feature from '../../models/2014/feature/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Feature); diff --git a/src/controllers/api/languageController.ts b/src/controllers/api/languageController.ts index e670ad0b..f6c4f5a8 100644 --- a/src/controllers/api/languageController.ts +++ b/src/controllers/api/languageController.ts @@ -1,4 +1,4 @@ -import Language from '../../models/language/index.js'; +import Language from '../../models/2014/language/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Language); diff --git a/src/controllers/api/magicItemController.ts b/src/controllers/api/magicItemController.ts index d557583e..2aa3e514 100644 --- a/src/controllers/api/magicItemController.ts +++ b/src/controllers/api/magicItemController.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; -import MagicItem from '../../models/magicItem/index.js'; +import MagicItem from '../../models/2014/magicItem/index.js'; interface IndexQuery { name?: { $regex: RegExp }; diff --git a/src/controllers/api/magicSchoolController.ts b/src/controllers/api/magicSchoolController.ts index 4dcc127d..0d04753a 100644 --- a/src/controllers/api/magicSchoolController.ts +++ b/src/controllers/api/magicSchoolController.ts @@ -1,4 +1,4 @@ -import MagicSchool from '../../models/magicSchool/index.js'; +import MagicSchool from '../../models/2014/magicSchool/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(MagicSchool); diff --git a/src/controllers/api/monsterController.ts b/src/controllers/api/monsterController.ts index a99d9bc3..6f856cc3 100644 --- a/src/controllers/api/monsterController.ts +++ b/src/controllers/api/monsterController.ts @@ -2,7 +2,7 @@ import { Request, Response, NextFunction } from 'express'; import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; -import Monster from '../../models/monster/index.js'; +import Monster from '../../models/2014/monster/index.js'; interface IndexQuery { name?: { $regex: RegExp }; @@ -22,7 +22,7 @@ export const index = async (req: Request, res: Response, next: NextFunction) => const challengeRating = req.query.challenge_rating as string[]; searchQueries.challenge_rating = { - $in: challengeRating.map(Number).filter(item => !isNaN(item)), + $in: challengeRating.map(Number).filter((item) => !isNaN(item)), }; } diff --git a/src/controllers/api/proficiencyController.ts b/src/controllers/api/proficiencyController.ts index 5086378d..644e6713 100644 --- a/src/controllers/api/proficiencyController.ts +++ b/src/controllers/api/proficiencyController.ts @@ -1,4 +1,4 @@ -import Proficiency from '../../models/proficiency/index.js'; +import Proficiency from '../../models/2014/proficiency/index.js'; import SimpleController from '../simpleController.js'; export default new SimpleController(Proficiency); diff --git a/src/controllers/api/raceController.ts b/src/controllers/api/raceController.ts index a11f2309..9234cc86 100644 --- a/src/controllers/api/raceController.ts +++ b/src/controllers/api/raceController.ts @@ -1,11 +1,11 @@ import { Request, Response, NextFunction } from 'express'; -import Proficiency from '../../models/proficiency/index.js'; -import Race from '../../models/race/index.js'; +import Proficiency from '../../models/2014/proficiency/index.js'; +import Race from '../../models/2014/race/index.js'; import { ResourceList } from '../../util/data.js'; import SimpleController from '../simpleController.js'; -import Subrace from '../../models/subrace/index.js'; -import Trait from '../../models/trait/index.js'; +import Subrace from '../../models/2014/subrace/index.js'; +import Trait from '../../models/2014/trait/index.js'; const simpleController = new SimpleController(Race); diff --git a/src/controllers/api/ruleController.ts b/src/controllers/api/ruleController.ts index 2ed4608a..960669b5 100644 --- a/src/controllers/api/ruleController.ts +++ b/src/controllers/api/ruleController.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; -import Rule from '../../models/rule/index.js'; +import Rule from '../../models/2014/rule/index.js'; interface IndexQuery { name?: { $regex: RegExp }; diff --git a/src/controllers/api/ruleSectionController.ts b/src/controllers/api/ruleSectionController.ts index dbf30385..40ecea4e 100644 --- a/src/controllers/api/ruleSectionController.ts +++ b/src/controllers/api/ruleSectionController.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; -import RuleSection from '../../models/ruleSection/index.js'; +import RuleSection from '../../models/2014/ruleSection/index.js'; interface IndexQuery { name?: { $regex: RegExp }; desc?: { $regex: RegExp }; diff --git a/src/controllers/api/skillController.ts b/src/controllers/api/skillController.ts index d40376ce..61a7062a 100644 --- a/src/controllers/api/skillController.ts +++ b/src/controllers/api/skillController.ts @@ -1,4 +1,4 @@ import SimpleController from '../simpleController.js'; -import Skill from '../../models/skill/index.js'; +import Skill from '../../models/2014/skill/index.js'; export default new SimpleController(Skill); diff --git a/src/controllers/api/spellController.ts b/src/controllers/api/spellController.ts index af2b4b4f..d9491ec7 100644 --- a/src/controllers/api/spellController.ts +++ b/src/controllers/api/spellController.ts @@ -7,7 +7,7 @@ interface IndexQuery { 'school.name'?: { $in: RegExp[] }; } -import Spell from '../../models/spell/index.js'; +import Spell from '../../models/2014/spell/index.js'; export const index = async (req: Request, res: Response, next: NextFunction) => { try { @@ -23,7 +23,7 @@ export const index = async (req: Request, res: Response, next: NextFunction) => if (req.query.school !== undefined) { let schoolRegex; if (Array.isArray(req.query.school)) { - schoolRegex = req.query.school.map(c => new RegExp(escapeRegExp(c as string), 'i')); + schoolRegex = req.query.school.map((c) => new RegExp(escapeRegExp(c as string), 'i')); } else { schoolRegex = [new RegExp(escapeRegExp(req.query.school as string), 'i')]; } diff --git a/src/controllers/api/subclassController.ts b/src/controllers/api/subclassController.ts index 69c4ecc8..b9cc7082 100644 --- a/src/controllers/api/subclassController.ts +++ b/src/controllers/api/subclassController.ts @@ -1,9 +1,9 @@ import { Request, Response, NextFunction } from 'express'; -import Feature from '../../models/feature/index.js'; -import Level from '../../models/level/index.js'; +import Feature from '../../models/2014/feature/index.js'; +import Level from '../../models/2014/level/index.js'; import { ResourceList } from '../../util/data.js'; import SimpleController from '../simpleController.js'; -import Subclass from '../../models/subclass/index.js'; +import Subclass from '../../models/2014/subclass/index.js'; const simpleController = new SimpleController(Subclass); diff --git a/src/controllers/api/subraceController.ts b/src/controllers/api/subraceController.ts index cc2651a9..c788fd44 100644 --- a/src/controllers/api/subraceController.ts +++ b/src/controllers/api/subraceController.ts @@ -1,9 +1,9 @@ import { Request, Response, NextFunction } from 'express'; -import Proficiency from '../../models/proficiency/index.js'; +import Proficiency from '../../models/2014/proficiency/index.js'; import { ResourceList } from '../../util/data.js'; import SimpleController from '../simpleController.js'; -import Subrace from '../../models/subrace/index.js'; -import Trait from '../../models/trait/index.js'; +import Subrace from '../../models/2014/subrace/index.js'; +import Trait from '../../models/2014/trait/index.js'; const simpleController = new SimpleController(Subrace); diff --git a/src/controllers/api/traitController.ts b/src/controllers/api/traitController.ts index 28e2d4a2..d580bb0f 100644 --- a/src/controllers/api/traitController.ts +++ b/src/controllers/api/traitController.ts @@ -1,4 +1,4 @@ import SimpleController from '../simpleController.js'; -import Trait from '../../models/trait/index.js'; +import Trait from '../../models/2014/trait/index.js'; export default new SimpleController(Trait); diff --git a/src/controllers/api/weaponPropertyController.ts b/src/controllers/api/weaponPropertyController.ts index 527fc61d..be6b81af 100644 --- a/src/controllers/api/weaponPropertyController.ts +++ b/src/controllers/api/weaponPropertyController.ts @@ -1,4 +1,4 @@ import SimpleController from '../simpleController.js'; -import WeaponProperty from '../../models/weaponProperty/index.js'; +import WeaponProperty from '../../models/2014/weaponProperty/index.js'; export default new SimpleController(WeaponProperty); diff --git a/src/controllers/apiController.ts b/src/controllers/apiController.ts index 0f3ec954..f01336c7 100644 --- a/src/controllers/apiController.ts +++ b/src/controllers/apiController.ts @@ -1,5 +1,5 @@ import { Request, Response, NextFunction } from 'express'; -import Collection from '../models/collection/index.js'; +import Collection from '../models/2014/collection/index.js'; export const index = async (req: Request, res: Response, next: NextFunction) => { try { @@ -9,7 +9,7 @@ export const index = async (req: Request, res: Response, next: NextFunction) => .exec(); const apiIndex: Record = {}; - data.forEach(item => { + data.forEach((item) => { if (item.index === 'levels') return; apiIndex[item.index] = `/api/${item.index}`; diff --git a/src/graphql/resolvers/abilityScoreResolver.ts b/src/graphql/resolvers/abilityScoreResolver.ts index 10ed0744..855e75e6 100644 --- a/src/graphql/resolvers/abilityScoreResolver.ts +++ b/src/graphql/resolvers/abilityScoreResolver.ts @@ -1,4 +1,4 @@ -import SkillModel from '../../models/skill/index.js'; +import SkillModel from '../../models/2014/skill/index.js'; import { coalesceFilters, getMongoSortDirection, @@ -6,11 +6,11 @@ import { SortQuery, QueryParams, } from './common.js'; -import { AbilityScore } from '../../models/abilityScore/types'; +import { AbilityScore } from '../../models/2014/abilityScore/types.js'; const AbilityScoreResolver = { skills: async (abilityScore: AbilityScore, args: QueryParams) => { - const filters: any[] = [{ index: { $in: abilityScore.skills.map(s => s.index) } }]; + const filters: any[] = [{ index: { $in: abilityScore.skills.map((s) => s.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -21,9 +21,7 @@ const AbilityScoreResolver = { sort.name = getMongoSortDirection(args.order_direction); } - return await SkillModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await SkillModel.find(coalesceFilters(filters)).sort(sort).lean(); }, }; diff --git a/src/graphql/resolvers/armorResolver.ts b/src/graphql/resolvers/armorResolver.ts index e4984385..9f9f9f62 100644 --- a/src/graphql/resolvers/armorResolver.ts +++ b/src/graphql/resolvers/armorResolver.ts @@ -1,5 +1,5 @@ -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import { Equipment } from '../../models/equipment/types'; +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/resolvers/backgroundResolver.ts index 95b9b27f..ae90bf50 100644 --- a/src/graphql/resolvers/backgroundResolver.ts +++ b/src/graphql/resolvers/backgroundResolver.ts @@ -1,8 +1,8 @@ -import AlignmentModel from '../../models/alignment/index.js'; -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import EquipmentModel from '../../models/equipment/index.js'; -import LanguageModel from '../../models/language/index.js'; -import ProficiencyModel from '../../models/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,14 +10,14 @@ import { QueryParams, } from './common.js'; -import { Background } from '../../models/background/types'; +import { Background } from '../../models/2014/background/types.js'; const Background = { starting_equipment: async (background: Background, args: QueryParams) => { const starting_equipment = background.starting_equipment; const filters: any[] = [ { - index: { $in: starting_equipment.map(se => se.equipment.index) }, + index: { $in: starting_equipment.map((se) => se.equipment.index) }, }, ]; @@ -27,15 +27,15 @@ const Background = { const equipment = await EquipmentModel.find(coalesceFilters(filters)).lean(); - return starting_equipment.map(se => ({ + return starting_equipment.map((se) => ({ ...se, - equipment: equipment.find(e => e.index === se.equipment.index), + equipment: equipment.find((e) => e.index === se.equipment.index), })); }, starting_proficiencies: async (background: Background, args: QueryParams) => { const filters: any[] = [ { - index: { $in: background.starting_proficiencies.map(sp => sp.index) }, + index: { $in: background.starting_proficiencies.map((sp) => sp.index) }, }, ]; @@ -50,7 +50,7 @@ const Background = { background.language_options, { option_set_type: 'options_array', - options: (await LanguageModel.find().lean()).map(language => ({ + options: (await LanguageModel.find().lean()).map((language) => ({ option_type: 'reference', item: language, })), @@ -58,7 +58,7 @@ const Background = { true ), starting_equipment_options: async (background: Background) => - background.starting_equipment_options.map(async option => { + background.starting_equipment_options.map(async (option) => { if ('equipment_category' in option.from) { return resolveChoice(option, { equipment_category: await EquipmentCategoryModel.findOne({ @@ -69,12 +69,12 @@ const Background = { }), ideals: async (background: Background) => { if ('options' in background.ideals.from) { - const options = background.ideals.from.options.map(async option => { + const options = background.ideals.from.options.map(async (option) => { if ('alignments' in option) { return { ...option, alignments: await AlignmentModel.find({ - index: { $in: option.alignments.map(a => a.index) }, + index: { $in: option.alignments.map((a) => a.index) }, }).lean(), }; } diff --git a/src/graphql/resolvers/classResolver.ts b/src/graphql/resolvers/classResolver.ts index a5cc470b..bf45fb93 100644 --- a/src/graphql/resolvers/classResolver.ts +++ b/src/graphql/resolvers/classResolver.ts @@ -1,9 +1,9 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import EquipmentModel from '../../models/equipment/index.js'; -import LevelModel from '../../models/level/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import SubclassModel from '../../models/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,15 +13,15 @@ import { QueryParams, } from './common.js'; -import { Class } from '../../models/class/types'; -import { Option } from '../../models/common/types'; +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') { return { ...option, of: await EquipmentModel.findOne({ index: option.of.index }).lean(), - prerequisites: option.prerequisites?.map(async prereq => ({ + prerequisites: option.prerequisites?.map(async (prereq) => ({ ...prereq, proficiency: await ProficiencyModel.findOne({ index: prereq.proficiency?.index }).lean(), })), @@ -42,7 +42,7 @@ const resolveEquipmentOption: any = async (option: Option) => { if ('items' in option) { return { ...option, - items: option.items.map(async item => await resolveEquipmentOption(item)), + items: option.items.map(async (item) => await resolveEquipmentOption(item)), }; } }; @@ -51,7 +51,7 @@ const Class = { proficiencies: async (klass: Class, args: QueryParams) => { const filters: any[] = [ { - index: { $in: klass.proficiencies.map(p => p.index) }, + index: { $in: klass.proficiencies.map((p) => p.index) }, }, ]; @@ -63,7 +63,7 @@ const Class = { }, saving_throws: async (klass: Class) => await AbilityScoreModel.find({ - index: { $in: klass.saving_throws.map(st => st.index) }, + index: { $in: klass.saving_throws.map((st) => st.index) }, }).lean(), spellcasting: async (klass: Class) => klass.spellcasting @@ -79,18 +79,18 @@ const Class = { starting_equipment: async (klass: Class) => { const starting_equipment = klass.starting_equipment; const equipment = await EquipmentModel.find({ - index: { $in: starting_equipment?.map(se => se.equipment.index) }, + index: { $in: starting_equipment?.map((se) => se.equipment.index) }, }).lean(); - return starting_equipment?.map(se => ({ + return starting_equipment?.map((se) => ({ ...se, - equipment: equipment.find(e => e.index === se.equipment.index), + equipment: equipment.find((e) => e.index === se.equipment.index), })); }, class_levels: async (klass: Class) => await LevelModel.find({ 'class.index': klass.index }).lean(), subclasses: async (klass: Class, args: QueryParams) => { - const filters: any[] = [{ index: { $in: klass.subclasses.map(s => s.index) } }]; + const filters: any[] = [{ index: { $in: klass.subclasses.map((s) => s.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -103,12 +103,12 @@ const Class = { const { multi_classing } = klass; multiclassingToReturn.proficiencies = await ProficiencyModel.find({ - index: { $in: multi_classing.proficiencies?.map(prof => prof.index) }, + index: { $in: multi_classing.proficiencies?.map((prof) => prof.index) }, }).lean(); if (multi_classing.prerequisites) { multiclassingToReturn.prerequisites = multi_classing.prerequisites.map( - async prerequisite => ({ + async (prerequisite) => ({ ...prerequisite, ability_score: await AbilityScoreModel.findOne({ index: prerequisite.ability_score.index, @@ -124,7 +124,7 @@ const Class = { multiclassingToReturn.prerequisite_options = resolveChoice( multi_classing.prerequisite_options, { - options: multi_classing.prerequisite_options.from.options.map(async option => { + options: multi_classing.prerequisite_options.from.options.map(async (option) => { if (option.option_type === 'ability_bonus') { return { ...option, @@ -140,10 +140,10 @@ const Class = { if (multi_classing.proficiency_choices) { multiclassingToReturn.proficiency_choices = multi_classing.proficiency_choices.map( - async choice => { + async (choice) => { if ('options' in choice.from) { return resolveChoice(choice, { - options: choice.from.options.map(async option => { + options: choice.from.options.map(async (option) => { if ('item' in option) { return { ...option, @@ -160,10 +160,10 @@ const Class = { return multiclassingToReturn; }, proficiency_choices: async (klass: Class) => - klass.proficiency_choices.map(async choice => { + klass.proficiency_choices.map(async (choice) => { if ('options' in choice.from) { return resolveChoice(choice, { - options: choice.from.options.map(async option => { + options: choice.from.options.map(async (option) => { if ('item' in option) { return { ...option, @@ -172,7 +172,7 @@ const Class = { } if ('choice' in option && 'options' in option.choice.from) { - const options = option.choice.from.options.map(async o => { + const options = option.choice.from.options.map(async (o) => { if ('item' in o) { return { ...o, @@ -192,7 +192,7 @@ const Class = { } }), starting_equipment_options: async (klass: Class) => - klass.starting_equipment_options.map(async se_option => { + klass.starting_equipment_options.map(async (se_option) => { const optionToReturn: Record = { ...se_option }; const from = se_option.from; @@ -205,7 +205,7 @@ const Class = { }; } else { if ('options' in from) { - const options = from.options.map(async option => await resolveEquipmentOption(option)); + const options = from.options.map(async (option) => await resolveEquipmentOption(option)); optionToReturn.from = { ...from, options, diff --git a/src/graphql/resolvers/classSpecificResolver.ts b/src/graphql/resolvers/classSpecificResolver.ts index 1ff2847e..1f194cc2 100644 --- a/src/graphql/resolvers/classSpecificResolver.ts +++ b/src/graphql/resolvers/classSpecificResolver.ts @@ -1,4 +1,4 @@ -import { ClassSpecific as ClassSpecificType } from '../../models/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/resolvers/common.ts index 5ddf546b..2883d661 100644 --- a/src/graphql/resolvers/common.ts +++ b/src/graphql/resolvers/common.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import { AreaOfEffect, Choice, DifficultyClass } from '../../models/common/types'; -import { Equipment } from '../../models/equipment/types'; -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import SpellModel from '../../models/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/resolvers/equipmentCategoryResolver.ts index 724e88b8..122b6f58 100644 --- a/src/graphql/resolvers/equipmentCategoryResolver.ts +++ b/src/graphql/resolvers/equipmentCategoryResolver.ts @@ -1,10 +1,10 @@ -import EquipmentModel from '../../models/equipment/index.js'; -import MagicItemModel from '../../models/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/equipmentCategory/types'; -import { MagicItem } from '../../models/magicItem/types'; -import { Equipment } from '../../models/equipment/types'; +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'; type Args = { @@ -16,7 +16,7 @@ type Args = { const EquipmentCategory = { equipment: async (equipmentCategory: EquipmentCategory, args: Args) => { - const indexes = equipmentCategory.equipment.map(e => e.index); + const indexes = equipmentCategory.equipment.map((e) => e.index); const filters: any[] = [{ index: { $in: indexes } }]; if (args.name) { @@ -31,7 +31,7 @@ const EquipmentCategory = { let sort: SortQuery = {}; if (args.order) { - sort = coalesceSort(args.order, value => value.toLowerCase(), 2); + sort = coalesceSort(args.order, (value) => value.toLowerCase(), 2); } if (sort.name) { diff --git a/src/graphql/resolvers/equipmentMultipleItemResolver.ts b/src/graphql/resolvers/equipmentMultipleItemResolver.ts index 2f6e0c9e..a15bab3c 100644 --- a/src/graphql/resolvers/equipmentMultipleItemResolver.ts +++ b/src/graphql/resolvers/equipmentMultipleItemResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/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/resolvers/equipmentOptionResolver.ts index 8bf75ad1..562b85ee 100644 --- a/src/graphql/resolvers/equipmentOptionResolver.ts +++ b/src/graphql/resolvers/equipmentOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/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/resolvers/expertiseOptionResolver.ts index e5c0f77b..e95ab34f 100644 --- a/src/graphql/resolvers/expertiseOptionResolver.ts +++ b/src/graphql/resolvers/expertiseOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/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/resolvers/featResolver.ts index 0229f098..a535369b 100644 --- a/src/graphql/resolvers/featResolver.ts +++ b/src/graphql/resolvers/featResolver.ts @@ -1,17 +1,17 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; +import AbilityScoreModel from '../../models/2014/abilityScore/index.js'; -import { Feat } from '../../models/feat/types'; +import { Feat } from '../../models/2014/feat/types.js'; const Feat = { prerequisites: async (feat: Feat) => { const prerequisites = feat.prerequisites; const abilityScores = await AbilityScoreModel.find({ - index: { $in: prerequisites.map(p => p.ability_score.index) }, + index: { $in: prerequisites.map((p) => p.ability_score.index) }, }).lean(); - return prerequisites.map(async p => ({ + return prerequisites.map(async (p) => ({ ...p, - ability_score: abilityScores.find(as => as.index === p.ability_score.index), + ability_score: abilityScores.find((as) => as.index === p.ability_score.index), })); }, }; diff --git a/src/graphql/resolvers/featureResolver.ts b/src/graphql/resolvers/featureResolver.ts index c13bf97d..2bc4b725 100644 --- a/src/graphql/resolvers/featureResolver.ts +++ b/src/graphql/resolvers/featureResolver.ts @@ -1,13 +1,13 @@ -import ClassModel from '../../models/class/index.js'; -import FeatureModel from '../../models/feature/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import SpellModel from '../../models/spell/index.js'; -import SubclassModel from '../../models/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/feature/types'; -import { Proficiency } from '../../models/proficiency/types'; -import { Option } from '../../models/common/types'; +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/iEquipmentBaseResolver.ts b/src/graphql/resolvers/iEquipmentBaseResolver.ts index b939becc..36440342 100644 --- a/src/graphql/resolvers/iEquipmentBaseResolver.ts +++ b/src/graphql/resolvers/iEquipmentBaseResolver.ts @@ -1,5 +1,5 @@ import { resolveEquipmentType } from './common.js'; -import { Equipment } from '../../models/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const IEquipmentBase = { __resolveType(equipment: Equipment) { diff --git a/src/graphql/resolvers/iEquipmentResolver.ts b/src/graphql/resolvers/iEquipmentResolver.ts index 719d6b94..b8c672c9 100644 --- a/src/graphql/resolvers/iEquipmentResolver.ts +++ b/src/graphql/resolvers/iEquipmentResolver.ts @@ -1,5 +1,5 @@ import { resolveEquipmentType } from './common.js'; -import { Equipment } from '../../models/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const IEquipment = { __resolveType(equipment: Equipment) { diff --git a/src/graphql/resolvers/iGearResolver.ts b/src/graphql/resolvers/iGearResolver.ts index d2015736..5cfe5602 100644 --- a/src/graphql/resolvers/iGearResolver.ts +++ b/src/graphql/resolvers/iGearResolver.ts @@ -1,5 +1,5 @@ import { resolveGearType } from './common.js'; -import { Equipment } from '../../models/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const IGear = { __resolveType(gear: Equipment) { diff --git a/src/graphql/resolvers/languageResolver.ts b/src/graphql/resolvers/languageResolver.ts index b8ba52a2..08828804 100644 --- a/src/graphql/resolvers/languageResolver.ts +++ b/src/graphql/resolvers/languageResolver.ts @@ -1,4 +1,4 @@ -import { Language } from '../../models/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/resolvers/levelResolver.ts index 631366c2..2521fd9d 100644 --- a/src/graphql/resolvers/levelResolver.ts +++ b/src/graphql/resolvers/levelResolver.ts @@ -1,6 +1,6 @@ -import ClassModel from '../../models/class/index.js'; -import FeatureModel from '../../models/feature/index.js'; -import SubclassModel from '../../models/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,14 +9,14 @@ import { SortQuery, } from './common.js'; -import { Level } from '../../models/level/types'; +import { Level } from '../../models/2014/level/types.js'; const Level = { class: async (level: Level) => await ClassModel.findOne({ index: level.class.index }).lean(), subclass: async (level: Level) => level.subclass ? await SubclassModel.findOne({ index: level.subclass.index }).lean() : null, features: async (level: Level, args: QueryParams) => { - const filters: any[] = [{ index: { $in: level.features?.map(f => f.index) } }]; + const filters: any[] = [{ index: { $in: level.features?.map((f) => f.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -27,9 +27,7 @@ const Level = { sort.name = getMongoSortDirection(args.order_direction); } - return await FeatureModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await FeatureModel.find(coalesceFilters(filters)).sort(sort).lean(); }, }; diff --git a/src/graphql/resolvers/magicItemResolver.ts b/src/graphql/resolvers/magicItemResolver.ts index 0510fde0..94c720a6 100644 --- a/src/graphql/resolvers/magicItemResolver.ts +++ b/src/graphql/resolvers/magicItemResolver.ts @@ -1,5 +1,5 @@ import { equipmentBaseFieldResolvers } from './common.js'; -import { MagicItem } from '../../models/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/resolvers/magicShoolResolver.ts index a1d23609..c0fc084d 100644 --- a/src/graphql/resolvers/magicShoolResolver.ts +++ b/src/graphql/resolvers/magicShoolResolver.ts @@ -1,5 +1,5 @@ import { resolveSpells, SpellQuery } from './common.js'; -import { MagicSchool } from '../../models/magicSchool/types'; +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/resolvers/monsterActionOptionResolver.ts index 16d021db..5699e04f 100644 --- a/src/graphql/resolvers/monsterActionOptionResolver.ts +++ b/src/graphql/resolvers/monsterActionOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/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/resolvers/monsterResolver.ts index 8dfb51a9..5235170b 100644 --- a/src/graphql/resolvers/monsterResolver.ts +++ b/src/graphql/resolvers/monsterResolver.ts @@ -1,15 +1,15 @@ import { levelObjectToArray, resolveChoice, resolveDc } from './common.js'; -import ConditionModel from '../../models/condition/index.js'; -import DamageTypeModel from '../../models/damageType/index.js'; -import EquipmentModel from '../../models/equipment/index.js'; -import MonsterModel from '../../models/monster/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import SpellModel from '../../models/spell/index.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/monster/types'; -import { DamageType } from '../../models/damageType/types'; -import { Damage } from '../../models/common/types'; +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 = { @@ -17,7 +17,7 @@ const resolveUsage = (usage: ActionUsage | SpecialAbilityUsage) => { type: usage.type.toUpperCase().replace(/\s+/g, '_'), }; if ('rest_types' in usage) - resolvedUsage.rest_types = usage.rest_types?.map(rt => rt.toUpperCase()); + resolvedUsage.rest_types = usage.rest_types?.map((rt) => rt.toUpperCase()); return resolvedUsage; }; @@ -29,16 +29,16 @@ type ResolvedDamage = { const resolveDamage = async (damage: Damage[]) => { const damageTypes = await DamageTypeModel.find({ - index: { $in: damage.filter(d => d.damage_type).map(d => d.damage_type.index) }, + index: { $in: damage.filter((d) => d.damage_type).map((d) => d.damage_type.index) }, }).lean(); - return damage.map(async d => { + return damage.map(async (d) => { const newDamage: ResolvedDamage = { damage_dice: d.damage_dice, }; if (d.damage_type) { - newDamage.damage_type = damageTypes.find(dt => dt.index === d.damage_type.index); + newDamage.damage_type = damageTypes.find((dt) => dt.index === d.damage_type.index); } return newDamage; @@ -47,7 +47,7 @@ const resolveDamage = async (damage: Damage[]) => { const Monster = { armor_class: async (monster: Monster) => { - const resolvedAC = monster.armor_class.map(async ac => { + const resolvedAC = monster.armor_class.map(async (ac) => { const newAC: Record = { ...ac }; if (ac.type === 'armor' && 'armor' in ac) { @@ -71,11 +71,11 @@ const Monster = { }, condition_immunities: async (monster: Monster) => await ConditionModel.find({ - index: { $in: monster.condition_immunities.map(ci => ci.index) }, + index: { $in: monster.condition_immunities.map((ci) => ci.index) }, }).lean(), forms: async (monster: Monster) => monster.forms - ? await MonsterModel.find({ index: { $in: monster.forms.map(f => f.index) } }).lean() + ? await MonsterModel.find({ index: { $in: monster.forms.map((f) => f.index) } }).lean() : null, legendary_actions: async (monster: Monster) => { const { legendary_actions } = monster; @@ -97,17 +97,17 @@ const Monster = { }, proficiencies: async (monster: Monster) => { const profs = await ProficiencyModel.find({ - index: { $in: monster.proficiencies.map(p => p.proficiency.index) }, + index: { $in: monster.proficiencies.map((p) => p.proficiency.index) }, }).lean(); - return monster.proficiencies.map(async p => ({ + return monster.proficiencies.map(async (p) => ({ ...p, - proficiency: profs.find(prof => prof.index === p.proficiency.index), + proficiency: profs.find((prof) => prof.index === p.proficiency.index), })); }, reactions: async (monster: Monster) => monster.reactions - ? monster.reactions.map(async r => { + ? monster.reactions.map(async (r) => { const resolvedReaction: Record = { ...r }; if (r.dc) resolvedReaction.dc = resolveDc(r.dc); return resolvedReaction; @@ -138,10 +138,10 @@ const Monster = { resolvedSpellcasting.slots = levelObjectToArray(spellcasting.slots, 'slots'); const spells = await SpellModel.find({ - url: { $in: spellcasting.spells.map(s => s.url) }, + url: { $in: spellcasting.spells.map((s) => s.url) }, }).lean(); - resolvedSpellcasting.spells = spellcasting.spells.map(async s => { - const spell: Record = { spell: spells.find(sp => sp.url === s.url) }; + resolvedSpellcasting.spells = spellcasting.spells.map(async (s) => { + const spell: Record = { spell: spells.find((sp) => sp.url === s.url) }; if (s.usage) spell.usage = resolveUsage(s.usage); return spell; }); @@ -184,7 +184,7 @@ const Monster = { if (action.options && 'options' in action.options.from) { actionToAdd.options = resolveChoice(action.options, { - options: action.options.from.options.map(async option => { + options: action.options.from.options.map(async (option) => { if (option.option_type === 'breath') { const newOption: Record = { ...option, dc: await resolveDc(option.dc) }; diff --git a/src/graphql/resolvers/packResolver.ts b/src/graphql/resolvers/packResolver.ts index 1c3a5a1c..8f2217de 100644 --- a/src/graphql/resolvers/packResolver.ts +++ b/src/graphql/resolvers/packResolver.ts @@ -1,18 +1,18 @@ -import EquipmentModel from '../../models/equipment/index.js'; +import EquipmentModel from '../../models/2014/equipment/index.js'; import { gearFieldResolvers } from './common.js'; -import { Equipment } from '../../models/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const Pack = { ...gearFieldResolvers, contents: async (pack: Equipment) => { const contents = pack.contents; const equipment = await EquipmentModel.find({ - index: { $in: contents?.map(c => c.item.index) }, + index: { $in: contents?.map((c) => c.item.index) }, }).lean(); - return contents?.map(c => ({ + return contents?.map((c) => ({ ...c, - item: equipment.find(e => e.index === c.item.index), + item: equipment.find((e) => e.index === c.item.index), })); }, }; diff --git a/src/graphql/resolvers/proficiencyOptionResolver.ts b/src/graphql/resolvers/proficiencyOptionResolver.ts index 6ff63c91..9f7da0e6 100644 --- a/src/graphql/resolvers/proficiencyOptionResolver.ts +++ b/src/graphql/resolvers/proficiencyOptionResolver.ts @@ -1,4 +1,4 @@ -import { Option } from '../../models/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/resolvers/proficiencyRaceResolver.ts index 3867dd84..adf80257 100644 --- a/src/graphql/resolvers/proficiencyRaceResolver.ts +++ b/src/graphql/resolvers/proficiencyRaceResolver.ts @@ -1,5 +1,5 @@ -import { Race } from '../../models/race/types'; -import { Subrace } from '../../models/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/resolvers/proficiencyReferenceResolver.ts index 5a8c0003..5b77cfea 100644 --- a/src/graphql/resolvers/proficiencyReferenceResolver.ts +++ b/src/graphql/resolvers/proficiencyReferenceResolver.ts @@ -1,9 +1,9 @@ import { resolveEquipmentType } from './common.js'; -import { Equipment } from '../../models/equipment/types'; -import { EquipmentCategory } from '../../models/equipmentCategory/types'; -import { AbilityScore } from '../../models/abilityScore/types'; -import { Skill } from '../../models/skill/types'; +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/resolvers/proficiencyResolver.ts index 312918a4..e66a46ac 100644 --- a/src/graphql/resolvers/proficiencyResolver.ts +++ b/src/graphql/resolvers/proficiencyResolver.ts @@ -1,17 +1,17 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import ClassModel from '../../models/class/index.js'; -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import EquipmentModel from '../../models/equipment/index.js'; -import RaceModel from '../../models/race/index.js'; -import SkillModel from '../../models/skill/index.js'; -import SubraceModel from '../../models/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/proficiency/types'; +import { Proficiency } from '../../models/2014/proficiency/types.js'; const Proficiency = { classes: async (proficiency: Proficiency, args: QueryParams) => { - const filters: any[] = [{ index: { $in: proficiency.classes?.map(c => c.index) } }]; + const filters: any[] = [{ index: { $in: proficiency.classes?.map((c) => c.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -21,7 +21,7 @@ const Proficiency = { }, races: async (proficiency: Proficiency, args: QueryParams) => { const races = []; - for (const { url, index } of proficiency.races?.map(r => r) || []) { + for (const { url, index } of proficiency.races?.map((r) => r) || []) { const filters: any[] = [{ index }]; if (args.name) { @@ -47,10 +47,7 @@ const Proficiency = { if (url.includes('skills')) return await SkillModel.findOne({ url }).lean(); }, type: (proficiency: Proficiency) => - proficiency.type - .toUpperCase() - .replace(/'/g, '') - .replace(/\s+/g, '_'), + proficiency.type.toUpperCase().replace(/'/g, '').replace(/\s+/g, '_'), }; export default Proficiency; diff --git a/src/graphql/resolvers/queryResolver.ts b/src/graphql/resolvers/queryResolver.ts index bcfb6af0..1a7288e4 100644 --- a/src/graphql/resolvers/queryResolver.ts +++ b/src/graphql/resolvers/queryResolver.ts @@ -7,31 +7,31 @@ import { resolveSpells, } from './common.js'; -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import AlignmentModel from '../../models/alignment/index.js'; -import BackgroundModel from '../../models/background/index.js'; -import ClassModel from '../../models/class/index.js'; -import ConditionModel from '../../models/condition/index.js'; -import DamageTypeModel from '../../models/damageType/index.js'; -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import EquipmentModel from '../../models/equipment/index.js'; -import FeatModel from '../../models/feat/index.js'; -import FeatureModel from '../../models/feature/index.js'; -import LanguageModel from '../../models/language/index.js'; -import LevelModel from '../../models/level/index.js'; -import MagicItemModel from '../../models/magicItem/index.js'; -import MagicSchoolModel from '../../models/magicSchool/index.js'; -import MonsterModel from '../../models/monster/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import RaceModel from '../../models/race/index.js'; -import RuleModel from '../../models/rule/index.js'; -import RuleSectionModel from '../../models/ruleSection/index.js'; -import SkillModel from '../../models/skill/index.js'; -import SpellModel from '../../models/spell/index.js'; -import SubclassModel from '../../models/subclass/index.js'; -import SubraceModel from '../../models/subrace/index.js'; -import TraitModel from '../../models/trait/index.js'; -import WeaponPropertyModel from '../../models/weaponProperty/index.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'; @@ -56,9 +56,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await AbilityScoreModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await AbilityScoreModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async alignment(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -76,9 +74,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await AlignmentModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await AlignmentModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async background(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -96,9 +92,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await BackgroundModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await BackgroundModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async class(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -117,11 +111,9 @@ const Query = { let sort = {}; if (args.order) { - sort = coalesceSort(args.order, value => value.toLowerCase(), 2); + sort = coalesceSort(args.order, (value) => value.toLowerCase(), 2); } - return await ClassModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await ClassModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async condition(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -139,9 +131,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return ConditionModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return ConditionModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async damageType(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -159,9 +149,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await DamageTypeModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await DamageTypeModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async equipment(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -182,7 +170,8 @@ const Query = { if (args.order) { sort = coalesceSort( args.order, - value => (value === 'EQUIPMENT_CATEGORY' ? 'equipment_category.name' : value.toLowerCase()), + (value) => + value === 'EQUIPMENT_CATEGORY' ? 'equipment_category.name' : value.toLowerCase(), 3 ); } @@ -214,9 +203,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await EquipmentCategoryModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await EquipmentCategoryModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async feat(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -235,9 +222,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await FeatModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await FeatModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async feature(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -268,7 +253,7 @@ const Query = { if (args.order) { sort = coalesceSort( args.order, - value => { + (value) => { switch (value) { case 'CLASS': return 'class.name'; @@ -316,12 +301,10 @@ const Query = { let sort = {}; if (args.order) { - sort = coalesceSort(args.order, value => value.toLowerCase(), 3); + sort = coalesceSort(args.order, (value) => value.toLowerCase(), 3); } - return await LanguageModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await LanguageModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async level(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -355,7 +338,7 @@ const Query = { if (args.order) { sort = coalesceSort( args.order, - value => { + (value) => { switch (value) { case 'CLASS': return 'class.name'; @@ -400,7 +383,8 @@ const Query = { if (args.order) { sort = coalesceSort( args.order, - value => (value === 'EQUIPMENT_CATEGORY' ? 'equipment_category.name' : value.toLowerCase()), + (value) => + value === 'EQUIPMENT_CATEGORY' ? 'equipment_category.name' : value.toLowerCase(), 2 ); } @@ -432,9 +416,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await MagicSchoolModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await MagicSchoolModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async monster(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -504,7 +486,7 @@ const Query = { let sort = {}; if (args.order) { - sort = coalesceSort(args.order, value => value.toLowerCase(), 13); + sort = coalesceSort(args.order, (value) => value.toLowerCase(), 13); } let skip = 0; @@ -546,7 +528,7 @@ const Query = { let sort = {}; if (args.order) { - sort = coalesceSort(args.order, value => value.toLowerCase(), 2); + sort = coalesceSort(args.order, (value) => value.toLowerCase(), 2); } let skip = 0; @@ -591,12 +573,10 @@ const Query = { let sort = {}; if (args.order) { - sort = coalesceSort(args.order, value => value.toLowerCase(), 3); + sort = coalesceSort(args.order, (value) => value.toLowerCase(), 3); } - return await RaceModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await RaceModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async rule(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -614,9 +594,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await RuleModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await RuleModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async ruleSection(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -634,9 +612,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await RuleSectionModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await RuleSectionModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async skill(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -657,14 +633,12 @@ const Query = { if (args.order) { sort = coalesceSort( args.order, - value => (value === 'ABILITY_SCORE' ? 'ability_score.name' : value.toLowerCase()), + (value) => (value === 'ABILITY_SCORE' ? 'ability_score.name' : value.toLowerCase()), 2 ); } - return await SkillModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await SkillModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async spell(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -689,9 +663,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await SubclassModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await SubclassModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async subrace(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -709,9 +681,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await SubraceModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await SubraceModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async trait(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -729,9 +699,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await TraitModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await TraitModel.find(coalesceFilters(filters)).sort(sort).lean(); }, async weaponProperty(_: any, args: Record) { const filter = args.index ? { index: args.index } : {}; @@ -749,9 +717,7 @@ const Query = { sort.name = getMongoSortDirection(args.order_direction); } - return await WeaponPropertyModel.find(coalesceFilters(filters)) - .sort(sort) - .lean(); + return await WeaponPropertyModel.find(coalesceFilters(filters)).sort(sort).lean(); }, }; diff --git a/src/graphql/resolvers/raceResolver.ts b/src/graphql/resolvers/raceResolver.ts index 53dd3323..3a7df56b 100644 --- a/src/graphql/resolvers/raceResolver.ts +++ b/src/graphql/resolvers/raceResolver.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import LanguageModel from '../../models/language/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import SubraceModel from '../../models/subrace/index.js'; -import TraitModel from '../../models/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,22 +10,22 @@ import { QueryParams, } from './common.js'; -import { Race } from '../../models/race/types'; +import { Race } from '../../models/2014/race/types.js'; const Race = { ability_bonuses: async (race: Race) => { const abilityBonuses = race.ability_bonuses; const abilityScores = await AbilityScoreModel.find({ - index: { $in: abilityBonuses.map(ab => ab.ability_score.index) }, + index: { $in: abilityBonuses.map((ab) => ab.ability_score.index) }, }).lean(); - return abilityBonuses.map(ab => ({ + return abilityBonuses.map((ab) => ({ ...ab, - ability_score: abilityScores.find(as => as.index === ab.ability_score.index), + ability_score: abilityScores.find((as) => as.index === ab.ability_score.index), })); }, languages: async (race: Race, args: QueryParams) => { - const filters: any[] = [{ index: { $in: race.languages.map(l => l.index) } }]; + const filters: any[] = [{ index: { $in: race.languages.map((l) => l.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -37,7 +37,7 @@ const Race = { starting_proficiencies: async (race: Race, args: QueryParams) => { const filters: any[] = [ { - index: { $in: race.starting_proficiencies?.map(p => p.index) }, + index: { $in: race.starting_proficiencies?.map((p) => p.index) }, }, ]; @@ -48,7 +48,7 @@ const Race = { return await ProficiencyModel.find(coalesceFilters(filters)).lean(); }, subraces: async (race: Race, args: QueryParams) => { - const filters: any[] = [{ index: { $in: race.subraces?.map(s => s.index) } }]; + const filters: any[] = [{ index: { $in: race.subraces?.map((s) => s.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -57,7 +57,7 @@ const Race = { return await SubraceModel.find(coalesceFilters(filters)).lean(); }, traits: async (race: Race, args: QueryParams) => { - const filters: any[] = [{ index: { $in: race.traits?.map(t => t.index) } }]; + const filters: any[] = [{ index: { $in: race.traits?.map((t) => t.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -71,7 +71,7 @@ const Race = { } if ('options' in race.ability_bonus_options.from) { - const options = race.ability_bonus_options.from.options.map(async option => { + const options = race.ability_bonus_options.from.options.map(async (option) => { if ('ability_score' in option) { return { ...option, @@ -91,7 +91,7 @@ const Race = { } if ('options' in race.language_options.from) { - const options = race.language_options.from.options.map(async option => { + const options = race.language_options.from.options.map(async (option) => { if ('item' in option) { return { ...option, @@ -110,7 +110,7 @@ const Race = { } if ('options' in race.starting_proficiency_options.from) { - const options = race.starting_proficiency_options.from.options.map(async option => { + const options = race.starting_proficiency_options.from.options.map(async (option) => { if ('item' in option) { return { ...option, diff --git a/src/graphql/resolvers/ruleResolver.ts b/src/graphql/resolvers/ruleResolver.ts index 03a353fb..393c8e2c 100644 --- a/src/graphql/resolvers/ruleResolver.ts +++ b/src/graphql/resolvers/ruleResolver.ts @@ -1,12 +1,12 @@ -import RuleSectionModel from '../../models/ruleSection/index.js'; +import RuleSectionModel from '../../models/2014/ruleSection/index.js'; import { coalesceFilters, resolveContainsStringFilter, QueryParams } from './common.js'; -import { Rule } from '../../models/rule/types'; +import { Rule } from '../../models/2014/rule/types.js'; const Rule = { subsections: async (rule: Rule, args: QueryParams) => { const filters: any[] = [ { - index: { $in: rule.subsections.map(r => r.index) }, + index: { $in: rule.subsections.map((r) => r.index) }, }, ]; diff --git a/src/graphql/resolvers/skillResolver.ts b/src/graphql/resolvers/skillResolver.ts index 32d6f2ac..240c1ecb 100644 --- a/src/graphql/resolvers/skillResolver.ts +++ b/src/graphql/resolvers/skillResolver.ts @@ -1,5 +1,5 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import { Skill } from '../../models/skill/types'; +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/resolvers/spellPrerequisiteResolver.ts index 6d3217f2..511f4f66 100644 --- a/src/graphql/resolvers/spellPrerequisiteResolver.ts +++ b/src/graphql/resolvers/spellPrerequisiteResolver.ts @@ -1,5 +1,5 @@ -import { Level } from '../../models/level/types'; -import { Feature } from '../../models/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/resolvers/spellResolver.ts index d18a2c72..d1a3d873 100644 --- a/src/graphql/resolvers/spellResolver.ts +++ b/src/graphql/resolvers/spellResolver.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import ClassModel from '../../models/class/index.js'; -import DamageTypeModel from '../../models/damageType/index.js'; -import MagicSchoolModel from '../../models/magicSchool/index.js'; -import SubclassModel from '../../models/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/spell/types'; -import { DamageType } from '../../models/damageType/types'; +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/resolvers/startingEquipmentOptionSetResolver.ts index 93f4bd12..dfcc55b2 100644 --- a/src/graphql/resolvers/startingEquipmentOptionSetResolver.ts +++ b/src/graphql/resolvers/startingEquipmentOptionSetResolver.ts @@ -1,4 +1,4 @@ -import { OptionSet } from '../../models/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/resolvers/subclassResolver.ts index 0208a292..5e9de12f 100644 --- a/src/graphql/resolvers/subclassResolver.ts +++ b/src/graphql/resolvers/subclassResolver.ts @@ -1,9 +1,9 @@ -import ClassModel from '../../models/class/index.js'; -import FeatureModel from '../../models/feature/index.js'; -import LevelModel from '../../models/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/subclass/types'; +import { Subclass } from '../../models/2014/subclass/types.js'; const Subclass = { class: async (subclass: Subclass) => @@ -15,18 +15,18 @@ const Subclass = { const spells = await resolveSpells(args, [ { - index: { $in: subclass.spells.map(s => s.spell.index) }, + index: { $in: subclass.spells.map((s) => s.spell.index) }, }, ]); const spellsToReturn = []; for (const spell of subclass.spells) { - const s = spells.find(sp => sp.index === spell.spell.index); + const s = spells.find((sp) => sp.index === spell.spell.index); if (s) { spellsToReturn.push({ spell: s, prerequisites: spell.prerequisites.map( - async p => + async (p) => await (p.type == 'level' ? LevelModel.findOne({ index: p.index }).lean() : FeatureModel.findOne({ index: p.index }).lean()) diff --git a/src/graphql/resolvers/subclassSpecificResolver.ts b/src/graphql/resolvers/subclassSpecificResolver.ts index b842f9ed..371dbee8 100644 --- a/src/graphql/resolvers/subclassSpecificResolver.ts +++ b/src/graphql/resolvers/subclassSpecificResolver.ts @@ -1,4 +1,4 @@ -import { SubclassSpecific as SubclassSpecificType } from '../../models/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/resolvers/subraceResolver.ts index 6c2baec1..37efea33 100644 --- a/src/graphql/resolvers/subraceResolver.ts +++ b/src/graphql/resolvers/subraceResolver.ts @@ -1,8 +1,8 @@ -import AbilityScoreModel from '../../models/abilityScore/index.js'; -import LanguageModel from '../../models/language/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import RaceModel from '../../models/race/index.js'; -import TraitModel from '../../models/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,25 +10,25 @@ import { QueryParams, } from './common.js'; -import { Subrace } from '../../models/subrace/types'; +import { Subrace } from '../../models/2014/subrace/types.js'; const Subrace = { ability_bonuses: async (subrace: Subrace) => { const abilityBonuses = subrace.ability_bonuses; const abilityScores = await AbilityScoreModel.find({ - index: { $in: abilityBonuses.map(ab => ab.ability_score.index) }, + index: { $in: abilityBonuses.map((ab) => ab.ability_score.index) }, }).lean(); - return abilityBonuses.map(ab => ({ + return abilityBonuses.map((ab) => ({ ...ab, - ability_score: abilityScores.find(as => as.index === ab.ability_score.index), + ability_score: abilityScores.find((as) => as.index === ab.ability_score.index), })); }, race: async (subrace: Subrace) => await RaceModel.findOne({ index: subrace.race.index }).lean(), racial_traits: async (subrace: Subrace, args: QueryParams) => { const filters: any[] = [ { - index: { $in: subrace.racial_traits.map(t => t.index) }, + index: { $in: subrace.racial_traits.map((t) => t.index) }, }, ]; @@ -41,7 +41,7 @@ const Subrace = { starting_proficiencies: async (subrace: Subrace, args: QueryParams) => { const filters: any[] = [ { - index: { $in: subrace.starting_proficiencies?.map(p => p.index) }, + index: { $in: subrace.starting_proficiencies?.map((p) => p.index) }, }, ]; @@ -57,7 +57,7 @@ const Subrace = { } if ('options' in subrace.language_options.from) { - const options = subrace.language_options.from.options.map(async option => { + const options = subrace.language_options.from.options.map(async (option) => { if ('item' in option) { return await LanguageModel.findOne({ index: option.item.index }).lean(); } diff --git a/src/graphql/resolvers/toolResolver.ts b/src/graphql/resolvers/toolResolver.ts index bdb8c307..3d941f2e 100644 --- a/src/graphql/resolvers/toolResolver.ts +++ b/src/graphql/resolvers/toolResolver.ts @@ -1,15 +1,12 @@ -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; +import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; import { equipmentFieldResolvers } from './common.js'; -import { Equipment } from '../../models/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const Tool = { ...equipmentFieldResolvers, tool_category: async (tool: Equipment) => { - let index = tool.tool_category - ?.replace(/\s+/g, '-') - .replace(/'/g, '') - .toLowerCase(); + let index = tool.tool_category?.replace(/\s+/g, '-').replace(/'/g, '').toLowerCase(); if (index?.charAt(index.length - 1) !== 's') index += 's'; return await EquipmentCategoryModel.findOne({ index }).lean(); }, diff --git a/src/graphql/resolvers/traitResolver.ts b/src/graphql/resolvers/traitResolver.ts index e76a4778..2a8f47de 100644 --- a/src/graphql/resolvers/traitResolver.ts +++ b/src/graphql/resolvers/traitResolver.ts @@ -7,16 +7,16 @@ import { resolveContainsStringFilter, } from './common.js'; -import DamageTypeModel from '../../models/damageType/index.js'; -import ProficiencyModel from '../../models/proficiency/index.js'; -import RaceModel from '../../models/race/index.js'; -import SpellModel from '../../models/spell/index.js'; -import SubraceModel from '../../models/subrace/index.js'; -import TraitModel from '../../models/trait/index.js'; -import LanguageModel from '../../models/language/index.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/trait/types'; +import { Trait, Usage } from '../../models/2014/trait/types.js'; type TraitSpecificClient = { breath_weapon?: { @@ -40,7 +40,7 @@ const Trait = { proficiencies: async (trait: Trait, args: QueryParams) => { const filters: any[] = [ { - index: { $in: trait.proficiencies?.map(p => p.index) }, + index: { $in: trait.proficiencies?.map((p) => p.index) }, }, ]; @@ -53,7 +53,7 @@ const Trait = { parent: async (trait: Trait) => trait.parent ? await TraitModel.findOne({ index: trait.parent.index }).lean() : null, subraces: async (trait: Trait, args: QueryParams) => { - const filters: any[] = [{ index: { $in: trait.subraces?.map(s => s.index) } }]; + const filters: any[] = [{ index: { $in: trait.subraces?.map((s) => s.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -62,7 +62,7 @@ const Trait = { return await SubraceModel.find(coalesceFilters(filters)).lean(); }, races: async (trait: Trait, args: QueryParams) => { - const filters: any[] = [{ index: { $in: trait.races?.map(r => r.index) } }]; + const filters: any[] = [{ index: { $in: trait.races?.map((r) => r.index) } }]; if (args.name) { filters.push(resolveContainsStringFilter(args.name)); @@ -74,7 +74,7 @@ const Trait = { if (trait.proficiency_choices) { const { proficiency_choices } = trait; if ('options' in proficiency_choices.from) { - const options = proficiency_choices.from.options.map(async option => { + const options = proficiency_choices.from.options.map(async (option) => { if ('item' in option) { return { ...option, @@ -102,7 +102,7 @@ const Trait = { traitSpecificToReturn.breath_weapon = { ...trait_specific.breath_weapon, dc: resolveDc(trait_specific.breath_weapon.dc), - damage: trait_specific.breath_weapon.damage.map(async damage => ({ + damage: trait_specific.breath_weapon.damage.map(async (damage) => ({ damage_at_character_level: levelObjectToArray(damage.damage_at_character_level, 'damage'), damage_type: await DamageTypeModel.findOne({ index: damage.damage_type.index }).lean(), })), @@ -118,7 +118,7 @@ const Trait = { } if (trait_specific.spell_options && 'options' in trait_specific.spell_options.from) { - const options = trait_specific.spell_options.from.options.map(async option => { + const options = trait_specific.spell_options.from.options.map(async (option) => { if ('item' in option) { return { ...option, @@ -132,7 +132,7 @@ const Trait = { } if (trait_specific.subtrait_options && 'options' in trait_specific.subtrait_options.from) { - const options = trait_specific.subtrait_options.from.options.map(async option => { + const options = trait_specific.subtrait_options.from.options.map(async (option) => { if ('item' in option) { return { ...option, @@ -151,7 +151,7 @@ const Trait = { if (trait.language_options) { const { language_options } = trait; if ('options' in language_options.from) { - const options = language_options.from.options.map(async option => { + const options = language_options.from.options.map(async (option) => { if ('item' in option) { return { ...option, diff --git a/src/graphql/resolvers/vehicleResolver.ts b/src/graphql/resolvers/vehicleResolver.ts index 3e2b1d43..68816504 100644 --- a/src/graphql/resolvers/vehicleResolver.ts +++ b/src/graphql/resolvers/vehicleResolver.ts @@ -1,15 +1,12 @@ -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; +import EquipmentCategoryModel from '../../models/2014/equipmentCategory/index.js'; import { equipmentFieldResolvers } from './common.js'; -import { Equipment } from '../../models/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const Vehicle = { ...equipmentFieldResolvers, vehicle_category: async (vehicle: Equipment) => { - const index = vehicle.vehicle_category - ?.toLowerCase() - .replace(/\s+/g, '-') - .replace(/,/g, ''); + const index = vehicle.vehicle_category?.toLowerCase().replace(/\s+/g, '-').replace(/,/g, ''); return await EquipmentCategoryModel.findOne({ index }).lean(); }, }; diff --git a/src/graphql/resolvers/weaponResolver.ts b/src/graphql/resolvers/weaponResolver.ts index d434a244..6319dbcc 100644 --- a/src/graphql/resolvers/weaponResolver.ts +++ b/src/graphql/resolvers/weaponResolver.ts @@ -1,6 +1,6 @@ -import DamageTypeModel from '../../models/damageType/index.js'; -import EquipmentCategoryModel from '../../models/equipmentCategory/index.js'; -import WeaponPropertyModel from '../../models/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/equipment/types'; +import { Equipment } from '../../models/2014/equipment/types.js'; const Weapon = { ...equipmentFieldResolvers, @@ -28,7 +28,7 @@ const Weapon = { properties: async (weapon: Equipment, args: QueryParams) => { const filters: any[] = [ { - index: { $in: weapon.properties?.map(p => p.index) }, + index: { $in: weapon.properties?.map((p) => p.index) }, }, ]; diff --git a/src/models/abilityScore/index.ts b/src/models/2014/abilityScore/index.ts similarity index 92% rename from src/models/abilityScore/index.ts rename to src/models/2014/abilityScore/index.ts index cb44b196..b9d6dd5b 100644 --- a/src/models/abilityScore/index.ts +++ b/src/models/2014/abilityScore/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { AbilityScore } from './types'; +import { AbilityScore } from './types.js'; const AbilityScoreSchema = new Schema({ _id: { type: String, select: false }, diff --git a/src/models/abilityScore/types.d.ts b/src/models/2014/abilityScore/types.d.ts similarity index 100% rename from src/models/abilityScore/types.d.ts rename to src/models/2014/abilityScore/types.d.ts diff --git a/src/models/alignment/index.ts b/src/models/2014/alignment/index.ts similarity index 100% rename from src/models/alignment/index.ts rename to src/models/2014/alignment/index.ts diff --git a/src/models/alignment/types.d.ts b/src/models/2014/alignment/types.d.ts similarity index 100% rename from src/models/alignment/types.d.ts rename to src/models/2014/alignment/types.d.ts diff --git a/src/models/background/index.ts b/src/models/2014/background/index.ts similarity index 94% rename from src/models/background/index.ts rename to src/models/2014/background/index.ts index a76729f5..16882f9a 100644 --- a/src/models/background/index.ts +++ b/src/models/2014/background/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema, ChoiceSchema } from '../common/index.js'; -import { Background, Feature, Equipment } from './types'; +import { Background, Feature, Equipment } from './types.js'; const EquipmentSchema = new Schema({ _id: false, diff --git a/src/models/background/types.d.ts b/src/models/2014/background/types.d.ts similarity index 100% rename from src/models/background/types.d.ts rename to src/models/2014/background/types.d.ts diff --git a/src/models/class/index.ts b/src/models/2014/class/index.ts similarity index 98% rename from src/models/class/index.ts rename to src/models/2014/class/index.ts index e1594a1b..db00bcd4 100644 --- a/src/models/class/index.ts +++ b/src/models/2014/class/index.ts @@ -7,7 +7,7 @@ import { Spellcasting, MultiClassingPrereq, MultiClassing, -} from './types'; +} from './types.js'; const EquipmentSchema = new Schema({ _id: false, diff --git a/src/models/class/types.d.ts b/src/models/2014/class/types.d.ts similarity index 100% rename from src/models/class/types.d.ts rename to src/models/2014/class/types.d.ts diff --git a/src/models/collection/index.ts b/src/models/2014/collection/index.ts similarity index 100% rename from src/models/collection/index.ts rename to src/models/2014/collection/index.ts diff --git a/src/models/collection/types.d.ts b/src/models/2014/collection/types.d.ts similarity index 100% rename from src/models/collection/types.d.ts rename to src/models/2014/collection/types.d.ts diff --git a/src/models/common/index.ts b/src/models/2014/common/index.ts similarity index 100% rename from src/models/common/index.ts rename to src/models/2014/common/index.ts diff --git a/src/models/common/types.d.ts b/src/models/2014/common/types.d.ts similarity index 100% rename from src/models/common/types.d.ts rename to src/models/2014/common/types.d.ts diff --git a/src/models/condition/index.ts b/src/models/2014/condition/index.ts similarity index 100% rename from src/models/condition/index.ts rename to src/models/2014/condition/index.ts diff --git a/src/models/condition/types.d.ts b/src/models/2014/condition/types.d.ts similarity index 100% rename from src/models/condition/types.d.ts rename to src/models/2014/condition/types.d.ts diff --git a/src/models/damageType/index.ts b/src/models/2014/damageType/index.ts similarity index 100% rename from src/models/damageType/index.ts rename to src/models/2014/damageType/index.ts diff --git a/src/models/damageType/types.d.ts b/src/models/2014/damageType/types.d.ts similarity index 100% rename from src/models/damageType/types.d.ts rename to src/models/2014/damageType/types.d.ts diff --git a/src/models/equipment/index.ts b/src/models/2014/equipment/index.ts similarity index 99% rename from src/models/equipment/index.ts rename to src/models/2014/equipment/index.ts index 2cc7d3cc..586d1d4b 100644 --- a/src/models/equipment/index.ts +++ b/src/models/2014/equipment/index.ts @@ -10,7 +10,7 @@ import { ThrowRange, TwoHandedDamage, Equipment, -} from './types'; +} from './types.js'; const ArmorClassSchema = new Schema({ _id: false, diff --git a/src/models/equipment/types.d.ts b/src/models/2014/equipment/types.d.ts similarity index 100% rename from src/models/equipment/types.d.ts rename to src/models/2014/equipment/types.d.ts diff --git a/src/models/equipmentCategory/index.ts b/src/models/2014/equipmentCategory/index.ts similarity index 90% rename from src/models/equipmentCategory/index.ts rename to src/models/2014/equipmentCategory/index.ts index ff32b9a9..b16ef8b9 100644 --- a/src/models/equipmentCategory/index.ts +++ b/src/models/2014/equipmentCategory/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { EquipmentCategory } from './types'; +import { EquipmentCategory } from './types.js'; const EquipmentCategorySchema = new Schema({ _id: { type: String, select: false }, diff --git a/src/models/equipmentCategory/types.d.ts b/src/models/2014/equipmentCategory/types.d.ts similarity index 100% rename from src/models/equipmentCategory/types.d.ts rename to src/models/2014/equipmentCategory/types.d.ts diff --git a/src/models/feat/index.ts b/src/models/2014/feat/index.ts similarity index 92% rename from src/models/feat/index.ts rename to src/models/2014/feat/index.ts index 59692d07..cfc3a47b 100644 --- a/src/models/feat/index.ts +++ b/src/models/2014/feat/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { Prerequisite, Feat } from './types'; +import { Prerequisite, Feat } from './types.js'; const PrerequisiteSchema = new Schema({ _id: false, diff --git a/src/models/feat/types.d.ts b/src/models/2014/feat/types.d.ts similarity index 100% rename from src/models/feat/types.d.ts rename to src/models/2014/feat/types.d.ts diff --git a/src/models/feature/index.ts b/src/models/2014/feature/index.ts similarity index 98% rename from src/models/feature/index.ts rename to src/models/2014/feature/index.ts index 7fd4bdb4..00073149 100644 --- a/src/models/feature/index.ts +++ b/src/models/2014/feature/index.ts @@ -7,7 +7,7 @@ import { SpellPrerequisite, FeatureSpecific, Feature, -} from './types'; +} from './types.js'; const PrerequisiteSchema = new Schema( { diff --git a/src/models/feature/types.d.ts b/src/models/2014/feature/types.d.ts similarity index 100% rename from src/models/feature/types.d.ts rename to src/models/2014/feature/types.d.ts diff --git a/src/models/language/index.ts b/src/models/2014/language/index.ts similarity index 100% rename from src/models/language/index.ts rename to src/models/2014/language/index.ts diff --git a/src/models/language/types.d.ts b/src/models/2014/language/types.d.ts similarity index 100% rename from src/models/language/types.d.ts rename to src/models/2014/language/types.d.ts diff --git a/src/models/level/index.ts b/src/models/2014/level/index.ts similarity index 99% rename from src/models/level/index.ts rename to src/models/2014/level/index.ts index 5bea0276..1892c59c 100644 --- a/src/models/level/index.ts +++ b/src/models/2014/level/index.ts @@ -8,7 +8,7 @@ import { Level, Spellcasting, SubclassSpecific, -} from './types'; +} from './types.js'; const ClassSpecificCreatingSpellSlotSchema = new Schema({ _id: false, diff --git a/src/models/level/types.d.ts b/src/models/2014/level/types.d.ts similarity index 100% rename from src/models/level/types.d.ts rename to src/models/2014/level/types.d.ts diff --git a/src/models/magicItem/index.ts b/src/models/2014/magicItem/index.ts similarity index 93% rename from src/models/magicItem/index.ts rename to src/models/2014/magicItem/index.ts index e3c1636f..51b9861e 100644 --- a/src/models/magicItem/index.ts +++ b/src/models/2014/magicItem/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { Rarity, MagicItem } from './types'; +import { Rarity, MagicItem } from './types.js'; const RaritySchema = new Schema({ _id: false, diff --git a/src/models/magicItem/types.d.ts b/src/models/2014/magicItem/types.d.ts similarity index 100% rename from src/models/magicItem/types.d.ts rename to src/models/2014/magicItem/types.d.ts diff --git a/src/models/magicSchool/index.ts b/src/models/2014/magicSchool/index.ts similarity index 100% rename from src/models/magicSchool/index.ts rename to src/models/2014/magicSchool/index.ts diff --git a/src/models/magicSchool/types.d.ts b/src/models/2014/magicSchool/types.d.ts similarity index 100% rename from src/models/magicSchool/types.d.ts rename to src/models/2014/magicSchool/types.d.ts diff --git a/src/models/monster/index.ts b/src/models/2014/monster/index.ts similarity index 99% rename from src/models/monster/index.ts rename to src/models/2014/monster/index.ts index b2ca5093..ac86da7e 100644 --- a/src/models/monster/index.ts +++ b/src/models/2014/monster/index.ts @@ -25,7 +25,7 @@ import { SpecialAbility, Speed, Monster, -} from './types'; +} from './types.js'; const ActionOptionSchema = new Schema({ _id: false, diff --git a/src/models/monster/types.d.ts b/src/models/2014/monster/types.d.ts similarity index 100% rename from src/models/monster/types.d.ts rename to src/models/2014/monster/types.d.ts diff --git a/src/models/proficiency/index.ts b/src/models/2014/proficiency/index.ts similarity index 93% rename from src/models/proficiency/index.ts rename to src/models/2014/proficiency/index.ts index 6582dcc9..4112853d 100644 --- a/src/models/proficiency/index.ts +++ b/src/models/2014/proficiency/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { Reference, Proficiency } from './types'; +import { Reference, Proficiency } from './types.js'; const ReferenceSchema = new Schema({ _id: false, diff --git a/src/models/proficiency/types.d.ts b/src/models/2014/proficiency/types.d.ts similarity index 100% rename from src/models/proficiency/types.d.ts rename to src/models/2014/proficiency/types.d.ts diff --git a/src/models/race/index.ts b/src/models/2014/race/index.ts similarity index 95% rename from src/models/race/index.ts rename to src/models/2014/race/index.ts index f950e340..ff04f9f8 100644 --- a/src/models/race/index.ts +++ b/src/models/2014/race/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema, ChoiceSchema } from '../common/index.js'; -import { RaceAbilityBonus, Race } from './types'; +import { RaceAbilityBonus, Race } from './types.js'; const RaceAbilityBonusSchema = new Schema({ _id: false, diff --git a/src/models/race/types.d.ts b/src/models/2014/race/types.d.ts similarity index 100% rename from src/models/race/types.d.ts rename to src/models/2014/race/types.d.ts diff --git a/src/models/rule/index.ts b/src/models/2014/rule/index.ts similarity index 92% rename from src/models/rule/index.ts rename to src/models/2014/rule/index.ts index f170d738..e288d4c3 100644 --- a/src/models/rule/index.ts +++ b/src/models/2014/rule/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { Rule } from './types'; +import { Rule } from './types.js'; const RuleSchema = new Schema({ _id: { type: String, select: false }, diff --git a/src/models/rule/types.d.ts b/src/models/2014/rule/types.d.ts similarity index 100% rename from src/models/rule/types.d.ts rename to src/models/2014/rule/types.d.ts diff --git a/src/models/ruleSection/index.ts b/src/models/2014/ruleSection/index.ts similarity index 100% rename from src/models/ruleSection/index.ts rename to src/models/2014/ruleSection/index.ts diff --git a/src/models/ruleSection/types.d.ts b/src/models/2014/ruleSection/types.d.ts similarity index 100% rename from src/models/ruleSection/types.d.ts rename to src/models/2014/ruleSection/types.d.ts diff --git a/src/models/skill/index.ts b/src/models/2014/skill/index.ts similarity index 92% rename from src/models/skill/index.ts rename to src/models/2014/skill/index.ts index 4813e08c..a75ef95a 100644 --- a/src/models/skill/index.ts +++ b/src/models/2014/skill/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { Skill } from './types'; +import { Skill } from './types.js'; const SkillSchema = new Schema({ _id: { type: String, select: false }, diff --git a/src/models/skill/types.d.ts b/src/models/2014/skill/types.d.ts similarity index 100% rename from src/models/skill/types.d.ts rename to src/models/2014/skill/types.d.ts diff --git a/src/models/spell/index.ts b/src/models/2014/spell/index.ts similarity index 97% rename from src/models/spell/index.ts rename to src/models/2014/spell/index.ts index 1f2f3c14..ba3aa0ce 100644 --- a/src/models/spell/index.ts +++ b/src/models/2014/spell/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema, AreaOfEffectSchema } from '../common/index.js'; -import { Damage, DC } from './types'; +import { Damage, DC } from './types.js'; const DamageSchema = new Schema({ _id: false, diff --git a/src/models/spell/types.d.ts b/src/models/2014/spell/types.d.ts similarity index 100% rename from src/models/spell/types.d.ts rename to src/models/2014/spell/types.d.ts diff --git a/src/models/subclass/index.ts b/src/models/2014/subclass/index.ts similarity index 93% rename from src/models/subclass/index.ts rename to src/models/2014/subclass/index.ts index cc78c037..0a5f5efe 100644 --- a/src/models/subclass/index.ts +++ b/src/models/2014/subclass/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema } from '../common/index.js'; -import { SpellPrerequisite, Spell, Subclass } from './types'; +import { SpellPrerequisite, Spell, Subclass } from './types.js'; const SpellPrerequisiteSchema = new Schema({ _id: false, diff --git a/src/models/subclass/types.d.ts b/src/models/2014/subclass/types.d.ts similarity index 100% rename from src/models/subclass/types.d.ts rename to src/models/2014/subclass/types.d.ts diff --git a/src/models/subrace/index.ts b/src/models/2014/subrace/index.ts similarity index 93% rename from src/models/subrace/index.ts rename to src/models/2014/subrace/index.ts index b4c9b3df..811393b9 100644 --- a/src/models/subrace/index.ts +++ b/src/models/2014/subrace/index.ts @@ -1,6 +1,6 @@ import { Schema, model } from 'mongoose'; import { APIReferenceSchema, ChoiceSchema } from '../common/index.js'; -import { AbilityBonus, Subrace } from './types'; +import { AbilityBonus, Subrace } from './types.js'; const AbilityBonus = new Schema({ _id: false, diff --git a/src/models/subrace/types.d.ts b/src/models/2014/subrace/types.d.ts similarity index 100% rename from src/models/subrace/types.d.ts rename to src/models/2014/subrace/types.d.ts diff --git a/src/models/trait/index.ts b/src/models/2014/trait/index.ts similarity index 98% rename from src/models/trait/index.ts rename to src/models/2014/trait/index.ts index 3d46c525..15404de6 100644 --- a/src/models/trait/index.ts +++ b/src/models/2014/trait/index.ts @@ -5,7 +5,7 @@ import { AreaOfEffectSchema, DifficultyClassSchema, } from '../common/index.js'; -import { Proficiency, ActionDamage, Usage, Action, TraitSpecific, Trait } from './types'; +import { Proficiency, ActionDamage, Usage, Action, TraitSpecific, Trait } from './types.js'; const ProficiencySchema = new Schema({ _id: false, diff --git a/src/models/trait/types.d.ts b/src/models/2014/trait/types.d.ts similarity index 100% rename from src/models/trait/types.d.ts rename to src/models/2014/trait/types.d.ts diff --git a/src/models/weaponProperty/index.ts b/src/models/2014/weaponProperty/index.ts similarity index 100% rename from src/models/weaponProperty/index.ts rename to src/models/2014/weaponProperty/index.ts diff --git a/src/models/weaponProperty/types.d.ts b/src/models/2014/weaponProperty/types.d.ts similarity index 100% rename from src/models/weaponProperty/types.d.ts rename to src/models/2014/weaponProperty/types.d.ts diff --git a/src/tests/controllers/api/abilityScoreController.test.ts b/src/tests/controllers/api/abilityScoreController.test.ts index 090a320d..0047ef52 100644 --- a/src/tests/controllers/api/abilityScoreController.test.ts +++ b/src/tests/controllers/api/abilityScoreController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import AbilityScore from '../../../models/abilityScore/index.js'; +import AbilityScore from '../../../models/2014/abilityScore/index.js'; import AbilityScoreController from '../../../controllers/api/abilityScoreController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/classController.test.ts b/src/tests/controllers/api/classController.test.ts index e854db2d..e6b0f32f 100644 --- a/src/tests/controllers/api/classController.test.ts +++ b/src/tests/controllers/api/classController.test.ts @@ -4,12 +4,12 @@ import * as ClassController from '../../../controllers/api/classController.js'; import { mockNext } from '../../support/requestHelpers.js'; -import Class from '../../../models/class/index.js'; -import Feature from '../../../models/feature/index.js'; -import Level from '../../../models/level/index.js'; -import Proficiency from '../../../models/proficiency/index.js'; -import Spell from '../../../models/spell/index.js'; -import Subclass from '../../../models/subclass/index.js'; +import Class from '../../../models/2014/class/index.js'; +import Feature from '../../../models/2014/feature/index.js'; +import Level from '../../../models/2014/level/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; +import Spell from '../../../models/2014/spell/index.js'; +import Subclass from '../../../models/2014/subclass/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/conditionController.test.ts b/src/tests/controllers/api/conditionController.test.ts index 8e7e0739..2d81ae15 100644 --- a/src/tests/controllers/api/conditionController.test.ts +++ b/src/tests/controllers/api/conditionController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Condition from '../../../models/condition/index.js'; +import Condition from '../../../models/2014/condition/index.js'; import ConditionController from '../../../controllers/api/conditionController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/damageTypeController.test.ts b/src/tests/controllers/api/damageTypeController.test.ts index d4c51155..459a4987 100644 --- a/src/tests/controllers/api/damageTypeController.test.ts +++ b/src/tests/controllers/api/damageTypeController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import DamageType from '../../../models/damageType/index.js'; +import DamageType from '../../../models/2014/damageType/index.js'; import DamageTypeController from '../../../controllers/api/damageTypeController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/equipmentCategoryController.test.ts b/src/tests/controllers/api/equipmentCategoryController.test.ts index d9b301fd..9a458f75 100644 --- a/src/tests/controllers/api/equipmentCategoryController.test.ts +++ b/src/tests/controllers/api/equipmentCategoryController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import EquipmentCategory from '../../../models/equipmentCategory/index.js'; +import EquipmentCategory from '../../../models/2014/equipmentCategory/index.js'; import EquipmentCategoryController from '../../../controllers/api/equipmentCategoryController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/equipmentController.test.ts b/src/tests/controllers/api/equipmentController.test.ts index d351e70b..5bfcb760 100644 --- a/src/tests/controllers/api/equipmentController.test.ts +++ b/src/tests/controllers/api/equipmentController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Equipment from '../../../models/equipment/index.js'; +import Equipment from '../../../models/2014/equipment/index.js'; import EquipmentController from '../../../controllers/api/equipmentController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/featController.test.ts b/src/tests/controllers/api/featController.test.ts index 8e135319..d68ac50d 100644 --- a/src/tests/controllers/api/featController.test.ts +++ b/src/tests/controllers/api/featController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Feat from '../../../models/feat/index.js'; +import Feat from '../../../models/2014/feat/index.js'; import FeatController from '../../../controllers/api/featController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/featureController.test.ts b/src/tests/controllers/api/featureController.test.ts index a7d9a6b6..4ef4ffa1 100644 --- a/src/tests/controllers/api/featureController.test.ts +++ b/src/tests/controllers/api/featureController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Feature from '../../../models/feature/index.js'; +import Feature from '../../../models/2014/feature/index.js'; import FeatureController from '../../../controllers/api/featureController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/languageController.test.ts b/src/tests/controllers/api/languageController.test.ts index 2231bcdd..0541c9b8 100644 --- a/src/tests/controllers/api/languageController.test.ts +++ b/src/tests/controllers/api/languageController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Language from '../../../models/language/index.js'; +import Language from '../../../models/2014/language/index.js'; import LanguageController from '../../../controllers/api/languageController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/magicItemController.test.ts b/src/tests/controllers/api/magicItemController.test.ts index fa8d4c8a..72453d55 100644 --- a/src/tests/controllers/api/magicItemController.test.ts +++ b/src/tests/controllers/api/magicItemController.test.ts @@ -4,7 +4,7 @@ import * as MagicItemController from '../../../controllers/api/magicItemControll import { mockNext } from '../../support/requestHelpers.js'; -import MagicItem from '../../../models/magicItem/index.js'; +import MagicItem from '../../../models/2014/magicItem/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/magicSchoolController.test.ts b/src/tests/controllers/api/magicSchoolController.test.ts index 83c4926b..675130b6 100644 --- a/src/tests/controllers/api/magicSchoolController.test.ts +++ b/src/tests/controllers/api/magicSchoolController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import MagicSchool from '../../../models/magicSchool/index.js'; +import MagicSchool from '../../../models/2014/magicSchool/index.js'; import MagicSchoolController from '../../../controllers/api/magicSchoolController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/monsterController.test.ts b/src/tests/controllers/api/monsterController.test.ts index 8e17a7b3..3000dbd1 100644 --- a/src/tests/controllers/api/monsterController.test.ts +++ b/src/tests/controllers/api/monsterController.test.ts @@ -4,7 +4,7 @@ import * as MonsterController from '../../../controllers/api/monsterController.j import { mockNext } from '../../support/requestHelpers.js'; -import Monster from '../../../models/monster/index.js'; +import Monster from '../../../models/2014/monster/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/proficiencyController.test.ts b/src/tests/controllers/api/proficiencyController.test.ts index 0545b4ee..3c35abd7 100644 --- a/src/tests/controllers/api/proficiencyController.test.ts +++ b/src/tests/controllers/api/proficiencyController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Proficiency from '../../../models/proficiency/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; import ProficiencyController from '../../../controllers/api/proficiencyController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/raceController.test.ts b/src/tests/controllers/api/raceController.test.ts index d6d3cde6..51b8ad74 100644 --- a/src/tests/controllers/api/raceController.test.ts +++ b/src/tests/controllers/api/raceController.test.ts @@ -4,10 +4,10 @@ import * as RaceController from '../../../controllers/api/raceController.js'; import { mockNext } from '../../support/requestHelpers.js'; -import Proficiency from '../../../models/proficiency/index.js'; -import Race from '../../../models/race/index.js'; -import Subrace from '../../../models/subrace/index.js'; -import Trait from '../../../models/trait/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; +import Race from '../../../models/2014/race/index.js'; +import Subrace from '../../../models/2014/subrace/index.js'; +import Trait from '../../../models/2014/trait/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/ruleSectionController.test.ts b/src/tests/controllers/api/ruleSectionController.test.ts index 32350428..6621a6ac 100644 --- a/src/tests/controllers/api/ruleSectionController.test.ts +++ b/src/tests/controllers/api/ruleSectionController.test.ts @@ -2,7 +2,7 @@ import * as RuleSectionController from '../../../controllers/api/ruleSectionCont import { mockNext } from '../../support/requestHelpers.js'; -import RuleSection from '../../../models/ruleSection/index.js'; +import RuleSection from '../../../models/2014/ruleSection/index.js'; import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; diff --git a/src/tests/controllers/api/rulesController.test.ts b/src/tests/controllers/api/rulesController.test.ts index 93610efe..e842ccaa 100644 --- a/src/tests/controllers/api/rulesController.test.ts +++ b/src/tests/controllers/api/rulesController.test.ts @@ -4,7 +4,7 @@ import * as RulesController from '../../../controllers/api/ruleController.js'; import { mockNext } from '../../support/requestHelpers.js'; -import Rule from '../../../models/rule/index.js'; +import Rule from '../../../models/2014/rule/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/skillController.test.ts b/src/tests/controllers/api/skillController.test.ts index 89a2a7cc..5101159b 100644 --- a/src/tests/controllers/api/skillController.test.ts +++ b/src/tests/controllers/api/skillController.test.ts @@ -2,7 +2,7 @@ import { mockNext } from '../../support/requestHelpers.js'; import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import skill from '../../../models/skill/index.js'; +import skill from '../../../models/2014/skill/index.js'; import skillController from '../../../controllers/api/skillController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/spellController.test.ts b/src/tests/controllers/api/spellController.test.ts index 4eea4f2c..9cd40cda 100644 --- a/src/tests/controllers/api/spellController.test.ts +++ b/src/tests/controllers/api/spellController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import * as SpellController from '../../../controllers/api/spellController.js'; import { mockNext } from '../../support/requestHelpers.js'; -import Spell from '../../../models/spell/index.js'; +import Spell from '../../../models/2014/spell/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/subclassController.test.ts b/src/tests/controllers/api/subclassController.test.ts index 3ef0dbea..65b46b5f 100644 --- a/src/tests/controllers/api/subclassController.test.ts +++ b/src/tests/controllers/api/subclassController.test.ts @@ -4,9 +4,9 @@ import * as SubclassController from '../../../controllers/api/subclassController import { mockNext } from '../../support/requestHelpers.js'; -import Feature from '../../../models/feature/index.js'; -import Level from '../../../models/level/index.js'; -import Subclass from '../../../models/subclass/index.js'; +import Feature from '../../../models/2014/feature/index.js'; +import Level from '../../../models/2014/level/index.js'; +import Subclass from '../../../models/2014/subclass/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/subraceController.test.ts b/src/tests/controllers/api/subraceController.test.ts index 9aad0667..967b7936 100644 --- a/src/tests/controllers/api/subraceController.test.ts +++ b/src/tests/controllers/api/subraceController.test.ts @@ -4,9 +4,9 @@ import * as SubraceController from '../../../controllers/api/subraceController.j import { mockNext } from '../../support/requestHelpers.js'; -import Proficiency from '../../../models/proficiency/index.js'; -import Subrace from '../../../models/subrace/index.js'; -import Trait from '../../../models/trait/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; +import Subrace from '../../../models/2014/subrace/index.js'; +import Trait from '../../../models/2014/trait/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/traitController.test.ts b/src/tests/controllers/api/traitController.test.ts index f9765ac9..d003d742 100644 --- a/src/tests/controllers/api/traitController.test.ts +++ b/src/tests/controllers/api/traitController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import Trait from '../../../models/trait/index.js'; +import Trait from '../../../models/2014/trait/index.js'; import TraitController from '../../../controllers/api/traitController.js'; beforeEach(() => { diff --git a/src/tests/controllers/api/weaponPropertyController.test.ts b/src/tests/controllers/api/weaponPropertyController.test.ts index de44cff1..f3bd4ff7 100644 --- a/src/tests/controllers/api/weaponPropertyController.test.ts +++ b/src/tests/controllers/api/weaponPropertyController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; -import WeaponProperty from '../../../models/weaponProperty/index.js'; +import WeaponProperty from '../../../models/2014/weaponProperty/index.js'; import WeaponPropertyController from '../../../controllers/api/weaponPropertyController.js'; beforeEach(() => { diff --git a/src/tests/controllers/apiController.test.ts b/src/tests/controllers/apiController.test.ts index e4080eac..01815c0b 100644 --- a/src/tests/controllers/apiController.test.ts +++ b/src/tests/controllers/apiController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import * as ApiController from '../../controllers/apiController.js'; import { mockNext } from '../support/requestHelpers.js'; -import Collection from '../../models/collection/index.js'; +import Collection from '../../models/2014/collection/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/simpleController.test.ts b/src/tests/controllers/simpleController.test.ts index 00716aad..efb24a65 100644 --- a/src/tests/controllers/simpleController.test.ts +++ b/src/tests/controllers/simpleController.test.ts @@ -2,7 +2,7 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../support/requestHelpers.js'; -import AbilityScore from '../../models/abilityScore/index.js'; +import AbilityScore from '../../models/2014/abilityScore/index.js'; import SimpleController from '../../controllers/simpleController.js'; let simpleController: SimpleController; diff --git a/src/util/prewarmCache.ts b/src/util/prewarmCache.ts index f433853c..49ceaf08 100644 --- a/src/util/prewarmCache.ts +++ b/src/util/prewarmCache.ts @@ -1,9 +1,9 @@ -import MagicItem from '../models/magicItem/index.js'; -import Monster from '../models/monster/index.js'; +import MagicItem from '../models/2014/magicItem/index.js'; +import Monster from '../models/2014/monster/index.js'; import { ResourceList } from './data.js'; -import Rule from '../models/rule/index.js'; -import RuleSection from '../models/ruleSection/index.js'; -import Spell from '../models/spell/index.js'; +import Rule from '../models/2014/rule/index.js'; +import RuleSection from '../models/2014/ruleSection/index.js'; +import Spell from '../models/2014/spell/index.js'; import mongoose from 'mongoose'; import redisClient from './RedisClient.js'; From 78a3ffcbf8a969920fcaf89ac830685112c36fe0 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Wed, 25 Dec 2024 15:56:51 -0800 Subject: [PATCH 3/8] feat(routes): Add in 2014 routes and move controllers --- docker-compose.yml | 4 +- .../api/2014/abilityScoreController.ts | 4 ++ .../api/2014/alignmentController.ts | 4 ++ .../api/2014/backgroundController.ts | 4 ++ .../api/{ => 2014}/classController.ts | 18 +++--- .../api/2014/conditionController.ts | 4 ++ .../api/2014/damageTypeController.ts | 4 ++ .../api/2014/equipmentCategoryController.ts | 4 ++ .../api/2014/equipmentController.ts | 4 ++ src/controllers/api/2014/featController.ts | 4 ++ src/controllers/api/2014/featureController.ts | 4 ++ .../api/{ => 2014}/imageController.ts | 2 +- .../api/2014/languageController.ts | 4 ++ .../api/{ => 2014}/magicItemController.ts | 4 +- .../api/2014/magicSchoolController.ts | 4 ++ .../api/{ => 2014}/monsterController.ts | 4 +- .../api/2014/proficiencyController.ts | 4 ++ .../api/{ => 2014}/raceController.ts | 12 ++-- .../api/{ => 2014}/ruleController.ts | 4 +- .../api/{ => 2014}/ruleSectionController.ts | 4 +- src/controllers/api/2014/skillController.ts | 4 ++ .../api/{ => 2014}/spellController.ts | 4 +- .../api/{ => 2014}/subclassController.ts | 10 +-- .../api/{ => 2014}/subraceController.ts | 10 +-- src/controllers/api/2014/traitController.ts | 4 ++ .../api/2014/weaponPropertyController.ts | 4 ++ src/controllers/api/abilityScoreController.ts | 4 -- src/controllers/api/alignmentController.ts | 4 -- src/controllers/api/backgroundController.ts | 4 -- src/controllers/api/conditionController.ts | 4 -- src/controllers/api/damageTypeController.ts | 4 -- .../api/equipmentCategoryController.ts | 4 -- src/controllers/api/equipmentController.ts | 4 -- src/controllers/api/featController.ts | 4 -- src/controllers/api/featureController.ts | 4 -- src/controllers/api/languageController.ts | 4 -- src/controllers/api/magicSchoolController.ts | 4 -- src/controllers/api/proficiencyController.ts | 4 -- src/controllers/api/skillController.ts | 4 -- src/controllers/api/traitController.ts | 4 -- src/controllers/api/v2014Controller.ts | 22 +++++++ .../api/weaponPropertyController.ts | 4 -- src/controllers/apiController.ts | 2 +- src/routes/api.ts | 4 +- src/routes/api/2014.ts | 62 +++++++++++++++++++ src/routes/api/{ => 2014}/abilityScores.ts | 6 +- src/routes/api/{ => 2014}/alignments.ts | 6 +- src/routes/api/{ => 2014}/backgrounds.ts | 6 +- src/routes/api/{ => 2014}/classes.ts | 6 +- src/routes/api/{ => 2014}/conditions.ts | 6 +- src/routes/api/{ => 2014}/damageTypes.ts | 6 +- src/routes/api/{ => 2014}/equipment.ts | 6 +- .../api/{ => 2014}/equipmentCategories.ts | 6 +- src/routes/api/{ => 2014}/feats.ts | 6 +- src/routes/api/{ => 2014}/features.ts | 6 +- src/routes/api/{ => 2014}/images.ts | 4 +- src/routes/api/{ => 2014}/index.ts | 0 src/routes/api/{ => 2014}/languages.ts | 6 +- src/routes/api/{ => 2014}/magicItems.ts | 2 +- src/routes/api/{ => 2014}/magicSchools.ts | 6 +- src/routes/api/{ => 2014}/monsters.ts | 2 +- src/routes/api/{ => 2014}/proficiencies.ts | 6 +- src/routes/api/{ => 2014}/races.ts | 6 +- src/routes/api/{ => 2014}/rule-sections.ts | 2 +- src/routes/api/{ => 2014}/rules.ts | 2 +- src/routes/api/{ => 2014}/skills.ts | 6 +- src/routes/api/{ => 2014}/spells.ts | 2 +- src/routes/api/{ => 2014}/subclasses.ts | 6 +- src/routes/api/{ => 2014}/subraces.ts | 6 +- src/routes/api/{ => 2014}/traits.ts | 6 +- src/routes/api/{ => 2014}/weaponProperties.ts | 6 +- .../api/abilityScoreController.test.ts | 2 +- .../controllers/api/classController.test.ts | 2 +- .../api/conditionController.test.ts | 2 +- .../api/damageTypeController.test.ts | 2 +- .../api/equipmentCategoryController.test.ts | 2 +- .../api/equipmentController.test.ts | 2 +- .../controllers/api/featController.test.ts | 2 +- .../controllers/api/featureController.test.ts | 2 +- .../api/languageController.test.ts | 2 +- .../api/magicItemController.test.ts | 2 +- .../api/magicSchoolController.test.ts | 2 +- .../controllers/api/monsterController.test.ts | 2 +- .../api/proficiencyController.test.ts | 2 +- .../controllers/api/raceController.test.ts | 2 +- .../api/ruleSectionController.test.ts | 2 +- .../controllers/api/rulesController.test.ts | 2 +- .../controllers/api/skillController.test.ts | 2 +- .../controllers/api/spellController.test.ts | 2 +- .../api/subclassController.test.ts | 2 +- .../controllers/api/subraceController.test.ts | 2 +- .../controllers/api/traitController.test.ts | 2 +- .../api/weaponPropertyController.test.ts | 2 +- 93 files changed, 272 insertions(+), 186 deletions(-) create mode 100644 src/controllers/api/2014/abilityScoreController.ts create mode 100644 src/controllers/api/2014/alignmentController.ts create mode 100644 src/controllers/api/2014/backgroundController.ts rename src/controllers/api/{ => 2014}/classController.ts (92%) create mode 100644 src/controllers/api/2014/conditionController.ts create mode 100644 src/controllers/api/2014/damageTypeController.ts create mode 100644 src/controllers/api/2014/equipmentCategoryController.ts create mode 100644 src/controllers/api/2014/equipmentController.ts create mode 100644 src/controllers/api/2014/featController.ts create mode 100644 src/controllers/api/2014/featureController.ts rename src/controllers/api/{ => 2014}/imageController.ts (93%) create mode 100644 src/controllers/api/2014/languageController.ts rename src/controllers/api/{ => 2014}/magicItemController.ts (88%) create mode 100644 src/controllers/api/2014/magicSchoolController.ts rename src/controllers/api/{ => 2014}/monsterController.ts (91%) create mode 100644 src/controllers/api/2014/proficiencyController.ts rename src/controllers/api/{ => 2014}/raceController.ts (81%) rename src/controllers/api/{ => 2014}/ruleController.ts (90%) rename src/controllers/api/{ => 2014}/ruleSectionController.ts (89%) create mode 100644 src/controllers/api/2014/skillController.ts rename src/controllers/api/{ => 2014}/spellController.ts (92%) rename src/controllers/api/{ => 2014}/subclassController.ts (88%) rename src/controllers/api/{ => 2014}/subraceController.ts (79%) create mode 100644 src/controllers/api/2014/traitController.ts create mode 100644 src/controllers/api/2014/weaponPropertyController.ts delete mode 100644 src/controllers/api/abilityScoreController.ts delete mode 100644 src/controllers/api/alignmentController.ts delete mode 100644 src/controllers/api/backgroundController.ts delete mode 100644 src/controllers/api/conditionController.ts delete mode 100644 src/controllers/api/damageTypeController.ts delete mode 100644 src/controllers/api/equipmentCategoryController.ts delete mode 100644 src/controllers/api/equipmentController.ts delete mode 100644 src/controllers/api/featController.ts delete mode 100644 src/controllers/api/featureController.ts delete mode 100644 src/controllers/api/languageController.ts delete mode 100644 src/controllers/api/magicSchoolController.ts delete mode 100644 src/controllers/api/proficiencyController.ts delete mode 100644 src/controllers/api/skillController.ts delete mode 100644 src/controllers/api/traitController.ts create mode 100644 src/controllers/api/v2014Controller.ts delete mode 100644 src/controllers/api/weaponPropertyController.ts create mode 100644 src/routes/api/2014.ts rename src/routes/api/{ => 2014}/abilityScores.ts (50%) rename src/routes/api/{ => 2014}/alignments.ts (51%) rename src/routes/api/{ => 2014}/backgrounds.ts (51%) rename src/routes/api/{ => 2014}/classes.ts (85%) rename src/routes/api/{ => 2014}/conditions.ts (51%) rename src/routes/api/{ => 2014}/damageTypes.ts (51%) rename src/routes/api/{ => 2014}/equipment.ts (51%) rename src/routes/api/{ => 2014}/equipmentCategories.ts (51%) rename src/routes/api/{ => 2014}/feats.ts (51%) rename src/routes/api/{ => 2014}/features.ts (51%) rename src/routes/api/{ => 2014}/images.ts (52%) rename src/routes/api/{ => 2014}/index.ts (100%) rename src/routes/api/{ => 2014}/languages.ts (51%) rename src/routes/api/{ => 2014}/magicItems.ts (66%) rename src/routes/api/{ => 2014}/magicSchools.ts (51%) rename src/routes/api/{ => 2014}/monsters.ts (67%) rename src/routes/api/{ => 2014}/proficiencies.ts (51%) rename src/routes/api/{ => 2014}/races.ts (69%) rename src/routes/api/{ => 2014}/rule-sections.ts (66%) rename src/routes/api/{ => 2014}/rules.ts (68%) rename src/routes/api/{ => 2014}/skills.ts (51%) rename src/routes/api/{ => 2014}/spells.ts (67%) rename src/routes/api/{ => 2014}/subclasses.ts (73%) rename src/routes/api/{ => 2014}/subraces.ts (65%) rename src/routes/api/{ => 2014}/traits.ts (51%) rename src/routes/api/{ => 2014}/weaponProperties.ts (51%) diff --git a/docker-compose.yml b/docker-compose.yml index 3f2d669b..abab8cf3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: db: - # image: ghcr.io/5e-bits/5e-database:latest - build: ../5e-database + image: ghcr.io/5e-bits/5e-database:latest + # build: ../5e-database ports: - '27017:27017' diff --git a/src/controllers/api/2014/abilityScoreController.ts b/src/controllers/api/2014/abilityScoreController.ts new file mode 100644 index 00000000..b48b05f5 --- /dev/null +++ b/src/controllers/api/2014/abilityScoreController.ts @@ -0,0 +1,4 @@ +import AbilityScore from '../../../models/2014/abilityScore/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(AbilityScore); diff --git a/src/controllers/api/2014/alignmentController.ts b/src/controllers/api/2014/alignmentController.ts new file mode 100644 index 00000000..ce4d912c --- /dev/null +++ b/src/controllers/api/2014/alignmentController.ts @@ -0,0 +1,4 @@ +import Alignment from '../../../models/2014/alignment/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Alignment); diff --git a/src/controllers/api/2014/backgroundController.ts b/src/controllers/api/2014/backgroundController.ts new file mode 100644 index 00000000..c25c1d57 --- /dev/null +++ b/src/controllers/api/2014/backgroundController.ts @@ -0,0 +1,4 @@ +import Background from '../../../models/2014/background/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Background); diff --git a/src/controllers/api/classController.ts b/src/controllers/api/2014/classController.ts similarity index 92% rename from src/controllers/api/classController.ts rename to src/controllers/api/2014/classController.ts index 47381d3b..8c876d2b 100644 --- a/src/controllers/api/classController.ts +++ b/src/controllers/api/2014/classController.ts @@ -1,14 +1,14 @@ import { Request, Response, NextFunction } from 'express'; -import { ResourceList, escapeRegExp } from '../../util/index.js'; - -import Class from '../../models/2014/class/index.js'; -import Feature from '../../models/2014/feature/index.js'; -import Level from '../../models/2014/level/index.js'; -import Proficiency from '../../models/2014/proficiency/index.js'; -import SimpleController from '../simpleController.js'; -import Spell from '../../models/2014/spell/index.js'; -import Subclass from '../../models/2014/subclass/index.js'; +import { ResourceList, escapeRegExp } from '../../../util/index.js'; + +import Class from '../../../models/2014/class/index.js'; +import Feature from '../../../models/2014/feature/index.js'; +import Level from '../../../models/2014/level/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; +import SimpleController from '../../simpleController.js'; +import Spell from '../../../models/2014/spell/index.js'; +import Subclass from '../../../models/2014/subclass/index.js'; const simpleController = new SimpleController(Class); interface ShowLevelsForClassQuery { diff --git a/src/controllers/api/2014/conditionController.ts b/src/controllers/api/2014/conditionController.ts new file mode 100644 index 00000000..28004bd7 --- /dev/null +++ b/src/controllers/api/2014/conditionController.ts @@ -0,0 +1,4 @@ +import Condition from '../../../models/2014/condition/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Condition); diff --git a/src/controllers/api/2014/damageTypeController.ts b/src/controllers/api/2014/damageTypeController.ts new file mode 100644 index 00000000..1771c0d3 --- /dev/null +++ b/src/controllers/api/2014/damageTypeController.ts @@ -0,0 +1,4 @@ +import DamageType from '../../../models/2014/damageType/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(DamageType); diff --git a/src/controllers/api/2014/equipmentCategoryController.ts b/src/controllers/api/2014/equipmentCategoryController.ts new file mode 100644 index 00000000..1e7830f0 --- /dev/null +++ b/src/controllers/api/2014/equipmentCategoryController.ts @@ -0,0 +1,4 @@ +import EquipmentCategory from '../../../models/2014/equipmentCategory/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(EquipmentCategory); diff --git a/src/controllers/api/2014/equipmentController.ts b/src/controllers/api/2014/equipmentController.ts new file mode 100644 index 00000000..993d45ea --- /dev/null +++ b/src/controllers/api/2014/equipmentController.ts @@ -0,0 +1,4 @@ +import Equipment from '../../../models/2014/equipment/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Equipment); diff --git a/src/controllers/api/2014/featController.ts b/src/controllers/api/2014/featController.ts new file mode 100644 index 00000000..a2dcc737 --- /dev/null +++ b/src/controllers/api/2014/featController.ts @@ -0,0 +1,4 @@ +import Feat from '../../../models/2014/feat/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Feat); diff --git a/src/controllers/api/2014/featureController.ts b/src/controllers/api/2014/featureController.ts new file mode 100644 index 00000000..e18ec857 --- /dev/null +++ b/src/controllers/api/2014/featureController.ts @@ -0,0 +1,4 @@ +import Feature from '../../../models/2014/feature/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Feature); diff --git a/src/controllers/api/imageController.ts b/src/controllers/api/2014/imageController.ts similarity index 93% rename from src/controllers/api/imageController.ts rename to src/controllers/api/2014/imageController.ts index ddd58fa6..683bfcd8 100644 --- a/src/controllers/api/imageController.ts +++ b/src/controllers/api/2014/imageController.ts @@ -1,7 +1,7 @@ import { NextFunction, Request, Response } from 'express'; import { GetObjectCommand } from '@aws-sdk/client-s3'; -import { awsS3Client } from '../../util/index.js'; +import { awsS3Client } from '../../../util/index.js'; const show = async (req: Request, res: Response, next: NextFunction) => { try { diff --git a/src/controllers/api/2014/languageController.ts b/src/controllers/api/2014/languageController.ts new file mode 100644 index 00000000..7047734e --- /dev/null +++ b/src/controllers/api/2014/languageController.ts @@ -0,0 +1,4 @@ +import Language from '../../../models/2014/language/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Language); diff --git a/src/controllers/api/magicItemController.ts b/src/controllers/api/2014/magicItemController.ts similarity index 88% rename from src/controllers/api/magicItemController.ts rename to src/controllers/api/2014/magicItemController.ts index 2aa3e514..42919c76 100644 --- a/src/controllers/api/magicItemController.ts +++ b/src/controllers/api/2014/magicItemController.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; -import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; -import MagicItem from '../../models/2014/magicItem/index.js'; +import { ResourceList, escapeRegExp, redisClient } from '../../../util/index.js'; +import MagicItem from '../../../models/2014/magicItem/index.js'; interface IndexQuery { name?: { $regex: RegExp }; diff --git a/src/controllers/api/2014/magicSchoolController.ts b/src/controllers/api/2014/magicSchoolController.ts new file mode 100644 index 00000000..fa7ddf1c --- /dev/null +++ b/src/controllers/api/2014/magicSchoolController.ts @@ -0,0 +1,4 @@ +import MagicSchool from '../../../models/2014/magicSchool/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(MagicSchool); diff --git a/src/controllers/api/monsterController.ts b/src/controllers/api/2014/monsterController.ts similarity index 91% rename from src/controllers/api/monsterController.ts rename to src/controllers/api/2014/monsterController.ts index 6f856cc3..97b68970 100644 --- a/src/controllers/api/monsterController.ts +++ b/src/controllers/api/2014/monsterController.ts @@ -1,8 +1,8 @@ import { Request, Response, NextFunction } from 'express'; -import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; +import { ResourceList, escapeRegExp, redisClient } from '../../../util/index.js'; -import Monster from '../../models/2014/monster/index.js'; +import Monster from '../../../models/2014/monster/index.js'; interface IndexQuery { name?: { $regex: RegExp }; diff --git a/src/controllers/api/2014/proficiencyController.ts b/src/controllers/api/2014/proficiencyController.ts new file mode 100644 index 00000000..f5a912a6 --- /dev/null +++ b/src/controllers/api/2014/proficiencyController.ts @@ -0,0 +1,4 @@ +import Proficiency from '../../../models/2014/proficiency/index.js'; +import SimpleController from '../../simpleController.js'; + +export default new SimpleController(Proficiency); diff --git a/src/controllers/api/raceController.ts b/src/controllers/api/2014/raceController.ts similarity index 81% rename from src/controllers/api/raceController.ts rename to src/controllers/api/2014/raceController.ts index 9234cc86..8639d298 100644 --- a/src/controllers/api/raceController.ts +++ b/src/controllers/api/2014/raceController.ts @@ -1,11 +1,11 @@ import { Request, Response, NextFunction } from 'express'; -import Proficiency from '../../models/2014/proficiency/index.js'; -import Race from '../../models/2014/race/index.js'; -import { ResourceList } from '../../util/data.js'; -import SimpleController from '../simpleController.js'; -import Subrace from '../../models/2014/subrace/index.js'; -import Trait from '../../models/2014/trait/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; +import Race from '../../../models/2014/race/index.js'; +import { ResourceList } from '../../../util/data.js'; +import SimpleController from '../../simpleController.js'; +import Subrace from '../../../models/2014/subrace/index.js'; +import Trait from '../../../models/2014/trait/index.js'; const simpleController = new SimpleController(Race); diff --git a/src/controllers/api/ruleController.ts b/src/controllers/api/2014/ruleController.ts similarity index 90% rename from src/controllers/api/ruleController.ts rename to src/controllers/api/2014/ruleController.ts index 960669b5..aca112ef 100644 --- a/src/controllers/api/ruleController.ts +++ b/src/controllers/api/2014/ruleController.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; -import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; +import { ResourceList, escapeRegExp, redisClient } from '../../../util/index.js'; -import Rule from '../../models/2014/rule/index.js'; +import Rule from '../../../models/2014/rule/index.js'; interface IndexQuery { name?: { $regex: RegExp }; diff --git a/src/controllers/api/ruleSectionController.ts b/src/controllers/api/2014/ruleSectionController.ts similarity index 89% rename from src/controllers/api/ruleSectionController.ts rename to src/controllers/api/2014/ruleSectionController.ts index 40ecea4e..fc50ace3 100644 --- a/src/controllers/api/ruleSectionController.ts +++ b/src/controllers/api/2014/ruleSectionController.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; -import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; +import { ResourceList, escapeRegExp, redisClient } from '../../../util/index.js'; -import RuleSection from '../../models/2014/ruleSection/index.js'; +import RuleSection from '../../../models/2014/ruleSection/index.js'; interface IndexQuery { name?: { $regex: RegExp }; desc?: { $regex: RegExp }; diff --git a/src/controllers/api/2014/skillController.ts b/src/controllers/api/2014/skillController.ts new file mode 100644 index 00000000..f201376b --- /dev/null +++ b/src/controllers/api/2014/skillController.ts @@ -0,0 +1,4 @@ +import SimpleController from '../../simpleController.js'; +import Skill from '../../../models/2014/skill/index.js'; + +export default new SimpleController(Skill); diff --git a/src/controllers/api/spellController.ts b/src/controllers/api/2014/spellController.ts similarity index 92% rename from src/controllers/api/spellController.ts rename to src/controllers/api/2014/spellController.ts index d9491ec7..f352ceb6 100644 --- a/src/controllers/api/spellController.ts +++ b/src/controllers/api/2014/spellController.ts @@ -1,5 +1,5 @@ import { Request, Response, NextFunction } from 'express'; -import { ResourceList, escapeRegExp, redisClient } from '../../util/index.js'; +import { ResourceList, escapeRegExp, redisClient } from '../../../util/index.js'; interface IndexQuery { name?: { $regex: RegExp }; @@ -7,7 +7,7 @@ interface IndexQuery { 'school.name'?: { $in: RegExp[] }; } -import Spell from '../../models/2014/spell/index.js'; +import Spell from '../../../models/2014/spell/index.js'; export const index = async (req: Request, res: Response, next: NextFunction) => { try { diff --git a/src/controllers/api/subclassController.ts b/src/controllers/api/2014/subclassController.ts similarity index 88% rename from src/controllers/api/subclassController.ts rename to src/controllers/api/2014/subclassController.ts index b9cc7082..5cf0f059 100644 --- a/src/controllers/api/subclassController.ts +++ b/src/controllers/api/2014/subclassController.ts @@ -1,9 +1,9 @@ import { Request, Response, NextFunction } from 'express'; -import Feature from '../../models/2014/feature/index.js'; -import Level from '../../models/2014/level/index.js'; -import { ResourceList } from '../../util/data.js'; -import SimpleController from '../simpleController.js'; -import Subclass from '../../models/2014/subclass/index.js'; +import Feature from '../../../models/2014/feature/index.js'; +import Level from '../../../models/2014/level/index.js'; +import { ResourceList } from '../../../util/data.js'; +import SimpleController from '../../simpleController.js'; +import Subclass from '../../../models/2014/subclass/index.js'; const simpleController = new SimpleController(Subclass); diff --git a/src/controllers/api/subraceController.ts b/src/controllers/api/2014/subraceController.ts similarity index 79% rename from src/controllers/api/subraceController.ts rename to src/controllers/api/2014/subraceController.ts index c788fd44..9afabeba 100644 --- a/src/controllers/api/subraceController.ts +++ b/src/controllers/api/2014/subraceController.ts @@ -1,9 +1,9 @@ import { Request, Response, NextFunction } from 'express'; -import Proficiency from '../../models/2014/proficiency/index.js'; -import { ResourceList } from '../../util/data.js'; -import SimpleController from '../simpleController.js'; -import Subrace from '../../models/2014/subrace/index.js'; -import Trait from '../../models/2014/trait/index.js'; +import Proficiency from '../../../models/2014/proficiency/index.js'; +import { ResourceList } from '../../../util/data.js'; +import SimpleController from '../../simpleController.js'; +import Subrace from '../../../models/2014/subrace/index.js'; +import Trait from '../../../models/2014/trait/index.js'; const simpleController = new SimpleController(Subrace); diff --git a/src/controllers/api/2014/traitController.ts b/src/controllers/api/2014/traitController.ts new file mode 100644 index 00000000..8ca93b25 --- /dev/null +++ b/src/controllers/api/2014/traitController.ts @@ -0,0 +1,4 @@ +import SimpleController from '../../simpleController.js'; +import Trait from '../../../models/2014/trait/index.js'; + +export default new SimpleController(Trait); diff --git a/src/controllers/api/2014/weaponPropertyController.ts b/src/controllers/api/2014/weaponPropertyController.ts new file mode 100644 index 00000000..42088f7f --- /dev/null +++ b/src/controllers/api/2014/weaponPropertyController.ts @@ -0,0 +1,4 @@ +import SimpleController from '../../simpleController.js'; +import WeaponProperty from '../../../models/2014/weaponProperty/index.js'; + +export default new SimpleController(WeaponProperty); diff --git a/src/controllers/api/abilityScoreController.ts b/src/controllers/api/abilityScoreController.ts deleted file mode 100644 index 784927a3..00000000 --- a/src/controllers/api/abilityScoreController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import AbilityScore from '../../models/2014/abilityScore/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(AbilityScore); diff --git a/src/controllers/api/alignmentController.ts b/src/controllers/api/alignmentController.ts deleted file mode 100644 index 60645334..00000000 --- a/src/controllers/api/alignmentController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Alignment from '../../models/2014/alignment/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Alignment); diff --git a/src/controllers/api/backgroundController.ts b/src/controllers/api/backgroundController.ts deleted file mode 100644 index 0abbfca1..00000000 --- a/src/controllers/api/backgroundController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Background from '../../models/2014/background/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Background); diff --git a/src/controllers/api/conditionController.ts b/src/controllers/api/conditionController.ts deleted file mode 100644 index ebde94ac..00000000 --- a/src/controllers/api/conditionController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Condition from '../../models/2014/condition/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Condition); diff --git a/src/controllers/api/damageTypeController.ts b/src/controllers/api/damageTypeController.ts deleted file mode 100644 index e389b661..00000000 --- a/src/controllers/api/damageTypeController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import DamageType from '../../models/2014/damageType/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(DamageType); diff --git a/src/controllers/api/equipmentCategoryController.ts b/src/controllers/api/equipmentCategoryController.ts deleted file mode 100644 index 2da9c825..00000000 --- a/src/controllers/api/equipmentCategoryController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import EquipmentCategory from '../../models/2014/equipmentCategory/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(EquipmentCategory); diff --git a/src/controllers/api/equipmentController.ts b/src/controllers/api/equipmentController.ts deleted file mode 100644 index bf3534e8..00000000 --- a/src/controllers/api/equipmentController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Equipment from '../../models/2014/equipment/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Equipment); diff --git a/src/controllers/api/featController.ts b/src/controllers/api/featController.ts deleted file mode 100644 index b37b0207..00000000 --- a/src/controllers/api/featController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Feat from '../../models/2014/feat/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Feat); diff --git a/src/controllers/api/featureController.ts b/src/controllers/api/featureController.ts deleted file mode 100644 index a1a130bc..00000000 --- a/src/controllers/api/featureController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Feature from '../../models/2014/feature/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Feature); diff --git a/src/controllers/api/languageController.ts b/src/controllers/api/languageController.ts deleted file mode 100644 index f6c4f5a8..00000000 --- a/src/controllers/api/languageController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Language from '../../models/2014/language/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Language); diff --git a/src/controllers/api/magicSchoolController.ts b/src/controllers/api/magicSchoolController.ts deleted file mode 100644 index 0d04753a..00000000 --- a/src/controllers/api/magicSchoolController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import MagicSchool from '../../models/2014/magicSchool/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(MagicSchool); diff --git a/src/controllers/api/proficiencyController.ts b/src/controllers/api/proficiencyController.ts deleted file mode 100644 index 644e6713..00000000 --- a/src/controllers/api/proficiencyController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Proficiency from '../../models/2014/proficiency/index.js'; -import SimpleController from '../simpleController.js'; - -export default new SimpleController(Proficiency); diff --git a/src/controllers/api/skillController.ts b/src/controllers/api/skillController.ts deleted file mode 100644 index 61a7062a..00000000 --- a/src/controllers/api/skillController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import SimpleController from '../simpleController.js'; -import Skill from '../../models/2014/skill/index.js'; - -export default new SimpleController(Skill); diff --git a/src/controllers/api/traitController.ts b/src/controllers/api/traitController.ts deleted file mode 100644 index d580bb0f..00000000 --- a/src/controllers/api/traitController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import SimpleController from '../simpleController.js'; -import Trait from '../../models/2014/trait/index.js'; - -export default new SimpleController(Trait); diff --git a/src/controllers/api/v2014Controller.ts b/src/controllers/api/v2014Controller.ts new file mode 100644 index 00000000..273501e1 --- /dev/null +++ b/src/controllers/api/v2014Controller.ts @@ -0,0 +1,22 @@ +import { Request, Response, NextFunction } from 'express'; +import Collection from '../../models/2014/collection/index.js'; + +export const index = async (req: Request, res: Response, next: NextFunction) => { + try { + const data = await Collection.find({}) + .select({ index: 1, _id: 0 }) + .sort({ index: 'asc' }) + .exec(); + + const apiIndex: Record = {}; + data.forEach((item) => { + if (item.index === 'levels') return; + + apiIndex[item.index] = `/api/2014/${item.index}`; + }); + + return res.status(200).json(apiIndex); + } catch (err) { + next(err); + } +}; diff --git a/src/controllers/api/weaponPropertyController.ts b/src/controllers/api/weaponPropertyController.ts deleted file mode 100644 index be6b81af..00000000 --- a/src/controllers/api/weaponPropertyController.ts +++ /dev/null @@ -1,4 +0,0 @@ -import SimpleController from '../simpleController.js'; -import WeaponProperty from '../../models/2014/weaponProperty/index.js'; - -export default new SimpleController(WeaponProperty); diff --git a/src/controllers/apiController.ts b/src/controllers/apiController.ts index f01336c7..a8a934f3 100644 --- a/src/controllers/apiController.ts +++ b/src/controllers/apiController.ts @@ -8,7 +8,7 @@ export const index = async (req: Request, res: Response, next: NextFunction) => .sort({ index: 'asc' }) .exec(); - const apiIndex: Record = {}; + const apiIndex: Record = { '2014': '/api/2014' }; data.forEach((item) => { if (item.index === 'levels') return; diff --git a/src/routes/api.ts b/src/routes/api.ts index a29af661..a1208f45 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -24,7 +24,8 @@ import { SubracesHandler, TraitsHandler, WeaponPropertiesHandler, -} from './api/index.js'; +} from './api/2014/index.js'; +import V2014Handler from './api/2014.js'; import express from 'express'; import { index } from '../controllers/apiController.js'; @@ -32,6 +33,7 @@ import { index } from '../controllers/apiController.js'; const router = express.Router(); router.get('/', index); +router.use('/2014', V2014Handler); router.use('/ability-scores', AbilityScoresHandler); router.use('/alignments', AlignmentsHandler); diff --git a/src/routes/api/2014.ts b/src/routes/api/2014.ts new file mode 100644 index 00000000..9206ff64 --- /dev/null +++ b/src/routes/api/2014.ts @@ -0,0 +1,62 @@ +import { + AbilityScoresHandler, + AlignmentsHandler, + BackgroundsHandler, + ClassesHandler, + ConditionsHandler, + DamageTypesHandler, + EquipmentCategoriesHandler, + EquipmentHandler, + FeatsHandler, + FeaturesHandler, + ImageHandler, + LanguagesHandler, + MagicItemsHandler, + MagicSchoolsHandler, + MonstersHandler, + ProficienciesHandler, + RacesHandler, + RuleSectionsHandler, + RulesHandler, + SkillsHandler, + SpellsHandler, + SubclassesHandler, + SubracesHandler, + TraitsHandler, + WeaponPropertiesHandler, +} from './2014/index.js'; + +import express from 'express'; +import { index } from '../../controllers/api/v2014Controller.js'; + +const router = express.Router(); + +router.get('/', index); + +router.use('/ability-scores', AbilityScoresHandler); +router.use('/alignments', AlignmentsHandler); +router.use('/backgrounds', BackgroundsHandler); +router.use('/classes', ClassesHandler); +router.use('/conditions', ConditionsHandler); +router.use('/damage-types', DamageTypesHandler); +router.use('/equipment-categories', EquipmentCategoriesHandler); +router.use('/equipment', EquipmentHandler); +router.use('/feats', FeatsHandler); +router.use('/features', FeaturesHandler); +router.use('/images', ImageHandler); +router.use('/languages', LanguagesHandler); +router.use('/magic-items', MagicItemsHandler); +router.use('/magic-schools', MagicSchoolsHandler); +router.use('/monsters', MonstersHandler); +router.use('/proficiencies', ProficienciesHandler); +router.use('/races', RacesHandler); +router.use('/rules', RulesHandler); +router.use('/rule-sections', RuleSectionsHandler); +router.use('/skills', SkillsHandler); +router.use('/spells', SpellsHandler); +router.use('/subclasses', SubclassesHandler); +router.use('/subraces', SubracesHandler); +router.use('/traits', TraitsHandler); +router.use('/weapon-properties', WeaponPropertiesHandler); + +export default router; diff --git a/src/routes/api/abilityScores.ts b/src/routes/api/2014/abilityScores.ts similarity index 50% rename from src/routes/api/abilityScores.ts rename to src/routes/api/2014/abilityScores.ts index 4455d0bc..9efb8613 100644 --- a/src/routes/api/abilityScores.ts +++ b/src/routes/api/2014/abilityScores.ts @@ -1,13 +1,13 @@ -import AbilityScoreController from '../../controllers/api/abilityScoreController.js'; +import AbilityScoreController from '../../../controllers/api/2014/abilityScoreController.js'; import express from 'express'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { AbilityScoreController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { AbilityScoreController.show(req, res, next); }); diff --git a/src/routes/api/alignments.ts b/src/routes/api/2014/alignments.ts similarity index 51% rename from src/routes/api/alignments.ts rename to src/routes/api/2014/alignments.ts index 0a1c4680..87842fa2 100644 --- a/src/routes/api/alignments.ts +++ b/src/routes/api/2014/alignments.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import AlignmentController from '../../controllers/api/alignmentController.js'; +import AlignmentController from '../../../controllers/api/2014/alignmentController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { AlignmentController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { AlignmentController.show(req, res, next); }); diff --git a/src/routes/api/backgrounds.ts b/src/routes/api/2014/backgrounds.ts similarity index 51% rename from src/routes/api/backgrounds.ts rename to src/routes/api/2014/backgrounds.ts index 66783635..988e532f 100644 --- a/src/routes/api/backgrounds.ts +++ b/src/routes/api/2014/backgrounds.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import BackgroundController from '../../controllers/api/backgroundController.js'; +import BackgroundController from '../../../controllers/api/2014/backgroundController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { BackgroundController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { BackgroundController.show(req, res, next); }); diff --git a/src/routes/api/classes.ts b/src/routes/api/2014/classes.ts similarity index 85% rename from src/routes/api/classes.ts rename to src/routes/api/2014/classes.ts index bee2e0b4..d25bd611 100644 --- a/src/routes/api/classes.ts +++ b/src/routes/api/2014/classes.ts @@ -1,13 +1,13 @@ import * as express from 'express'; -import * as ClassController from '../../controllers/api/classController.js'; +import * as ClassController from '../../../controllers/api/2014/classController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { ClassController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { ClassController.show(req, res, next); }); diff --git a/src/routes/api/conditions.ts b/src/routes/api/2014/conditions.ts similarity index 51% rename from src/routes/api/conditions.ts rename to src/routes/api/2014/conditions.ts index 73a134f3..395c2014 100644 --- a/src/routes/api/conditions.ts +++ b/src/routes/api/2014/conditions.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import ConditionController from '../../controllers/api/conditionController.js'; +import ConditionController from '../../../controllers/api/2014/conditionController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { ConditionController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { ConditionController.show(req, res, next); }); export default router; diff --git a/src/routes/api/damageTypes.ts b/src/routes/api/2014/damageTypes.ts similarity index 51% rename from src/routes/api/damageTypes.ts rename to src/routes/api/2014/damageTypes.ts index af1e3889..9d34e5e6 100644 --- a/src/routes/api/damageTypes.ts +++ b/src/routes/api/2014/damageTypes.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import DamageTypeController from '../../controllers/api/damageTypeController.js'; +import DamageTypeController from '../../../controllers/api/2014/damageTypeController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { DamageTypeController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { DamageTypeController.show(req, res, next); }); diff --git a/src/routes/api/equipment.ts b/src/routes/api/2014/equipment.ts similarity index 51% rename from src/routes/api/equipment.ts rename to src/routes/api/2014/equipment.ts index c5d99dc8..accb0d45 100644 --- a/src/routes/api/equipment.ts +++ b/src/routes/api/2014/equipment.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import EquipmentController from '../../controllers/api/equipmentController.js'; +import EquipmentController from '../../../controllers/api/2014/equipmentController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { EquipmentController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { EquipmentController.show(req, res, next); }); diff --git a/src/routes/api/equipmentCategories.ts b/src/routes/api/2014/equipmentCategories.ts similarity index 51% rename from src/routes/api/equipmentCategories.ts rename to src/routes/api/2014/equipmentCategories.ts index 37f7207d..747b3780 100644 --- a/src/routes/api/equipmentCategories.ts +++ b/src/routes/api/2014/equipmentCategories.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import EquipmentCategoryController from '../../controllers/api/equipmentCategoryController.js'; +import EquipmentCategoryController from '../../../controllers/api/2014/equipmentCategoryController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { EquipmentCategoryController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { EquipmentCategoryController.show(req, res, next); }); diff --git a/src/routes/api/feats.ts b/src/routes/api/2014/feats.ts similarity index 51% rename from src/routes/api/feats.ts rename to src/routes/api/2014/feats.ts index ba58df6d..ce835423 100644 --- a/src/routes/api/feats.ts +++ b/src/routes/api/2014/feats.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import FeatController from '../../controllers/api/featController.js'; +import FeatController from '../../../controllers/api/2014/featController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { FeatController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { FeatController.show(req, res, next); }); diff --git a/src/routes/api/features.ts b/src/routes/api/2014/features.ts similarity index 51% rename from src/routes/api/features.ts rename to src/routes/api/2014/features.ts index 1a92c60d..94bcd564 100644 --- a/src/routes/api/features.ts +++ b/src/routes/api/2014/features.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import FeatureController from '../../controllers/api/featureController.js'; +import FeatureController from '../../../controllers/api/2014/featureController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { FeatureController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { FeatureController.show(req, res, next); }); diff --git a/src/routes/api/images.ts b/src/routes/api/2014/images.ts similarity index 52% rename from src/routes/api/images.ts rename to src/routes/api/2014/images.ts index 92cf1342..636da639 100644 --- a/src/routes/api/images.ts +++ b/src/routes/api/2014/images.ts @@ -1,10 +1,10 @@ import * as express from 'express'; -import ImageController from '../../controllers/api/imageController.js'; +import ImageController from '../../../controllers/api/2014/imageController.js'; const router = express.Router(); -router.get('/*', function(req, res, next) { +router.get('/*', function (req, res, next) { ImageController.show(req, res, next); }); diff --git a/src/routes/api/index.ts b/src/routes/api/2014/index.ts similarity index 100% rename from src/routes/api/index.ts rename to src/routes/api/2014/index.ts diff --git a/src/routes/api/languages.ts b/src/routes/api/2014/languages.ts similarity index 51% rename from src/routes/api/languages.ts rename to src/routes/api/2014/languages.ts index 61d2599e..c82bbabb 100644 --- a/src/routes/api/languages.ts +++ b/src/routes/api/2014/languages.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import LanguageController from '../../controllers/api/languageController.js'; +import LanguageController from '../../../controllers/api/2014/languageController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { LanguageController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { LanguageController.show(req, res, next); }); diff --git a/src/routes/api/magicItems.ts b/src/routes/api/2014/magicItems.ts similarity index 66% rename from src/routes/api/magicItems.ts rename to src/routes/api/2014/magicItems.ts index 6f20f1c5..cc7d45d1 100644 --- a/src/routes/api/magicItems.ts +++ b/src/routes/api/2014/magicItems.ts @@ -1,4 +1,4 @@ -import * as MagicItemController from '../../controllers/api/magicItemController.js'; +import * as MagicItemController from '../../../controllers/api/2014/magicItemController.js'; import * as express from 'express'; const router = express.Router(); diff --git a/src/routes/api/magicSchools.ts b/src/routes/api/2014/magicSchools.ts similarity index 51% rename from src/routes/api/magicSchools.ts rename to src/routes/api/2014/magicSchools.ts index e383693b..75e5c948 100644 --- a/src/routes/api/magicSchools.ts +++ b/src/routes/api/2014/magicSchools.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import MagicSchoolController from '../../controllers/api/magicSchoolController.js'; +import MagicSchoolController from '../../../controllers/api/2014/magicSchoolController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { MagicSchoolController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { MagicSchoolController.show(req, res, next); }); diff --git a/src/routes/api/monsters.ts b/src/routes/api/2014/monsters.ts similarity index 67% rename from src/routes/api/monsters.ts rename to src/routes/api/2014/monsters.ts index b73d1d91..be0376e7 100644 --- a/src/routes/api/monsters.ts +++ b/src/routes/api/2014/monsters.ts @@ -1,4 +1,4 @@ -import * as MonsterController from '../../controllers/api/monsterController.js'; +import * as MonsterController from '../../../controllers/api/2014/monsterController.js'; import * as express from 'express'; const router = express.Router(); diff --git a/src/routes/api/proficiencies.ts b/src/routes/api/2014/proficiencies.ts similarity index 51% rename from src/routes/api/proficiencies.ts rename to src/routes/api/2014/proficiencies.ts index 7475261a..156f7fbc 100644 --- a/src/routes/api/proficiencies.ts +++ b/src/routes/api/2014/proficiencies.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import ProficiencyController from '../../controllers/api/proficiencyController.js'; +import ProficiencyController from '../../../controllers/api/2014/proficiencyController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { ProficiencyController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { ProficiencyController.show(req, res, next); }); diff --git a/src/routes/api/races.ts b/src/routes/api/2014/races.ts similarity index 69% rename from src/routes/api/races.ts rename to src/routes/api/2014/races.ts index 42ff42e8..bccb9269 100644 --- a/src/routes/api/races.ts +++ b/src/routes/api/2014/races.ts @@ -1,13 +1,13 @@ -import * as RaceController from '../../controllers/api/raceController.js'; +import * as RaceController from '../../../controllers/api/2014/raceController.js'; import * as express from 'express'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { RaceController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { RaceController.show(req, res, next); }); diff --git a/src/routes/api/rule-sections.ts b/src/routes/api/2014/rule-sections.ts similarity index 66% rename from src/routes/api/rule-sections.ts rename to src/routes/api/2014/rule-sections.ts index 0f16b22f..65dc581a 100644 --- a/src/routes/api/rule-sections.ts +++ b/src/routes/api/2014/rule-sections.ts @@ -1,4 +1,4 @@ -import * as RuleSectionController from '../../controllers/api/ruleSectionController.js'; +import * as RuleSectionController from '../../../controllers/api/2014/ruleSectionController.js'; import * as express from 'express'; const router = express.Router(); diff --git a/src/routes/api/rules.ts b/src/routes/api/2014/rules.ts similarity index 68% rename from src/routes/api/rules.ts rename to src/routes/api/2014/rules.ts index 8db56be1..1befff92 100644 --- a/src/routes/api/rules.ts +++ b/src/routes/api/2014/rules.ts @@ -1,4 +1,4 @@ -import * as RuleController from '../../controllers/api/ruleController.js'; +import * as RuleController from '../../../controllers/api/2014/ruleController.js'; import * as express from 'express'; const router = express.Router(); diff --git a/src/routes/api/skills.ts b/src/routes/api/2014/skills.ts similarity index 51% rename from src/routes/api/skills.ts rename to src/routes/api/2014/skills.ts index 77b9acfa..f08bd345 100644 --- a/src/routes/api/skills.ts +++ b/src/routes/api/2014/skills.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import SkillController from '../../controllers/api/skillController.js'; +import SkillController from '../../../controllers/api/2014/skillController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { SkillController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { SkillController.show(req, res, next); }); export default router; diff --git a/src/routes/api/spells.ts b/src/routes/api/2014/spells.ts similarity index 67% rename from src/routes/api/spells.ts rename to src/routes/api/2014/spells.ts index c6dbadcf..fe9e36ee 100644 --- a/src/routes/api/spells.ts +++ b/src/routes/api/2014/spells.ts @@ -1,4 +1,4 @@ -import * as SpellController from '../../controllers/api/spellController.js'; +import * as SpellController from '../../../controllers/api/2014/spellController.js'; import * as express from 'express'; const router = express.Router(); diff --git a/src/routes/api/subclasses.ts b/src/routes/api/2014/subclasses.ts similarity index 73% rename from src/routes/api/subclasses.ts rename to src/routes/api/2014/subclasses.ts index cb69ed64..76856450 100644 --- a/src/routes/api/subclasses.ts +++ b/src/routes/api/2014/subclasses.ts @@ -1,13 +1,13 @@ -import * as SubclassController from '../../controllers/api/subclassController.js'; +import * as SubclassController from '../../../controllers/api/2014/subclassController.js'; import * as express from 'express'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { SubclassController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { SubclassController.show(req, res, next); }); diff --git a/src/routes/api/subraces.ts b/src/routes/api/2014/subraces.ts similarity index 65% rename from src/routes/api/subraces.ts rename to src/routes/api/2014/subraces.ts index 94709b41..e9d85cb7 100644 --- a/src/routes/api/subraces.ts +++ b/src/routes/api/2014/subraces.ts @@ -1,13 +1,13 @@ -import * as SubraceController from '../../controllers/api/subraceController.js'; +import * as SubraceController from '../../../controllers/api/2014/subraceController.js'; import * as express from 'express'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { SubraceController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { SubraceController.show(req, res, next); }); diff --git a/src/routes/api/traits.ts b/src/routes/api/2014/traits.ts similarity index 51% rename from src/routes/api/traits.ts rename to src/routes/api/2014/traits.ts index 75f79ff3..9933371c 100644 --- a/src/routes/api/traits.ts +++ b/src/routes/api/2014/traits.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import TraitController from '../../controllers/api/traitController.js'; +import TraitController from '../../../controllers/api/2014/traitController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { TraitController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { TraitController.show(req, res, next); }); diff --git a/src/routes/api/weaponProperties.ts b/src/routes/api/2014/weaponProperties.ts similarity index 51% rename from src/routes/api/weaponProperties.ts rename to src/routes/api/2014/weaponProperties.ts index e2e80c00..35851c0b 100644 --- a/src/routes/api/weaponProperties.ts +++ b/src/routes/api/2014/weaponProperties.ts @@ -1,14 +1,14 @@ import * as express from 'express'; -import WeaponPropertyController from '../../controllers/api/weaponPropertyController.js'; +import WeaponPropertyController from '../../../controllers/api/2014/weaponPropertyController.js'; const router = express.Router(); -router.get('/', function(req, res, next) { +router.get('/', function (req, res, next) { WeaponPropertyController.index(req, res, next); }); -router.get('/:index', function(req, res, next) { +router.get('/:index', function (req, res, next) { WeaponPropertyController.show(req, res, next); }); diff --git a/src/tests/controllers/api/abilityScoreController.test.ts b/src/tests/controllers/api/abilityScoreController.test.ts index 0047ef52..f064972a 100644 --- a/src/tests/controllers/api/abilityScoreController.test.ts +++ b/src/tests/controllers/api/abilityScoreController.test.ts @@ -4,7 +4,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import AbilityScore from '../../../models/2014/abilityScore/index.js'; -import AbilityScoreController from '../../../controllers/api/abilityScoreController.js'; +import AbilityScoreController from '../../../controllers/api/2014/abilityScoreController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/classController.test.ts b/src/tests/controllers/api/classController.test.ts index e6b0f32f..8307777e 100644 --- a/src/tests/controllers/api/classController.test.ts +++ b/src/tests/controllers/api/classController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as ClassController from '../../../controllers/api/classController.js'; +import * as ClassController from '../../../controllers/api/2014/classController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/conditionController.test.ts b/src/tests/controllers/api/conditionController.test.ts index 2d81ae15..10148811 100644 --- a/src/tests/controllers/api/conditionController.test.ts +++ b/src/tests/controllers/api/conditionController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Condition from '../../../models/2014/condition/index.js'; -import ConditionController from '../../../controllers/api/conditionController.js'; +import ConditionController from '../../../controllers/api/2014/conditionController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/damageTypeController.test.ts b/src/tests/controllers/api/damageTypeController.test.ts index 459a4987..d0eec153 100644 --- a/src/tests/controllers/api/damageTypeController.test.ts +++ b/src/tests/controllers/api/damageTypeController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import DamageType from '../../../models/2014/damageType/index.js'; -import DamageTypeController from '../../../controllers/api/damageTypeController.js'; +import DamageTypeController from '../../../controllers/api/2014/damageTypeController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/equipmentCategoryController.test.ts b/src/tests/controllers/api/equipmentCategoryController.test.ts index 9a458f75..c74d72cc 100644 --- a/src/tests/controllers/api/equipmentCategoryController.test.ts +++ b/src/tests/controllers/api/equipmentCategoryController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import EquipmentCategory from '../../../models/2014/equipmentCategory/index.js'; -import EquipmentCategoryController from '../../../controllers/api/equipmentCategoryController.js'; +import EquipmentCategoryController from '../../../controllers/api/2014/equipmentCategoryController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/equipmentController.test.ts b/src/tests/controllers/api/equipmentController.test.ts index 5bfcb760..6f6eec46 100644 --- a/src/tests/controllers/api/equipmentController.test.ts +++ b/src/tests/controllers/api/equipmentController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Equipment from '../../../models/2014/equipment/index.js'; -import EquipmentController from '../../../controllers/api/equipmentController.js'; +import EquipmentController from '../../../controllers/api/2014/equipmentController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/featController.test.ts b/src/tests/controllers/api/featController.test.ts index d68ac50d..30007cce 100644 --- a/src/tests/controllers/api/featController.test.ts +++ b/src/tests/controllers/api/featController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Feat from '../../../models/2014/feat/index.js'; -import FeatController from '../../../controllers/api/featController.js'; +import FeatController from '../../../controllers/api/2014/featController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/featureController.test.ts b/src/tests/controllers/api/featureController.test.ts index 4ef4ffa1..58423635 100644 --- a/src/tests/controllers/api/featureController.test.ts +++ b/src/tests/controllers/api/featureController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Feature from '../../../models/2014/feature/index.js'; -import FeatureController from '../../../controllers/api/featureController.js'; +import FeatureController from '../../../controllers/api/2014/featureController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/languageController.test.ts b/src/tests/controllers/api/languageController.test.ts index 0541c9b8..f50d6ece 100644 --- a/src/tests/controllers/api/languageController.test.ts +++ b/src/tests/controllers/api/languageController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Language from '../../../models/2014/language/index.js'; -import LanguageController from '../../../controllers/api/languageController.js'; +import LanguageController from '../../../controllers/api/2014/languageController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/magicItemController.test.ts b/src/tests/controllers/api/magicItemController.test.ts index 72453d55..0ce70bd0 100644 --- a/src/tests/controllers/api/magicItemController.test.ts +++ b/src/tests/controllers/api/magicItemController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as MagicItemController from '../../../controllers/api/magicItemController.js'; +import * as MagicItemController from '../../../controllers/api/2014/magicItemController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/magicSchoolController.test.ts b/src/tests/controllers/api/magicSchoolController.test.ts index 675130b6..80463fbe 100644 --- a/src/tests/controllers/api/magicSchoolController.test.ts +++ b/src/tests/controllers/api/magicSchoolController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import MagicSchool from '../../../models/2014/magicSchool/index.js'; -import MagicSchoolController from '../../../controllers/api/magicSchoolController.js'; +import MagicSchoolController from '../../../controllers/api/2014/magicSchoolController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/monsterController.test.ts b/src/tests/controllers/api/monsterController.test.ts index 3000dbd1..15a595ed 100644 --- a/src/tests/controllers/api/monsterController.test.ts +++ b/src/tests/controllers/api/monsterController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as MonsterController from '../../../controllers/api/monsterController.js'; +import * as MonsterController from '../../../controllers/api/2014/monsterController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/proficiencyController.test.ts b/src/tests/controllers/api/proficiencyController.test.ts index 3c35abd7..3f7bfef6 100644 --- a/src/tests/controllers/api/proficiencyController.test.ts +++ b/src/tests/controllers/api/proficiencyController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Proficiency from '../../../models/2014/proficiency/index.js'; -import ProficiencyController from '../../../controllers/api/proficiencyController.js'; +import ProficiencyController from '../../../controllers/api/2014/proficiencyController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/raceController.test.ts b/src/tests/controllers/api/raceController.test.ts index 51b8ad74..e8f632d1 100644 --- a/src/tests/controllers/api/raceController.test.ts +++ b/src/tests/controllers/api/raceController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as RaceController from '../../../controllers/api/raceController.js'; +import * as RaceController from '../../../controllers/api/2014/raceController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/ruleSectionController.test.ts b/src/tests/controllers/api/ruleSectionController.test.ts index 6621a6ac..abe6f2d6 100644 --- a/src/tests/controllers/api/ruleSectionController.test.ts +++ b/src/tests/controllers/api/ruleSectionController.test.ts @@ -1,4 +1,4 @@ -import * as RuleSectionController from '../../../controllers/api/ruleSectionController.js'; +import * as RuleSectionController from '../../../controllers/api/2014/ruleSectionController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/rulesController.test.ts b/src/tests/controllers/api/rulesController.test.ts index e842ccaa..3fea0983 100644 --- a/src/tests/controllers/api/rulesController.test.ts +++ b/src/tests/controllers/api/rulesController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as RulesController from '../../../controllers/api/ruleController.js'; +import * as RulesController from '../../../controllers/api/2014/ruleController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/skillController.test.ts b/src/tests/controllers/api/skillController.test.ts index 5101159b..5400745c 100644 --- a/src/tests/controllers/api/skillController.test.ts +++ b/src/tests/controllers/api/skillController.test.ts @@ -3,7 +3,7 @@ import { mockNext } from '../../support/requestHelpers.js'; import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; import skill from '../../../models/2014/skill/index.js'; -import skillController from '../../../controllers/api/skillController.js'; +import skillController from '../../../controllers/api/2014/skillController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/spellController.test.ts b/src/tests/controllers/api/spellController.test.ts index 9cd40cda..f3ee8f59 100644 --- a/src/tests/controllers/api/spellController.test.ts +++ b/src/tests/controllers/api/spellController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as SpellController from '../../../controllers/api/spellController.js'; +import * as SpellController from '../../../controllers/api/2014/spellController.js'; import { mockNext } from '../../support/requestHelpers.js'; import Spell from '../../../models/2014/spell/index.js'; diff --git a/src/tests/controllers/api/subclassController.test.ts b/src/tests/controllers/api/subclassController.test.ts index 65b46b5f..ba1336de 100644 --- a/src/tests/controllers/api/subclassController.test.ts +++ b/src/tests/controllers/api/subclassController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as SubclassController from '../../../controllers/api/subclassController.js'; +import * as SubclassController from '../../../controllers/api/2014/subclassController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/subraceController.test.ts b/src/tests/controllers/api/subraceController.test.ts index 967b7936..5fc88ea5 100644 --- a/src/tests/controllers/api/subraceController.test.ts +++ b/src/tests/controllers/api/subraceController.test.ts @@ -1,6 +1,6 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as SubraceController from '../../../controllers/api/subraceController.js'; +import * as SubraceController from '../../../controllers/api/2014/subraceController.js'; import { mockNext } from '../../support/requestHelpers.js'; diff --git a/src/tests/controllers/api/traitController.test.ts b/src/tests/controllers/api/traitController.test.ts index d003d742..ad5b6f45 100644 --- a/src/tests/controllers/api/traitController.test.ts +++ b/src/tests/controllers/api/traitController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import Trait from '../../../models/2014/trait/index.js'; -import TraitController from '../../../controllers/api/traitController.js'; +import TraitController from '../../../controllers/api/2014/traitController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/weaponPropertyController.test.ts b/src/tests/controllers/api/weaponPropertyController.test.ts index f3bd4ff7..be9440f7 100644 --- a/src/tests/controllers/api/weaponPropertyController.test.ts +++ b/src/tests/controllers/api/weaponPropertyController.test.ts @@ -3,7 +3,7 @@ import { createRequest, createResponse } from 'node-mocks-http'; import { mockNext } from '../../support/requestHelpers.js'; import WeaponProperty from '../../../models/2014/weaponProperty/index.js'; -import WeaponPropertyController from '../../../controllers/api/weaponPropertyController.js'; +import WeaponPropertyController from '../../../controllers/api/2014/weaponPropertyController.js'; beforeEach(() => { mockingoose.resetAll(); From 501c8b78b83d17e5d6c2fdfb45b5dcd2e4defa36 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Fri, 27 Dec 2024 16:20:48 -0800 Subject: [PATCH 4/8] Now with working tests --- jest.config.integration.ts | 1 + package.json | 2 +- src/models/2014/equipment/types.d.ts | 2 +- src/models/2014/monster/types.d.ts | 6 +- src/models/2014/trait/types.d.ts | 2 +- .../{ => 2014}/abilityScoreController.test.ts | 6 +- .../api/{ => 2014}/classController.test.ts | 16 +- .../{ => 2014}/conditionController.test.ts | 6 +- .../{ => 2014}/damageTypeController.test.ts | 6 +- .../equipmentCategoryController.test.ts | 6 +- .../{ => 2014}/equipmentController.test.ts | 6 +- .../api/{ => 2014}/featController.test.ts | 6 +- .../api/{ => 2014}/featureController.test.ts | 6 +- .../api/{ => 2014}/languageController.test.ts | 6 +- .../{ => 2014}/magicItemController.test.ts | 6 +- .../{ => 2014}/magicSchoolController.test.ts | 6 +- .../api/{ => 2014}/monsterController.test.ts | 6 +- .../{ => 2014}/proficiencyController.test.ts | 6 +- .../api/{ => 2014}/raceController.test.ts | 12 +- .../{ => 2014}/ruleSectionController.test.ts | 6 +- .../api/{ => 2014}/rulesController.test.ts | 6 +- .../api/{ => 2014}/skillController.test.ts | 6 +- .../api/{ => 2014}/spellController.test.ts | 6 +- .../api/{ => 2014}/subclassController.test.ts | 10 +- .../api/{ => 2014}/subraceController.test.ts | 10 +- .../api/{ => 2014}/traitController.test.ts | 6 +- .../weaponPropertyController.test.ts | 6 +- .../controllers/api/v2014Controller.test.ts | 40 ++++ src/tests/controllers/apiController.test.ts | 1 + .../api/2014/abilityScores.itest.ts | 73 +++++++ .../integration/api/2014/classes.itest.ts | 192 ++++++++++++++++++ .../integration/api/2014/conditions.itest.ts | 73 +++++++ .../integration/api/2014/damageTypes.itest.ts | 73 +++++++ .../integration/api/2014/equipment.itest.ts | 73 +++++++ .../api/2014/equipmentCategories.itest.ts | 73 +++++++ src/tests/integration/api/2014/feats.itest.ts | 73 +++++++ .../integration/api/2014/features.itest.ts | 73 +++++++ .../integration/api/2014/languages.itest.ts | 73 +++++++ .../integration/api/2014/magicItems.itest.ts | 83 ++++++++ .../api/2014/magicSchools.itest.ts | 73 +++++++ .../integration/api/2014/monsters.itest.ts | 131 ++++++++++++ .../api/2014/proficiencies.itest.ts | 73 +++++++ src/tests/integration/api/2014/races.itest.ts | 102 ++++++++++ .../api/2014/ruleSections.itest.ts | 105 ++++++++++ src/tests/integration/api/2014/rules.itest.ts | 105 ++++++++++ .../integration/api/2014/skills.itest.ts | 73 +++++++ .../integration/api/2014/spells.itest.ts | 184 +++++++++++++++++ .../integration/api/2014/subclasses.itest.ts | 102 ++++++++++ .../integration/api/2014/subraces.itest.ts | 91 +++++++++ .../integration/api/2014/traits.itest.ts | 73 +++++++ .../api/2014/weaponProperties.itest.ts | 73 +++++++ .../integration/api/abilityScores.itest.ts | 3 + src/tests/integration/api/classes.itest.ts | 3 + src/tests/integration/api/conditions.itest.ts | 3 + .../integration/api/damageTypes.itest.ts | 3 + src/tests/integration/api/equipment.itest.ts | 3 + .../api/equipmentCategories.itest.ts | 3 + src/tests/integration/api/feats.itest.ts | 3 + src/tests/integration/api/features.itest.ts | 3 + src/tests/integration/api/languages.itest.ts | 3 + src/tests/integration/api/magicItems.itest.ts | 3 + .../integration/api/magicSchools.itest.ts | 3 + src/tests/integration/api/monsters.itest.ts | 3 + .../integration/api/proficiencies.itest.ts | 3 + src/tests/integration/api/races.itest.ts | 3 + .../integration/api/ruleSections.itest.ts | 3 + src/tests/integration/api/rules.itest.ts | 3 + src/tests/integration/api/skills.itest.ts | 3 + src/tests/integration/api/spells.itest.ts | 3 + src/tests/integration/api/subclasses.itest.ts | 3 + src/tests/integration/api/subraces.itest.ts | 3 + src/tests/integration/api/traits.itest.ts | 3 + .../integration/api/weaponProperties.itest.ts | 3 + src/tests/integration/server.itest.ts | 12 ++ tsconfig.json | 99 +-------- 75 files changed, 2258 insertions(+), 173 deletions(-) rename src/tests/controllers/api/{ => 2014}/abilityScoreController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/classController.test.ts (97%) rename src/tests/controllers/api/{ => 2014}/conditionController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/damageTypeController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/equipmentCategoryController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/equipmentController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/featController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/featureController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/languageController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/magicItemController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/magicSchoolController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/monsterController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/proficiencyController.test.ts (92%) rename src/tests/controllers/api/{ => 2014}/raceController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/ruleSectionController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/rulesController.test.ts (95%) rename src/tests/controllers/api/{ => 2014}/skillController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/spellController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/subclassController.test.ts (96%) rename src/tests/controllers/api/{ => 2014}/subraceController.test.ts (94%) rename src/tests/controllers/api/{ => 2014}/traitController.test.ts (93%) rename src/tests/controllers/api/{ => 2014}/weaponPropertyController.test.ts (92%) create mode 100644 src/tests/controllers/api/v2014Controller.test.ts create mode 100644 src/tests/integration/api/2014/abilityScores.itest.ts create mode 100644 src/tests/integration/api/2014/classes.itest.ts create mode 100644 src/tests/integration/api/2014/conditions.itest.ts create mode 100644 src/tests/integration/api/2014/damageTypes.itest.ts create mode 100644 src/tests/integration/api/2014/equipment.itest.ts create mode 100644 src/tests/integration/api/2014/equipmentCategories.itest.ts create mode 100644 src/tests/integration/api/2014/feats.itest.ts create mode 100644 src/tests/integration/api/2014/features.itest.ts create mode 100644 src/tests/integration/api/2014/languages.itest.ts create mode 100644 src/tests/integration/api/2014/magicItems.itest.ts create mode 100644 src/tests/integration/api/2014/magicSchools.itest.ts create mode 100644 src/tests/integration/api/2014/monsters.itest.ts create mode 100644 src/tests/integration/api/2014/proficiencies.itest.ts create mode 100644 src/tests/integration/api/2014/races.itest.ts create mode 100644 src/tests/integration/api/2014/ruleSections.itest.ts create mode 100644 src/tests/integration/api/2014/rules.itest.ts create mode 100644 src/tests/integration/api/2014/skills.itest.ts create mode 100644 src/tests/integration/api/2014/spells.itest.ts create mode 100644 src/tests/integration/api/2014/subclasses.itest.ts create mode 100644 src/tests/integration/api/2014/subraces.itest.ts create mode 100644 src/tests/integration/api/2014/traits.itest.ts create mode 100644 src/tests/integration/api/2014/weaponProperties.itest.ts diff --git a/jest.config.integration.ts b/jest.config.integration.ts index d1a9f0b7..ab9f5192 100644 --- a/jest.config.integration.ts +++ b/jest.config.integration.ts @@ -6,6 +6,7 @@ const integrationConfig: Config.InitialOptions = { displayName: 'Integration Tests', testRegex: '\\.itest\\.(js|ts)$', silent: true, + maxWorkers: '50%', // Use 50% of available CPUs }; console.log('RUNNING INTEGRATION TESTS'); diff --git a/package.json b/package.json index 8d13de67..786d6854 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "gen-postman": "npm run bundle-swagger && portman --cliOptionsFile portman-cli.json", "test": "npm run test:unit && npm run test:integration:local", "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c jest.config.unit.ts", - "test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c jest.config.integration.ts --detectOpenHandles --forceExit", + "test:integration": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest/bin/jest.js -c jest.config.integration.ts --detectOpenHandles --forceExit --runInBand", "test:integration:local": "docker compose pull && docker compose build && docker compose run --use-aliases api npm run test:integration" }, "dependencies": { diff --git a/src/models/2014/equipment/types.d.ts b/src/models/2014/equipment/types.d.ts index 24272e16..9abdba2c 100644 --- a/src/models/2014/equipment/types.d.ts +++ b/src/models/2014/equipment/types.d.ts @@ -54,7 +54,7 @@ export type Equipment = { _id?: mongoose.Types.ObjectId; armor_category?: string; armor_class?: ArmorClass; - capacity?: number; + capacity?: string; category_range?: string; contents?: Content[]; cost: Cost; diff --git a/src/models/2014/monster/types.d.ts b/src/models/2014/monster/types.d.ts index 15fb6880..558d447b 100644 --- a/src/models/2014/monster/types.d.ts +++ b/src/models/2014/monster/types.d.ts @@ -79,7 +79,7 @@ type LegendaryAction = { name: string; desc: string; attack_bonus?: number; - damage?: ActionDamage[]; + damage?: Damage[]; dc?: DifficultyClass; }; @@ -138,7 +138,7 @@ type SpecialAbility = { name: string; desc: string; attack_bonus?: number; - damage?: ActionDamage[]; + damage?: Damage[]; dc?: DifficultyClass; spellcasting?: SpecialAbilitySpellcasting; usage: SpecialAbilityUsage; @@ -149,7 +149,7 @@ type Speed = { burrow?: string; climb?: string; fly?: string; - hover?: string; + hover?: boolean; swim?: string; walk?: string; }; diff --git a/src/models/2014/trait/types.d.ts b/src/models/2014/trait/types.d.ts index e709aab1..aa93fe53 100644 --- a/src/models/2014/trait/types.d.ts +++ b/src/models/2014/trait/types.d.ts @@ -8,7 +8,7 @@ type Proficiency = { url: string; }; -type ActionDamage = { +export type ActionDamage = { _id?: boolean; damage_type: APIReference; damage_at_character_level: Record; diff --git a/src/tests/controllers/api/abilityScoreController.test.ts b/src/tests/controllers/api/2014/abilityScoreController.test.ts similarity index 92% rename from src/tests/controllers/api/abilityScoreController.test.ts rename to src/tests/controllers/api/2014/abilityScoreController.test.ts index f064972a..55c4aef8 100644 --- a/src/tests/controllers/api/abilityScoreController.test.ts +++ b/src/tests/controllers/api/2014/abilityScoreController.test.ts @@ -1,10 +1,10 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import AbilityScore from '../../../models/2014/abilityScore/index.js'; -import AbilityScoreController from '../../../controllers/api/2014/abilityScoreController.js'; +import AbilityScore from '../../../../models/2014/abilityScore/index.js'; +import AbilityScoreController from '../../../../controllers/api/2014/abilityScoreController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/classController.test.ts b/src/tests/controllers/api/2014/classController.test.ts similarity index 97% rename from src/tests/controllers/api/classController.test.ts rename to src/tests/controllers/api/2014/classController.test.ts index 8307777e..42d6b300 100644 --- a/src/tests/controllers/api/classController.test.ts +++ b/src/tests/controllers/api/2014/classController.test.ts @@ -1,15 +1,15 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as ClassController from '../../../controllers/api/2014/classController.js'; +import * as ClassController from '../../../../controllers/api/2014/classController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Class from '../../../models/2014/class/index.js'; -import Feature from '../../../models/2014/feature/index.js'; -import Level from '../../../models/2014/level/index.js'; -import Proficiency from '../../../models/2014/proficiency/index.js'; -import Spell from '../../../models/2014/spell/index.js'; -import Subclass from '../../../models/2014/subclass/index.js'; +import Class from '../../../../models/2014/class/index.js'; +import Feature from '../../../../models/2014/feature/index.js'; +import Level from '../../../../models/2014/level/index.js'; +import Proficiency from '../../../../models/2014/proficiency/index.js'; +import Spell from '../../../../models/2014/spell/index.js'; +import Subclass from '../../../../models/2014/subclass/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/conditionController.test.ts b/src/tests/controllers/api/2014/conditionController.test.ts similarity index 92% rename from src/tests/controllers/api/conditionController.test.ts rename to src/tests/controllers/api/2014/conditionController.test.ts index 10148811..e89ea50a 100644 --- a/src/tests/controllers/api/conditionController.test.ts +++ b/src/tests/controllers/api/2014/conditionController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Condition from '../../../models/2014/condition/index.js'; -import ConditionController from '../../../controllers/api/2014/conditionController.js'; +import Condition from '../../../../models/2014/condition/index.js'; +import ConditionController from '../../../../controllers/api/2014/conditionController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/damageTypeController.test.ts b/src/tests/controllers/api/2014/damageTypeController.test.ts similarity index 92% rename from src/tests/controllers/api/damageTypeController.test.ts rename to src/tests/controllers/api/2014/damageTypeController.test.ts index d0eec153..4eae6ef4 100644 --- a/src/tests/controllers/api/damageTypeController.test.ts +++ b/src/tests/controllers/api/2014/damageTypeController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import DamageType from '../../../models/2014/damageType/index.js'; -import DamageTypeController from '../../../controllers/api/2014/damageTypeController.js'; +import DamageType from '../../../../models/2014/damageType/index.js'; +import DamageTypeController from '../../../../controllers/api/2014/damageTypeController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/equipmentCategoryController.test.ts b/src/tests/controllers/api/2014/equipmentCategoryController.test.ts similarity index 92% rename from src/tests/controllers/api/equipmentCategoryController.test.ts rename to src/tests/controllers/api/2014/equipmentCategoryController.test.ts index c74d72cc..5f48f3a1 100644 --- a/src/tests/controllers/api/equipmentCategoryController.test.ts +++ b/src/tests/controllers/api/2014/equipmentCategoryController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import EquipmentCategory from '../../../models/2014/equipmentCategory/index.js'; -import EquipmentCategoryController from '../../../controllers/api/2014/equipmentCategoryController.js'; +import EquipmentCategory from '../../../../models/2014/equipmentCategory/index.js'; +import EquipmentCategoryController from '../../../../controllers/api/2014/equipmentCategoryController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/equipmentController.test.ts b/src/tests/controllers/api/2014/equipmentController.test.ts similarity index 92% rename from src/tests/controllers/api/equipmentController.test.ts rename to src/tests/controllers/api/2014/equipmentController.test.ts index 6f6eec46..9a7f9487 100644 --- a/src/tests/controllers/api/equipmentController.test.ts +++ b/src/tests/controllers/api/2014/equipmentController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Equipment from '../../../models/2014/equipment/index.js'; -import EquipmentController from '../../../controllers/api/2014/equipmentController.js'; +import Equipment from '../../../../models/2014/equipment/index.js'; +import EquipmentController from '../../../../controllers/api/2014/equipmentController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/featController.test.ts b/src/tests/controllers/api/2014/featController.test.ts similarity index 92% rename from src/tests/controllers/api/featController.test.ts rename to src/tests/controllers/api/2014/featController.test.ts index 30007cce..3cd5be41 100644 --- a/src/tests/controllers/api/featController.test.ts +++ b/src/tests/controllers/api/2014/featController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Feat from '../../../models/2014/feat/index.js'; -import FeatController from '../../../controllers/api/2014/featController.js'; +import Feat from '../../../../models/2014/feat/index.js'; +import FeatController from '../../../../controllers/api/2014/featController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/featureController.test.ts b/src/tests/controllers/api/2014/featureController.test.ts similarity index 93% rename from src/tests/controllers/api/featureController.test.ts rename to src/tests/controllers/api/2014/featureController.test.ts index 58423635..b33d4a05 100644 --- a/src/tests/controllers/api/featureController.test.ts +++ b/src/tests/controllers/api/2014/featureController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Feature from '../../../models/2014/feature/index.js'; -import FeatureController from '../../../controllers/api/2014/featureController.js'; +import Feature from '../../../../models/2014/feature/index.js'; +import FeatureController from '../../../../controllers/api/2014/featureController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/languageController.test.ts b/src/tests/controllers/api/2014/languageController.test.ts similarity index 92% rename from src/tests/controllers/api/languageController.test.ts rename to src/tests/controllers/api/2014/languageController.test.ts index f50d6ece..f3f389de 100644 --- a/src/tests/controllers/api/languageController.test.ts +++ b/src/tests/controllers/api/2014/languageController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Language from '../../../models/2014/language/index.js'; -import LanguageController from '../../../controllers/api/2014/languageController.js'; +import Language from '../../../../models/2014/language/index.js'; +import LanguageController from '../../../../controllers/api/2014/languageController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/magicItemController.test.ts b/src/tests/controllers/api/2014/magicItemController.test.ts similarity index 92% rename from src/tests/controllers/api/magicItemController.test.ts rename to src/tests/controllers/api/2014/magicItemController.test.ts index 0ce70bd0..d6cade16 100644 --- a/src/tests/controllers/api/magicItemController.test.ts +++ b/src/tests/controllers/api/2014/magicItemController.test.ts @@ -1,10 +1,10 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as MagicItemController from '../../../controllers/api/2014/magicItemController.js'; +import * as MagicItemController from '../../../../controllers/api/2014/magicItemController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import MagicItem from '../../../models/2014/magicItem/index.js'; +import MagicItem from '../../../../models/2014/magicItem/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/magicSchoolController.test.ts b/src/tests/controllers/api/2014/magicSchoolController.test.ts similarity index 92% rename from src/tests/controllers/api/magicSchoolController.test.ts rename to src/tests/controllers/api/2014/magicSchoolController.test.ts index 80463fbe..ac8c2184 100644 --- a/src/tests/controllers/api/magicSchoolController.test.ts +++ b/src/tests/controllers/api/2014/magicSchoolController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import MagicSchool from '../../../models/2014/magicSchool/index.js'; -import MagicSchoolController from '../../../controllers/api/2014/magicSchoolController.js'; +import MagicSchool from '../../../../models/2014/magicSchool/index.js'; +import MagicSchoolController from '../../../../controllers/api/2014/magicSchoolController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/monsterController.test.ts b/src/tests/controllers/api/2014/monsterController.test.ts similarity index 93% rename from src/tests/controllers/api/monsterController.test.ts rename to src/tests/controllers/api/2014/monsterController.test.ts index 15a595ed..9153f5e2 100644 --- a/src/tests/controllers/api/monsterController.test.ts +++ b/src/tests/controllers/api/2014/monsterController.test.ts @@ -1,10 +1,10 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as MonsterController from '../../../controllers/api/2014/monsterController.js'; +import * as MonsterController from '../../../../controllers/api/2014/monsterController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Monster from '../../../models/2014/monster/index.js'; +import Monster from '../../../../models/2014/monster/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/proficiencyController.test.ts b/src/tests/controllers/api/2014/proficiencyController.test.ts similarity index 92% rename from src/tests/controllers/api/proficiencyController.test.ts rename to src/tests/controllers/api/2014/proficiencyController.test.ts index 3f7bfef6..f855b0dd 100644 --- a/src/tests/controllers/api/proficiencyController.test.ts +++ b/src/tests/controllers/api/2014/proficiencyController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Proficiency from '../../../models/2014/proficiency/index.js'; -import ProficiencyController from '../../../controllers/api/2014/proficiencyController.js'; +import Proficiency from '../../../../models/2014/proficiency/index.js'; +import ProficiencyController from '../../../../controllers/api/2014/proficiencyController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/raceController.test.ts b/src/tests/controllers/api/2014/raceController.test.ts similarity index 93% rename from src/tests/controllers/api/raceController.test.ts rename to src/tests/controllers/api/2014/raceController.test.ts index e8f632d1..8f5565f1 100644 --- a/src/tests/controllers/api/raceController.test.ts +++ b/src/tests/controllers/api/2014/raceController.test.ts @@ -1,13 +1,13 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as RaceController from '../../../controllers/api/2014/raceController.js'; +import * as RaceController from '../../../../controllers/api/2014/raceController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Proficiency from '../../../models/2014/proficiency/index.js'; -import Race from '../../../models/2014/race/index.js'; -import Subrace from '../../../models/2014/subrace/index.js'; -import Trait from '../../../models/2014/trait/index.js'; +import Proficiency from '../../../../models/2014/proficiency/index.js'; +import Race from '../../../../models/2014/race/index.js'; +import Subrace from '../../../../models/2014/subrace/index.js'; +import Trait from '../../../../models/2014/trait/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/ruleSectionController.test.ts b/src/tests/controllers/api/2014/ruleSectionController.test.ts similarity index 93% rename from src/tests/controllers/api/ruleSectionController.test.ts rename to src/tests/controllers/api/2014/ruleSectionController.test.ts index abe6f2d6..f65d9a3d 100644 --- a/src/tests/controllers/api/ruleSectionController.test.ts +++ b/src/tests/controllers/api/2014/ruleSectionController.test.ts @@ -1,8 +1,8 @@ -import * as RuleSectionController from '../../../controllers/api/2014/ruleSectionController.js'; +import * as RuleSectionController from '../../../../controllers/api/2014/ruleSectionController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import RuleSection from '../../../models/2014/ruleSection/index.js'; +import RuleSection from '../../../../models/2014/ruleSection/index.js'; import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; diff --git a/src/tests/controllers/api/rulesController.test.ts b/src/tests/controllers/api/2014/rulesController.test.ts similarity index 95% rename from src/tests/controllers/api/rulesController.test.ts rename to src/tests/controllers/api/2014/rulesController.test.ts index 3fea0983..2237374a 100644 --- a/src/tests/controllers/api/rulesController.test.ts +++ b/src/tests/controllers/api/2014/rulesController.test.ts @@ -1,10 +1,10 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as RulesController from '../../../controllers/api/2014/ruleController.js'; +import * as RulesController from '../../../../controllers/api/2014/ruleController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Rule from '../../../models/2014/rule/index.js'; +import Rule from '../../../../models/2014/rule/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/skillController.test.ts b/src/tests/controllers/api/2014/skillController.test.ts similarity index 93% rename from src/tests/controllers/api/skillController.test.ts rename to src/tests/controllers/api/2014/skillController.test.ts index 5400745c..bc4bcef6 100644 --- a/src/tests/controllers/api/skillController.test.ts +++ b/src/tests/controllers/api/2014/skillController.test.ts @@ -1,9 +1,9 @@ -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import skill from '../../../models/2014/skill/index.js'; -import skillController from '../../../controllers/api/2014/skillController.js'; +import skill from '../../../../models/2014/skill/index.js'; +import skillController from '../../../../controllers/api/2014/skillController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/spellController.test.ts b/src/tests/controllers/api/2014/spellController.test.ts similarity index 93% rename from src/tests/controllers/api/spellController.test.ts rename to src/tests/controllers/api/2014/spellController.test.ts index f3ee8f59..b703e40b 100644 --- a/src/tests/controllers/api/spellController.test.ts +++ b/src/tests/controllers/api/2014/spellController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as SpellController from '../../../controllers/api/2014/spellController.js'; +import * as SpellController from '../../../../controllers/api/2014/spellController.js'; -import { mockNext } from '../../support/requestHelpers.js'; -import Spell from '../../../models/2014/spell/index.js'; +import { mockNext } from '../../../support/requestHelpers.js'; +import Spell from '../../../../models/2014/spell/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/subclassController.test.ts b/src/tests/controllers/api/2014/subclassController.test.ts similarity index 96% rename from src/tests/controllers/api/subclassController.test.ts rename to src/tests/controllers/api/2014/subclassController.test.ts index ba1336de..27e60afc 100644 --- a/src/tests/controllers/api/subclassController.test.ts +++ b/src/tests/controllers/api/2014/subclassController.test.ts @@ -1,12 +1,12 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as SubclassController from '../../../controllers/api/2014/subclassController.js'; +import * as SubclassController from '../../../../controllers/api/2014/subclassController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Feature from '../../../models/2014/feature/index.js'; -import Level from '../../../models/2014/level/index.js'; -import Subclass from '../../../models/2014/subclass/index.js'; +import Feature from '../../../../models/2014/feature/index.js'; +import Level from '../../../../models/2014/level/index.js'; +import Subclass from '../../../../models/2014/subclass/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/subraceController.test.ts b/src/tests/controllers/api/2014/subraceController.test.ts similarity index 94% rename from src/tests/controllers/api/subraceController.test.ts rename to src/tests/controllers/api/2014/subraceController.test.ts index 5fc88ea5..88dcd959 100644 --- a/src/tests/controllers/api/subraceController.test.ts +++ b/src/tests/controllers/api/2014/subraceController.test.ts @@ -1,12 +1,12 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import * as SubraceController from '../../../controllers/api/2014/subraceController.js'; +import * as SubraceController from '../../../../controllers/api/2014/subraceController.js'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Proficiency from '../../../models/2014/proficiency/index.js'; -import Subrace from '../../../models/2014/subrace/index.js'; -import Trait from '../../../models/2014/trait/index.js'; +import Proficiency from '../../../../models/2014/proficiency/index.js'; +import Subrace from '../../../../models/2014/subrace/index.js'; +import Trait from '../../../../models/2014/trait/index.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/traitController.test.ts b/src/tests/controllers/api/2014/traitController.test.ts similarity index 93% rename from src/tests/controllers/api/traitController.test.ts rename to src/tests/controllers/api/2014/traitController.test.ts index ad5b6f45..258c1364 100644 --- a/src/tests/controllers/api/traitController.test.ts +++ b/src/tests/controllers/api/2014/traitController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import Trait from '../../../models/2014/trait/index.js'; -import TraitController from '../../../controllers/api/2014/traitController.js'; +import Trait from '../../../../models/2014/trait/index.js'; +import TraitController from '../../../../controllers/api/2014/traitController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/weaponPropertyController.test.ts b/src/tests/controllers/api/2014/weaponPropertyController.test.ts similarity index 92% rename from src/tests/controllers/api/weaponPropertyController.test.ts rename to src/tests/controllers/api/2014/weaponPropertyController.test.ts index be9440f7..bf979a86 100644 --- a/src/tests/controllers/api/weaponPropertyController.test.ts +++ b/src/tests/controllers/api/2014/weaponPropertyController.test.ts @@ -1,9 +1,9 @@ import mockingoose from 'mockingoose'; import { createRequest, createResponse } from 'node-mocks-http'; -import { mockNext } from '../../support/requestHelpers.js'; +import { mockNext } from '../../../support/requestHelpers.js'; -import WeaponProperty from '../../../models/2014/weaponProperty/index.js'; -import WeaponPropertyController from '../../../controllers/api/2014/weaponPropertyController.js'; +import WeaponProperty from '../../../../models/2014/weaponProperty/index.js'; +import WeaponPropertyController from '../../../../controllers/api/2014/weaponPropertyController.js'; beforeEach(() => { mockingoose.resetAll(); diff --git a/src/tests/controllers/api/v2014Controller.test.ts b/src/tests/controllers/api/v2014Controller.test.ts new file mode 100644 index 00000000..3333200a --- /dev/null +++ b/src/tests/controllers/api/v2014Controller.test.ts @@ -0,0 +1,40 @@ +import mockingoose from 'mockingoose'; +import { createRequest, createResponse } from 'node-mocks-http'; + +import * as ApiController from '../../../controllers/api/v2014Controller.js'; +import { mockNext } from '../../support/requestHelpers.js'; +import Collection from '../../../models/2014/collection/index.js'; + +beforeEach(() => { + mockingoose.resetAll(); +}); + +describe('index', () => { + const findDoc = [ + { + index: 'a', + }, + { + index: 'b', + }, + { + index: 'c', + }, + ]; + const expectedResponse = { + a: '/api/2014/a', + b: '/api/2014/b', + c: '/api/2014/c', + }; + const request = createRequest(); + + it('returns the routes', async () => { + const response = createResponse(); + mockingoose(Collection).toReturn(findDoc, 'find'); + + await ApiController.index(request, response, mockNext); + + expect(response.statusCode).toBe(200); + expect(JSON.parse(response._getData())).toStrictEqual(expectedResponse); + }); +}); diff --git a/src/tests/controllers/apiController.test.ts b/src/tests/controllers/apiController.test.ts index 01815c0b..504c865c 100644 --- a/src/tests/controllers/apiController.test.ts +++ b/src/tests/controllers/apiController.test.ts @@ -22,6 +22,7 @@ describe('index', () => { }, ]; const expectedResponse = { + '2014': '/api/2014', a: '/api/a', b: '/api/b', c: '/api/c', diff --git a/src/tests/integration/api/2014/abilityScores.itest.ts b/src/tests/integration/api/2014/abilityScores.itest.ts new file mode 100644 index 00000000..9a4c23da --- /dev/null +++ b/src/tests/integration/api/2014/abilityScores.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/ability-scores', () => { + it('should list ability scores', async () => { + const res = await request(app).get('/api/2014/ability-scores'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/ability-scores'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/ability-scores?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/ability-scores'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/ability-scores?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/ability-scores/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/ability-scores'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/ability-scores/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/ability-scores/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/classes.itest.ts b/src/tests/integration/api/2014/classes.itest.ts new file mode 100644 index 00000000..c045f03b --- /dev/null +++ b/src/tests/integration/api/2014/classes.itest.ts @@ -0,0 +1,192 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/classes', () => { + it('should list classes', async () => { + const res = await request(app).get('/api/2014/classes'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/classes?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/classes?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/classes/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/classes/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/classes/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + + describe('/api/2014/classes/:index/subclasses', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/subclasses`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/classes/:index/starting-equipment', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/starting-equipment`); + expect(res.statusCode).toEqual(200); + }); + }); + + describe('/api/2014/classes/:index/spellcasting', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/spellcasting`); + expect(res.statusCode).toEqual(200); + }); + }); + + describe('/api/2014/classes/:index/spells', () => { + it('returns objects', async () => { + const res = await request(app).get(`/api/classes/wizard/spells`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/classes/:index/features', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/features`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/classes/:index/proficiencies', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/proficiencies`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/classes/:index/multi-classing', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/multi-classing`); + expect(res.statusCode).toEqual(200); + }); + }); + + describe('/api/2014/classes/:index/levels', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/classes/${index}/levels`); + expect(res.statusCode).toEqual(200); + expect(res.body.length).not.toEqual(0); + expect(res.body.length).toEqual(20); + }); + + it('returns the subclass levels as well', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const classRes = await request(app).get(`/api/classes/${index}`); + const subclass = classRes.body.subclasses[0].index; + const res = await request(app).get(`/api/classes/${index}/levels?subclass=${subclass}`); + expect(res.statusCode).toEqual(200); + expect(res.body.length).not.toEqual(0); + expect(res.body.length).toBeGreaterThan(20); + }); + + describe('/api/2014/classes/:index/levels/:level', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const level = 1; + const res = await request(app).get(`/api/classes/${index}/levels/${level}`); + expect(res.statusCode).toEqual(200); + expect(res.body.level).toEqual(level); + }); + }); + + describe('/api/2014/classes/:index/levels/:level/spells', () => { + it('returns objects', async () => { + const index = 'wizard'; + const level = 1; + const res = await request(app).get(`/api/classes/${index}/levels/${level}/spells`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/classes/:index/levels/:level/features', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/classes'); + const index = indexRes.body.results[1].index; + const level = 1; + const res = await request(app).get(`/api/classes/${index}/levels/${level}/spells`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/conditions.itest.ts b/src/tests/integration/api/2014/conditions.itest.ts new file mode 100644 index 00000000..61acb0ad --- /dev/null +++ b/src/tests/integration/api/2014/conditions.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/conditions', () => { + it('should list conditions', async () => { + const res = await request(app).get('/api/2014/conditions'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/conditions'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/conditions?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/conditions'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/conditions?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/conditions/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/conditions'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/conditions/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/conditions/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/damageTypes.itest.ts b/src/tests/integration/api/2014/damageTypes.itest.ts new file mode 100644 index 00000000..0224fb84 --- /dev/null +++ b/src/tests/integration/api/2014/damageTypes.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/damage-types', () => { + it('should list damage types', async () => { + const res = await request(app).get('/api/2014/damage-types'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/damage-types'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/damage-types?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/damage-types'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/damage-types?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/damage-types/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/damage-types'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/damage-types/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/damage-types/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/equipment.itest.ts b/src/tests/integration/api/2014/equipment.itest.ts new file mode 100644 index 00000000..a8d683fd --- /dev/null +++ b/src/tests/integration/api/2014/equipment.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/equipment', () => { + it('should list equipment', async () => { + const res = await request(app).get('/api/2014/equipment'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/equipment'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/equipment?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/equipment'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/equipment?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/equipment/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/equipment'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/equipment/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/equipment/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/equipmentCategories.itest.ts b/src/tests/integration/api/2014/equipmentCategories.itest.ts new file mode 100644 index 00000000..248f1124 --- /dev/null +++ b/src/tests/integration/api/2014/equipmentCategories.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/equipment-categories', () => { + it('should list equipment categories', async () => { + const res = await request(app).get('/api/2014/equipment-categories'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/equipment-categories'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/equipment-categories?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/equipment-categories'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/equipment-categories?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/equipment-categories/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/equipment-categories'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/equipment-categories/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/equipment-categories/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/feats.itest.ts b/src/tests/integration/api/2014/feats.itest.ts new file mode 100644 index 00000000..02244f45 --- /dev/null +++ b/src/tests/integration/api/2014/feats.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/feats', () => { + it('should list feats', async () => { + const res = await request(app).get('/api/2014/feats'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/feats'); + const name = indexRes.body.results[0].name; + const res = await request(app).get(`/api/feats?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/feats'); + const name = indexRes.body.results[0].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/feats?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/feats/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/feats'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/feats/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/feats/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/features.itest.ts b/src/tests/integration/api/2014/features.itest.ts new file mode 100644 index 00000000..a58ffa7c --- /dev/null +++ b/src/tests/integration/api/2014/features.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/features', () => { + it('should list features', async () => { + const res = await request(app).get('/api/2014/features'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/features'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/features?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/features'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/features?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/features/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/features'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/features/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/features/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/languages.itest.ts b/src/tests/integration/api/2014/languages.itest.ts new file mode 100644 index 00000000..c644b1c7 --- /dev/null +++ b/src/tests/integration/api/2014/languages.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/languages', () => { + it('should list languages', async () => { + const res = await request(app).get('/api/2014/languages'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/languages'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/languages?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/languages'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/languages?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/languages/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/languages'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/languages/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/languages/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/magicItems.itest.ts b/src/tests/integration/api/2014/magicItems.itest.ts new file mode 100644 index 00000000..b18b6084 --- /dev/null +++ b/src/tests/integration/api/2014/magicItems.itest.ts @@ -0,0 +1,83 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/magic-items', () => { + it('should list magic items', async () => { + const res = await request(app).get('/api/2014/magic-items'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + it('should hit the cache', async () => { + await redisClient.del('/api/2014/magic-items'); + const clientSet = jest.spyOn(redisClient, 'set'); + let res = await request(app).get('/api/2014/magic-items'); + res = await request(app).get('/api/2014/magic-items'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + expect(clientSet).toHaveBeenCalledTimes(1); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/magic-items'); + const name = indexRes.body.results[5].name; + const res = await request(app).get(`/api/magic-items?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/magic-items'); + const name = indexRes.body.results[5].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/magic-items?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/magic-items/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/magic-items'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/magic-items/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/magic-items/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/magicSchools.itest.ts b/src/tests/integration/api/2014/magicSchools.itest.ts new file mode 100644 index 00000000..ea913364 --- /dev/null +++ b/src/tests/integration/api/2014/magicSchools.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/magic-schools', () => { + it('should list magic items', async () => { + const res = await request(app).get('/api/2014/magic-schools'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/magic-schools'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/magic-schools?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/magic-schools'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/magic-schools?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/magic-schools/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/magic-schools'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/magic-schools/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/magic-schools/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/monsters.itest.ts b/src/tests/integration/api/2014/monsters.itest.ts new file mode 100644 index 00000000..a4660728 --- /dev/null +++ b/src/tests/integration/api/2014/monsters.itest.ts @@ -0,0 +1,131 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/monsters', () => { + it('should list monsters', async () => { + const res = await request(app).get('/api/2014/monsters'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + it('should hit the cache', async () => { + await redisClient.del('/api/2014/monsters'); + const clientSet = jest.spyOn(redisClient, 'set'); + let res = await request(app).get('/api/2014/monsters'); + res = await request(app).get('/api/2014/monsters'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + expect(clientSet).toHaveBeenCalledTimes(1); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/monsters'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/monsters?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/monsters'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/monsters?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('with challenge_rating query', () => { + describe('with only one provided challenge rating', () => { + it('returns expected objects', async () => { + const expectedCR = 0.25; + const res = await request(app).get(`/api/monsters?challenge_rating=${expectedCR}`); + expect(res.statusCode).toEqual(200); + + const randomIndex = Math.floor(Math.random() * res.body.results.length); + const randomResult = res.body.results[randomIndex]; + + const indexRes = await request(app).get(`/api/monsters/${randomResult.index}`); + expect(indexRes.statusCode).toEqual(200); + expect(indexRes.body.challenge_rating).toEqual(expectedCR); + }); + }); + + describe('with many provided challenge ratings', () => { + it('returns expected objects', async () => { + const cr1 = 1; + const cr1Res = await request(app).get(`/api/monsters?challenge_rating=${cr1}`); + expect(cr1Res.statusCode).toEqual(200); + + const cr20 = 20; + const cr20Res = await request(app).get(`/api/monsters?challenge_rating=${cr20}`); + expect(cr20Res.statusCode).toEqual(200); + + const bothRes = await request(app).get( + `/api/monsters?challenge_rating=${cr1}&challenge_rating=${cr20}` + ); + expect(bothRes.statusCode).toEqual(200); + expect(bothRes.body.count).toEqual(cr1Res.body.count + cr20Res.body.count); + + const altBothRes = await request(app).get(`/api/monsters?challenge_rating=${cr1},${cr20}`); + expect(altBothRes.statusCode).toEqual(200); + expect(altBothRes.body.count).toEqual(cr1Res.body.count + cr20Res.body.count); + + const randomIndex = Math.floor(Math.random() * bothRes.body.results.length); + const randomResult = bothRes.body.results[randomIndex]; + + const indexRes = await request(app).get(`/api/monsters/${randomResult.index}`); + expect(indexRes.statusCode).toEqual(200); + expect( + indexRes.body.challenge_rating == cr1 || indexRes.body.challenge_rating == cr20 + ).toBeTruthy(); + }); + }); + }); + + describe('/api/2014/monsters/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/monsters'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/monsters/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/monsters/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/proficiencies.itest.ts b/src/tests/integration/api/2014/proficiencies.itest.ts new file mode 100644 index 00000000..a1ef266c --- /dev/null +++ b/src/tests/integration/api/2014/proficiencies.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/proficiencies', () => { + it('should list proficiencies', async () => { + const res = await request(app).get('/api/2014/proficiencies'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/proficiencies'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/proficiencies?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/proficiencies'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/proficiencies?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/proficiencies/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/proficiencies'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/proficiencies/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/proficiencies/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/races.itest.ts b/src/tests/integration/api/2014/races.itest.ts new file mode 100644 index 00000000..717b1def --- /dev/null +++ b/src/tests/integration/api/2014/races.itest.ts @@ -0,0 +1,102 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/races', () => { + it('should list races', async () => { + const res = await request(app).get('/api/2014/races'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/races'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/races?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/races'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/races?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/races/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/races'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/races/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/races/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + + describe('/api/2014/races/:index/subraces', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/races'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/races/${index}/subraces`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/races/:index/proficiencies', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/races'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/races/${index}/proficiencies`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/races/:index/traits', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/races'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/races/${index}/traits`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/ruleSections.itest.ts b/src/tests/integration/api/2014/ruleSections.itest.ts new file mode 100644 index 00000000..ab6b8f2f --- /dev/null +++ b/src/tests/integration/api/2014/ruleSections.itest.ts @@ -0,0 +1,105 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/rule-sections', () => { + it('should list rule sections', async () => { + const res = await request(app).get('/api/2014/rule-sections'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + it('should hit the cache', async () => { + await redisClient.del('/api/2014/rule-sections'); + const clientSet = jest.spyOn(redisClient, 'set'); + let res = await request(app).get('/api/2014/rule-sections'); + res = await request(app).get('/api/2014/rule-sections'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + expect(clientSet).toHaveBeenCalledTimes(1); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/rule-sections'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/rule-sections?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/rule-sections'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/rule-sections?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('with desc query', () => { + it('returns the object with matching desc', async () => { + const indexRes = await request(app).get('/api/2014/rule-sections'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/rule-sections/${index}`); + const name = res.body.name; + const descRes = await request(app).get(`/api/rule-sections?desc=${name}`); + expect(descRes.statusCode).toEqual(200); + expect(descRes.body.results[0].index).toEqual(index); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/rule-sections'); + const index = indexRes.body.results[1].index; + const name = indexRes.body.results[1].name; + const queryDesc = name.toLowerCase(); + const res = await request(app).get(`/api/rule-sections?desc=${queryDesc}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].index).toEqual(index); + }); + }); +}); + +describe('/api/2014/rule-sections/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/rule-sections'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/rule-sections/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/rule-sections/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); +}); diff --git a/src/tests/integration/api/2014/rules.itest.ts b/src/tests/integration/api/2014/rules.itest.ts new file mode 100644 index 00000000..26c01e94 --- /dev/null +++ b/src/tests/integration/api/2014/rules.itest.ts @@ -0,0 +1,105 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/rules', () => { + it('should list rules', async () => { + const res = await request(app).get('/api/2014/rules'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + it('should hit the cache', async () => { + await redisClient.del('/api/2014/rules'); + const clientSet = jest.spyOn(redisClient, 'set'); + let res = await request(app).get('/api/2014/rules'); + res = await request(app).get('/api/2014/rules'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + expect(clientSet).toHaveBeenCalledTimes(1); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/rules'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/rules?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/rules'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/rules?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('with desc query', () => { + it('returns the object with matching desc', async () => { + const indexRes = await request(app).get('/api/2014/rules'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/rules/${index}`); + const name = res.body.name; + const descRes = await request(app).get(`/api/rules?desc=${name}`); + expect(descRes.statusCode).toEqual(200); + expect(descRes.body.results[0].index).toEqual(index); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/rules'); + const index = indexRes.body.results[1].index; + const name = indexRes.body.results[1].name; + const queryDesc = name.toLowerCase(); + const res = await request(app).get(`/api/rules?desc=${queryDesc}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].index).toEqual(index); + }); + }); + + describe('/api/2014/rules/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/rules'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/rules/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/rules/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/skills.itest.ts b/src/tests/integration/api/2014/skills.itest.ts new file mode 100644 index 00000000..fbdba904 --- /dev/null +++ b/src/tests/integration/api/2014/skills.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/skills', () => { + it('should list skills', async () => { + const res = await request(app).get('/api/2014/skills'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/skills'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/skills?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/skills'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/skills?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/skills/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/skills'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/skills/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/skills/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/spells.itest.ts b/src/tests/integration/api/2014/spells.itest.ts new file mode 100644 index 00000000..414bd860 --- /dev/null +++ b/src/tests/integration/api/2014/spells.itest.ts @@ -0,0 +1,184 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/spells', () => { + it('should list spells', async () => { + const res = await request(app).get('/api/2014/spells'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + it('should hit the cache', async () => { + await redisClient.del('/api/2014/spells'); + const clientSet = jest.spyOn(redisClient, 'set'); + let res = await request(app).get('/api/2014/spells'); + res = await request(app).get('/api/2014/spells'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + expect(clientSet).toHaveBeenCalledTimes(1); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/spells'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/spells?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/spells'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/spells?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('with level query', () => { + it('returns expected objects', async () => { + const expectedLevel = 2; + const res = await request(app).get(`/api/spells?level=${expectedLevel}`); + expect(res.statusCode).toEqual(200); + + const randomIndex = Math.floor(Math.random() * res.body.results.length); + const randomResult = res.body.results[randomIndex]; + + const indexRes = await request(app).get(`/api/spells/${randomResult.index}`); + expect(indexRes.statusCode).toEqual(200); + expect(indexRes.body.level).toEqual(expectedLevel); + }); + + describe('with many provided level', () => { + it('returns expected objects', async () => { + const expectedLevel1 = 1; + const res1 = await request(app).get(`/api/spells?level=${expectedLevel1}`); + expect(res1.statusCode).toEqual(200); + + const expectLevel2 = 8; + const res2 = await request(app).get(`/api/spells?level=${expectLevel2}`); + expect(res2.statusCode).toEqual(200); + + const bothRes = await request(app).get( + `/api/spells?level=${expectedLevel1}&level=${expectLevel2}` + ); + expect(bothRes.statusCode).toEqual(200); + expect(bothRes.body.count).toEqual(res1.body.count + res2.body.count); + + const randomIndex = Math.floor(Math.random() * bothRes.body.results.length); + const randomResult = bothRes.body.results[randomIndex]; + + const indexRes = await request(app).get(`/api/spells/${randomResult.index}`); + expect(indexRes.statusCode).toEqual(200); + expect( + indexRes.body.level == expectedLevel1 || indexRes.body.level == expectLevel2 + ).toBeTruthy(); + }); + }); + }); + + describe('with school query', () => { + it('returns expected objects', async () => { + const expectedSchool = 'Illusion'; + const res = await request(app).get(`/api/spells?school=${expectedSchool}`); + expect(res.statusCode).toEqual(200); + + const randomIndex = Math.floor(Math.random() * res.body.results.length); + const randomResult = res.body.results[randomIndex]; + + const indexRes = await request(app).get(`/api/spells/${randomResult.index}`); + expect(indexRes.statusCode).toEqual(200); + expect(indexRes.body.school.name).toEqual(expectedSchool); + }); + + describe('with many provided schools', () => { + it('returns expected objects', async () => { + const expectedSchool1 = 'Illusion'; + const res1 = await request(app).get(`/api/spells?school=${expectedSchool1}`); + expect(res1.statusCode).toEqual(200); + + const expectedSchool2 = 'Evocation'; + const res2 = await request(app).get(`/api/spells?school=${expectedSchool2}`); + expect(res2.statusCode).toEqual(200); + + const bothRes = await request(app).get( + `/api/spells?school=${expectedSchool1}&school=${expectedSchool2}` + ); + expect(bothRes.statusCode).toEqual(200); + expect(bothRes.body.count).toEqual(res1.body.count + res2.body.count); + + const randomIndex = Math.floor(Math.random() * bothRes.body.results.length); + const randomResult = bothRes.body.results[randomIndex]; + + const indexRes = await request(app).get(`/api/spells/${randomResult.index}`); + expect(indexRes.statusCode).toEqual(200); + expect( + indexRes.body.school.name == expectedSchool1 || + indexRes.body.school.name == expectedSchool2 + ).toBeTruthy(); + }); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/spells'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/spells/${index}`); + const school = showRes.body.school.name; + const querySchool = school.toLowerCase(); + const res = await request(app).get(`/api/spells?school=${querySchool}`); + + const randomIndex = Math.floor(Math.random() * res.body.results.length); + const randomResult = res.body.results[randomIndex]; + + const queryRes = await request(app).get(`/api/spells/${randomResult.index}`); + expect(queryRes.statusCode).toEqual(200); + expect(queryRes.body.school.name).toEqual(school); + }); + }); + + describe('/api/2014/spells/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/spells'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/spells/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/spells/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/subclasses.itest.ts b/src/tests/integration/api/2014/subclasses.itest.ts new file mode 100644 index 00000000..323a2aa8 --- /dev/null +++ b/src/tests/integration/api/2014/subclasses.itest.ts @@ -0,0 +1,102 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/subclasses', () => { + it('should list subclasses', async () => { + const res = await request(app).get('/api/2014/subclasses'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/subclasses'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/subclasses?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/subclasses'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/subclasses?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/subclasses/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/subclasses'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/subclasses/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/subclasses/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + + describe('/api/2014/subclasses/:index/levels', () => { + it('returns objects', async () => { + const index = 'berserker'; + const res = await request(app).get(`/api/subclasses/${index}/levels`); + expect(res.statusCode).toEqual(200); + expect(res.body.length).not.toEqual(0); + }); + + describe('/api/2014/subclasses/:index/levels/:level', () => { + it('returns objects', async () => { + const index = 'berserker'; + const level = 3; + const res = await request(app).get(`/api/subclasses/${index}/levels/${level}`); + expect(res.statusCode).toEqual(200); + expect(res.body.level).toEqual(level); + }); + + describe('/api/2014/subclasses/:index/levels/:level/features', () => { + it('returns objects', async () => { + const index = 'berserker'; + const level = 3; + const res = await request(app).get(`/api/subclasses/${index}/levels/${level}/features`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/subraces.itest.ts b/src/tests/integration/api/2014/subraces.itest.ts new file mode 100644 index 00000000..150b939b --- /dev/null +++ b/src/tests/integration/api/2014/subraces.itest.ts @@ -0,0 +1,91 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/subraces', () => { + it('should list subraces', async () => { + const res = await request(app).get('/api/2014/subraces'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/subraces'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/subraces?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/subraces'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/subraces?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/subraces/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/subraces'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/subraces/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/subraces/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + + describe('/api/2014/subraces/:index/traits', () => { + it('returns objects', async () => { + const indexRes = await request(app).get('/api/2014/subraces'); + const index = indexRes.body.results[1].index; + const res = await request(app).get(`/api/subraces/${index}/traits`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + + describe('/api/2014/subraces/:index/proficiencies', () => { + it('returns objects', async () => { + const res = await request(app).get(`/api/subraces/high-elf/proficiencies`); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/traits.itest.ts b/src/tests/integration/api/2014/traits.itest.ts new file mode 100644 index 00000000..920029ac --- /dev/null +++ b/src/tests/integration/api/2014/traits.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/traits', () => { + it('should list traits', async () => { + const res = await request(app).get('/api/2014/traits'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/traits'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/traits?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/traits'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/traits?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/traits/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/traits'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/traits/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/traits/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/2014/weaponProperties.itest.ts b/src/tests/integration/api/2014/weaponProperties.itest.ts new file mode 100644 index 00000000..11b0099a --- /dev/null +++ b/src/tests/integration/api/2014/weaponProperties.itest.ts @@ -0,0 +1,73 @@ +import { mongodbUri, redisClient } from '../../../../util'; + +import { Application } from 'express'; +import { jest } from '@jest/globals'; +import createApp from '../../../../server'; + +import mongoose from 'mongoose'; +import request from 'supertest'; + +let app: Application; +let server: any; + +afterEach(() => { + jest.clearAllMocks(); +}); + +beforeAll(async () => { + await mongoose.connect(mongodbUri); + await redisClient.connect(); + app = await createApp(); + server = app.listen(); // Start the server and store the instance +}); + +afterAll(async () => { + await mongoose.disconnect(); + await redisClient.quit(); + server.close(); +}); + +describe('/api/2014/weapon-properties', () => { + it('should list weapon properties', async () => { + const res = await request(app).get('/api/2014/weapon-properties'); + expect(res.statusCode).toEqual(200); + expect(res.body.results.length).not.toEqual(0); + }); + + describe('with name query', () => { + it('returns the named object', async () => { + const indexRes = await request(app).get('/api/2014/weapon-properties'); + const name = indexRes.body.results[1].name; + const res = await request(app).get(`/api/weapon-properties?name=${name}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + + it('is case insensitive', async () => { + const indexRes = await request(app).get('/api/2014/weapon-properties'); + const name = indexRes.body.results[1].name; + const queryName = name.toLowerCase(); + const res = await request(app).get(`/api/weapon-properties?name=${queryName}`); + expect(res.statusCode).toEqual(200); + expect(res.body.results[0].name).toEqual(name); + }); + }); + + describe('/api/2014/weapon-properties/:index', () => { + it('should return one object', async () => { + const indexRes = await request(app).get('/api/2014/weapon-properties'); + const index = indexRes.body.results[0].index; + const showRes = await request(app).get(`/api/weapon-properties/${index}`); + expect(showRes.statusCode).toEqual(200); + expect(showRes.body.index).toEqual(index); + }); + + describe('with an invalid index', () => { + it('should return 404', async () => { + const invalidIndex = 'invalid-index'; + const showRes = await request(app).get(`/api/weapon-properties/${invalidIndex}`); + expect(showRes.statusCode).toEqual(404); + }); + }); + }); +}); diff --git a/src/tests/integration/api/abilityScores.itest.ts b/src/tests/integration/api/abilityScores.itest.ts index 51f0a914..55d788ab 100644 --- a/src/tests/integration/api/abilityScores.itest.ts +++ b/src/tests/integration/api/abilityScores.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/ability-scores', () => { diff --git a/src/tests/integration/api/classes.itest.ts b/src/tests/integration/api/classes.itest.ts index 106c38bc..5b137b8f 100644 --- a/src/tests/integration/api/classes.itest.ts +++ b/src/tests/integration/api/classes.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/classes', () => { diff --git a/src/tests/integration/api/conditions.itest.ts b/src/tests/integration/api/conditions.itest.ts index 0aeadaa0..d63cd275 100644 --- a/src/tests/integration/api/conditions.itest.ts +++ b/src/tests/integration/api/conditions.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/conditions', () => { diff --git a/src/tests/integration/api/damageTypes.itest.ts b/src/tests/integration/api/damageTypes.itest.ts index 6ff4fb1e..2c35d084 100644 --- a/src/tests/integration/api/damageTypes.itest.ts +++ b/src/tests/integration/api/damageTypes.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/damage-types', () => { diff --git a/src/tests/integration/api/equipment.itest.ts b/src/tests/integration/api/equipment.itest.ts index 1f7afbae..d1f9484f 100644 --- a/src/tests/integration/api/equipment.itest.ts +++ b/src/tests/integration/api/equipment.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/equipment', () => { diff --git a/src/tests/integration/api/equipmentCategories.itest.ts b/src/tests/integration/api/equipmentCategories.itest.ts index 6620f0a8..e7f61bb8 100644 --- a/src/tests/integration/api/equipmentCategories.itest.ts +++ b/src/tests/integration/api/equipmentCategories.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/equipment-categories', () => { diff --git a/src/tests/integration/api/feats.itest.ts b/src/tests/integration/api/feats.itest.ts index 8c0b8c3e..372304ab 100644 --- a/src/tests/integration/api/feats.itest.ts +++ b/src/tests/integration/api/feats.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/feats', () => { diff --git a/src/tests/integration/api/features.itest.ts b/src/tests/integration/api/features.itest.ts index ed18a18b..81bbf9bd 100644 --- a/src/tests/integration/api/features.itest.ts +++ b/src/tests/integration/api/features.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/features', () => { diff --git a/src/tests/integration/api/languages.itest.ts b/src/tests/integration/api/languages.itest.ts index e402ba7a..e81889c9 100644 --- a/src/tests/integration/api/languages.itest.ts +++ b/src/tests/integration/api/languages.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/languages', () => { diff --git a/src/tests/integration/api/magicItems.itest.ts b/src/tests/integration/api/magicItems.itest.ts index 61132463..c6254ffb 100644 --- a/src/tests/integration/api/magicItems.itest.ts +++ b/src/tests/integration/api/magicItems.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/magic-items', () => { diff --git a/src/tests/integration/api/magicSchools.itest.ts b/src/tests/integration/api/magicSchools.itest.ts index 4f88f817..6b46a381 100644 --- a/src/tests/integration/api/magicSchools.itest.ts +++ b/src/tests/integration/api/magicSchools.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/magic-schools', () => { diff --git a/src/tests/integration/api/monsters.itest.ts b/src/tests/integration/api/monsters.itest.ts index 3a5773fd..34fd1770 100644 --- a/src/tests/integration/api/monsters.itest.ts +++ b/src/tests/integration/api/monsters.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/monsters', () => { diff --git a/src/tests/integration/api/proficiencies.itest.ts b/src/tests/integration/api/proficiencies.itest.ts index 9f4366bd..5fe1bb0c 100644 --- a/src/tests/integration/api/proficiencies.itest.ts +++ b/src/tests/integration/api/proficiencies.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/proficiencies', () => { diff --git a/src/tests/integration/api/races.itest.ts b/src/tests/integration/api/races.itest.ts index a208c94e..4907f781 100644 --- a/src/tests/integration/api/races.itest.ts +++ b/src/tests/integration/api/races.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/races', () => { diff --git a/src/tests/integration/api/ruleSections.itest.ts b/src/tests/integration/api/ruleSections.itest.ts index 53c33043..72011eac 100644 --- a/src/tests/integration/api/ruleSections.itest.ts +++ b/src/tests/integration/api/ruleSections.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/rule-sections', () => { diff --git a/src/tests/integration/api/rules.itest.ts b/src/tests/integration/api/rules.itest.ts index 9828b973..54dd80dd 100644 --- a/src/tests/integration/api/rules.itest.ts +++ b/src/tests/integration/api/rules.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/rules', () => { diff --git a/src/tests/integration/api/skills.itest.ts b/src/tests/integration/api/skills.itest.ts index 68878c8c..95740946 100644 --- a/src/tests/integration/api/skills.itest.ts +++ b/src/tests/integration/api/skills.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/skills', () => { diff --git a/src/tests/integration/api/spells.itest.ts b/src/tests/integration/api/spells.itest.ts index abbbd6c5..d7f060ba 100644 --- a/src/tests/integration/api/spells.itest.ts +++ b/src/tests/integration/api/spells.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/spells', () => { diff --git a/src/tests/integration/api/subclasses.itest.ts b/src/tests/integration/api/subclasses.itest.ts index da196242..67658dea 100644 --- a/src/tests/integration/api/subclasses.itest.ts +++ b/src/tests/integration/api/subclasses.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/subclasses', () => { diff --git a/src/tests/integration/api/subraces.itest.ts b/src/tests/integration/api/subraces.itest.ts index 489fa1f5..08c59e04 100644 --- a/src/tests/integration/api/subraces.itest.ts +++ b/src/tests/integration/api/subraces.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/subraces', () => { diff --git a/src/tests/integration/api/traits.itest.ts b/src/tests/integration/api/traits.itest.ts index 81d788be..dbfcfabe 100644 --- a/src/tests/integration/api/traits.itest.ts +++ b/src/tests/integration/api/traits.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/traits', () => { diff --git a/src/tests/integration/api/weaponProperties.itest.ts b/src/tests/integration/api/weaponProperties.itest.ts index 7476ce50..0e3ccb08 100644 --- a/src/tests/integration/api/weaponProperties.itest.ts +++ b/src/tests/integration/api/weaponProperties.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/api/weapon-properties', () => { diff --git a/src/tests/integration/server.itest.ts b/src/tests/integration/server.itest.ts index 776ef347..07ecc665 100644 --- a/src/tests/integration/server.itest.ts +++ b/src/tests/integration/server.itest.ts @@ -7,6 +7,7 @@ import mongoose from 'mongoose'; import request from 'supertest'; let app: Application; +let server: any; afterEach(() => { jest.clearAllMocks(); @@ -16,11 +17,13 @@ beforeAll(async () => { await mongoose.connect(mongodbUri); await redisClient.connect(); app = await createApp(); + server = app.listen(); // Start the server and store the instance }); afterAll(async () => { await mongoose.disconnect(); await redisClient.quit(); + server.close(); }); describe('/', () => { @@ -52,3 +55,12 @@ describe('/api', () => { expect(res.body).not.toHaveProperty('levels'); }); }); + +describe('/api/2014', () => { + it('should list the endpoints', async () => { + const res = await request(app).get('/api/2014'); + expect(res.statusCode).toEqual(200); + expect(res.body).toHaveProperty('ability-scores'); + expect(res.body).not.toHaveProperty('levels'); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index a2bf7590..8827208f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,94 +1,15 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - /* Language and Environment */ - "target": "es5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ - // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - /* Modules */ - "module": "ESNext" /* Specify what module code is generated. */, - // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "resolveJsonModule": true, /* Enable importing .json files */ - // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ - /* JavaScript Support */ - "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */, - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist" /* Specify an output folder for all emitted files. */, - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, - "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - /* Type Checking */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ - // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ - // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "node", + "allowJs": true, + "outDir": "./dist", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true }, "include": [ "src/js/**/*.js", From 8f81d251d40f04af8940089138007284909f3152 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Fri, 27 Dec 2024 18:10:42 -0800 Subject: [PATCH 5/8] 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) => { From ba24043ac5022f7f308abacca2d23f17caea7df8 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Fri, 27 Dec 2024 18:18:20 -0800 Subject: [PATCH 6/8] Allow for versioned schemas --- src/middleware/apolloServer.ts | 3 +-- src/server.ts | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/middleware/apolloServer.ts b/src/middleware/apolloServer.ts index d5d59059..9eb151a8 100644 --- a/src/middleware/apolloServer.ts +++ b/src/middleware/apolloServer.ts @@ -1,9 +1,8 @@ import { ApolloServer } from '@apollo/server'; import { ApolloServerPluginCacheControl } from '@apollo/server/plugin/cacheControl'; import depthLimit from 'graphql-depth-limit'; -import schema from '../graphql/2014/schema.js'; -const createApolloMiddleware = async () => { +const createApolloMiddleware = async (schema: any) => { const server = new ApolloServer({ schema, plugins: [ diff --git a/src/server.ts b/src/server.ts index ef4d94c9..3c70ebfb 100644 --- a/src/server.ts +++ b/src/server.ts @@ -11,6 +11,7 @@ import morgan from 'morgan'; import docsController from './controllers/docsController.js'; import path from 'path'; import rateLimit from 'express-rate-limit'; +import schema2014 from './graphql/2014/schema.js'; const __filename = fileURLToPath(import.meta.url); @@ -41,13 +42,13 @@ export default async () => { app.use(limiter); console.log('Setting up Apollo GraphQL server'); - const apolloMiddleware = await createApolloMiddleware(); - await apolloMiddleware.start(); + const apolloMiddleware2014 = await createApolloMiddleware(schema2014); + await apolloMiddleware2014.start(); app.use( '/graphql', cors(), bodyParser.json(), - expressMiddleware(apolloMiddleware, { + expressMiddleware(apolloMiddleware2014, { context: async ({ req }) => ({ token: req.headers.token }), }) ); @@ -55,7 +56,7 @@ export default async () => { '/graphql/2014', cors(), bodyParser.json(), - expressMiddleware(apolloMiddleware, { + expressMiddleware(apolloMiddleware2014, { context: async ({ req }) => ({ token: req.headers.token }), }) ); From fb0c902dd55177a96d1bbdf36a52b387e84909e7 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Sun, 29 Dec 2024 11:38:54 -0800 Subject: [PATCH 7/8] Swagger updates --- src/swagger/api-spec/openapi.json | 532 ++++++++--------- src/swagger/api-spec/openapi.yml | 556 +++++++++--------- .../parameters/{ => 2014}/combined.yml | 0 .../{ => 2014}/path/ability-scores.yml | 0 .../parameters/{ => 2014}/path/alignments.yml | 0 .../{ => 2014}/path/backgrounds.yml | 0 .../parameters/{ => 2014}/path/classes.yml | 0 .../parameters/{ => 2014}/path/common.yml | 0 .../parameters/{ => 2014}/path/conditions.yml | 0 .../{ => 2014}/path/damage-types.yml | 0 .../parameters/{ => 2014}/path/equipment.yml | 2 +- .../parameters/{ => 2014}/path/features.yml | 2 +- .../parameters/{ => 2014}/path/languages.yml | 0 .../{ => 2014}/path/magic-schools.yml | 0 .../parameters/{ => 2014}/path/monsters.yml | 0 .../{ => 2014}/path/proficiencies.yml | 2 +- .../parameters/{ => 2014}/path/races.yml | 0 .../{ => 2014}/path/rule-sections.yml | 0 .../parameters/{ => 2014}/path/rules.yml | 0 .../parameters/{ => 2014}/path/skills.yml | 0 .../parameters/{ => 2014}/path/spells.yml | 2 +- .../parameters/{ => 2014}/path/subclasses.yml | 0 .../parameters/{ => 2014}/path/subraces.yml | 0 .../parameters/{ => 2014}/path/traits.yml | 0 .../{ => 2014}/path/weapon-properties.yml | 0 .../parameters/{ => 2014}/query/classes.yml | 0 .../parameters/{ => 2014}/query/monsters.yml | 0 .../parameters/{ => 2014}/query/spells.yml | 0 src/swagger/parameters/2024/.keepme | 0 .../paths/{ => 2014}/ability-scores.yml | 14 +- src/swagger/paths/{ => 2014}/alignments.yml | 6 +- src/swagger/paths/{ => 2014}/backgrounds.yml | 66 +-- src/swagger/paths/{ => 2014}/classes.yml | 166 +++--- src/swagger/paths/{ => 2014}/combined.yml | 0 src/swagger/paths/2014/common.yml | 56 ++ src/swagger/paths/{ => 2014}/conditions.yml | 12 +- src/swagger/paths/{ => 2014}/damage-types.yml | 10 +- .../paths/{ => 2014}/equipment-categories.yml | 16 +- src/swagger/paths/{ => 2014}/equipment.yml | 20 +- src/swagger/paths/{ => 2014}/feats.yml | 8 +- src/swagger/paths/{ => 2014}/features.yml | 16 +- src/swagger/paths/{ => 2014}/languages.yml | 6 +- src/swagger/paths/{ => 2014}/magic-items.yml | 6 +- .../paths/{ => 2014}/magic-schools.yml | 12 +- src/swagger/paths/{ => 2014}/monsters.yml | 34 +- .../paths/{ => 2014}/proficiencies.yml | 18 +- src/swagger/paths/{ => 2014}/races.yml | 42 +- .../paths/{ => 2014}/rule-sections.yml | 6 +- src/swagger/paths/{ => 2014}/rules.yml | 24 +- src/swagger/paths/{ => 2014}/skills.yml | 8 +- src/swagger/paths/{ => 2014}/spells.yml | 22 +- src/swagger/paths/{ => 2014}/subclasses.yml | 84 +-- src/swagger/paths/{ => 2014}/subraces.yml | 26 +- src/swagger/paths/{ => 2014}/traits.yml | 8 +- .../paths/{ => 2014}/weapon-properties.yml | 6 +- src/swagger/paths/2024/.keepme | 0 src/swagger/paths/common.yml | 56 -- .../schemas/{ => 2014}/ability-scores.yml | 0 src/swagger/schemas/{ => 2014}/alignments.yml | 0 src/swagger/schemas/{ => 2014}/armor.yml | 0 .../schemas/{ => 2014}/backgrounds.yml | 0 src/swagger/schemas/{ => 2014}/classes.yml | 0 src/swagger/schemas/{ => 2014}/combined.yml | 0 src/swagger/schemas/{ => 2014}/common.yml | 0 src/swagger/schemas/{ => 2014}/equipment.yml | 0 src/swagger/schemas/{ => 2014}/feats.yml | 0 src/swagger/schemas/{ => 2014}/features.yml | 0 .../schemas/{ => 2014}/game-mechanics.yml | 0 src/swagger/schemas/{ => 2014}/language.yml | 0 .../schemas/{ => 2014}/monsters-common.yml | 0 src/swagger/schemas/{ => 2014}/monsters.yml | 0 .../schemas/{ => 2014}/multiclassing.yml | 0 .../schemas/{ => 2014}/proficiencies.yml | 0 src/swagger/schemas/{ => 2014}/races.yml | 0 src/swagger/schemas/{ => 2014}/rules.yml | 0 src/swagger/schemas/{ => 2014}/skills.yml | 0 src/swagger/schemas/{ => 2014}/spell.yml | 0 .../schemas/{ => 2014}/spellcasting.yml | 0 src/swagger/schemas/{ => 2014}/subclass.yml | 0 src/swagger/schemas/{ => 2014}/subrace.yml | 0 src/swagger/schemas/{ => 2014}/traits.yml | 0 src/swagger/schemas/{ => 2014}/weapon.yml | 0 src/swagger/schemas/2024/.keepme | 0 src/swagger/swagger.yml | 203 ++++--- 84 files changed, 1023 insertions(+), 1024 deletions(-) rename src/swagger/parameters/{ => 2014}/combined.yml (100%) rename src/swagger/parameters/{ => 2014}/path/ability-scores.yml (100%) rename src/swagger/parameters/{ => 2014}/path/alignments.yml (100%) rename src/swagger/parameters/{ => 2014}/path/backgrounds.yml (100%) rename src/swagger/parameters/{ => 2014}/path/classes.yml (100%) rename src/swagger/parameters/{ => 2014}/path/common.yml (100%) rename src/swagger/parameters/{ => 2014}/path/conditions.yml (100%) rename src/swagger/parameters/{ => 2014}/path/damage-types.yml (100%) rename src/swagger/parameters/{ => 2014}/path/equipment.yml (84%) rename src/swagger/parameters/{ => 2014}/path/features.yml (85%) rename src/swagger/parameters/{ => 2014}/path/languages.yml (100%) rename src/swagger/parameters/{ => 2014}/path/magic-schools.yml (100%) rename src/swagger/parameters/{ => 2014}/path/monsters.yml (100%) rename src/swagger/parameters/{ => 2014}/path/proficiencies.yml (83%) rename src/swagger/parameters/{ => 2014}/path/races.yml (100%) rename src/swagger/parameters/{ => 2014}/path/rule-sections.yml (100%) rename src/swagger/parameters/{ => 2014}/path/rules.yml (100%) rename src/swagger/parameters/{ => 2014}/path/skills.yml (100%) rename src/swagger/parameters/{ => 2014}/path/spells.yml (85%) rename src/swagger/parameters/{ => 2014}/path/subclasses.yml (100%) rename src/swagger/parameters/{ => 2014}/path/subraces.yml (100%) rename src/swagger/parameters/{ => 2014}/path/traits.yml (100%) rename src/swagger/parameters/{ => 2014}/path/weapon-properties.yml (100%) rename src/swagger/parameters/{ => 2014}/query/classes.yml (100%) rename src/swagger/parameters/{ => 2014}/query/monsters.yml (100%) rename src/swagger/parameters/{ => 2014}/query/spells.yml (100%) create mode 100644 src/swagger/parameters/2024/.keepme rename src/swagger/paths/{ => 2014}/ability-scores.yml (79%) rename src/swagger/paths/{ => 2014}/alignments.yml (84%) rename src/swagger/paths/{ => 2014}/backgrounds.yml (81%) rename src/swagger/paths/{ => 2014}/classes.yml (72%) rename src/swagger/paths/{ => 2014}/combined.yml (100%) create mode 100644 src/swagger/paths/2014/common.yml rename src/swagger/paths/{ => 2014}/conditions.yml (78%) rename src/swagger/paths/{ => 2014}/damage-types.yml (74%) rename src/swagger/paths/{ => 2014}/equipment-categories.yml (69%) rename src/swagger/paths/{ => 2014}/equipment.yml (73%) rename src/swagger/paths/{ => 2014}/feats.yml (87%) rename src/swagger/paths/{ => 2014}/features.yml (80%) rename src/swagger/paths/{ => 2014}/languages.yml (84%) rename src/swagger/paths/{ => 2014}/magic-items.yml (86%) rename src/swagger/paths/{ => 2014}/magic-schools.yml (78%) rename src/swagger/paths/{ => 2014}/monsters.yml (87%) rename src/swagger/paths/{ => 2014}/proficiencies.yml (67%) rename src/swagger/paths/{ => 2014}/races.yml (74%) rename src/swagger/paths/{ => 2014}/rule-sections.yml (89%) rename src/swagger/paths/{ => 2014}/rules.yml (82%) rename src/swagger/paths/{ => 2014}/skills.yml (84%) rename src/swagger/paths/{ => 2014}/spells.yml (75%) rename src/swagger/paths/{ => 2014}/subclasses.yml (68%) rename src/swagger/paths/{ => 2014}/subraces.yml (66%) rename src/swagger/paths/{ => 2014}/traits.yml (80%) rename src/swagger/paths/{ => 2014}/weapon-properties.yml (85%) create mode 100644 src/swagger/paths/2024/.keepme delete mode 100644 src/swagger/paths/common.yml rename src/swagger/schemas/{ => 2014}/ability-scores.yml (100%) rename src/swagger/schemas/{ => 2014}/alignments.yml (100%) rename src/swagger/schemas/{ => 2014}/armor.yml (100%) rename src/swagger/schemas/{ => 2014}/backgrounds.yml (100%) rename src/swagger/schemas/{ => 2014}/classes.yml (100%) rename src/swagger/schemas/{ => 2014}/combined.yml (100%) rename src/swagger/schemas/{ => 2014}/common.yml (100%) rename src/swagger/schemas/{ => 2014}/equipment.yml (100%) rename src/swagger/schemas/{ => 2014}/feats.yml (100%) rename src/swagger/schemas/{ => 2014}/features.yml (100%) rename src/swagger/schemas/{ => 2014}/game-mechanics.yml (100%) rename src/swagger/schemas/{ => 2014}/language.yml (100%) rename src/swagger/schemas/{ => 2014}/monsters-common.yml (100%) rename src/swagger/schemas/{ => 2014}/monsters.yml (100%) rename src/swagger/schemas/{ => 2014}/multiclassing.yml (100%) rename src/swagger/schemas/{ => 2014}/proficiencies.yml (100%) rename src/swagger/schemas/{ => 2014}/races.yml (100%) rename src/swagger/schemas/{ => 2014}/rules.yml (100%) rename src/swagger/schemas/{ => 2014}/skills.yml (100%) rename src/swagger/schemas/{ => 2014}/spell.yml (100%) rename src/swagger/schemas/{ => 2014}/spellcasting.yml (100%) rename src/swagger/schemas/{ => 2014}/subclass.yml (100%) rename src/swagger/schemas/{ => 2014}/subrace.yml (100%) rename src/swagger/schemas/{ => 2014}/traits.yml (100%) rename src/swagger/schemas/{ => 2014}/weapon.yml (100%) create mode 100644 src/swagger/schemas/2024/.keepme diff --git a/src/swagger/api-spec/openapi.json b/src/swagger/api-spec/openapi.json index ad3bfb9a..1a6ac792 100644 --- a/src/swagger/api-spec/openapi.json +++ b/src/swagger/api-spec/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "D&D 5e API", - "description": "# Introduction\n\nWelcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API!\nThis documentation should help you familiarize yourself with the resources\navailable and how to consume them with HTTP requests. Read through the getting\nstarted section before you dive in. Most of your problems should be solved\njust by reading through it.\n\n## Getting Started\n\nLet's make our first API request to the D&D 5th Edition API!\n\nOpen up a terminal and use [curl](http://curl.haxx.se/) or [httpie](http://httpie.org/)\nto make an API request for a resource. You can also scroll through the\ndefinitions below and send requests directly from the endpoint documentation!\n\nFor example, if you paste and run this `curl` command:\n```bash\ncurl -X GET \"https://www.dnd5eapi.co/api/ability-scores/cha\" -H \"Accept: application/json\"\n```\n\nWe should see a result containing details about the Charisma ability score:\n```bash\n{\n \"index\": \"cha\",\n \"name\": \"CHA\",\n \"full_name\": \"Charisma\",\n \"desc\": [\n \"Charisma measures your ability to interact effectively with others. It\n includes such factors as confidence and eloquence, and it can represent\n a charming or commanding personality.\",\n \"A Charisma check might arise when you try to influence or entertain\n others, when you try to make an impression or tell a convincing lie,\n or when you are navigating a tricky social situation. The Deception,\n Intimidation, Performance, and Persuasion skills reflect aptitude in\n certain kinds of Charisma checks.\"\n ],\n \"skills\": [\n {\n \"name\": \"Deception\",\n \"index\": \"deception\",\n \"url\": \"/api/skills/deception\"\n },\n {\n \"name\": \"Intimidation\",\n \"index\": \"intimidation\",\n \"url\": \"/api/skills/intimidation\"\n },\n {\n \"name\": \"Performance\",\n \"index\": \"performance\",\n \"url\": \"/api/skills/performance\"\n },\n {\n \"name\": \"Persuasion\",\n \"index\": \"persuasion\",\n \"url\": \"/api/skills/persuasion\"\n }\n ],\n \"url\": \"/api/ability-scores/cha\"\n}\n```\n\n## Authentication\n\nThe dnd5eapi is a completely open API. No authentication is required to query\nand get data. This also means that we've limited what you can do to just\n`GET`-ing the data. If you find a mistake in the data, feel free to\n[message us](https://discord.gg/TQuYTv7).\n\n## GraphQL\n\nThis API supports [GraphQL](https://graphql.org/). The GraphQL URL for this API\nis `https://www.dnd5eapi.co/graphql`. Most of your questions regarding the GraphQL schema can be answered\nby querying the endpoint with the Apollo sandbox explorer.\n\n## Schemas\n\nDefinitions of all schemas will be accessible in a future update. Two of the most common schemas are described here.\n\n### `APIReference`\nRepresents a minimal representation of a resource. The detailed representation of the referenced resource can be retrieved by making a request to the referenced `URL`.\n```\nAPIReference {\n index string\n name string\n url string\n}\n```\n
\n\n### `DC`\nRepresents a difficulty check.\n```\nDC {\n dc_type APIReference\n dc_value number\n success_type \"none\" | \"half\" | \"other\"\n}\n```\n
\n\n### `Damage`\nRepresents damage.\n```\nDamage {\n damage_type APIReference\n damage_dice string\n}\n```\n
\n\n### `Choice`\nRepresents a choice made by a player. Commonly seen related to decisions made during character creation or combat (e.g.: the description of the cleric class, under **Proficiencies**, states \"Skills: Choose two from\tHistory, Insight, Medicine, Persuasion, and\tReligion\" [[SRD p15]](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=15))\n```\nChoice {\n desc string\n choose number\n type string\n from OptionSet\n}\n```\n
\n\n### `OptionSet`\nThe OptionSet structure provides the options to be chosen from, or sufficient data to fetch and interpret the options. All OptionSets have an `option_set_type` attribute that indicates the structure of the object that contains the options. The possible values are `options_array`, `equipment_category`, and `reference_list`. Other attributes on the OptionSet depend on the value of this attribute.\n- `options_array`\n - `options` (array): An array of Option objects. Each item in the array represents an option that can be chosen.\n- `equipment_category`\n - `equipment_category` (APIReference): A reference to an EquipmentCategory. Each item in the EquipmentCategory's `equipment` array represents one option that can be chosen.\n- `resource_list`\n - `resource_list_url` (string): A reference (by URL) to a collection in the database. The URL may include query parameters. Each item in the resulting ResourceList's `results` array represents one option that can be chosen.\n
\n\n### `Option`\nWhen the options are given in an `options_array`, each item in the array inherits from the Option structure. All Options have an `option_type` attribute that indicates the structure of the option. The value of this attribute indicates how the option should be handled, and each type has different attributes. The possible values and their corresponding attributes are listed below.\n- `reference` - A terminal option. Contains a reference to a Document that can be added to the list of options chosen.\n - `item` (APIReference): A reference to the chosen item.\n- `action` - A terminal option. Contains information describing an action, for use within Multiattack actions.\n - `action_name` (string): The name of the action, according to its `name` attribute.\n - `count` (number | string): The number of times this action can be repeated if this option is chosen.\n - `type` (string = `\"melee\" | \"ranged\" | \"ability\" | \"magic\"`, optional): For attack actions that can be either melee, ranged, abilities, or magic.\n- `multiple` - When this option is chosen, all of its child options are chosen, and must be resolved the same way as a normal option.\n - `items` (array): An array of Option objects. All of them must be taken if the option is chosen.\n- `choice` - A nested choice. If this option is chosen, the Choice structure contained within must be resolved like a normal Choice structure, and the results are the chosen options.\n - `choice` (Choice): The Choice to resolve.\n- `string` - A terminal option. Contains a reference to a string.\n - `string` (string): The string.\n- `ideal` - A terminal option. Contains information about an ideal.\n - `desc` (string): A description of the ideal.\n - `alignments` (ApiReference[]): A list of alignments of those who might follow the ideal.\n- `counted_reference` - A terminal option. Contains a reference to something else in the API along with a count.\n - `count` (number): Count.\n - `of` (ApiReference): Thing being referenced.\n- `score_prerequisite` - A terminal option. Contains a reference to an ability score and a minimum score.\n - `ability_score` (ApiReference): Ability score being referenced.\n - `minimum_score` (number): The minimum score required to satisfy the prerequisite.\n- `ability_bonus` - A terminal option. Contains a reference to an ability score and a bonus\n - `ability_score` (ApiReference): Ability score being referenced\n - `bonus` (number): The bonus being applied to the ability score\n- `breath` - A terminal option: Contains a reference to information about a breath attack.\n - `name` (string): Name of the breath.\n - `dc` (DC): Difficulty check of the breath attack.\n - `damage` ([Damage]): Damage dealt by the breath attack, if any.\n- `damage` - A terminal option. Contains information about damage.\n - `damage_type` (ApiReference): Reference to type of damage.\n - `damage_dice` (string): Damage expressed in dice (e.g. \"13d6\").\n - `notes` (string): Information regarding the damage.\n\n## FAQ\n\n### What is the SRD?\nThe SRD, or Systems Reference Document, contains guidelines for publishing content under the OGL. This allows for some of the data for D&D 5e to be open source. The API only covers data that can be found in the SRD. [Here's a link to the full text of the SRD.](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf)\n\n### What is the OGL?\nThe Open Game License (OGL) is a public copyright license by Wizards of the Coast that may be used by tabletop role-playing game developers to grant permission to modify, copy, and redistribute some of the content designed for their games, notably game mechanics. However, they must share-alike copies and derivative works. [More information about the OGL can be found here.](https://en.wikipedia.org/wiki/Open_Game_License)\n\n### A monster, spell, subclass, etc. is missing from the API / Database. Can I add it?\nPlease check if the data is within the SRD. If it is, feel free to open an issue or PR to add it yourself. Otherwise, due to legal reasons, we cannot add it.\n\n### Can this API be self hosted?\nYes it can! You can also host the data yourself if you don't want to use the API at all. You can also make changes and add extra data if you like. However, it is up to you to merge in new changes to the data and API.\n\n#### Can I publish is on ? Is this free use?\nYes, you can. The API itself is under the [MIT license](https://opensource.org/licenses/MIT), and the underlying data accessible via the API is supported under the SRD and OGL.\n\n# Status Page\n\nThe status page for the API can be found here: https://5e-bits.github.io/dnd-uptime/\n\n# Chat\n\nCome hang out with us [on Discord](https://discord.gg/TQuYTv7)!\n\n# Contribute\n\nThis API is built from two repositories.\n - The repo containing the data lives here: https://github.com/bagelbits/5e-database\n - The repo with the API implementation lives here: https://github.com/bagelbits/5e-srd-api\n\nThis is a evolving API and having fresh ideas are always welcome! You can\nopen an issue in either repo, open a PR for changes, or just discuss with\nother users in this discord.\n", + "description": "# Introduction\n\nWelcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API!\nThis documentation should help you familiarize yourself with the resources\navailable and how to consume them with HTTP requests. Read through the getting\nstarted section before you dive in. Most of your problems should be solved\njust by reading through it.\n\n## Getting Started\n\nLet's make our first API request to the D&D 5th Edition API!\n\nOpen up a terminal and use [curl](http://curl.haxx.se/) or [httpie](http://httpie.org/)\nto make an API request for a resource. You can also scroll through the\ndefinitions below and send requests directly from the endpoint documentation!\n\nFor example, if you paste and run this `curl` command:\n```bash\ncurl -X GET \"https://www.dnd5eapi.co/api/2014/ability-scores/cha\" -H \"Accept: application/json\"\n```\n\nWe should see a result containing details about the Charisma ability score:\n```bash\n{\n \"index\": \"cha\",\n \"name\": \"CHA\",\n \"full_name\": \"Charisma\",\n \"desc\": [\n \"Charisma measures your ability to interact effectively with others. It\n includes such factors as confidence and eloquence, and it can represent\n a charming or commanding personality.\",\n \"A Charisma check might arise when you try to influence or entertain\n others, when you try to make an impression or tell a convincing lie,\n or when you are navigating a tricky social situation. The Deception,\n Intimidation, Performance, and Persuasion skills reflect aptitude in\n certain kinds of Charisma checks.\"\n ],\n \"skills\": [\n {\n \"name\": \"Deception\",\n \"index\": \"deception\",\n \"url\": \"/api/2014/skills/deception\"\n },\n {\n \"name\": \"Intimidation\",\n \"index\": \"intimidation\",\n \"url\": \"/api/2014/skills/intimidation\"\n },\n {\n \"name\": \"Performance\",\n \"index\": \"performance\",\n \"url\": \"/api/2014/skills/performance\"\n },\n {\n \"name\": \"Persuasion\",\n \"index\": \"persuasion\",\n \"url\": \"/api/2014/skills/persuasion\"\n }\n ],\n \"url\": \"/api/2014/ability-scores/cha\"\n}\n```\n\n## Authentication\n\nThe dnd5eapi is a completely open API. No authentication is required to query\nand get data. This also means that we've limited what you can do to just\n`GET`-ing the data. If you find a mistake in the data, feel free to\n[message us](https://discord.gg/TQuYTv7).\n\n## GraphQL\n\nThis API supports [GraphQL](https://graphql.org/). The GraphQL URL for this API\nis `https://www.dnd5eapi.co/graphql`. Most of your questions regarding the GraphQL schema can be answered\nby querying the endpoint with the Apollo sandbox explorer.\n\n## Schemas\n\nDefinitions of all schemas will be accessible in a future update. Two of the most common schemas are described here.\n\n### `APIReference`\nRepresents a minimal representation of a resource. The detailed representation of the referenced resource can be retrieved by making a request to the referenced `URL`.\n```\nAPIReference {\n index string\n name string\n url string\n}\n```\n
\n\n### `DC`\nRepresents a difficulty check.\n```\nDC {\n dc_type APIReference\n dc_value number\n success_type \"none\" | \"half\" | \"other\"\n}\n```\n
\n\n### `Damage`\nRepresents damage.\n```\nDamage {\n damage_type APIReference\n damage_dice string\n}\n```\n
\n\n### `Choice`\nRepresents a choice made by a player. Commonly seen related to decisions made during character creation or combat (e.g.: the description of the cleric class, under **Proficiencies**, states \"Skills: Choose two from\tHistory, Insight, Medicine, Persuasion, and\tReligion\" [[SRD p15]](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=15))\n```\nChoice {\n desc string\n choose number\n type string\n from OptionSet\n}\n```\n
\n\n### `OptionSet`\nThe OptionSet structure provides the options to be chosen from, or sufficient data to fetch and interpret the options. All OptionSets have an `option_set_type` attribute that indicates the structure of the object that contains the options. The possible values are `options_array`, `equipment_category`, and `reference_list`. Other attributes on the OptionSet depend on the value of this attribute.\n- `options_array`\n - `options` (array): An array of Option objects. Each item in the array represents an option that can be chosen.\n- `equipment_category`\n - `equipment_category` (APIReference): A reference to an EquipmentCategory. Each item in the EquipmentCategory's `equipment` array represents one option that can be chosen.\n- `resource_list`\n - `resource_list_url` (string): A reference (by URL) to a collection in the database. The URL may include query parameters. Each item in the resulting ResourceList's `results` array represents one option that can be chosen.\n
\n\n### `Option`\nWhen the options are given in an `options_array`, each item in the array inherits from the Option structure. All Options have an `option_type` attribute that indicates the structure of the option. The value of this attribute indicates how the option should be handled, and each type has different attributes. The possible values and their corresponding attributes are listed below.\n- `reference` - A terminal option. Contains a reference to a Document that can be added to the list of options chosen.\n - `item` (APIReference): A reference to the chosen item.\n- `action` - A terminal option. Contains information describing an action, for use within Multiattack actions.\n - `action_name` (string): The name of the action, according to its `name` attribute.\n - `count` (number | string): The number of times this action can be repeated if this option is chosen.\n - `type` (string = `\"melee\" | \"ranged\" | \"ability\" | \"magic\"`, optional): For attack actions that can be either melee, ranged, abilities, or magic.\n- `multiple` - When this option is chosen, all of its child options are chosen, and must be resolved the same way as a normal option.\n - `items` (array): An array of Option objects. All of them must be taken if the option is chosen.\n- `choice` - A nested choice. If this option is chosen, the Choice structure contained within must be resolved like a normal Choice structure, and the results are the chosen options.\n - `choice` (Choice): The Choice to resolve.\n- `string` - A terminal option. Contains a reference to a string.\n - `string` (string): The string.\n- `ideal` - A terminal option. Contains information about an ideal.\n - `desc` (string): A description of the ideal.\n - `alignments` (ApiReference[]): A list of alignments of those who might follow the ideal.\n- `counted_reference` - A terminal option. Contains a reference to something else in the API along with a count.\n - `count` (number): Count.\n - `of` (ApiReference): Thing being referenced.\n- `score_prerequisite` - A terminal option. Contains a reference to an ability score and a minimum score.\n - `ability_score` (ApiReference): Ability score being referenced.\n - `minimum_score` (number): The minimum score required to satisfy the prerequisite.\n- `ability_bonus` - A terminal option. Contains a reference to an ability score and a bonus\n - `ability_score` (ApiReference): Ability score being referenced\n - `bonus` (number): The bonus being applied to the ability score\n- `breath` - A terminal option: Contains a reference to information about a breath attack.\n - `name` (string): Name of the breath.\n - `dc` (DC): Difficulty check of the breath attack.\n - `damage` ([Damage]): Damage dealt by the breath attack, if any.\n- `damage` - A terminal option. Contains information about damage.\n - `damage_type` (ApiReference): Reference to type of damage.\n - `damage_dice` (string): Damage expressed in dice (e.g. \"13d6\").\n - `notes` (string): Information regarding the damage.\n\n## FAQ\n\n### What is the SRD?\nThe SRD, or Systems Reference Document, contains guidelines for publishing content under the OGL. This allows for some of the data for D&D 5e to be open source. The API only covers data that can be found in the SRD. [Here's a link to the full text of the SRD.](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf)\n\n### What is the OGL?\nThe Open Game License (OGL) is a public copyright license by Wizards of the Coast that may be used by tabletop role-playing game developers to grant permission to modify, copy, and redistribute some of the content designed for their games, notably game mechanics. However, they must share-alike copies and derivative works. [More information about the OGL can be found here.](https://en.wikipedia.org/wiki/Open_Game_License)\n\n### A monster, spell, subclass, etc. is missing from the API / Database. Can I add it?\nPlease check if the data is within the SRD. If it is, feel free to open an issue or PR to add it yourself. Otherwise, due to legal reasons, we cannot add it.\n\n### Can this API be self hosted?\nYes it can! You can also host the data yourself if you don't want to use the API at all. You can also make changes and add extra data if you like. However, it is up to you to merge in new changes to the data and API.\n\n#### Can I publish is on ? Is this free use?\nYes, you can. The API itself is under the [MIT license](https://opensource.org/licenses/MIT), and the underlying data accessible via the API is supported under the SRD and OGL.\n\n# Status Page\n\nThe status page for the API can be found here: https://5e-bits.github.io/dnd-uptime/\n\n# Chat\n\nCome hang out with us [on Discord](https://discord.gg/TQuYTv7)!\n\n# Contribute\n\nThis API is built from two repositories.\n - The repo containing the data lives here: https://github.com/bagelbits/5e-database\n - The repo with the API implementation lives here: https://github.com/bagelbits/5e-srd-api\n\nThis is a evolving API and having fresh ideas are always welcome! You can\nopen an issue in either repo, open a PR for changes, or just discuss with\nother users in this discord.\n", "version": "0.1", "license": { "name": "MIT License", @@ -51,30 +51,30 @@ } }, "example": { - "ability-scores": "/api/ability-scores", - "alignments": "/api/alignments", - "backgrounds": "/api/backgrounds", - "classes": "/api/classes", - "conditions": "/api/conditions", - "damage-types": "/api/damage-types", - "equipment-categories": "/api/equipment-categories", - "equipment": "/api/equipment", - "feats": "/api/feats", - "features": "/api/features", - "languages": "/api/languages", - "magic-items": "/api/magic-items", - "magic-schools": "/api/magic-schools", - "monsters": "/api/monsters", - "proficiencies": "/api/proficiencies", - "races": "/api/races", - "rules": "/api/rules", - "rule-sections": "/api/rule-sections", - "skills": "/api/skills", - "spells": "/api/spells", - "subclasses": "/api/subclasses", - "subraces": "/api/subraces", - "traits": "/api/traits", - "weapon-properties": "/api/weapon-properties" + "ability-scores": "/api/2014/ability-scores", + "alignments": "/api/2014/alignments", + "backgrounds": "/api/2014/backgrounds", + "classes": "/api/2014/classes", + "conditions": "/api/2014/conditions", + "damage-types": "/api/2014/damage-types", + "equipment-categories": "/api/2014/equipment-categories", + "equipment": "/api/2014/equipment", + "feats": "/api/2014/feats", + "features": "/api/2014/features", + "languages": "/api/2014/languages", + "magic-items": "/api/2014/magic-items", + "magic-schools": "/api/2014/magic-schools", + "monsters": "/api/2014/monsters", + "proficiencies": "/api/2014/proficiencies", + "races": "/api/2014/races", + "rules": "/api/2014/rules", + "rule-sections": "/api/2014/rule-sections", + "skills": "/api/2014/skills", + "spells": "/api/2014/spells", + "subclasses": "/api/2014/subclasses", + "subraces": "/api/2014/subraces", + "traits": "/api/2014/traits", + "weapon-properties": "/api/2014/weapon-properties" } } } @@ -82,10 +82,10 @@ } } }, - "/api/{endpoint}": { + "/api/2014/{endpoint}": { "get": { "summary": "Get list of all available resources for an endpoint.", - "description": "Currently only the [`/spells`](#get-/api/spells) and [`/monsters`](#get-/api/monsters) endpoints support filtering with query parameters. Use of these query parameters is documented under the respective [Spells](#tag--Spells) and [Monsters](#tag--Monsters) sections.\n", + "description": "Currently only the [`/spells`](#get-/api/2014/spells) and [`/monsters`](#get-/api/2014/monsters) endpoints support filtering with query parameters. Use of these query parameters is documented under the respective [Spells](#tag--Spells) and [Monsters](#tag--Monsters) sections.\n", "tags": [ "Common" ], @@ -108,7 +108,7 @@ } } }, - "/api/ability-scores/{index}": { + "/api/2014/ability-scores/{index}": { "get": { "summary": "Get an ability score by index.", "description": "# Ability Score\n\nRepresents one of the six abilities that describes a creature's physical and mental characteristics. The three main rolls of the game - the ability check, the saving throw, and the attack roll - rely on the ability scores. [[SRD p76](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=76)]\n", @@ -131,7 +131,7 @@ "example": { "index": "cha", "name": "CHA", - "url": "/api/ability-scores/cha", + "url": "/api/2014/ability-scores/cha", "desc": [ "Charisma measures your ability to interact effectively with others. It includes such factors as confidence and eloquence, and it can represent a charming or commanding personality.", "A Charisma check might arise when you try to influence or entertain others, when you try to make an impression or tell a convincing lie, or when you are navigating a tricky social situation. The Deception, Intimidation, Performance, and Persuasion skills reflect aptitude in certain kinds of Charisma checks." @@ -141,22 +141,22 @@ { "index": "deception", "name": "Deception", - "url": "/api/skills/deception" + "url": "/api/2014/skills/deception" }, { "index": "intimidation", "name": "Intimidation", - "url": "/api/skills/intimidation" + "url": "/api/2014/skills/intimidation" }, { "index": "performance", "name": "Performance", - "url": "/api/skills/performance" + "url": "/api/2014/skills/performance" }, { "index": "persuasion", "name": "Persuasion", - "url": "/api/skills/persuasion" + "url": "/api/2014/skills/persuasion" } ] } @@ -166,7 +166,7 @@ } } }, - "/api/alignments/{index}": { + "/api/2014/alignments/{index}": { "get": { "summary": "Get an alignment by index.", "description": "# Alignment\n\nA typical creature in the game world has an alignment, which broadly describes its moral and personal attitudes. Alignment is a combination of two factors: one identifies morality (good, evil, or neutral), and the other describes attitudes toward society and order (lawful, chaotic, or neutral). Thus, nine distinct alignments define the possible combinations.[[SRD p58](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=58)]\n", @@ -189,7 +189,7 @@ "example": { "index": "chaotic-neutral", "name": "Chaotic Neutral", - "url": "/api/alignments/chaotic-neutral", + "url": "/api/2014/alignments/chaotic-neutral", "desc": "Chaotic neutral (CN) creatures follow their whims, holding their personal freedom above all else. Many barbarians and rogues, and some bards, are chaotic neutral.", "abbreviation": "CN" } @@ -199,7 +199,7 @@ } } }, - "/api/backgrounds/{index}": { + "/api/2014/backgrounds/{index}": { "get": { "summary": "Get a background by index.", "description": "# Background\n\nEvery story has a beginning. Your character's background reveals where you came from, how you became an adventurer, and your place in the world. Choosing a background provides you with important story cues about your character's identity. [[SRD p60](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=60)]\n\n_Note:_ acolyte is the only background included in the SRD.\n", @@ -226,12 +226,12 @@ { "index": "skill-insight", "name": "Skill: Insight", - "url": "/api/proficiencies/skill-insight" + "url": "/api/2014/proficiencies/skill-insight" }, { "index": "skill-religion", "name": "Skill: Religion", - "url": "/api/proficiencies/skill-religion" + "url": "/api/2014/proficiencies/skill-religion" } ], "language_options": { @@ -239,7 +239,7 @@ "type": "languages", "from": { "option_set_type": "resource_list", - "resource_list_url": "/api/languages" + "resource_list_url": "/api/2014/languages" } }, "starting_equipment": [ @@ -247,7 +247,7 @@ "equipment": { "index": "clothes-common", "name": "Clothes, common", - "url": "/api/equipment/clothes-common" + "url": "/api/2014/equipment/clothes-common" }, "quantity": 1 }, @@ -255,7 +255,7 @@ "equipment": { "index": "pouch", "name": "Pouch", - "url": "/api/equipment/pouch" + "url": "/api/2014/equipment/pouch" }, "quantity": 1 } @@ -269,7 +269,7 @@ "equipment_category": { "index": "holy-symbols", "name": "Holy Symbols", - "url": "/api/equipment-categories/holy-symbols" + "url": "/api/2014/equipment-categories/holy-symbols" } } } @@ -335,17 +335,17 @@ { "index": "lawful-good", "name": "Lawful Good", - "url": "/api/alignments/lawful-good" + "url": "/api/2014/alignments/lawful-good" }, { "index": "lawful-neutral", "name": "Lawful Neutral", - "url": "/api/alignments/lawful-neutral" + "url": "/api/2014/alignments/lawful-neutral" }, { "index": "lawful-evil", "name": "Lawful Evil", - "url": "/api/alignments/lawful-evil" + "url": "/api/2014/alignments/lawful-evil" } ] }, @@ -356,17 +356,17 @@ { "index": "lawful-good", "name": "Lawful Good", - "url": "/api/alignments/lawful-good" + "url": "/api/2014/alignments/lawful-good" }, { "index": "neutral-good", "name": "Neutral Good", - "url": "/api/alignments/neutral-good" + "url": "/api/2014/alignments/neutral-good" }, { "index": "chaotic-good", "name": "Chaotic Good", - "url": "/api/alignments/chaotic-good" + "url": "/api/2014/alignments/chaotic-good" } ] }, @@ -377,17 +377,17 @@ { "index": "chaotic-good", "name": "Chaotic Good", - "url": "/api/alignments/chaotic-good" + "url": "/api/2014/alignments/chaotic-good" }, { "index": "chaotic-neutral", "name": "Chaotic Neutral", - "url": "/api/alignments/chaotic-neutral" + "url": "/api/2014/alignments/chaotic-neutral" }, { "index": "chaotic-evil", "name": "Chaotic Evil", - "url": "/api/alignments/chaotic-evil" + "url": "/api/2014/alignments/chaotic-evil" } ] }, @@ -398,17 +398,17 @@ { "index": "lawful-good", "name": "Lawful Good", - "url": "/api/alignments/lawful-good" + "url": "/api/2014/alignments/lawful-good" }, { "index": "lawful-neutral", "name": "Lawful Neutral", - "url": "/api/alignments/lawful-neutral" + "url": "/api/2014/alignments/lawful-neutral" }, { "index": "lawful-evil", "name": "Lawful Evil", - "url": "/api/alignments/lawful-evil" + "url": "/api/2014/alignments/lawful-evil" } ] }, @@ -419,17 +419,17 @@ { "index": "lawful-good", "name": "Lawful Good", - "url": "/api/alignments/lawful-good" + "url": "/api/2014/alignments/lawful-good" }, { "index": "lawful-neutral", "name": "Lawful Neutral", - "url": "/api/alignments/lawful-neutral" + "url": "/api/2014/alignments/lawful-neutral" }, { "index": "lawful-evil", "name": "Lawful Evil", - "url": "/api/alignments/lawful-evil" + "url": "/api/2014/alignments/lawful-evil" } ] }, @@ -440,47 +440,47 @@ { "index": "lawful-good", "name": "Lawful Good", - "url": "/api/alignments/lawful-good" + "url": "/api/2014/alignments/lawful-good" }, { "index": "neutral-good", "name": "Neutral Good", - "url": "/api/alignments/neutral-good" + "url": "/api/2014/alignments/neutral-good" }, { "index": "chaotic-good", "name": "Chaotic Good", - "url": "/api/alignments/chaotic-good" + "url": "/api/2014/alignments/chaotic-good" }, { "index": "lawful-neutral", "name": "Lawful Neutral", - "url": "/api/alignments/lawful-neutral" + "url": "/api/2014/alignments/lawful-neutral" }, { "index": "neutral", "name": "Neutral", - "url": "/api/alignments/neutral" + "url": "/api/2014/alignments/neutral" }, { "index": "chaotic-neutral", "name": "Chaotic Neutral", - "url": "/api/alignments/chaotic-neutral" + "url": "/api/2014/alignments/chaotic-neutral" }, { "index": "lawful-evil", "name": "Lawful Evil", - "url": "/api/alignments/lawful-evil" + "url": "/api/2014/alignments/lawful-evil" }, { "index": "neutral-evil", "name": "Neutral Evil", - "url": "/api/alignments/neutral-evil" + "url": "/api/2014/alignments/neutral-evil" }, { "index": "chaotic-evil", "name": "Chaotic Evil", - "url": "/api/alignments/chaotic-evil" + "url": "/api/2014/alignments/chaotic-evil" } ] } @@ -553,7 +553,7 @@ ] } }, - "url": "/api/backgrounds/acolyte" + "url": "/api/2014/backgrounds/acolyte" } } } @@ -561,7 +561,7 @@ } } }, - "/api/classes/{index}": { + "/api/2014/classes/{index}": { "get": { "summary": "Get a class by index.", "description": "# Class\n\nA character class is a fundamental part of the identity and nature of\ncharacters in the Dungeons & Dragons role-playing game. A character's\ncapabilities, strengths, and weaknesses are largely defined by its class.\nA character's class affects a character's available skills and abilities. [[SRD p8-55](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=8)]\n", @@ -582,7 +582,7 @@ "$ref": "#/components/schemas/Class" }, "example": { - "class_levels": "/api/classes/barbarian/levels", + "class_levels": "/api/2014/classes/barbarian/levels", "hit_die": 12, "index": "barbarian", "multi_classing": { @@ -591,7 +591,7 @@ "ability_score": { "index": "str", "name": "STR", - "url": "/api/ability-scores/str" + "url": "/api/2014/ability-scores/str" }, "minimum_score": 13 } @@ -600,17 +600,17 @@ { "index": "shields", "name": "Shields", - "url": "/api/proficiencies/shields" + "url": "/api/2014/proficiencies/shields" }, { "index": "simple-weapons", "name": "Simple Weapons", - "url": "/api/proficiencies/simple-weapons" + "url": "/api/2014/proficiencies/simple-weapons" }, { "index": "martial-weapons", "name": "Martial Weapons", - "url": "/api/proficiencies/martial-weapons" + "url": "/api/2014/proficiencies/martial-weapons" } ], "proficiency_choices": [] @@ -620,27 +620,27 @@ { "index": "light-armor", "name": "Light Armor", - "url": "/api/proficiencies/light-armor" + "url": "/api/2014/proficiencies/light-armor" }, { "index": "medium-armor", "name": "Medium Armor", - "url": "/api/proficiencies/medium-armor" + "url": "/api/2014/proficiencies/medium-armor" }, { "index": "shields", "name": "Shields", - "url": "/api/proficiencies/shields" + "url": "/api/2014/proficiencies/shields" }, { "index": "simple-weapons", "name": "Simple Weapons", - "url": "/api/proficiencies/simple-weapons" + "url": "/api/2014/proficiencies/simple-weapons" }, { "index": "martial-weapons", "name": "Martial Weapons", - "url": "/api/proficiencies/martial-weapons" + "url": "/api/2014/proficiencies/martial-weapons" } ], "proficiency_choices": [ @@ -656,7 +656,7 @@ "item": { "index": "skill-animal-handling", "name": "Skill: Animal Handling", - "url": "/api/proficiencies/skill-animal-handling" + "url": "/api/2014/proficiencies/skill-animal-handling" } }, { @@ -664,7 +664,7 @@ "item": { "index": "skill-athletics", "name": "Skill: Athletics", - "url": "/api/proficiencies/skill-athletics" + "url": "/api/2014/proficiencies/skill-athletics" } }, { @@ -672,7 +672,7 @@ "item": { "index": "skill-intimidation", "name": "Skill: Intimidation", - "url": "/api/proficiencies/skill-intimidation" + "url": "/api/2014/proficiencies/skill-intimidation" } }, { @@ -680,7 +680,7 @@ "item": { "index": "skill-nature", "name": "Skill: Nature", - "url": "/api/proficiencies/skill-nature" + "url": "/api/2014/proficiencies/skill-nature" } }, { @@ -688,7 +688,7 @@ "item": { "index": "skill-perception", "name": "Skill: Perception", - "url": "/api/proficiencies/skill-perception" + "url": "/api/2014/proficiencies/skill-perception" } }, { @@ -696,7 +696,7 @@ "item": { "index": "skill-survival", "name": "Skill: Survival", - "url": "/api/proficiencies/skill-survival" + "url": "/api/2014/proficiencies/skill-survival" } } ] @@ -707,12 +707,12 @@ { "index": "str", "name": "STR", - "url": "/api/ability-scores/str" + "url": "/api/2014/ability-scores/str" }, { "index": "con", "name": "CON", - "url": "/api/ability-scores/con" + "url": "/api/2014/ability-scores/con" } ], "starting_equipment": [ @@ -720,7 +720,7 @@ "equipment": { "index": "explorers-pack", "name": "Explorer's Pack", - "url": "/api/equipment/explorers-pack" + "url": "/api/2014/equipment/explorers-pack" }, "quantity": 1 }, @@ -728,7 +728,7 @@ "equipment": { "index": "javelin", "name": "Javelin", - "url": "/api/equipment/javelin" + "url": "/api/2014/equipment/javelin" }, "quantity": 4 } @@ -747,7 +747,7 @@ "of": { "index": "greataxe", "name": "Greataxe", - "url": "/api/equipment/greataxe" + "url": "/api/2014/equipment/greataxe" } }, { @@ -761,7 +761,7 @@ "equipment_category": { "index": "martial-melee-weapons", "name": "Martial Melee Weapons", - "url": "/api/equipment-categories/martial-melee-weapons" + "url": "/api/2014/equipment-categories/martial-melee-weapons" } } } @@ -782,7 +782,7 @@ "of": { "index": "handaxe", "name": "Handaxe", - "url": "/api/equipment/handaxe" + "url": "/api/2014/equipment/handaxe" } }, { @@ -796,7 +796,7 @@ "equipment_category": { "index": "simple-weapons", "name": "Simple Weapons", - "url": "/api/equipment-categories/simple-weapons" + "url": "/api/2014/equipment-categories/simple-weapons" } } } @@ -809,10 +809,10 @@ { "index": "berserker", "name": "Berserker", - "url": "/api/subclasses/berserker" + "url": "/api/2014/subclasses/berserker" } ], - "url": "/api/classes/barbarian" + "url": "/api/2014/classes/barbarian" } } } @@ -820,7 +820,7 @@ } } }, - "/api/classes/{index}/subclasses": { + "/api/2014/classes/{index}/subclasses": { "get": { "summary": "Get subclasses available for a class.", "tags": [ @@ -845,7 +845,7 @@ { "index": "berserker", "name": "Berserker", - "url": "/api/subclasses/berserker" + "url": "/api/2014/subclasses/berserker" } ] } @@ -855,7 +855,7 @@ } } }, - "/api/classes/{index}/spells": { + "/api/2014/classes/{index}/spells": { "get": { "summary": "Get spells available for a class.", "tags": [ @@ -880,13 +880,13 @@ { "index": "power-word-kill", "name": "Power Word Kill", - "url": "/api/spells/power-word-kill", + "url": "/api/2014/spells/power-word-kill", "level": 9 }, { "index": "true-polymorph", "name": "True Polymorph", - "url": "/api/spells/true-polymorph", + "url": "/api/2014/spells/true-polymorph", "level": 9 } ] @@ -897,7 +897,7 @@ } } }, - "/api/classes/{index}/spellcasting": { + "/api/2014/classes/{index}/spellcasting": { "get": { "summary": "Get spellcasting info for a class.", "tags": [ @@ -921,7 +921,7 @@ "spellcasting_ability": { "index": "cha", "name": "CHA", - "url": "/api/ability-scores/cha" + "url": "/api/2014/ability-scores/cha" }, "info": [ { @@ -987,7 +987,7 @@ } } }, - "/api/classes/{index}/features": { + "/api/2014/classes/{index}/features": { "get": { "summary": "Get features available for a class.", "tags": [ @@ -1012,7 +1012,7 @@ } } }, - "/api/classes/{index}/proficiencies": { + "/api/2014/classes/{index}/proficiencies": { "get": { "summary": "Get proficiencies available for a class.", "tags": [ @@ -1037,7 +1037,7 @@ } } }, - "/api/classes/{index}/multi-classing": { + "/api/2014/classes/{index}/multi-classing": { "get": { "summary": "Get multiclassing resource for a class.", "tags": [ @@ -1062,7 +1062,7 @@ "ability_score": { "index": "str", "name": "STR", - "url": "/api/ability-scores/str" + "url": "/api/2014/ability-scores/str" }, "minimum_score": 13 } @@ -1071,17 +1071,17 @@ { "index": "shields", "name": "Shields", - "url": "/api/proficiencies/shields" + "url": "/api/2014/proficiencies/shields" }, { "index": "simple-weapons", "name": "Simple Weapons", - "url": "/api/proficiencies/simple-weapons" + "url": "/api/2014/proficiencies/simple-weapons" }, { "index": "martial-weapons", "name": "Martial Weapons", - "url": "/api/proficiencies/martial-weapons" + "url": "/api/2014/proficiencies/martial-weapons" } ], "proficiency_choices": [] @@ -1092,7 +1092,7 @@ } } }, - "/api/classes/{index}/levels": { + "/api/2014/classes/{index}/levels": { "get": { "summary": "Get all level resources for a class.", "tags": [ @@ -1123,7 +1123,7 @@ } } }, - "/api/classes/{index}/levels/{class_level}": { + "/api/2014/classes/{index}/levels/{class_level}": { "get": { "summary": "Get level resource for a class and level.", "tags": [ @@ -1153,12 +1153,12 @@ { "index": "rage", "name": "Rage", - "url": "/api/features/rage" + "url": "/api/2014/features/rage" }, { "index": "barbarian-unarmored-defense", "name": "Unarmored Defense", - "url": "/api/features/barbarian-unarmored-defense" + "url": "/api/2014/features/barbarian-unarmored-defense" } ], "class_specific": { @@ -1170,9 +1170,9 @@ "class": { "index": "barbarian", "name": "Barbarian", - "url": "/api/classes/barbarian" + "url": "/api/2014/classes/barbarian" }, - "url": "/api/classes/barbarian/levels/1" + "url": "/api/2014/classes/barbarian/levels/1" } } } @@ -1180,7 +1180,7 @@ } } }, - "/api/classes/{index}/levels/{class_level}/features": { + "/api/2014/classes/{index}/levels/{class_level}/features": { "get": { "summary": "Get features available to a class at the requested level.", "tags": [ @@ -1208,12 +1208,12 @@ { "index": "barbarian-unarmored-defense", "name": "Unarmored Defense", - "url": "/api/features/barbarian-unarmored-defense" + "url": "/api/2014/features/barbarian-unarmored-defense" }, { "index": "rage", "name": "Rage", - "url": "/api/features/rage" + "url": "/api/2014/features/rage" } ] } @@ -1223,7 +1223,7 @@ } } }, - "/api/classes/{index}/levels/{spell_level}/spells": { + "/api/2014/classes/{index}/levels/{spell_level}/spells": { "get": { "summary": "Get spells of the requested level available to the class.", "tags": [ @@ -1251,27 +1251,27 @@ { "index": "dominate-monster", "name": "Dominate Monster", - "url": "/api/spells/dominate-monster" + "url": "/api/2014/spells/dominate-monster" }, { "index": "earthquake", "name": "Earthquake", - "url": "/api/spells/earthquake" + "url": "/api/2014/spells/earthquake" }, { "index": "incendiary-cloud", "name": "Incendiary Cloud", - "url": "/api/spells/incendiary-cloud" + "url": "/api/2014/spells/incendiary-cloud" }, { "index": "power-word-stun", "name": "Power Word Stun", - "url": "/api/spells/power-word-stun" + "url": "/api/2014/spells/power-word-stun" }, { "index": "sunburst", "name": "Sunburst", - "url": "/api/spells/sunburst" + "url": "/api/2014/spells/sunburst" } ] } @@ -1281,10 +1281,10 @@ } } }, - "/api/conditions/{index}": { + "/api/2014/conditions/{index}": { "get": { "summary": "Get a condition by index.", - "description": "# Condition\n\nA condition alters a creature’s capabilities in a variety of ways and can \narise as a result of a spell, a class feature, a monster’s attack, or other \neffect. Most conditions, such as blinded, are impairments, but a few, such \nas invisible, can be advantageous.\n", + "description": "# Condition\n\nA condition alters a creature’s capabilities in a variety of ways and can\narise as a result of a spell, a class feature, a monster’s attack, or other\neffect. Most conditions, such as blinded, are impairments, but a few, such\nas invisible, can be advantageous.\n", "tags": [ "Game Mechanics" ], @@ -1304,7 +1304,7 @@ "example": { "index": "blinded", "name": "Blinded", - "url": "/api/conditions/blinded", + "url": "/api/2014/conditions/blinded", "desc": [ "- A blinded creature can't see and automatically fails any ability check that requires sight.", "- Attack rolls against the creature have advantage, and the creature's attack rolls have disadvantage." @@ -1316,10 +1316,10 @@ } } }, - "/api/damage-types/{index}": { + "/api/2014/damage-types/{index}": { "get": { "summary": "Get a damage type by index.", - "description": "# Damage type\n\nDifferent attacks, damaging spells, and other harmful effects deal different \ntypes of damage. Damage types have no rules of their own, but other rules, \nsuch as damage resistance, rely on the types.\n", + "description": "# Damage type\n\nDifferent attacks, damaging spells, and other harmful effects deal different\ntypes of damage. Damage types have no rules of their own, but other rules,\nsuch as damage resistance, rely on the types.\n", "tags": [ "Game Mechanics" ], @@ -1339,7 +1339,7 @@ "example": { "index": "acid", "name": "Acid", - "url": "/api/damage-types/acid", + "url": "/api/2014/damage-types/acid", "desc": [ "The corrosive spray of a black dragon's breath and the dissolving enzymes secreted by a black pudding deal acid damage." ] @@ -1350,10 +1350,10 @@ } } }, - "/api/equipment/{index}": { + "/api/2014/equipment/{index}": { "get": { "summary": "Get an equipment item by index.", - "description": "# Equipment\n\nOpportunities abound to find treasure, equipment, weapons, armor, and more \nin the dungeons you explore. Normally, you can sell your treasures and \ntrinkets when you return to a town or other settlement, provided that you \ncan find buyers and merchants interested in your loot.\n", + "description": "# Equipment\n\nOpportunities abound to find treasure, equipment, weapons, armor, and more\nin the dungeons you explore. Normally, you can sell your treasures and\ntrinkets when you return to a town or other settlement, provided that you\ncan find buyers and merchants interested in your loot.\n", "tags": [ "Equipment" ], @@ -1382,14 +1382,14 @@ "damage_type": { "index": "bludgeoning", "name": "Bludgeoning", - "url": "/api/damage-types/bludgeoning" + "url": "/api/2014/damage-types/bludgeoning" } }, "desc": [], "equipment_category": { "index": "weapon", "name": "Weapon", - "url": "/api/equipment-categories/weapon" + "url": "/api/2014/equipment-categories/weapon" }, "index": "club", "name": "Club", @@ -1397,12 +1397,12 @@ { "index": "light", "name": "Light", - "url": "/api/weapon-properties/light" + "url": "/api/2014/weapon-properties/light" }, { "index": "monk", "name": "Monk", - "url": "/api/weapon-properties/monk" + "url": "/api/2014/weapon-properties/monk" } ], "range": { @@ -1410,7 +1410,7 @@ "normal": 5 }, "special": [], - "url": "/api/equipment/club", + "url": "/api/2014/equipment/club", "weapon_category": "Simple", "weapon_range": "Melee", "weight": 2 @@ -1421,7 +1421,7 @@ } } }, - "/api/equipment-categories/{index}": { + "/api/2014/equipment-categories/{index}": { "get": { "summary": "Get an equipment category by index.", "description": "These are the categories that various equipment fall under.", @@ -1451,37 +1451,37 @@ "example": { "index": "waterborne-vehicles", "name": "Waterborne Vehicles", - "url": "/api/equipment-categories/waterborne-vehicles", + "url": "/api/2014/equipment-categories/waterborne-vehicles", "equipment": [ { "index": "galley", "name": "Galley", - "url": "/api/equipment/galley" + "url": "/api/2014/equipment/galley" }, { "index": "keelboat", "name": "Keelboat", - "url": "/api/equipment/keelboat" + "url": "/api/2014/equipment/keelboat" }, { "index": "longship", "name": "Longship", - "url": "/api/equipment/longship" + "url": "/api/2014/equipment/longship" }, { "index": "rowboat", "name": "Rowboat", - "url": "/api/equipment/rowboat" + "url": "/api/2014/equipment/rowboat" }, { "index": "sailing-ship", "name": "Sailing ship", - "url": "/api/equipment/sailing-ship" + "url": "/api/2014/equipment/sailing-ship" }, { "index": "warship", "name": "Warship", - "url": "/api/equipment/warship" + "url": "/api/2014/equipment/warship" } ] } @@ -1491,10 +1491,10 @@ } } }, - "/api/feats/{index}": { + "/api/2014/feats/{index}": { "get": { "summary": "Get a feat by index.", - "description": "# Feat \n\nA feat is a boon a character can receive at level up instead of an ability score increase.\n", + "description": "# Feat\n\nA feat is a boon a character can receive at level up instead of an ability score increase.\n", "tags": [ "Feats" ], @@ -1523,7 +1523,7 @@ "example": { "index": "grappler", "name": "Grappler", - "url": "/api/feats/grappler", + "url": "/api/2014/feats/grappler", "desc": [ "You’ve developed the Skills necessary to hold your own in close--quarters Grappling. You gain the following benefits:", "- You have advantage on Attack Rolls against a creature you are Grappling.", @@ -1534,7 +1534,7 @@ "ability_score": { "index": "str", "name": "STR", - "url": "/api/ability-scores/str" + "url": "/api/2014/ability-scores/str" }, "minimum_score": 13 } @@ -1546,10 +1546,10 @@ } } }, - "/api/features/{index}": { + "/api/2014/features/{index}": { "get": { "summary": "Get a feature by index.", - "description": "# Feature \n\nWhen you gain a new level in a class, you get its features for that level. \nYou don’t, however, receive the class’s starting Equipment, and a few \nfeatures have additional rules when you’re multiclassing: Channel Divinity, \nExtra Attack, Unarmored Defense, and Spellcasting.\n", + "description": "# Feature\n\nWhen you gain a new level in a class, you get its features for that level.\nYou don’t, however, receive the class’s starting Equipment, and a few\nfeatures have additional rules when you’re multiclassing: Channel Divinity,\nExtra Attack, Unarmored Defense, and Spellcasting.\n", "tags": [ "Features" ], @@ -1569,11 +1569,11 @@ "example": { "index": "action-surge-1-use", "name": "Action Surge (1 use)", - "url": "/api/features/action-surge-1-use", + "url": "/api/2014/features/action-surge-1-use", "class": { "index": "fighter", "name": "Fighter", - "url": "/api/classes/fighter" + "url": "/api/2014/classes/fighter" }, "desc": [ "Starting at 2nd level, you can push yourself beyond your normal limits for a moment. On your turn, you can take one additional action on top of your regular action and a possible bonus action.", @@ -1588,7 +1588,7 @@ } } }, - "/api/languages/{index}": { + "/api/2014/languages/{index}": { "get": { "summary": "Get a language by index.", "description": "# Language\n\nYour race indicates the languages your character can speak by default, and your background might give you access to one or more additional languages of your choice. [[SRD p59](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=59)]\n", @@ -1611,7 +1611,7 @@ "example": { "index": "elvish", "name": "Elvish", - "url": "/api/languages/elvish", + "url": "/api/2014/languages/elvish", "desc": "Elvish is fluid, with subtle intonations and intricate grammar. Elven literature is rich and varied, and their songs and poems are famous among other races. Many bards learn their language so they can add Elvish ballads to their repertoires.", "type": "Standard", "script": "Elvish", @@ -1625,7 +1625,7 @@ } } }, - "/api/magic-items/{index}": { + "/api/2014/magic-items/{index}": { "get": { "summary": "Get a magic item by index.", "description": "These are the various magic items you can find in the game.", @@ -1655,7 +1655,7 @@ "example": { "index": "adamantine-armor", "name": "Adamantine Armor", - "url": "/api/magic-items/adamantine-armor", + "url": "/api/2014/magic-items/adamantine-armor", "desc": [ "Armor (medium or heavy, but not hide), uncommon", "This suit of armor is reinforced with adamantine, one of the hardest substances in existence. While you're wearing it, any critical hit against you becomes a normal hit." @@ -1663,7 +1663,7 @@ "equipment_category": { "index": "armor", "name": "Armor", - "url": "/api/equipment-categories/armor" + "url": "/api/2014/equipment-categories/armor" }, "rarity": { "name": "Uncommon" @@ -1677,10 +1677,10 @@ } } }, - "/api/magic-schools/{index}": { + "/api/2014/magic-schools/{index}": { "get": { "summary": "Get a magic school by index.", - "description": "# Magic School\n\nAcademies of magic group spells into eight categories called schools of \nmagic. Scholars, particularly wizards, apply these categories to all spells, \nbelieving that all magic functions in essentially the same way, whether it \nderives from rigorous study or is bestowed by a deity.\n", + "description": "# Magic School\n\nAcademies of magic group spells into eight categories called schools of\nmagic. Scholars, particularly wizards, apply these categories to all spells,\nbelieving that all magic functions in essentially the same way, whether it\nderives from rigorous study or is bestowed by a deity.\n", "tags": [ "Game Mechanics" ], @@ -1700,7 +1700,7 @@ "example": { "index": "conjuration", "name": "Conjuration", - "url": "/api/magic-schools/conjuration", + "url": "/api/2014/magic-schools/conjuration", "desc": "Conjuration spells involve the transportation of objects and creatures from one location to another. Some spells summon creatures or objects to the caster's side, whereas others allow the caster to teleport to another location. Some conjurations create objects or effects out of nothing." } } @@ -1709,7 +1709,7 @@ } } }, - "/api/monsters": { + "/api/2014/monsters": { "get": { "summary": "Get list of monsters with optional filtering", "tags": [ @@ -1734,7 +1734,7 @@ } } }, - "/api/monsters/{index}": { + "/api/2014/monsters/{index}": { "get": { "summary": "Get monster by index.", "tags": [ @@ -1756,7 +1756,7 @@ "example": { "index": "aboleth", "name": "Aboleth", - "url": "/api/monsters/aboleth", + "url": "/api/2014/monsters/aboleth", "actions": [ { "attacks": [], @@ -1781,7 +1781,7 @@ "damage_type": { "index": "bludgeoning", "name": "Bludgeoning", - "url": "/api/damage-types/bludgeoning" + "url": "/api/2014/damage-types/bludgeoning" } }, { @@ -1789,7 +1789,7 @@ "damage_type": { "index": "acid", "name": "Acid", - "url": "/api/damage-types/acid" + "url": "/api/2014/damage-types/acid" } } ], @@ -1797,7 +1797,7 @@ "dc_type": { "index": "con", "name": "CON", - "url": "/api/ability-scores/con" + "url": "/api/2014/ability-scores/con" }, "dc_value": 14, "success_type": "none" @@ -1814,7 +1814,7 @@ "damage_type": { "index": "bludgeoning", "name": "Bludgeoning", - "url": "/api/damage-types/bludgeoning" + "url": "/api/2014/damage-types/bludgeoning" } } ], @@ -1828,7 +1828,7 @@ "dc_type": { "index": "wis", "name": "WIS", - "url": "/api/ability-scores/wis" + "url": "/api/2014/ability-scores/wis" }, "dc_value": 14, "success_type": "none" @@ -1882,7 +1882,7 @@ "damage_type": { "index": "psychic", "name": "Psychic", - "url": "/api/damage-types/psychic" + "url": "/api/2014/damage-types/psychic" } } ], @@ -1895,7 +1895,7 @@ "proficiency": { "index": "saving-throw-con", "name": "Saving Throw: CON", - "url": "/api/proficiencies/saving-throw-con" + "url": "/api/2014/proficiencies/saving-throw-con" }, "value": 6 }, @@ -1903,7 +1903,7 @@ "proficiency": { "index": "saving-throw-int", "name": "Saving Throw: INT", - "url": "/api/proficiencies/saving-throw-int" + "url": "/api/2014/proficiencies/saving-throw-int" }, "value": 8 }, @@ -1911,7 +1911,7 @@ "proficiency": { "index": "saving-throw-wis", "name": "Saving Throw: WIS", - "url": "/api/proficiencies/saving-throw-wis" + "url": "/api/2014/proficiencies/saving-throw-wis" }, "value": 6 }, @@ -1919,7 +1919,7 @@ "proficiency": { "index": "skill-history", "name": "Skill: History", - "url": "/api/proficiencies/skill-history" + "url": "/api/2014/proficiencies/skill-history" }, "value": 12 }, @@ -1927,7 +1927,7 @@ "proficiency": { "index": "skill-perception", "name": "Skill: Perception", - "url": "/api/proficiencies/skill-perception" + "url": "/api/2014/proficiencies/skill-perception" }, "value": 10 } @@ -1950,7 +1950,7 @@ "dc_type": { "index": "con", "name": "CON", - "url": "/api/ability-scores/con" + "url": "/api/2014/ability-scores/con" }, "dc_value": 14, "success_type": "none" @@ -1980,10 +1980,10 @@ } } }, - "/api/proficiencies/{index}": { + "/api/2014/proficiencies/{index}": { "get": { "summary": "Get a proficiency by index.", - "description": "# Proficiency \n\nBy virtue of race, class, and background a character is proficient at using certain skills, weapons, and equipment. Characters can also gain additional proficiencies at higher levels or by multiclassing. A characters starting proficiencies are determined during character creation.\n", + "description": "# Proficiency\n\nBy virtue of race, class, and background a character is proficient at using certain skills, weapons, and equipment. Characters can also gain additional proficiencies at higher levels or by multiclassing. A characters starting proficiencies are determined during character creation.\n", "tags": [ "Character Data" ], @@ -2003,35 +2003,35 @@ "example": { "index": "medium-armor", "name": "Medium Armor", - "url": "/api/proficiencies/medium-armor", + "url": "/api/2014/proficiencies/medium-armor", "type": "Armor", "classes": [ { "index": "barbarian", "name": "Barbarian", - "url": "/api/classes/barbarian" + "url": "/api/2014/classes/barbarian" }, { "index": "cleric", "name": "Cleric", - "url": "/api/classes/cleric" + "url": "/api/2014/classes/cleric" }, { "index": "druid", "name": "Druid", - "url": "/api/classes/druid" + "url": "/api/2014/classes/druid" }, { "index": "ranger", "name": "Ranger", - "url": "/api/classes/ranger" + "url": "/api/2014/classes/ranger" } ], "races": [], "reference": { "index": "medium-armor", "name": "Medium Armor", - "url": "/api/equipment-categories/medium-armor" + "url": "/api/2014/equipment-categories/medium-armor" } } } @@ -2040,7 +2040,7 @@ } } }, - "/api/races/{index}": { + "/api/2014/races/{index}": { "get": { "summary": "Get a race by index.", "description": "Each race grants your character ability and skill bonuses as well as racial traits.", @@ -2063,13 +2063,13 @@ "example": { "index": "elf", "name": "Elf", - "url": "/api/races/elf", + "url": "/api/2014/races/elf", "ability_bonuses": [ { "ability_score": { "index": "dex", "name": "DEX", - "url": "/api/ability-scores/dex" + "url": "/api/2014/ability-scores/dex" }, "bonus": 2 } @@ -2081,12 +2081,12 @@ { "index": "common", "name": "Common", - "url": "/api/languages/common" + "url": "/api/2014/languages/common" }, { "index": "elvish", "name": "Elvish", - "url": "/api/languages/elvish" + "url": "/api/2014/languages/elvish" } ], "size": "Medium", @@ -2096,31 +2096,31 @@ { "index": "skill-perception", "name": "Skill: Perception", - "url": "/api/proficiencies/skill-perception" + "url": "/api/2014/proficiencies/skill-perception" } ], "subraces": [ { "index": "high-elf", "name": "High Elf", - "url": "/api/subraces/high-elf" + "url": "/api/2014/subraces/high-elf" } ], "traits": [ { "index": "darkvision", "name": "Darkvision", - "url": "/api/traits/darkvision" + "url": "/api/2014/traits/darkvision" }, { "index": "fey-ancestry", "name": "Fey Ancestry", - "url": "/api/traits/fey-ancestry" + "url": "/api/2014/traits/fey-ancestry" }, { "index": "trance", "name": "Trance", - "url": "/api/traits/trance" + "url": "/api/2014/traits/trance" } ] } @@ -2130,7 +2130,7 @@ } } }, - "/api/races/{index}/subraces": { + "/api/2014/races/{index}/subraces": { "get": { "summary": "Get subraces available for a race.", "tags": [ @@ -2155,7 +2155,7 @@ } } }, - "/api/races/{index}/proficiencies": { + "/api/2014/races/{index}/proficiencies": { "get": { "summary": "Get proficiencies available for a race.", "tags": [ @@ -2180,7 +2180,7 @@ } } }, - "/api/races/{index}/traits": { + "/api/2014/races/{index}/traits": { "get": { "summary": "Get traits available for a race.", "tags": [ @@ -2205,7 +2205,7 @@ } } }, - "/api/rule-sections/{index}": { + "/api/2014/rule-sections/{index}": { "get": { "summary": "Get a rule section by index.", "description": "Rule sections represent a sub-heading and text that can be found underneath a rule heading in the SRD.", @@ -2228,7 +2228,7 @@ "example": { "index": "time", "name": "Time", - "url": "/api/rule-sections/time", + "url": "/api/2014/rule-sections/time", "desc": "## Time\n\nIn situations where keeping track of the passage of time is important, the GM determines the time a task requires. The GM might use a different time scale depending on the context of the situation at hand. In a dungeon environment, the adventurers' movement happens on a scale of **minutes**. It takes them about a minute to creep down a long hallway, another minute to check for traps on the door at the end of the hall, and a good ten minutes to search the chamber beyond for anything interesting or valuable.\n\nIn a city or wilderness, a scale of **hours** is often more appropriate. Adventurers eager to reach the lonely tower at the heart of the forest hurry across those fifteen miles in just under four hours' time.\n\nFor long journeys, a scale of **days** works best.\n\nFollowing the road from Baldur's Gate to Waterdeep, the adventurers spend four uneventful days before a goblin ambush interrupts their journey.\n\nIn combat and other fast-paced situations, the game relies on **rounds**, a 6-second span of time.\n" } } @@ -2237,10 +2237,10 @@ } } }, - "/api/rules/{index}": { + "/api/2014/rules/{index}": { "get": { "summary": "Get a rule by index.", - "description": "# Rule \n\nRules are pages in the SRD that document the mechanics of Dungeons and Dragons. \nRules have descriptions which is the text directly underneath the rule heading \nin the SRD. Rules also have subsections for each heading underneath the rule in the SRD.\n", + "description": "# Rule\n\nRules are pages in the SRD that document the mechanics of Dungeons and Dragons.\nRules have descriptions which is the text directly underneath the rule heading\nin the SRD. Rules also have subsections for each heading underneath the rule in the SRD.\n", "tags": [ "Rules" ], @@ -2260,38 +2260,38 @@ "example": { "index": "using-ability-scores", "name": "Using Ability Scores", - "url": "/api/rules/using-ability-scores", + "url": "/api/2014/rules/using-ability-scores", "desc": "# Using Ability Scores\n\nSix abilities provide a quick description of every creature's physical and mental characteristics:\n- **Strength**, measuring physical power\n- **Dexterity**, measuring agility\n- **Constitution**, measuring endurance\n- **Intelligence**, measuring reasoning and memory\n- **Wisdom**, measuring perception and insight\n- **Charisma**, measuring force of personality\n\nIs a character muscle-bound and insightful? Brilliant and charming? Nimble and hardy? Ability scores define these qualities-a creature's assets as well as weaknesses.\n\nThe three main rolls of the game-the ability check, the saving throw, and the attack roll-rely on the six ability scores. The book's introduction describes the basic rule behind these rolls: roll a d20, add an ability modifier derived from one of the six ability scores, and compare the total to a target number.\n\n**Ability Scores and Modifiers** Each of a creature's abilities has a score, a number that defines the magnitude of that ability. An ability score is not just a measure of innate capabilities, but also encompasses a creature's training and competence in activities related to that ability.\n\nA score of 10 or 11 is the normal human average, but adventurers and many monsters are a cut above average in most abilities. A score of 18 is the highest that a person usually reaches. Adventurers can have scores as high as 20, and monsters and divine beings can have scores as high as 30.\n\nEach ability also has a modifier, derived from the score and ranging from -5 (for an ability score of 1) to +10 (for a score of 30). The Ability Scores and Modifiers table notes the ability modifiers for the range of possible ability scores, from 1 to 30.\n", "subsections": [ { "index": "ability-scores-and-modifiers", "name": "Ability Scores and Modifiers", - "url": "/api/rule-sections/ability-scores-and-modifiers" + "url": "/api/2014/rule-sections/ability-scores-and-modifiers" }, { "index": "advantage-and-disadvantage", "name": "Advantage and Disadvantage", - "url": "/api/rule-sections/advantage-and-disadvantage" + "url": "/api/2014/rule-sections/advantage-and-disadvantage" }, { "index": "proficiency-bonus", "name": "Proficiency Bonus", - "url": "/api/rule-sections/proficiency-bonus" + "url": "/api/2014/rule-sections/proficiency-bonus" }, { "index": "ability-checks", "name": "Ability Checks", - "url": "/api/rule-sections/ability-checks" + "url": "/api/2014/rule-sections/ability-checks" }, { "index": "using-each-ability", "name": "Using Each Ability", - "url": "/api/rule-sections/using-each-ability" + "url": "/api/2014/rule-sections/using-each-ability" }, { "index": "saving-throws", "name": "Saving Throws", - "url": "/api/rule-sections/saving-throws" + "url": "/api/2014/rule-sections/saving-throws" } ] } @@ -2301,7 +2301,7 @@ } } }, - "/api/skills/{index}": { + "/api/2014/skills/{index}": { "get": { "summary": "Get a skill by index.", "description": "# Skill\n\nEach ability covers a broad range of capabilities, including skills that a character or a monster can be proficient in. A skill represents a specific aspect of an ability score, and an individual's proficiency in a skill demonstrates a focus on that aspect. [[SRD p77](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=77)]\n", @@ -2324,11 +2324,11 @@ "example": { "index": "acrobatics", "name": "Acrobatics", - "url": "/api/skills/acrobatics", + "url": "/api/2014/skills/acrobatics", "ability_score": { "index": "dex", "name": "DEX", - "url": "/api/ability-scores/dex" + "url": "/api/2014/ability-scores/dex" }, "desc": [ "Your Dexterity (Acrobatics) check covers your attempt to stay on your feet in a tricky situation, such as when you're trying to run across a sheet of ice, balance on a tightrope, or stay upright on a rocking ship's deck. The GM might also call for a Dexterity (Acrobatics) check to see if you can perform acrobatic stunts, including dives, rolls, somersaults, and flips." @@ -2340,7 +2340,7 @@ } } }, - "/api/spells": { + "/api/2014/spells": { "get": { "summary": "Get list of spells with optional filtering.", "tags": [ @@ -2368,7 +2368,7 @@ } } }, - "/api/spells/{index}": { + "/api/2014/spells/{index}": { "get": { "summary": "Get a spell by index.", "tags": [ @@ -2390,14 +2390,14 @@ "example": { "index": "sacred-flame", "name": "Sacred Flame", - "url": "/api/spells/sacred-flame", + "url": "/api/2014/spells/sacred-flame", "attack_type": "ranged", "casting_time": "1 action", "classes": [ { "index": "cleric", "name": "Cleric", - "url": "/api/classes/cleric" + "url": "/api/2014/classes/cleric" } ], "components": [ @@ -2415,7 +2415,7 @@ "damage_type": { "index": "radiant", "name": "Radiant", - "url": "/api/damage-types/radiant" + "url": "/api/2014/damage-types/radiant" } }, "dc": { @@ -2423,7 +2423,7 @@ "dc_type": { "index": "dex", "name": "DEX", - "url": "/api/ability-scores/dex" + "url": "/api/2014/ability-scores/dex" } }, "desc": [ @@ -2438,13 +2438,13 @@ "school": { "index": "evocation", "name": "Evocation", - "url": "/api/magic-schools/evocation" + "url": "/api/2014/magic-schools/evocation" }, "subclasses": [ { "index": "lore", "name": "Lore", - "url": "/api/subclasses/lore" + "url": "/api/2014/subclasses/lore" } ] } @@ -2454,7 +2454,7 @@ } } }, - "/api/subclasses/{index}": { + "/api/2014/subclasses/{index}": { "get": { "summary": "Get a subclass by index.", "description": "Subclasses reflect the different paths a class may take as levels are gained.", @@ -2477,11 +2477,11 @@ "example": { "index": "fiend", "name": "Fiend", - "url": "/api/subclasses/fiend", + "url": "/api/2014/subclasses/fiend", "class": { "index": "warlock", "name": "Warlock", - "url": "/api/classes/warlock" + "url": "/api/2014/classes/warlock" }, "desc": [ "You have made a pact with a fiend from the lower planes of existence, a being whose aims are evil, even if you strive against those aims. Such beings desire the corruption or destruction of all things, ultimately including you. Fiends powerful enough to forge a pact include demon lords such as Demogorgon, Orcus, Fraz'Urb-luu, and Baphomet; archdevils such as Asmodeus, Dispater, Mephistopheles, and Belial; pit fiends and balors that are especially mighty; and ultroloths and other lords of the yugoloths." @@ -2493,13 +2493,13 @@ "index": "warlock-1", "name": "Warlock 1", "type": "level", - "url": "/api/classes/warlock/levels/1" + "url": "/api/2014/classes/warlock/levels/1" } ], "spell": { "index": "burning-hands", "name": "Burning Hands", - "url": "/api/spells/burning-hands" + "url": "/api/2014/spells/burning-hands" } }, { @@ -2508,13 +2508,13 @@ "index": "warlock-1", "name": "Warlock 1", "type": "level", - "url": "/api/classes/warlock/levels/1" + "url": "/api/2014/classes/warlock/levels/1" } ], "spell": { "index": "command", "name": "Command", - "url": "/api/spells/command" + "url": "/api/2014/spells/command" } }, { @@ -2523,13 +2523,13 @@ "index": "warlock-3", "name": "Warlock 3", "type": "level", - "url": "/api/classes/warlock/levels/3" + "url": "/api/2014/classes/warlock/levels/3" } ], "spell": { "index": "blindness-deafness", "name": "Blindness/Deafness", - "url": "/api/spells/blindness-deafness" + "url": "/api/2014/spells/blindness-deafness" } }, { @@ -2538,13 +2538,13 @@ "index": "warlock-3", "name": "Warlock 3", "type": "level", - "url": "/api/classes/warlock/levels/3" + "url": "/api/2014/classes/warlock/levels/3" } ], "spell": { "index": "scorching-ray", "name": "Scorching Ray", - "url": "/api/spells/scorching-ray" + "url": "/api/2014/spells/scorching-ray" } }, { @@ -2553,13 +2553,13 @@ "index": "warlock-5", "name": "Warlock 5", "type": "level", - "url": "/api/classes/warlock/levels/5" + "url": "/api/2014/classes/warlock/levels/5" } ], "spell": { "index": "fireball", "name": "Fireball", - "url": "/api/spells/fireball" + "url": "/api/2014/spells/fireball" } }, { @@ -2568,13 +2568,13 @@ "index": "warlock-5", "name": "Warlock 5", "type": "level", - "url": "/api/classes/warlock/levels/5" + "url": "/api/2014/classes/warlock/levels/5" } ], "spell": { "index": "stinking-cloud", "name": "Stinking Cloud", - "url": "/api/spells/stinking-cloud" + "url": "/api/2014/spells/stinking-cloud" } }, { @@ -2583,13 +2583,13 @@ "index": "warlock-7", "name": "Warlock 7", "type": "level", - "url": "/api/classes/warlock/levels/7" + "url": "/api/2014/classes/warlock/levels/7" } ], "spell": { "index": "fire-shield", "name": "Fire Shield", - "url": "/api/spells/fire-shield" + "url": "/api/2014/spells/fire-shield" } }, { @@ -2598,13 +2598,13 @@ "index": "warlock-7", "name": "Warlock 7", "type": "level", - "url": "/api/classes/warlock/levels/7" + "url": "/api/2014/classes/warlock/levels/7" } ], "spell": { "index": "wall-of-fire", "name": "Wall of Fire", - "url": "/api/spells/wall-of-fire" + "url": "/api/2014/spells/wall-of-fire" } }, { @@ -2613,13 +2613,13 @@ "index": "warlock-9", "name": "Warlock 9", "type": "level", - "url": "/api/classes/warlock/levels/9" + "url": "/api/2014/classes/warlock/levels/9" } ], "spell": { "index": "flame-strike", "name": "Flame Strike", - "url": "/api/spells/flame-strike" + "url": "/api/2014/spells/flame-strike" } }, { @@ -2628,18 +2628,18 @@ "index": "warlock-9", "name": "Warlock 9", "type": "level", - "url": "/api/classes/warlock/levels/9" + "url": "/api/2014/classes/warlock/levels/9" } ], "spell": { "index": "hallow", "name": "Hallow", - "url": "/api/spells/hallow" + "url": "/api/2014/spells/hallow" } } ], "subclass_flavor": "Otherworldly Patron", - "subclass_levels": "/api/subclasses/fiend/levels" + "subclass_levels": "/api/2014/subclasses/fiend/levels" } } } @@ -2647,7 +2647,7 @@ } } }, - "/api/subclasses/{index}/features": { + "/api/2014/subclasses/{index}/features": { "get": { "summary": "Get features available for a subclass.", "tags": [ @@ -2672,7 +2672,7 @@ } } }, - "/api/subclasses/{index}/levels": { + "/api/2014/subclasses/{index}/levels": { "get": { "summary": "Get all level resources for a subclass.", "tags": [ @@ -2700,7 +2700,7 @@ } } }, - "/api/subclasses/{index}/levels/{subclass_level}": { + "/api/2014/subclasses/{index}/levels/{subclass_level}": { "get": { "summary": "Get level resources for a subclass and level.", "tags": [ @@ -2732,24 +2732,24 @@ }, "example": { "index": "devotion-3", - "url": "/api/subclasses/devotion/levels/3", + "url": "/api/2014/subclasses/devotion/levels/3", "class": { "index": "paladin", "name": "Paladin", - "url": "/api/classes/paladin" + "url": "/api/2014/classes/paladin" }, "features": [ { "index": "channel-divinity", "name": "Channel Divinity", - "url": "/api/features/channel-divinity" + "url": "/api/2014/features/channel-divinity" } ], "level": 3, "subclass": { "index": "devotion", "name": "Devotion", - "url": "/api/subclasses/devotion" + "url": "/api/2014/subclasses/devotion" } } } @@ -2758,7 +2758,7 @@ } } }, - "/api/subclasses/{index}/levels/{subclass_level}/features": { + "/api/2014/subclasses/{index}/levels/{subclass_level}/features": { "get": { "summary": "Get features of the requested spell level available to the class.", "tags": [ @@ -2794,7 +2794,7 @@ } } }, - "/api/subraces/{index}": { + "/api/2014/subraces/{index}": { "get": { "summary": "Get a subrace by index.", "description": "Subraces reflect the different varieties of a certain parent race.", @@ -2817,13 +2817,13 @@ "example": { "index": "hill-dwarf", "name": "Hill Dwarf", - "url": "/api/subraces/hill-dwarf", + "url": "/api/2014/subraces/hill-dwarf", "ability_bonuses": [ { "ability_score": { "index": "wis", "name": "WIS", - "url": "/api/ability-scores/wis" + "url": "/api/2014/ability-scores/wis" }, "bonus": 1 } @@ -2833,13 +2833,13 @@ "race": { "index": "dwarf", "name": "Dwarf", - "url": "/api/races/dwarf" + "url": "/api/2014/races/dwarf" }, "racial_traits": [ { "index": "dwarven-toughness", "name": "Dwarven Toughness", - "url": "/api/traits/dwarven-toughness" + "url": "/api/2014/traits/dwarven-toughness" } ], "starting_proficiencies": [] @@ -2850,7 +2850,7 @@ } } }, - "/api/subraces/{index}/proficiencies": { + "/api/2014/subraces/{index}/proficiencies": { "get": { "summary": "Get proficiences available for a subrace.", "tags": [ @@ -2875,7 +2875,7 @@ } } }, - "/api/subraces/{index}/traits": { + "/api/2014/subraces/{index}/traits": { "get": { "summary": "Get traits available for a subrace.", "tags": [ @@ -2900,7 +2900,7 @@ } } }, - "/api/traits/{index}": { + "/api/2014/traits/{index}": { "get": { "summary": "Get a trait by index.", "tags": [ @@ -2922,7 +2922,7 @@ "example": { "index": "trance", "name": "Trance", - "url": "/api/traits/trance", + "url": "/api/2014/traits/trance", "desc": [ "Elves do not need to sleep. Instead, they meditate deeply, remaining semiconscious, for 4 hours a day. (The Common word for such meditation is \"trance.\") While meditating, you can dream after a fashion; such dreams are actually mental exercises that have become reflexive through years of practice. After resting this way, you gain the same benefit that a human does from 8 hours of sleep." ], @@ -2931,7 +2931,7 @@ { "index": "elf", "name": "Elf", - "url": "/api/races/elf" + "url": "/api/2014/races/elf" } ], "subraces": [] @@ -2942,7 +2942,7 @@ } } }, - "/api/weapon-properties/{index}": { + "/api/2014/weapon-properties/{index}": { "get": { "summary": "Get a weapon property by index.", "tags": [ @@ -2964,7 +2964,7 @@ "example": { "index": "ammunition", "name": "Ammunition", - "url": "/api/weapon-properties/ammunition", + "url": "/api/2014/weapon-properties/ammunition", "desc": [ "You can use a weapon that has the ammunition property to make a ranged attack only if you have ammunition to fire from the weapon. Each time you attack with the weapon, you expend one piece of ammunition. Drawing the ammunition from a quiver, case, or other container is part of the attack (you need a free hand to load a one-handed weapon).", "At the end of the battle, you can recover half your expended ammunition by taking a minute to search the battlefield. If you use a weapon that has the ammunition property to make a melee attack, you treat the weapon as an improvised weapon (see \"Improvised Weapons\" later in the section). A sling must be loaded to deal any damage when used in this way." @@ -3050,7 +3050,7 @@ "name": "index", "in": "path", "required": true, - "description": "The `index` of the proficiency to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `proficiencies`.\n", + "description": "The `index` of the proficiency to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `proficiencies`.\n", "schema": { "type": "string", "example": "medium-armor" @@ -3244,7 +3244,7 @@ "name": "index", "in": "path", "required": true, - "description": "The `index` of the equipment to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `equipment`.\n", + "description": "The `index` of the equipment to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `equipment`.\n", "schema": { "type": "string", "example": "club" @@ -3254,7 +3254,7 @@ "name": "index", "in": "path", "required": true, - "description": "The `index` of the feature to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `features`.\n", + "description": "The `index` of the feature to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `features`.\n", "schema": { "type": "string" }, @@ -3448,7 +3448,7 @@ "name": "index", "in": "path", "required": true, - "description": "The `index` of the `Spell` to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `spells`.\n", + "description": "The `index` of the `Spell` to get.\n\nAvailable values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `spells`.\n", "schema": { "type": "string", "example": "sacred-flame" diff --git a/src/swagger/api-spec/openapi.yml b/src/swagger/api-spec/openapi.yml index 74a234ac..bf7d1545 100644 --- a/src/swagger/api-spec/openapi.yml +++ b/src/swagger/api-spec/openapi.yml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: D&D 5e API - description: "# Introduction\n\nWelcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API!\nThis documentation should help you familiarize yourself with the resources\navailable and how to consume them with HTTP requests. Read through the getting\nstarted section before you dive in. Most of your problems should be solved\njust by reading through it.\n\n## Getting Started\n\nLet's make our first API request to the D&D 5th Edition API!\n\nOpen up a terminal and use [curl](http://curl.haxx.se/) or [httpie](http://httpie.org/)\nto make an API request for a resource. You can also scroll through the\ndefinitions below and send requests directly from the endpoint documentation!\n\nFor example, if you paste and run this `curl` command:\n```bash\ncurl -X GET \"https://www.dnd5eapi.co/api/ability-scores/cha\" -H \"Accept: application/json\"\n```\n\nWe should see a result containing details about the Charisma ability score:\n```bash\n{\n \"index\": \"cha\",\n \"name\": \"CHA\",\n \"full_name\": \"Charisma\",\n \"desc\": [\n \"Charisma measures your ability to interact effectively with others. It\n includes such factors as confidence and eloquence, and it can represent\n a charming or commanding personality.\",\n \"A Charisma check might arise when you try to influence or entertain\n others, when you try to make an impression or tell a convincing lie,\n or when you are navigating a tricky social situation. The Deception,\n Intimidation, Performance, and Persuasion skills reflect aptitude in\n certain kinds of Charisma checks.\"\n ],\n \"skills\": [\n {\n \"name\": \"Deception\",\n \"index\": \"deception\",\n \"url\": \"/api/skills/deception\"\n },\n {\n \"name\": \"Intimidation\",\n \"index\": \"intimidation\",\n \"url\": \"/api/skills/intimidation\"\n },\n {\n \"name\": \"Performance\",\n \"index\": \"performance\",\n \"url\": \"/api/skills/performance\"\n },\n {\n \"name\": \"Persuasion\",\n \"index\": \"persuasion\",\n \"url\": \"/api/skills/persuasion\"\n }\n ],\n \"url\": \"/api/ability-scores/cha\"\n}\n```\n\n## Authentication\n\nThe dnd5eapi is a completely open API. No authentication is required to query\nand get data. This also means that we've limited what you can do to just\n`GET`-ing the data. If you find a mistake in the data, feel free to\n[message us](https://discord.gg/TQuYTv7).\n\n## GraphQL\n\nThis API supports [GraphQL](https://graphql.org/). The GraphQL URL for this API\nis `https://www.dnd5eapi.co/graphql`. Most of your questions regarding the GraphQL schema can be answered\nby querying the endpoint with the Apollo sandbox explorer.\n\n## Schemas\n\nDefinitions of all schemas will be accessible in a future update. Two of the most common schemas are described here.\n\n### `APIReference`\nRepresents a minimal representation of a resource. The detailed representation of the referenced resource can be retrieved by making a request to the referenced `URL`.\n```\nAPIReference {\n index string\n name string\n url string\n}\n```\n
\n\n### `DC`\nRepresents a difficulty check.\n```\nDC {\n dc_type APIReference\n dc_value number\n success_type \"none\" | \"half\" | \"other\"\n}\n```\n
\n\n### `Damage`\nRepresents damage.\n```\nDamage {\n damage_type APIReference\n damage_dice string\n}\n```\n
\n\n### `Choice`\nRepresents a choice made by a player. Commonly seen related to decisions made during character creation or combat (e.g.: the description of the cleric class, under **Proficiencies**, states \"Skills: Choose two from\tHistory, Insight, Medicine, Persuasion, and\tReligion\" [[SRD p15]](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=15))\n```\nChoice {\n desc string\n choose number\n type string\n from OptionSet\n}\n```\n
\n\n### `OptionSet`\nThe OptionSet structure provides the options to be chosen from, or sufficient data to fetch and interpret the options. All OptionSets have an `option_set_type` attribute that indicates the structure of the object that contains the options. The possible values are `options_array`, `equipment_category`, and `reference_list`. Other attributes on the OptionSet depend on the value of this attribute.\n- `options_array`\n - `options` (array): An array of Option objects. Each item in the array represents an option that can be chosen.\n- `equipment_category`\n - `equipment_category` (APIReference): A reference to an EquipmentCategory. Each item in the EquipmentCategory's `equipment` array represents one option that can be chosen.\n- `resource_list`\n - `resource_list_url` (string): A reference (by URL) to a collection in the database. The URL may include query parameters. Each item in the resulting ResourceList's `results` array represents one option that can be chosen.\n
\n\n### `Option`\nWhen the options are given in an `options_array`, each item in the array inherits from the Option structure. All Options have an `option_type` attribute that indicates the structure of the option. The value of this attribute indicates how the option should be handled, and each type has different attributes. The possible values and their corresponding attributes are listed below.\n- `reference` - A terminal option. Contains a reference to a Document that can be added to the list of options chosen.\n - `item` (APIReference): A reference to the chosen item.\n- `action` - A terminal option. Contains information describing an action, for use within Multiattack actions.\n - `action_name` (string): The name of the action, according to its `name` attribute.\n - `count` (number | string): The number of times this action can be repeated if this option is chosen.\n - `type` (string = `\"melee\" | \"ranged\" | \"ability\" | \"magic\"`, optional): For attack actions that can be either melee, ranged, abilities, or magic.\n- `multiple` - When this option is chosen, all of its child options are chosen, and must be resolved the same way as a normal option.\n - `items` (array): An array of Option objects. All of them must be taken if the option is chosen.\n- `choice` - A nested choice. If this option is chosen, the Choice structure contained within must be resolved like a normal Choice structure, and the results are the chosen options.\n - `choice` (Choice): The Choice to resolve.\n- `string` - A terminal option. Contains a reference to a string.\n - `string` (string): The string.\n- `ideal` - A terminal option. Contains information about an ideal.\n - `desc` (string): A description of the ideal.\n - `alignments` (ApiReference[]): A list of alignments of those who might follow the ideal.\n- `counted_reference` - A terminal option. Contains a reference to something else in the API along with a count.\n - `count` (number): Count.\n - `of` (ApiReference): Thing being referenced.\n- `score_prerequisite` - A terminal option. Contains a reference to an ability score and a minimum score.\n - `ability_score` (ApiReference): Ability score being referenced.\n - `minimum_score` (number): The minimum score required to satisfy the prerequisite.\n- `ability_bonus` - A terminal option. Contains a reference to an ability score and a bonus\n - `ability_score` (ApiReference): Ability score being referenced\n - `bonus` (number): The bonus being applied to the ability score\n- `breath` - A terminal option: Contains a reference to information about a breath attack.\n - `name` (string): Name of the breath.\n - `dc` (DC): Difficulty check of the breath attack.\n - `damage` ([Damage]): Damage dealt by the breath attack, if any.\n- `damage` - A terminal option. Contains information about damage.\n - `damage_type` (ApiReference): Reference to type of damage.\n - `damage_dice` (string): Damage expressed in dice (e.g. \"13d6\").\n - `notes` (string): Information regarding the damage.\n\n## FAQ\n\n### What is the SRD?\nThe SRD, or Systems Reference Document, contains guidelines for publishing content under the OGL. This allows for some of the data for D&D 5e to be open source. The API only covers data that can be found in the SRD. [Here's a link to the full text of the SRD.](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf)\n\n### What is the OGL?\nThe Open Game License (OGL) is a public copyright license by Wizards of the Coast that may be used by tabletop role-playing game developers to grant permission to modify, copy, and redistribute some of the content designed for their games, notably game mechanics. However, they must share-alike copies and derivative works. [More information about the OGL can be found here.](https://en.wikipedia.org/wiki/Open_Game_License)\n\n### A monster, spell, subclass, etc. is missing from the API / Database. Can I add it?\nPlease check if the data is within the SRD. If it is, feel free to open an issue or PR to add it yourself. Otherwise, due to legal reasons, we cannot add it.\n\n### Can this API be self hosted?\nYes it can! You can also host the data yourself if you don't want to use the API at all. You can also make changes and add extra data if you like. However, it is up to you to merge in new changes to the data and API.\n\n#### Can I publish is on ? Is this free use?\nYes, you can. The API itself is under the [MIT license](https://opensource.org/licenses/MIT), and the underlying data accessible via the API is supported under the SRD and OGL.\n\n# Status Page\n\nThe status page for the API can be found here: https://5e-bits.github.io/dnd-uptime/\n\n# Chat\n\nCome hang out with us [on Discord](https://discord.gg/TQuYTv7)!\n\n# Contribute\n\nThis API is built from two repositories.\n - The repo containing the data lives here: https://github.com/bagelbits/5e-database\n - The repo with the API implementation lives here: https://github.com/bagelbits/5e-srd-api\n\nThis is a evolving API and having fresh ideas are always welcome! You can\nopen an issue in either repo, open a PR for changes, or just discuss with\nother users in this discord.\n" + description: "# Introduction\n\nWelcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API!\nThis documentation should help you familiarize yourself with the resources\navailable and how to consume them with HTTP requests. Read through the getting\nstarted section before you dive in. Most of your problems should be solved\njust by reading through it.\n\n## Getting Started\n\nLet's make our first API request to the D&D 5th Edition API!\n\nOpen up a terminal and use [curl](http://curl.haxx.se/) or [httpie](http://httpie.org/)\nto make an API request for a resource. You can also scroll through the\ndefinitions below and send requests directly from the endpoint documentation!\n\nFor example, if you paste and run this `curl` command:\n```bash\ncurl -X GET \"https://www.dnd5eapi.co/api/2014/ability-scores/cha\" -H \"Accept: application/json\"\n```\n\nWe should see a result containing details about the Charisma ability score:\n```bash\n{\n \"index\": \"cha\",\n \"name\": \"CHA\",\n \"full_name\": \"Charisma\",\n \"desc\": [\n \"Charisma measures your ability to interact effectively with others. It\n includes such factors as confidence and eloquence, and it can represent\n a charming or commanding personality.\",\n \"A Charisma check might arise when you try to influence or entertain\n others, when you try to make an impression or tell a convincing lie,\n or when you are navigating a tricky social situation. The Deception,\n Intimidation, Performance, and Persuasion skills reflect aptitude in\n certain kinds of Charisma checks.\"\n ],\n \"skills\": [\n {\n \"name\": \"Deception\",\n \"index\": \"deception\",\n \"url\": \"/api/2014/skills/deception\"\n },\n {\n \"name\": \"Intimidation\",\n \"index\": \"intimidation\",\n \"url\": \"/api/2014/skills/intimidation\"\n },\n {\n \"name\": \"Performance\",\n \"index\": \"performance\",\n \"url\": \"/api/2014/skills/performance\"\n },\n {\n \"name\": \"Persuasion\",\n \"index\": \"persuasion\",\n \"url\": \"/api/2014/skills/persuasion\"\n }\n ],\n \"url\": \"/api/2014/ability-scores/cha\"\n}\n```\n\n## Authentication\n\nThe dnd5eapi is a completely open API. No authentication is required to query\nand get data. This also means that we've limited what you can do to just\n`GET`-ing the data. If you find a mistake in the data, feel free to\n[message us](https://discord.gg/TQuYTv7).\n\n## GraphQL\n\nThis API supports [GraphQL](https://graphql.org/). The GraphQL URL for this API\nis `https://www.dnd5eapi.co/graphql`. Most of your questions regarding the GraphQL schema can be answered\nby querying the endpoint with the Apollo sandbox explorer.\n\n## Schemas\n\nDefinitions of all schemas will be accessible in a future update. Two of the most common schemas are described here.\n\n### `APIReference`\nRepresents a minimal representation of a resource. The detailed representation of the referenced resource can be retrieved by making a request to the referenced `URL`.\n```\nAPIReference {\n index string\n name string\n url string\n}\n```\n
\n\n### `DC`\nRepresents a difficulty check.\n```\nDC {\n dc_type APIReference\n dc_value number\n success_type \"none\" | \"half\" | \"other\"\n}\n```\n
\n\n### `Damage`\nRepresents damage.\n```\nDamage {\n damage_type APIReference\n damage_dice string\n}\n```\n
\n\n### `Choice`\nRepresents a choice made by a player. Commonly seen related to decisions made during character creation or combat (e.g.: the description of the cleric class, under **Proficiencies**, states \"Skills: Choose two from\tHistory, Insight, Medicine, Persuasion, and\tReligion\" [[SRD p15]](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=15))\n```\nChoice {\n desc string\n choose number\n type string\n from OptionSet\n}\n```\n
\n\n### `OptionSet`\nThe OptionSet structure provides the options to be chosen from, or sufficient data to fetch and interpret the options. All OptionSets have an `option_set_type` attribute that indicates the structure of the object that contains the options. The possible values are `options_array`, `equipment_category`, and `reference_list`. Other attributes on the OptionSet depend on the value of this attribute.\n- `options_array`\n - `options` (array): An array of Option objects. Each item in the array represents an option that can be chosen.\n- `equipment_category`\n - `equipment_category` (APIReference): A reference to an EquipmentCategory. Each item in the EquipmentCategory's `equipment` array represents one option that can be chosen.\n- `resource_list`\n - `resource_list_url` (string): A reference (by URL) to a collection in the database. The URL may include query parameters. Each item in the resulting ResourceList's `results` array represents one option that can be chosen.\n
\n\n### `Option`\nWhen the options are given in an `options_array`, each item in the array inherits from the Option structure. All Options have an `option_type` attribute that indicates the structure of the option. The value of this attribute indicates how the option should be handled, and each type has different attributes. The possible values and their corresponding attributes are listed below.\n- `reference` - A terminal option. Contains a reference to a Document that can be added to the list of options chosen.\n - `item` (APIReference): A reference to the chosen item.\n- `action` - A terminal option. Contains information describing an action, for use within Multiattack actions.\n - `action_name` (string): The name of the action, according to its `name` attribute.\n - `count` (number | string): The number of times this action can be repeated if this option is chosen.\n - `type` (string = `\"melee\" | \"ranged\" | \"ability\" | \"magic\"`, optional): For attack actions that can be either melee, ranged, abilities, or magic.\n- `multiple` - When this option is chosen, all of its child options are chosen, and must be resolved the same way as a normal option.\n - `items` (array): An array of Option objects. All of them must be taken if the option is chosen.\n- `choice` - A nested choice. If this option is chosen, the Choice structure contained within must be resolved like a normal Choice structure, and the results are the chosen options.\n - `choice` (Choice): The Choice to resolve.\n- `string` - A terminal option. Contains a reference to a string.\n - `string` (string): The string.\n- `ideal` - A terminal option. Contains information about an ideal.\n - `desc` (string): A description of the ideal.\n - `alignments` (ApiReference[]): A list of alignments of those who might follow the ideal.\n- `counted_reference` - A terminal option. Contains a reference to something else in the API along with a count.\n - `count` (number): Count.\n - `of` (ApiReference): Thing being referenced.\n- `score_prerequisite` - A terminal option. Contains a reference to an ability score and a minimum score.\n - `ability_score` (ApiReference): Ability score being referenced.\n - `minimum_score` (number): The minimum score required to satisfy the prerequisite.\n- `ability_bonus` - A terminal option. Contains a reference to an ability score and a bonus\n - `ability_score` (ApiReference): Ability score being referenced\n - `bonus` (number): The bonus being applied to the ability score\n- `breath` - A terminal option: Contains a reference to information about a breath attack.\n - `name` (string): Name of the breath.\n - `dc` (DC): Difficulty check of the breath attack.\n - `damage` ([Damage]): Damage dealt by the breath attack, if any.\n- `damage` - A terminal option. Contains information about damage.\n - `damage_type` (ApiReference): Reference to type of damage.\n - `damage_dice` (string): Damage expressed in dice (e.g. \"13d6\").\n - `notes` (string): Information regarding the damage.\n\n## FAQ\n\n### What is the SRD?\nThe SRD, or Systems Reference Document, contains guidelines for publishing content under the OGL. This allows for some of the data for D&D 5e to be open source. The API only covers data that can be found in the SRD. [Here's a link to the full text of the SRD.](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf)\n\n### What is the OGL?\nThe Open Game License (OGL) is a public copyright license by Wizards of the Coast that may be used by tabletop role-playing game developers to grant permission to modify, copy, and redistribute some of the content designed for their games, notably game mechanics. However, they must share-alike copies and derivative works. [More information about the OGL can be found here.](https://en.wikipedia.org/wiki/Open_Game_License)\n\n### A monster, spell, subclass, etc. is missing from the API / Database. Can I add it?\nPlease check if the data is within the SRD. If it is, feel free to open an issue or PR to add it yourself. Otherwise, due to legal reasons, we cannot add it.\n\n### Can this API be self hosted?\nYes it can! You can also host the data yourself if you don't want to use the API at all. You can also make changes and add extra data if you like. However, it is up to you to merge in new changes to the data and API.\n\n#### Can I publish is on ? Is this free use?\nYes, you can. The API itself is under the [MIT license](https://opensource.org/licenses/MIT), and the underlying data accessible via the API is supported under the SRD and OGL.\n\n# Status Page\n\nThe status page for the API can be found here: https://5e-bits.github.io/dnd-uptime/\n\n# Chat\n\nCome hang out with us [on Discord](https://discord.gg/TQuYTv7)!\n\n# Contribute\n\nThis API is built from two repositories.\n - The repo containing the data lives here: https://github.com/bagelbits/5e-database\n - The repo with the API implementation lives here: https://github.com/bagelbits/5e-srd-api\n\nThis is a evolving API and having fresh ideas are always welcome! You can\nopen an issue in either repo, open a PR for changes, or just discuss with\nother users in this discord.\n" version: '0.1' license: name: MIT License @@ -34,35 +34,35 @@ paths: additionalProperties: type: string example: - ability-scores: /api/ability-scores - alignments: /api/alignments - backgrounds: /api/backgrounds - classes: /api/classes - conditions: /api/conditions - damage-types: /api/damage-types - equipment-categories: /api/equipment-categories - equipment: /api/equipment - feats: /api/feats - features: /api/features - languages: /api/languages - magic-items: /api/magic-items - magic-schools: /api/magic-schools - monsters: /api/monsters - proficiencies: /api/proficiencies - races: /api/races - rules: /api/rules - rule-sections: /api/rule-sections - skills: /api/skills - spells: /api/spells - subclasses: /api/subclasses - subraces: /api/subraces - traits: /api/traits - weapon-properties: /api/weapon-properties - '/api/{endpoint}': + ability-scores: /api/2014/ability-scores + alignments: /api/2014/alignments + backgrounds: /api/2014/backgrounds + classes: /api/2014/classes + conditions: /api/2014/conditions + damage-types: /api/2014/damage-types + equipment-categories: /api/2014/equipment-categories + equipment: /api/2014/equipment + feats: /api/2014/feats + features: /api/2014/features + languages: /api/2014/languages + magic-items: /api/2014/magic-items + magic-schools: /api/2014/magic-schools + monsters: /api/2014/monsters + proficiencies: /api/2014/proficiencies + races: /api/2014/races + rules: /api/2014/rules + rule-sections: /api/2014/rule-sections + skills: /api/2014/skills + spells: /api/2014/spells + subclasses: /api/2014/subclasses + subraces: /api/2014/subraces + traits: /api/2014/traits + weapon-properties: /api/2014/weapon-properties + '/api/2014/{endpoint}': get: summary: Get list of all available resources for an endpoint. description: | - Currently only the [`/spells`](#get-/api/spells) and [`/monsters`](#get-/api/monsters) endpoints support filtering with query parameters. Use of these query parameters is documented under the respective [Spells](#tag--Spells) and [Monsters](#tag--Monsters) sections. + Currently only the [`/spells`](#get-/api/2014/spells) and [`/monsters`](#get-/api/2014/monsters) endpoints support filtering with query parameters. Use of these query parameters is documented under the respective [Spells](#tag--Spells) and [Monsters](#tag--Monsters) sections. tags: - Common parameters: @@ -74,7 +74,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/ability-scores/{index}': + '/api/2014/ability-scores/{index}': get: summary: Get an ability score by index. description: | @@ -95,7 +95,7 @@ paths: example: index: cha name: CHA - url: /api/ability-scores/cha + url: /api/2014/ability-scores/cha desc: - 'Charisma measures your ability to interact effectively with others. It includes such factors as confidence and eloquence, and it can represent a charming or commanding personality.' - 'A Charisma check might arise when you try to influence or entertain others, when you try to make an impression or tell a convincing lie, or when you are navigating a tricky social situation. The Deception, Intimidation, Performance, and Persuasion skills reflect aptitude in certain kinds of Charisma checks.' @@ -103,17 +103,17 @@ paths: skills: - index: deception name: Deception - url: /api/skills/deception + url: /api/2014/skills/deception - index: intimidation name: Intimidation - url: /api/skills/intimidation + url: /api/2014/skills/intimidation - index: performance name: Performance - url: /api/skills/performance + url: /api/2014/skills/performance - index: persuasion name: Persuasion - url: /api/skills/persuasion - '/api/alignments/{index}': + url: /api/2014/skills/persuasion + '/api/2014/alignments/{index}': get: summary: Get an alignment by index. description: | @@ -134,10 +134,10 @@ paths: example: index: chaotic-neutral name: Chaotic Neutral - url: /api/alignments/chaotic-neutral + url: /api/2014/alignments/chaotic-neutral desc: 'Chaotic neutral (CN) creatures follow their whims, holding their personal freedom above all else. Many barbarians and rogues, and some bards, are chaotic neutral.' abbreviation: CN - '/api/backgrounds/{index}': + '/api/2014/backgrounds/{index}': get: summary: Get a background by index. description: | @@ -163,26 +163,26 @@ paths: starting_proficiencies: - index: skill-insight name: 'Skill: Insight' - url: /api/proficiencies/skill-insight + url: /api/2014/proficiencies/skill-insight - index: skill-religion name: 'Skill: Religion' - url: /api/proficiencies/skill-religion + url: /api/2014/proficiencies/skill-religion language_options: choose: 2 type: languages from: option_set_type: resource_list - resource_list_url: /api/languages + resource_list_url: /api/2014/languages starting_equipment: - equipment: index: clothes-common name: 'Clothes, common' - url: /api/equipment/clothes-common + url: /api/2014/equipment/clothes-common quantity: 1 - equipment: index: pouch name: Pouch - url: /api/equipment/pouch + url: /api/2014/equipment/pouch quantity: 1 starting_equipment_options: - choose: 1 @@ -192,7 +192,7 @@ paths: equipment_category: index: holy-symbols name: Holy Symbols - url: /api/equipment-categories/holy-symbols + url: /api/2014/equipment-categories/holy-symbols feature: name: Shelter of the Faithful desc: @@ -231,91 +231,91 @@ paths: alignments: - index: lawful-good name: Lawful Good - url: /api/alignments/lawful-good + url: /api/2014/alignments/lawful-good - index: lawful-neutral name: Lawful Neutral - url: /api/alignments/lawful-neutral + url: /api/2014/alignments/lawful-neutral - index: lawful-evil name: Lawful Evil - url: /api/alignments/lawful-evil + url: /api/2014/alignments/lawful-evil - option_type: ideal desc: 'Charity. I always try to help those in need, no matter what the personal cost.' alignments: - index: lawful-good name: Lawful Good - url: /api/alignments/lawful-good + url: /api/2014/alignments/lawful-good - index: neutral-good name: Neutral Good - url: /api/alignments/neutral-good + url: /api/2014/alignments/neutral-good - index: chaotic-good name: Chaotic Good - url: /api/alignments/chaotic-good + url: /api/2014/alignments/chaotic-good - option_type: ideal desc: Change. We must help bring about the changes the gods are constantly working in the world. alignments: - index: chaotic-good name: Chaotic Good - url: /api/alignments/chaotic-good + url: /api/2014/alignments/chaotic-good - index: chaotic-neutral name: Chaotic Neutral - url: /api/alignments/chaotic-neutral + url: /api/2014/alignments/chaotic-neutral - index: chaotic-evil name: Chaotic Evil - url: /api/alignments/chaotic-evil + url: /api/2014/alignments/chaotic-evil - option_type: ideal desc: Power. I hope to one day rise to the top of my faith's religious hierarchy. alignments: - index: lawful-good name: Lawful Good - url: /api/alignments/lawful-good + url: /api/2014/alignments/lawful-good - index: lawful-neutral name: Lawful Neutral - url: /api/alignments/lawful-neutral + url: /api/2014/alignments/lawful-neutral - index: lawful-evil name: Lawful Evil - url: /api/alignments/lawful-evil + url: /api/2014/alignments/lawful-evil - option_type: ideal desc: 'Faith. I trust that my deity will guide my actions. I have faith that if I work hard, things will go well.' alignments: - index: lawful-good name: Lawful Good - url: /api/alignments/lawful-good + url: /api/2014/alignments/lawful-good - index: lawful-neutral name: Lawful Neutral - url: /api/alignments/lawful-neutral + url: /api/2014/alignments/lawful-neutral - index: lawful-evil name: Lawful Evil - url: /api/alignments/lawful-evil + url: /api/2014/alignments/lawful-evil - option_type: ideal desc: Aspiration. I seek to prove myself worthy of my god's favor by matching my actions against his or her teachings. alignments: - index: lawful-good name: Lawful Good - url: /api/alignments/lawful-good + url: /api/2014/alignments/lawful-good - index: neutral-good name: Neutral Good - url: /api/alignments/neutral-good + url: /api/2014/alignments/neutral-good - index: chaotic-good name: Chaotic Good - url: /api/alignments/chaotic-good + url: /api/2014/alignments/chaotic-good - index: lawful-neutral name: Lawful Neutral - url: /api/alignments/lawful-neutral + url: /api/2014/alignments/lawful-neutral - index: neutral name: Neutral - url: /api/alignments/neutral + url: /api/2014/alignments/neutral - index: chaotic-neutral name: Chaotic Neutral - url: /api/alignments/chaotic-neutral + url: /api/2014/alignments/chaotic-neutral - index: lawful-evil name: Lawful Evil - url: /api/alignments/lawful-evil + url: /api/2014/alignments/lawful-evil - index: neutral-evil name: Neutral Evil - url: /api/alignments/neutral-evil + url: /api/2014/alignments/neutral-evil - index: chaotic-evil name: Chaotic Evil - url: /api/alignments/chaotic-evil + url: /api/2014/alignments/chaotic-evil bonds: choose: 1 type: bonds @@ -352,8 +352,8 @@ paths: string: I am suspicious of strangers and expect the worst of them. - option_type: string string: 'Once I pick a goal, I become obsessed with it to the detriment of everything else in my life.' - url: /api/backgrounds/acolyte - '/api/classes/{index}': + url: /api/2014/backgrounds/acolyte + '/api/2014/classes/{index}': get: summary: Get a class by index. description: | @@ -375,7 +375,7 @@ paths: schema: $ref: '#/components/schemas/Class' example: - class_levels: /api/classes/barbarian/levels + class_levels: /api/2014/classes/barbarian/levels hit_die: 12 index: barbarian multi_classing: @@ -383,36 +383,36 @@ paths: - ability_score: index: str name: STR - url: /api/ability-scores/str + url: /api/2014/ability-scores/str minimum_score: 13 proficiencies: - index: shields name: Shields - url: /api/proficiencies/shields + url: /api/2014/proficiencies/shields - index: simple-weapons name: Simple Weapons - url: /api/proficiencies/simple-weapons + url: /api/2014/proficiencies/simple-weapons - index: martial-weapons name: Martial Weapons - url: /api/proficiencies/martial-weapons + url: /api/2014/proficiencies/martial-weapons proficiency_choices: [] name: Barbarian proficiencies: - index: light-armor name: Light Armor - url: /api/proficiencies/light-armor + url: /api/2014/proficiencies/light-armor - index: medium-armor name: Medium Armor - url: /api/proficiencies/medium-armor + url: /api/2014/proficiencies/medium-armor - index: shields name: Shields - url: /api/proficiencies/shields + url: /api/2014/proficiencies/shields - index: simple-weapons name: Simple Weapons - url: /api/proficiencies/simple-weapons + url: /api/2014/proficiencies/simple-weapons - index: martial-weapons name: Martial Weapons - url: /api/proficiencies/martial-weapons + url: /api/2014/proficiencies/martial-weapons proficiency_choices: - desc: 'Choose two from Animal Handling, Athletics, Intimidation, Nature, Perception, and Survival' choose: 2 @@ -424,49 +424,49 @@ paths: item: index: skill-animal-handling name: 'Skill: Animal Handling' - url: /api/proficiencies/skill-animal-handling + url: /api/2014/proficiencies/skill-animal-handling - option_type: reference item: index: skill-athletics name: 'Skill: Athletics' - url: /api/proficiencies/skill-athletics + url: /api/2014/proficiencies/skill-athletics - option_type: reference item: index: skill-intimidation name: 'Skill: Intimidation' - url: /api/proficiencies/skill-intimidation + url: /api/2014/proficiencies/skill-intimidation - option_type: reference item: index: skill-nature name: 'Skill: Nature' - url: /api/proficiencies/skill-nature + url: /api/2014/proficiencies/skill-nature - option_type: reference item: index: skill-perception name: 'Skill: Perception' - url: /api/proficiencies/skill-perception + url: /api/2014/proficiencies/skill-perception - option_type: reference item: index: skill-survival name: 'Skill: Survival' - url: /api/proficiencies/skill-survival + url: /api/2014/proficiencies/skill-survival saving_throws: - index: str name: STR - url: /api/ability-scores/str + url: /api/2014/ability-scores/str - index: con name: CON - url: /api/ability-scores/con + url: /api/2014/ability-scores/con starting_equipment: - equipment: index: explorers-pack name: Explorer's Pack - url: /api/equipment/explorers-pack + url: /api/2014/equipment/explorers-pack quantity: 1 - equipment: index: javelin name: Javelin - url: /api/equipment/javelin + url: /api/2014/equipment/javelin quantity: 4 starting_equipment_options: - desc: (a) a greataxe or (b) any martial melee weapon @@ -480,7 +480,7 @@ paths: of: index: greataxe name: Greataxe - url: /api/equipment/greataxe + url: /api/2014/equipment/greataxe - option_type: choice choice: desc: any martial melee weapon @@ -491,7 +491,7 @@ paths: equipment_category: index: martial-melee-weapons name: Martial Melee Weapons - url: /api/equipment-categories/martial-melee-weapons + url: /api/2014/equipment-categories/martial-melee-weapons - desc: (a) two handaxes or (b) any simple weapon choose: 1 type: equipment @@ -503,7 +503,7 @@ paths: of: index: handaxe name: Handaxe - url: /api/equipment/handaxe + url: /api/2014/equipment/handaxe - option_type: choice choice: desc: any simple weapon @@ -514,13 +514,13 @@ paths: equipment_category: index: simple-weapons name: Simple Weapons - url: /api/equipment-categories/simple-weapons + url: /api/2014/equipment-categories/simple-weapons subclasses: - index: berserker name: Berserker - url: /api/subclasses/berserker - url: /api/classes/barbarian - '/api/classes/{index}/subclasses': + url: /api/2014/subclasses/berserker + url: /api/2014/classes/barbarian + '/api/2014/classes/{index}/subclasses': get: summary: Get subclasses available for a class. tags: @@ -539,8 +539,8 @@ paths: results: - index: berserker name: Berserker - url: /api/subclasses/berserker - '/api/classes/{index}/spells': + url: /api/2014/subclasses/berserker + '/api/2014/classes/{index}/spells': get: summary: Get spells available for a class. tags: @@ -559,13 +559,13 @@ paths: results: - index: power-word-kill name: Power Word Kill - url: /api/spells/power-word-kill + url: /api/2014/spells/power-word-kill level: 9 - index: true-polymorph name: True Polymorph - url: /api/spells/true-polymorph + url: /api/2014/spells/true-polymorph level: 9 - '/api/classes/{index}/spellcasting': + '/api/2014/classes/{index}/spellcasting': get: summary: Get spellcasting info for a class. tags: @@ -584,7 +584,7 @@ paths: spellcasting_ability: index: cha name: CHA - url: /api/ability-scores/cha + url: /api/2014/ability-scores/cha info: - name: Cantrips desc: @@ -618,7 +618,7 @@ paths: $ref: '#/components/schemas/error-response' example: error: Not found - '/api/classes/{index}/features': + '/api/2014/classes/{index}/features': get: summary: Get features available for a class. tags: @@ -632,7 +632,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/classes/{index}/proficiencies': + '/api/2014/classes/{index}/proficiencies': get: summary: Get proficiencies available for a class. tags: @@ -646,7 +646,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/classes/{index}/multi-classing': + '/api/2014/classes/{index}/multi-classing': get: summary: Get multiclassing resource for a class. tags: @@ -665,20 +665,20 @@ paths: - ability_score: index: str name: STR - url: /api/ability-scores/str + url: /api/2014/ability-scores/str minimum_score: 13 proficiencies: - index: shields name: Shields - url: /api/proficiencies/shields + url: /api/2014/proficiencies/shields - index: simple-weapons name: Simple Weapons - url: /api/proficiencies/simple-weapons + url: /api/2014/proficiencies/simple-weapons - index: martial-weapons name: Martial Weapons - url: /api/proficiencies/martial-weapons + url: /api/2014/proficiencies/martial-weapons proficiency_choices: [] - '/api/classes/{index}/levels': + '/api/2014/classes/{index}/levels': get: summary: Get all level resources for a class. tags: @@ -695,7 +695,7 @@ paths: type: array items: $ref: '#/components/schemas/ClassLevel' - '/api/classes/{index}/levels/{class_level}': + '/api/2014/classes/{index}/levels/{class_level}': get: summary: Get level resource for a class and level. tags: @@ -717,10 +717,10 @@ paths: features: - index: rage name: Rage - url: /api/features/rage + url: /api/2014/features/rage - index: barbarian-unarmored-defense name: Unarmored Defense - url: /api/features/barbarian-unarmored-defense + url: /api/2014/features/barbarian-unarmored-defense class_specific: rage_count: 2 rage_damage_bonus: 2 @@ -729,9 +729,9 @@ paths: class: index: barbarian name: Barbarian - url: /api/classes/barbarian - url: /api/classes/barbarian/levels/1 - '/api/classes/{index}/levels/{class_level}/features': + url: /api/2014/classes/barbarian + url: /api/2014/classes/barbarian/levels/1 + '/api/2014/classes/{index}/levels/{class_level}/features': get: summary: Get features available to a class at the requested level. tags: @@ -751,11 +751,11 @@ paths: results: - index: barbarian-unarmored-defense name: Unarmored Defense - url: /api/features/barbarian-unarmored-defense + url: /api/2014/features/barbarian-unarmored-defense - index: rage name: Rage - url: /api/features/rage - '/api/classes/{index}/levels/{spell_level}/spells': + url: /api/2014/features/rage + '/api/2014/classes/{index}/levels/{spell_level}/spells': get: summary: Get spells of the requested level available to the class. tags: @@ -775,28 +775,28 @@ paths: results: - index: dominate-monster name: Dominate Monster - url: /api/spells/dominate-monster + url: /api/2014/spells/dominate-monster - index: earthquake name: Earthquake - url: /api/spells/earthquake + url: /api/2014/spells/earthquake - index: incendiary-cloud name: Incendiary Cloud - url: /api/spells/incendiary-cloud + url: /api/2014/spells/incendiary-cloud - index: power-word-stun name: Power Word Stun - url: /api/spells/power-word-stun + url: /api/2014/spells/power-word-stun - index: sunburst name: Sunburst - url: /api/spells/sunburst - '/api/conditions/{index}': + url: /api/2014/spells/sunburst + '/api/2014/conditions/{index}': get: summary: Get a condition by index. description: | # Condition - A condition alters a creature’s capabilities in a variety of ways and can - arise as a result of a spell, a class feature, a monster’s attack, or other - effect. Most conditions, such as blinded, are impairments, but a few, such + A condition alters a creature’s capabilities in a variety of ways and can + arise as a result of a spell, a class feature, a monster’s attack, or other + effect. Most conditions, such as blinded, are impairments, but a few, such as invisible, can be advantageous. tags: - Game Mechanics @@ -812,18 +812,18 @@ paths: example: index: blinded name: Blinded - url: /api/conditions/blinded + url: /api/2014/conditions/blinded desc: - '- A blinded creature can''t see and automatically fails any ability check that requires sight.' - '- Attack rolls against the creature have advantage, and the creature''s attack rolls have disadvantage.' - '/api/damage-types/{index}': + '/api/2014/damage-types/{index}': get: summary: Get a damage type by index. description: | # Damage type - Different attacks, damaging spells, and other harmful effects deal different - types of damage. Damage types have no rules of their own, but other rules, + Different attacks, damaging spells, and other harmful effects deal different + types of damage. Damage types have no rules of their own, but other rules, such as damage resistance, rely on the types. tags: - Game Mechanics @@ -839,18 +839,18 @@ paths: example: index: acid name: Acid - url: /api/damage-types/acid + url: /api/2014/damage-types/acid desc: - The corrosive spray of a black dragon's breath and the dissolving enzymes secreted by a black pudding deal acid damage. - '/api/equipment/{index}': + '/api/2014/equipment/{index}': get: summary: Get an equipment item by index. description: | # Equipment - Opportunities abound to find treasure, equipment, weapons, armor, and more - in the dungeons you explore. Normally, you can sell your treasures and - trinkets when you return to a town or other settlement, provided that you + Opportunities abound to find treasure, equipment, weapons, armor, and more + in the dungeons you explore. Normally, you can sell your treasures and + trinkets when you return to a town or other settlement, provided that you can find buyers and merchants interested in your loot. tags: - Equipment @@ -874,30 +874,30 @@ paths: damage_type: index: bludgeoning name: Bludgeoning - url: /api/damage-types/bludgeoning + url: /api/2014/damage-types/bludgeoning desc: [] equipment_category: index: weapon name: Weapon - url: /api/equipment-categories/weapon + url: /api/2014/equipment-categories/weapon index: club name: Club properties: - index: light name: Light - url: /api/weapon-properties/light + url: /api/2014/weapon-properties/light - index: monk name: Monk - url: /api/weapon-properties/monk + url: /api/2014/weapon-properties/monk range: long: null normal: 5 special: [] - url: /api/equipment/club + url: /api/2014/equipment/club weapon_category: Simple weapon_range: Melee weight: 2 - '/api/equipment-categories/{index}': + '/api/2014/equipment-categories/{index}': get: summary: Get an equipment category by index. description: These are the categories that various equipment fall under. @@ -924,31 +924,31 @@ paths: example: index: waterborne-vehicles name: Waterborne Vehicles - url: /api/equipment-categories/waterborne-vehicles + url: /api/2014/equipment-categories/waterborne-vehicles equipment: - index: galley name: Galley - url: /api/equipment/galley + url: /api/2014/equipment/galley - index: keelboat name: Keelboat - url: /api/equipment/keelboat + url: /api/2014/equipment/keelboat - index: longship name: Longship - url: /api/equipment/longship + url: /api/2014/equipment/longship - index: rowboat name: Rowboat - url: /api/equipment/rowboat + url: /api/2014/equipment/rowboat - index: sailing-ship name: Sailing ship - url: /api/equipment/sailing-ship + url: /api/2014/equipment/sailing-ship - index: warship name: Warship - url: /api/equipment/warship - '/api/feats/{index}': + url: /api/2014/equipment/warship + '/api/2014/feats/{index}': get: summary: Get a feat by index. description: | - # Feat + # Feat A feat is a boon a character can receive at level up instead of an ability score increase. tags: @@ -973,7 +973,7 @@ paths: example: index: grappler name: Grappler - url: /api/feats/grappler + url: /api/2014/feats/grappler desc: - 'You’ve developed the Skills necessary to hold your own in close--quarters Grappling. You gain the following benefits:' - '- You have advantage on Attack Rolls against a creature you are Grappling.' @@ -982,17 +982,17 @@ paths: - ability_score: index: str name: STR - url: /api/ability-scores/str + url: /api/2014/ability-scores/str minimum_score: 13 - '/api/features/{index}': + '/api/2014/features/{index}': get: summary: Get a feature by index. description: | - # Feature + # Feature - When you gain a new level in a class, you get its features for that level. - You don’t, however, receive the class’s starting Equipment, and a few - features have additional rules when you’re multiclassing: Channel Divinity, + When you gain a new level in a class, you get its features for that level. + You don’t, however, receive the class’s starting Equipment, and a few + features have additional rules when you’re multiclassing: Channel Divinity, Extra Attack, Unarmored Defense, and Spellcasting. tags: - Features @@ -1008,17 +1008,17 @@ paths: example: index: action-surge-1-use name: Action Surge (1 use) - url: /api/features/action-surge-1-use + url: /api/2014/features/action-surge-1-use class: index: fighter name: Fighter - url: /api/classes/fighter + url: /api/2014/classes/fighter desc: - 'Starting at 2nd level, you can push yourself beyond your normal limits for a moment. On your turn, you can take one additional action on top of your regular action and a possible bonus action.' - 'Once you use this feature, you must finish a short or long rest before you can use it again. Starting at 17th level, you can use it twice before a rest, but only once on the same turn.' level: 2 prerequisites: [] - '/api/languages/{index}': + '/api/2014/languages/{index}': get: summary: Get a language by index. description: | @@ -1039,13 +1039,13 @@ paths: example: index: elvish name: Elvish - url: /api/languages/elvish + url: /api/2014/languages/elvish desc: 'Elvish is fluid, with subtle intonations and intricate grammar. Elven literature is rich and varied, and their songs and poems are famous among other races. Many bards learn their language so they can add Elvish ballads to their repertoires.' type: Standard script: Elvish typical_speakers: - Elves - '/api/magic-items/{index}': + '/api/2014/magic-items/{index}': get: summary: Get a magic item by index. description: These are the various magic items you can find in the game. @@ -1072,27 +1072,27 @@ paths: example: index: adamantine-armor name: Adamantine Armor - url: /api/magic-items/adamantine-armor + url: /api/2014/magic-items/adamantine-armor desc: - 'Armor (medium or heavy, but not hide), uncommon' - 'This suit of armor is reinforced with adamantine, one of the hardest substances in existence. While you''re wearing it, any critical hit against you becomes a normal hit.' equipment_category: index: armor name: Armor - url: /api/equipment-categories/armor + url: /api/2014/equipment-categories/armor rarity: name: Uncommon variants: [] variant: false - '/api/magic-schools/{index}': + '/api/2014/magic-schools/{index}': get: summary: Get a magic school by index. description: | # Magic School - Academies of magic group spells into eight categories called schools of - magic. Scholars, particularly wizards, apply these categories to all spells, - believing that all magic functions in essentially the same way, whether it + Academies of magic group spells into eight categories called schools of + magic. Scholars, particularly wizards, apply these categories to all spells, + believing that all magic functions in essentially the same way, whether it derives from rigorous study or is bestowed by a deity. tags: - Game Mechanics @@ -1108,9 +1108,9 @@ paths: example: index: conjuration name: Conjuration - url: /api/magic-schools/conjuration + url: /api/2014/magic-schools/conjuration desc: 'Conjuration spells involve the transportation of objects and creatures from one location to another. Some spells summon creatures or objects to the caster''s side, whereas others allow the caster to teleport to another location. Some conjurations create objects or effects out of nothing.' - /api/monsters: + /api/2014/monsters: get: summary: Get list of monsters with optional filtering tags: @@ -1124,7 +1124,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/monsters/{index}': + '/api/2014/monsters/{index}': get: summary: Get monster by index. tags: @@ -1141,7 +1141,7 @@ paths: example: index: aboleth name: Aboleth - url: /api/monsters/aboleth + url: /api/2014/monsters/aboleth actions: - attacks: [] damage: [] @@ -1159,17 +1159,17 @@ paths: damage_type: index: bludgeoning name: Bludgeoning - url: /api/damage-types/bludgeoning + url: /api/2014/damage-types/bludgeoning - damage_dice: 1d12 damage_type: index: acid name: Acid - url: /api/damage-types/acid + url: /api/2014/damage-types/acid dc: dc_type: index: con name: CON - url: /api/ability-scores/con + url: /api/2014/ability-scores/con dc_value: 14 success_type: none desc: 'Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 14 Constitution saving throw or become diseased. The disease has no effect for 1 minute and can be removed by any magic that cures disease. After 1 minute, the diseased creature''s skin becomes translucent and slimy, the creature can''t regain hit points unless it is underwater, and the disease can be removed only by heal or another disease-curing spell of 6th level or higher. When the creature is outside a body of water, it takes 6 (1d12) acid damage every 10 minutes unless moisture is applied to the skin before 10 minutes have passed.' @@ -1181,7 +1181,7 @@ paths: damage_type: index: bludgeoning name: Bludgeoning - url: /api/damage-types/bludgeoning + url: /api/2014/damage-types/bludgeoning desc: 'Melee Weapon Attack: +9 to hit, reach 10 ft. one target. Hit: 15 (3d6 + 5) bludgeoning damage.' name: Tail - attacks: [] @@ -1190,7 +1190,7 @@ paths: dc_type: index: wis name: WIS - url: /api/ability-scores/wis + url: /api/2014/ability-scores/wis dc_value: 14 success_type: none desc: |- @@ -1232,34 +1232,34 @@ paths: damage_type: index: psychic name: Psychic - url: /api/damage-types/psychic + url: /api/2014/damage-types/psychic desc: 'One creature charmed by the aboleth takes 10 (3d6) psychic damage, and the aboleth regains hit points equal to the damage the creature takes.' name: Psychic Drain (Costs 2 Actions) proficiencies: - proficiency: index: saving-throw-con name: 'Saving Throw: CON' - url: /api/proficiencies/saving-throw-con + url: /api/2014/proficiencies/saving-throw-con value: 6 - proficiency: index: saving-throw-int name: 'Saving Throw: INT' - url: /api/proficiencies/saving-throw-int + url: /api/2014/proficiencies/saving-throw-int value: 8 - proficiency: index: saving-throw-wis name: 'Saving Throw: WIS' - url: /api/proficiencies/saving-throw-wis + url: /api/2014/proficiencies/saving-throw-wis value: 6 - proficiency: index: skill-history name: 'Skill: History' - url: /api/proficiencies/skill-history + url: /api/2014/proficiencies/skill-history value: 12 - proficiency: index: skill-perception name: 'Skill: Perception' - url: /api/proficiencies/skill-perception + url: /api/2014/proficiencies/skill-perception value: 10 reactions: [] senses: @@ -1275,7 +1275,7 @@ paths: dc_type: index: con name: CON - url: /api/ability-scores/con + url: /api/2014/ability-scores/con dc_value: 14 success_type: none desc: 'While underwater, the aboleth is surrounded by transformative mucus. A creature that touches the aboleth or that hits it with a melee attack while within 5 ft. of it must make a DC 14 Constitution saving throw. On a failure, the creature is diseased for 1d4 hours. The diseased creature can breathe only underwater.' @@ -1291,11 +1291,11 @@ paths: type: aberration wisdom: 15 xp: 5900 - '/api/proficiencies/{index}': + '/api/2014/proficiencies/{index}': get: summary: Get a proficiency by index. description: | - # Proficiency + # Proficiency By virtue of race, class, and background a character is proficient at using certain skills, weapons, and equipment. Characters can also gain additional proficiencies at higher levels or by multiclassing. A characters starting proficiencies are determined during character creation. tags: @@ -1312,27 +1312,27 @@ paths: example: index: medium-armor name: Medium Armor - url: /api/proficiencies/medium-armor + url: /api/2014/proficiencies/medium-armor type: Armor classes: - index: barbarian name: Barbarian - url: /api/classes/barbarian + url: /api/2014/classes/barbarian - index: cleric name: Cleric - url: /api/classes/cleric + url: /api/2014/classes/cleric - index: druid name: Druid - url: /api/classes/druid + url: /api/2014/classes/druid - index: ranger name: Ranger - url: /api/classes/ranger + url: /api/2014/classes/ranger races: [] reference: index: medium-armor name: Medium Armor - url: /api/equipment-categories/medium-armor - '/api/races/{index}': + url: /api/2014/equipment-categories/medium-armor + '/api/2014/races/{index}': get: summary: Get a race by index. description: Each race grants your character ability and skill bonuses as well as racial traits. @@ -1350,12 +1350,12 @@ paths: example: index: elf name: Elf - url: /api/races/elf + url: /api/2014/races/elf ability_bonuses: - ability_score: index: dex name: DEX - url: /api/ability-scores/dex + url: /api/2014/ability-scores/dex bonus: 2 age: 'Although elves reach physical maturity at about the same age as humans, the elven understanding of adulthood goes beyond physical growth to encompass worldly experience. An elf typically claims adulthood and an adult name around the age of 100 and can live to be 750 years old.' alignment: 'Elves love freedom, variety, and self-expression, so they lean strongly toward the gentler aspects of chaos. They value and protect others'' freedom as well as their own, and they are more often good than not. The drow are an exception; their exile has made them vicious and dangerous. Drow are more often evil than not.' @@ -1363,32 +1363,32 @@ paths: languages: - index: common name: Common - url: /api/languages/common + url: /api/2014/languages/common - index: elvish name: Elvish - url: /api/languages/elvish + url: /api/2014/languages/elvish size: Medium size_description: Elves range from under 5 to over 6 feet tall and have slender builds. Your size is Medium. speed: 30 starting_proficiencies: - index: skill-perception name: 'Skill: Perception' - url: /api/proficiencies/skill-perception + url: /api/2014/proficiencies/skill-perception subraces: - index: high-elf name: High Elf - url: /api/subraces/high-elf + url: /api/2014/subraces/high-elf traits: - index: darkvision name: Darkvision - url: /api/traits/darkvision + url: /api/2014/traits/darkvision - index: fey-ancestry name: Fey Ancestry - url: /api/traits/fey-ancestry + url: /api/2014/traits/fey-ancestry - index: trance name: Trance - url: /api/traits/trance - '/api/races/{index}/subraces': + url: /api/2014/traits/trance + '/api/2014/races/{index}/subraces': get: summary: Get subraces available for a race. tags: @@ -1402,7 +1402,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/races/{index}/proficiencies': + '/api/2014/races/{index}/proficiencies': get: summary: Get proficiencies available for a race. tags: @@ -1416,7 +1416,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/races/{index}/traits': + '/api/2014/races/{index}/traits': get: summary: Get traits available for a race. tags: @@ -1430,7 +1430,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/rule-sections/{index}': + '/api/2014/rule-sections/{index}': get: summary: Get a rule section by index. description: Rule sections represent a sub-heading and text that can be found underneath a rule heading in the SRD. @@ -1448,7 +1448,7 @@ paths: example: index: time name: Time - url: /api/rule-sections/time + url: /api/2014/rule-sections/time desc: | ## Time @@ -1461,14 +1461,14 @@ paths: Following the road from Baldur's Gate to Waterdeep, the adventurers spend four uneventful days before a goblin ambush interrupts their journey. In combat and other fast-paced situations, the game relies on **rounds**, a 6-second span of time. - '/api/rules/{index}': + '/api/2014/rules/{index}': get: summary: Get a rule by index. description: | - # Rule + # Rule - Rules are pages in the SRD that document the mechanics of Dungeons and Dragons. - Rules have descriptions which is the text directly underneath the rule heading + Rules are pages in the SRD that document the mechanics of Dungeons and Dragons. + Rules have descriptions which is the text directly underneath the rule heading in the SRD. Rules also have subsections for each heading underneath the rule in the SRD. tags: - Rules @@ -1484,7 +1484,7 @@ paths: example: index: using-ability-scores name: Using Ability Scores - url: /api/rules/using-ability-scores + url: /api/2014/rules/using-ability-scores desc: | # Using Ability Scores @@ -1508,23 +1508,23 @@ paths: subsections: - index: ability-scores-and-modifiers name: Ability Scores and Modifiers - url: /api/rule-sections/ability-scores-and-modifiers + url: /api/2014/rule-sections/ability-scores-and-modifiers - index: advantage-and-disadvantage name: Advantage and Disadvantage - url: /api/rule-sections/advantage-and-disadvantage + url: /api/2014/rule-sections/advantage-and-disadvantage - index: proficiency-bonus name: Proficiency Bonus - url: /api/rule-sections/proficiency-bonus + url: /api/2014/rule-sections/proficiency-bonus - index: ability-checks name: Ability Checks - url: /api/rule-sections/ability-checks + url: /api/2014/rule-sections/ability-checks - index: using-each-ability name: Using Each Ability - url: /api/rule-sections/using-each-ability + url: /api/2014/rule-sections/using-each-ability - index: saving-throws name: Saving Throws - url: /api/rule-sections/saving-throws - '/api/skills/{index}': + url: /api/2014/rule-sections/saving-throws + '/api/2014/skills/{index}': get: summary: Get a skill by index. description: | @@ -1545,14 +1545,14 @@ paths: example: index: acrobatics name: Acrobatics - url: /api/skills/acrobatics + url: /api/2014/skills/acrobatics ability_score: index: dex name: DEX - url: /api/ability-scores/dex + url: /api/2014/ability-scores/dex desc: - 'Your Dexterity (Acrobatics) check covers your attempt to stay on your feet in a tricky situation, such as when you''re trying to run across a sheet of ice, balance on a tightrope, or stay upright on a rocking ship''s deck. The GM might also call for a Dexterity (Acrobatics) check to see if you can perform acrobatic stunts, including dives, rolls, somersaults, and flips.' - /api/spells: + /api/2014/spells: get: summary: Get list of spells with optional filtering. tags: @@ -1567,7 +1567,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/spells/{index}': + '/api/2014/spells/{index}': get: summary: Get a spell by index. tags: @@ -1584,13 +1584,13 @@ paths: example: index: sacred-flame name: Sacred Flame - url: /api/spells/sacred-flame + url: /api/2014/spells/sacred-flame attack_type: ranged casting_time: 1 action classes: - index: cleric name: Cleric - url: /api/classes/cleric + url: /api/2014/classes/cleric components: - V - S @@ -1604,13 +1604,13 @@ paths: damage_type: index: radiant name: Radiant - url: /api/damage-types/radiant + url: /api/2014/damage-types/radiant dc: dc_success: none dc_type: index: dex name: DEX - url: /api/ability-scores/dex + url: /api/2014/ability-scores/dex desc: - Flame-like radiance descends on a creature that you can see within range. The target must succeed on a dexterity saving throw or take 1d8 radiant damage. The target gains no benefit from cover for this saving throw. - 'The spell''s damage increases by 1d8 when you reach 5th level (2d8), 11th level (3d8), and 17th level (4d8).' @@ -1622,12 +1622,12 @@ paths: school: index: evocation name: Evocation - url: /api/magic-schools/evocation + url: /api/2014/magic-schools/evocation subclasses: - index: lore name: Lore - url: /api/subclasses/lore - '/api/subclasses/{index}': + url: /api/2014/subclasses/lore + '/api/2014/subclasses/{index}': get: summary: Get a subclass by index. description: Subclasses reflect the different paths a class may take as levels are gained. @@ -1645,11 +1645,11 @@ paths: example: index: fiend name: Fiend - url: /api/subclasses/fiend + url: /api/2014/subclasses/fiend class: index: warlock name: Warlock - url: /api/classes/warlock + url: /api/2014/classes/warlock desc: - 'You have made a pact with a fiend from the lower planes of existence, a being whose aims are evil, even if you strive against those aims. Such beings desire the corruption or destruction of all things, ultimately including you. Fiends powerful enough to forge a pact include demon lords such as Demogorgon, Orcus, Fraz''Urb-luu, and Baphomet; archdevils such as Asmodeus, Dispater, Mephistopheles, and Belial; pit fiends and balors that are especially mighty; and ultroloths and other lords of the yugoloths.' spells: @@ -1657,95 +1657,95 @@ paths: - index: warlock-1 name: Warlock 1 type: level - url: /api/classes/warlock/levels/1 + url: /api/2014/classes/warlock/levels/1 spell: index: burning-hands name: Burning Hands - url: /api/spells/burning-hands + url: /api/2014/spells/burning-hands - prerequisites: - index: warlock-1 name: Warlock 1 type: level - url: /api/classes/warlock/levels/1 + url: /api/2014/classes/warlock/levels/1 spell: index: command name: Command - url: /api/spells/command + url: /api/2014/spells/command - prerequisites: - index: warlock-3 name: Warlock 3 type: level - url: /api/classes/warlock/levels/3 + url: /api/2014/classes/warlock/levels/3 spell: index: blindness-deafness name: Blindness/Deafness - url: /api/spells/blindness-deafness + url: /api/2014/spells/blindness-deafness - prerequisites: - index: warlock-3 name: Warlock 3 type: level - url: /api/classes/warlock/levels/3 + url: /api/2014/classes/warlock/levels/3 spell: index: scorching-ray name: Scorching Ray - url: /api/spells/scorching-ray + url: /api/2014/spells/scorching-ray - prerequisites: - index: warlock-5 name: Warlock 5 type: level - url: /api/classes/warlock/levels/5 + url: /api/2014/classes/warlock/levels/5 spell: index: fireball name: Fireball - url: /api/spells/fireball + url: /api/2014/spells/fireball - prerequisites: - index: warlock-5 name: Warlock 5 type: level - url: /api/classes/warlock/levels/5 + url: /api/2014/classes/warlock/levels/5 spell: index: stinking-cloud name: Stinking Cloud - url: /api/spells/stinking-cloud + url: /api/2014/spells/stinking-cloud - prerequisites: - index: warlock-7 name: Warlock 7 type: level - url: /api/classes/warlock/levels/7 + url: /api/2014/classes/warlock/levels/7 spell: index: fire-shield name: Fire Shield - url: /api/spells/fire-shield + url: /api/2014/spells/fire-shield - prerequisites: - index: warlock-7 name: Warlock 7 type: level - url: /api/classes/warlock/levels/7 + url: /api/2014/classes/warlock/levels/7 spell: index: wall-of-fire name: Wall of Fire - url: /api/spells/wall-of-fire + url: /api/2014/spells/wall-of-fire - prerequisites: - index: warlock-9 name: Warlock 9 type: level - url: /api/classes/warlock/levels/9 + url: /api/2014/classes/warlock/levels/9 spell: index: flame-strike name: Flame Strike - url: /api/spells/flame-strike + url: /api/2014/spells/flame-strike - prerequisites: - index: warlock-9 name: Warlock 9 type: level - url: /api/classes/warlock/levels/9 + url: /api/2014/classes/warlock/levels/9 spell: index: hallow name: Hallow - url: /api/spells/hallow + url: /api/2014/spells/hallow subclass_flavor: Otherworldly Patron - subclass_levels: /api/subclasses/fiend/levels - '/api/subclasses/{index}/features': + subclass_levels: /api/2014/subclasses/fiend/levels + '/api/2014/subclasses/{index}/features': get: summary: Get features available for a subclass. tags: @@ -1759,7 +1759,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/subclasses/{index}/levels': + '/api/2014/subclasses/{index}/levels': get: summary: Get all level resources for a subclass. tags: @@ -1775,7 +1775,7 @@ paths: type: array items: $ref: '#/components/schemas/SubclassLevelResource' - '/api/subclasses/{index}/levels/{subclass_level}': + '/api/2014/subclasses/{index}/levels/{subclass_level}': get: summary: Get level resources for a subclass and level. tags: @@ -1799,21 +1799,21 @@ paths: $ref: '#/components/schemas/SubclassLevel' example: index: devotion-3 - url: /api/subclasses/devotion/levels/3 + url: /api/2014/subclasses/devotion/levels/3 class: index: paladin name: Paladin - url: /api/classes/paladin + url: /api/2014/classes/paladin features: - index: channel-divinity name: Channel Divinity - url: /api/features/channel-divinity + url: /api/2014/features/channel-divinity level: 3 subclass: index: devotion name: Devotion - url: /api/subclasses/devotion - '/api/subclasses/{index}/levels/{subclass_level}/features': + url: /api/2014/subclasses/devotion + '/api/2014/subclasses/{index}/levels/{subclass_level}/features': get: summary: Get features of the requested spell level available to the class. tags: @@ -1835,7 +1835,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/subraces/{index}': + '/api/2014/subraces/{index}': get: summary: Get a subrace by index. description: Subraces reflect the different varieties of a certain parent race. @@ -1853,25 +1853,25 @@ paths: example: index: hill-dwarf name: Hill Dwarf - url: /api/subraces/hill-dwarf + url: /api/2014/subraces/hill-dwarf ability_bonuses: - ability_score: index: wis name: WIS - url: /api/ability-scores/wis + url: /api/2014/ability-scores/wis bonus: 1 desc: 'As a hill dwarf, you have keen senses, deep intuition, and remarkable resilience.' languages: [] race: index: dwarf name: Dwarf - url: /api/races/dwarf + url: /api/2014/races/dwarf racial_traits: - index: dwarven-toughness name: Dwarven Toughness - url: /api/traits/dwarven-toughness + url: /api/2014/traits/dwarven-toughness starting_proficiencies: [] - '/api/subraces/{index}/proficiencies': + '/api/2014/subraces/{index}/proficiencies': get: summary: Get proficiences available for a subrace. tags: @@ -1885,7 +1885,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/subraces/{index}/traits': + '/api/2014/subraces/{index}/traits': get: summary: Get traits available for a subrace. tags: @@ -1899,7 +1899,7 @@ paths: application/json: schema: $ref: '#/components/schemas/APIReferenceList' - '/api/traits/{index}': + '/api/2014/traits/{index}': get: summary: Get a trait by index. tags: @@ -1916,16 +1916,16 @@ paths: example: index: trance name: Trance - url: /api/traits/trance + url: /api/2014/traits/trance desc: - 'Elves do not need to sleep. Instead, they meditate deeply, remaining semiconscious, for 4 hours a day. (The Common word for such meditation is "trance.") While meditating, you can dream after a fashion; such dreams are actually mental exercises that have become reflexive through years of practice. After resting this way, you gain the same benefit that a human does from 8 hours of sleep.' proficiencies: [] races: - index: elf name: Elf - url: /api/races/elf + url: /api/2014/races/elf subraces: [] - '/api/weapon-properties/{index}': + '/api/2014/weapon-properties/{index}': get: summary: Get a weapon property by index. tags: @@ -1942,7 +1942,7 @@ paths: example: index: ammunition name: Ammunition - url: /api/weapon-properties/ammunition + url: /api/2014/weapon-properties/ammunition desc: - 'You can use a weapon that has the ammunition property to make a ranged attack only if you have ammunition to fire from the weapon. Each time you attack with the weapon, you expend one piece of ammunition. Drawing the ammunition from a quiver, case, or other container is part of the attack (you need a free hand to load a one-handed weapon).' - 'At the end of the battle, you can recover half your expended ammunition by taking a minute to search the battlefield. If you use a weapon that has the ammunition property to make a melee attack, you treat the weapon as an improvised weapon (see "Improvised Weapons" later in the section). A sling must be loaded to deal any damage when used in this way.' @@ -2016,7 +2016,7 @@ components: description: | The `index` of the proficiency to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `proficiencies`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `proficiencies`. schema: type: string example: medium-armor @@ -2193,7 +2193,7 @@ components: description: | The `index` of the equipment to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `equipment`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `equipment`. schema: type: string example: club @@ -2204,7 +2204,7 @@ components: description: | The `index` of the feature to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `features`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `features`. schema: type: string example: action-surge-1-use @@ -2385,7 +2385,7 @@ components: description: | The `index` of the `Spell` to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `spells`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `spells`. schema: type: string example: sacred-flame diff --git a/src/swagger/parameters/combined.yml b/src/swagger/parameters/2014/combined.yml similarity index 100% rename from src/swagger/parameters/combined.yml rename to src/swagger/parameters/2014/combined.yml diff --git a/src/swagger/parameters/path/ability-scores.yml b/src/swagger/parameters/2014/path/ability-scores.yml similarity index 100% rename from src/swagger/parameters/path/ability-scores.yml rename to src/swagger/parameters/2014/path/ability-scores.yml diff --git a/src/swagger/parameters/path/alignments.yml b/src/swagger/parameters/2014/path/alignments.yml similarity index 100% rename from src/swagger/parameters/path/alignments.yml rename to src/swagger/parameters/2014/path/alignments.yml diff --git a/src/swagger/parameters/path/backgrounds.yml b/src/swagger/parameters/2014/path/backgrounds.yml similarity index 100% rename from src/swagger/parameters/path/backgrounds.yml rename to src/swagger/parameters/2014/path/backgrounds.yml diff --git a/src/swagger/parameters/path/classes.yml b/src/swagger/parameters/2014/path/classes.yml similarity index 100% rename from src/swagger/parameters/path/classes.yml rename to src/swagger/parameters/2014/path/classes.yml diff --git a/src/swagger/parameters/path/common.yml b/src/swagger/parameters/2014/path/common.yml similarity index 100% rename from src/swagger/parameters/path/common.yml rename to src/swagger/parameters/2014/path/common.yml diff --git a/src/swagger/parameters/path/conditions.yml b/src/swagger/parameters/2014/path/conditions.yml similarity index 100% rename from src/swagger/parameters/path/conditions.yml rename to src/swagger/parameters/2014/path/conditions.yml diff --git a/src/swagger/parameters/path/damage-types.yml b/src/swagger/parameters/2014/path/damage-types.yml similarity index 100% rename from src/swagger/parameters/path/damage-types.yml rename to src/swagger/parameters/2014/path/damage-types.yml diff --git a/src/swagger/parameters/path/equipment.yml b/src/swagger/parameters/2014/path/equipment.yml similarity index 84% rename from src/swagger/parameters/path/equipment.yml rename to src/swagger/parameters/2014/path/equipment.yml index 46def7e0..56bcb022 100644 --- a/src/swagger/parameters/path/equipment.yml +++ b/src/swagger/parameters/2014/path/equipment.yml @@ -4,7 +4,7 @@ required: true description: | The `index` of the equipment to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `equipment`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `equipment`. schema: type: string example: club diff --git a/src/swagger/parameters/path/features.yml b/src/swagger/parameters/2014/path/features.yml similarity index 85% rename from src/swagger/parameters/path/features.yml rename to src/swagger/parameters/2014/path/features.yml index 847180db..e0c1bcca 100644 --- a/src/swagger/parameters/path/features.yml +++ b/src/swagger/parameters/2014/path/features.yml @@ -4,7 +4,7 @@ required: true description: | The `index` of the feature to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `features`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `features`. schema: type: string example: action-surge-1-use diff --git a/src/swagger/parameters/path/languages.yml b/src/swagger/parameters/2014/path/languages.yml similarity index 100% rename from src/swagger/parameters/path/languages.yml rename to src/swagger/parameters/2014/path/languages.yml diff --git a/src/swagger/parameters/path/magic-schools.yml b/src/swagger/parameters/2014/path/magic-schools.yml similarity index 100% rename from src/swagger/parameters/path/magic-schools.yml rename to src/swagger/parameters/2014/path/magic-schools.yml diff --git a/src/swagger/parameters/path/monsters.yml b/src/swagger/parameters/2014/path/monsters.yml similarity index 100% rename from src/swagger/parameters/path/monsters.yml rename to src/swagger/parameters/2014/path/monsters.yml diff --git a/src/swagger/parameters/path/proficiencies.yml b/src/swagger/parameters/2014/path/proficiencies.yml similarity index 83% rename from src/swagger/parameters/path/proficiencies.yml rename to src/swagger/parameters/2014/path/proficiencies.yml index 971d0881..7c8c87b4 100644 --- a/src/swagger/parameters/path/proficiencies.yml +++ b/src/swagger/parameters/2014/path/proficiencies.yml @@ -4,7 +4,7 @@ required: true description: | The `index` of the proficiency to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `proficiencies`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `proficiencies`. schema: type: string example: medium-armor diff --git a/src/swagger/parameters/path/races.yml b/src/swagger/parameters/2014/path/races.yml similarity index 100% rename from src/swagger/parameters/path/races.yml rename to src/swagger/parameters/2014/path/races.yml diff --git a/src/swagger/parameters/path/rule-sections.yml b/src/swagger/parameters/2014/path/rule-sections.yml similarity index 100% rename from src/swagger/parameters/path/rule-sections.yml rename to src/swagger/parameters/2014/path/rule-sections.yml diff --git a/src/swagger/parameters/path/rules.yml b/src/swagger/parameters/2014/path/rules.yml similarity index 100% rename from src/swagger/parameters/path/rules.yml rename to src/swagger/parameters/2014/path/rules.yml diff --git a/src/swagger/parameters/path/skills.yml b/src/swagger/parameters/2014/path/skills.yml similarity index 100% rename from src/swagger/parameters/path/skills.yml rename to src/swagger/parameters/2014/path/skills.yml diff --git a/src/swagger/parameters/path/spells.yml b/src/swagger/parameters/2014/path/spells.yml similarity index 85% rename from src/swagger/parameters/path/spells.yml rename to src/swagger/parameters/2014/path/spells.yml index bb1014f5..786b048c 100644 --- a/src/swagger/parameters/path/spells.yml +++ b/src/swagger/parameters/2014/path/spells.yml @@ -4,7 +4,7 @@ required: true description: | The `index` of the `Spell` to get. - Available values can be found in the [`ResourceList`](#get-/api/-endpoint-) for `spells`. + Available values can be found in the [`ResourceList`](#get-/api/2014/-endpoint-) for `spells`. schema: type: string example: sacred-flame diff --git a/src/swagger/parameters/path/subclasses.yml b/src/swagger/parameters/2014/path/subclasses.yml similarity index 100% rename from src/swagger/parameters/path/subclasses.yml rename to src/swagger/parameters/2014/path/subclasses.yml diff --git a/src/swagger/parameters/path/subraces.yml b/src/swagger/parameters/2014/path/subraces.yml similarity index 100% rename from src/swagger/parameters/path/subraces.yml rename to src/swagger/parameters/2014/path/subraces.yml diff --git a/src/swagger/parameters/path/traits.yml b/src/swagger/parameters/2014/path/traits.yml similarity index 100% rename from src/swagger/parameters/path/traits.yml rename to src/swagger/parameters/2014/path/traits.yml diff --git a/src/swagger/parameters/path/weapon-properties.yml b/src/swagger/parameters/2014/path/weapon-properties.yml similarity index 100% rename from src/swagger/parameters/path/weapon-properties.yml rename to src/swagger/parameters/2014/path/weapon-properties.yml diff --git a/src/swagger/parameters/query/classes.yml b/src/swagger/parameters/2014/query/classes.yml similarity index 100% rename from src/swagger/parameters/query/classes.yml rename to src/swagger/parameters/2014/query/classes.yml diff --git a/src/swagger/parameters/query/monsters.yml b/src/swagger/parameters/2014/query/monsters.yml similarity index 100% rename from src/swagger/parameters/query/monsters.yml rename to src/swagger/parameters/2014/query/monsters.yml diff --git a/src/swagger/parameters/query/spells.yml b/src/swagger/parameters/2014/query/spells.yml similarity index 100% rename from src/swagger/parameters/query/spells.yml rename to src/swagger/parameters/2014/query/spells.yml diff --git a/src/swagger/parameters/2024/.keepme b/src/swagger/parameters/2024/.keepme new file mode 100644 index 00000000..e69de29b diff --git a/src/swagger/paths/ability-scores.yml b/src/swagger/paths/2014/ability-scores.yml similarity index 79% rename from src/swagger/paths/ability-scores.yml rename to src/swagger/paths/2014/ability-scores.yml index 4086303b..1cb044b6 100644 --- a/src/swagger/paths/ability-scores.yml +++ b/src/swagger/paths/2014/ability-scores.yml @@ -7,18 +7,18 @@ get: tags: - Character Data parameters: - - $ref: "../parameters/combined.yml#/ability-score-index" + - $ref: "../../parameters/2014/combined.yml#/ability-score-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/AbilityScore" + $ref: "../../schemas/2014/combined.yml#/AbilityScore" example: index: "cha" name: "CHA" - url: "/api/ability-scores/cha" + url: "/api/2014/ability-scores/cha" desc: [ "Charisma measures your ability to interact effectively with others. It includes such factors as confidence and eloquence, and it can represent a charming or commanding personality.", @@ -28,13 +28,13 @@ get: skills: - index: "deception" name: "Deception" - url: "/api/skills/deception" + url: "/api/2014/skills/deception" - index: "intimidation" name: "Intimidation" - url: "/api/skills/intimidation" + url: "/api/2014/skills/intimidation" - index: "performance" name: "Performance" - url: "/api/skills/performance" + url: "/api/2014/skills/performance" - index: "persuasion" name: "Persuasion" - url: "/api/skills/persuasion" + url: "/api/2014/skills/persuasion" diff --git a/src/swagger/paths/alignments.yml b/src/swagger/paths/2014/alignments.yml similarity index 84% rename from src/swagger/paths/alignments.yml rename to src/swagger/paths/2014/alignments.yml index 3425dadb..de7f0e6a 100644 --- a/src/swagger/paths/alignments.yml +++ b/src/swagger/paths/2014/alignments.yml @@ -7,17 +7,17 @@ get: tags: - Character Data parameters: - - $ref: "../parameters/combined.yml#/alignment-index" + - $ref: "../../parameters/2014/combined.yml#/alignment-index" responses: "200": description: "OK" content: application/json: schema: - $ref: "../schemas/combined.yml#/Alignment" + $ref: "../../schemas/2014/combined.yml#/Alignment" example: index: chaotic-neutral name: Chaotic Neutral - url: "/api/alignments/chaotic-neutral" + url: "/api/2014/alignments/chaotic-neutral" desc: Chaotic neutral (CN) creatures follow their whims, holding their personal freedom above all else. Many barbarians and rogues, and some bards, are chaotic neutral. abbreviation: CN diff --git a/src/swagger/paths/backgrounds.yml b/src/swagger/paths/2014/backgrounds.yml similarity index 81% rename from src/swagger/paths/backgrounds.yml rename to src/swagger/paths/2014/backgrounds.yml index b5927297..ea1870dd 100644 --- a/src/swagger/paths/backgrounds.yml +++ b/src/swagger/paths/2014/backgrounds.yml @@ -9,40 +9,40 @@ get: tags: - Character Data parameters: - - $ref: '../parameters/combined.yml#/background-index' + - $ref: '../../parameters/2014/combined.yml#/background-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/Background' + $ref: '../../schemas/2014/combined.yml#/Background' example: index: acolyte name: Acolyte starting_proficiencies: - index: skill-insight name: 'Skill: Insight' - url: '/api/proficiencies/skill-insight' + url: '/api/2014/proficiencies/skill-insight' - index: skill-religion name: 'Skill: Religion' - url: '/api/proficiencies/skill-religion' + url: '/api/2014/proficiencies/skill-religion' language_options: choose: 2 type: languages from: option_set_type: resource_list - resource_list_url: '/api/languages' + resource_list_url: '/api/2014/languages' starting_equipment: - equipment: index: clothes-common name: Clothes, common - url: '/api/equipment/clothes-common' + url: '/api/2014/equipment/clothes-common' quantity: 1 - equipment: index: pouch name: Pouch - url: '/api/equipment/pouch' + url: '/api/2014/equipment/pouch' quantity: 1 starting_equipment_options: - choose: 1 @@ -52,7 +52,7 @@ get: equipment_category: index: holy-symbols name: Holy Symbols - url: '/api/equipment-categories/holy-symbols' + url: '/api/2014/equipment-categories/holy-symbols' feature: name: Shelter of the Faithful desc: @@ -101,91 +101,91 @@ get: alignments: - index: lawful-good name: Lawful Good - url: '/api/alignments/lawful-good' + url: '/api/2014/alignments/lawful-good' - index: lawful-neutral name: Lawful Neutral - url: '/api/alignments/lawful-neutral' + url: '/api/2014/alignments/lawful-neutral' - index: lawful-evil name: Lawful Evil - url: '/api/alignments/lawful-evil' + url: '/api/2014/alignments/lawful-evil' - option_type: ideal desc: Charity. I always try to help those in need, no matter what the personal cost. alignments: - index: lawful-good name: Lawful Good - url: '/api/alignments/lawful-good' + url: '/api/2014/alignments/lawful-good' - index: neutral-good name: Neutral Good - url: '/api/alignments/neutral-good' + url: '/api/2014/alignments/neutral-good' - index: chaotic-good name: Chaotic Good - url: '/api/alignments/chaotic-good' + url: '/api/2014/alignments/chaotic-good' - option_type: ideal desc: Change. We must help bring about the changes the gods are constantly working in the world. alignments: - index: chaotic-good name: Chaotic Good - url: '/api/alignments/chaotic-good' + url: '/api/2014/alignments/chaotic-good' - index: chaotic-neutral name: Chaotic Neutral - url: '/api/alignments/chaotic-neutral' + url: '/api/2014/alignments/chaotic-neutral' - index: chaotic-evil name: Chaotic Evil - url: '/api/alignments/chaotic-evil' + url: '/api/2014/alignments/chaotic-evil' - option_type: ideal desc: Power. I hope to one day rise to the top of my faith's religious hierarchy. alignments: - index: lawful-good name: Lawful Good - url: '/api/alignments/lawful-good' + url: '/api/2014/alignments/lawful-good' - index: lawful-neutral name: Lawful Neutral - url: '/api/alignments/lawful-neutral' + url: '/api/2014/alignments/lawful-neutral' - index: lawful-evil name: Lawful Evil - url: '/api/alignments/lawful-evil' + url: '/api/2014/alignments/lawful-evil' - option_type: ideal desc: Faith. I trust that my deity will guide my actions. I have faith that if I work hard, things will go well. alignments: - index: lawful-good name: Lawful Good - url: '/api/alignments/lawful-good' + url: '/api/2014/alignments/lawful-good' - index: lawful-neutral name: Lawful Neutral - url: '/api/alignments/lawful-neutral' + url: '/api/2014/alignments/lawful-neutral' - index: lawful-evil name: Lawful Evil - url: '/api/alignments/lawful-evil' + url: '/api/2014/alignments/lawful-evil' - option_type: ideal desc: Aspiration. I seek to prove myself worthy of my god's favor by matching my actions against his or her teachings. alignments: - index: lawful-good name: Lawful Good - url: '/api/alignments/lawful-good' + url: '/api/2014/alignments/lawful-good' - index: neutral-good name: Neutral Good - url: '/api/alignments/neutral-good' + url: '/api/2014/alignments/neutral-good' - index: chaotic-good name: Chaotic Good - url: '/api/alignments/chaotic-good' + url: '/api/2014/alignments/chaotic-good' - index: lawful-neutral name: Lawful Neutral - url: '/api/alignments/lawful-neutral' + url: '/api/2014/alignments/lawful-neutral' - index: neutral name: Neutral - url: '/api/alignments/neutral' + url: '/api/2014/alignments/neutral' - index: chaotic-neutral name: Chaotic Neutral - url: '/api/alignments/chaotic-neutral' + url: '/api/2014/alignments/chaotic-neutral' - index: lawful-evil name: Lawful Evil - url: '/api/alignments/lawful-evil' + url: '/api/2014/alignments/lawful-evil' - index: neutral-evil name: Neutral Evil - url: '/api/alignments/neutral-evil' + url: '/api/2014/alignments/neutral-evil' - index: chaotic-evil name: Chaotic Evil - url: '/api/alignments/chaotic-evil' + url: '/api/2014/alignments/chaotic-evil' bonds: choose: 1 type: bonds @@ -222,4 +222,4 @@ get: string: I am suspicious of strangers and expect the worst of them. - option_type: string string: Once I pick a goal, I become obsessed with it to the detriment of everything else in my life. - url: '/api/backgrounds/acolyte' + url: '/api/2014/backgrounds/acolyte' diff --git a/src/swagger/paths/classes.yml b/src/swagger/paths/2014/classes.yml similarity index 72% rename from src/swagger/paths/classes.yml rename to src/swagger/paths/2014/classes.yml index 3bf42927..050ae7ad 100644 --- a/src/swagger/paths/classes.yml +++ b/src/swagger/paths/2014/classes.yml @@ -1,4 +1,4 @@ -# /api/classes/{indexParam} +# /api/2014/classes/{indexParam} class-path: get: summary: Get a class by index. @@ -12,16 +12,16 @@ class-path: tags: - Class parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/Class' + $ref: '../../schemas/2014/combined.yml#/Class' example: - class_levels: '/api/classes/barbarian/levels' + class_levels: '/api/2014/classes/barbarian/levels' hit_die: 12 index: barbarian multi_classing: @@ -29,36 +29,36 @@ class-path: - ability_score: index: str name: STR - url: '/api/ability-scores/str' + url: '/api/2014/ability-scores/str' minimum_score: 13 proficiencies: - index: shields name: Shields - url: '/api/proficiencies/shields' + url: '/api/2014/proficiencies/shields' - index: simple-weapons name: Simple Weapons - url: '/api/proficiencies/simple-weapons' + url: '/api/2014/proficiencies/simple-weapons' - index: martial-weapons name: Martial Weapons - url: '/api/proficiencies/martial-weapons' + url: '/api/2014/proficiencies/martial-weapons' proficiency_choices: [] name: Barbarian proficiencies: - index: light-armor name: Light Armor - url: '/api/proficiencies/light-armor' + url: '/api/2014/proficiencies/light-armor' - index: medium-armor name: Medium Armor - url: '/api/proficiencies/medium-armor' + url: '/api/2014/proficiencies/medium-armor' - index: shields name: Shields - url: '/api/proficiencies/shields' + url: '/api/2014/proficiencies/shields' - index: simple-weapons name: Simple Weapons - url: '/api/proficiencies/simple-weapons' + url: '/api/2014/proficiencies/simple-weapons' - index: martial-weapons name: Martial Weapons - url: '/api/proficiencies/martial-weapons' + url: '/api/2014/proficiencies/martial-weapons' proficiency_choices: - desc: Choose two from Animal Handling, Athletics, Intimidation, Nature, Perception, and Survival choose: 2 @@ -70,49 +70,49 @@ class-path: item: index: skill-animal-handling name: 'Skill: Animal Handling' - url: '/api/proficiencies/skill-animal-handling' + url: '/api/2014/proficiencies/skill-animal-handling' - option_type: reference item: index: skill-athletics name: 'Skill: Athletics' - url: '/api/proficiencies/skill-athletics' + url: '/api/2014/proficiencies/skill-athletics' - option_type: reference item: index: skill-intimidation name: 'Skill: Intimidation' - url: '/api/proficiencies/skill-intimidation' + url: '/api/2014/proficiencies/skill-intimidation' - option_type: reference item: index: skill-nature name: 'Skill: Nature' - url: '/api/proficiencies/skill-nature' + url: '/api/2014/proficiencies/skill-nature' - option_type: reference item: index: skill-perception name: 'Skill: Perception' - url: '/api/proficiencies/skill-perception' + url: '/api/2014/proficiencies/skill-perception' - option_type: reference item: index: skill-survival name: 'Skill: Survival' - url: '/api/proficiencies/skill-survival' + url: '/api/2014/proficiencies/skill-survival' saving_throws: - index: str name: STR - url: '/api/ability-scores/str' + url: '/api/2014/ability-scores/str' - index: con name: CON - url: '/api/ability-scores/con' + url: '/api/2014/ability-scores/con' starting_equipment: - equipment: index: explorers-pack name: Explorer's Pack - url: '/api/equipment/explorers-pack' + url: '/api/2014/equipment/explorers-pack' quantity: 1 - equipment: index: javelin name: Javelin - url: '/api/equipment/javelin' + url: '/api/2014/equipment/javelin' quantity: 4 starting_equipment_options: - desc: (a) a greataxe or (b) any martial melee weapon @@ -126,7 +126,7 @@ class-path: of: index: greataxe name: Greataxe - url: '/api/equipment/greataxe' + url: '/api/2014/equipment/greataxe' - option_type: choice choice: desc: any martial melee weapon @@ -137,7 +137,7 @@ class-path: equipment_category: index: martial-melee-weapons name: Martial Melee Weapons - url: '/api/equipment-categories/martial-melee-weapons' + url: '/api/2014/equipment-categories/martial-melee-weapons' - desc: (a) two handaxes or (b) any simple weapon choose: 1 type: equipment @@ -149,7 +149,7 @@ class-path: of: index: handaxe name: Handaxe - url: '/api/equipment/handaxe' + url: '/api/2014/equipment/handaxe' - option_type: choice choice: desc: any simple weapon @@ -160,80 +160,80 @@ class-path: equipment_category: index: simple-weapons name: Simple Weapons - url: '/api/equipment-categories/simple-weapons' + url: '/api/2014/equipment-categories/simple-weapons' subclasses: - index: berserker name: Berserker - url: '/api/subclasses/berserker' - url: '/api/classes/barbarian' -# /api/classes/{indexParam}/subclasses + url: '/api/2014/subclasses/berserker' + url: '/api/2014/classes/barbarian' +# /api/2014/classes/{indexParam}/subclasses class-subclass-path: get: summary: Get subclasses available for a class. tags: - Class Resource Lists parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/APIReferenceList' + $ref: '../../schemas/2014/combined.yml#/APIReferenceList' example: count: 1 results: - index: berserker name: Berserker - url: '/api/subclasses/berserker' -#/api/classes/{indexParam}/spells + url: '/api/2014/subclasses/berserker' +#/api/2014/classes/{indexParam}/spells class-spells-path: get: summary: Get spells available for a class. tags: - Class Resource Lists parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/ClassSpellList' + $ref: '../../schemas/2014/combined.yml#/ClassSpellList' example: count: 2 results: - index: power-word-kill name: Power Word Kill - url: '/api/spells/power-word-kill' + url: '/api/2014/spells/power-word-kill' level: 9 - index: true-polymorph name: True Polymorph - url: '/api/spells/true-polymorph' + url: '/api/2014/spells/true-polymorph' level: 9 -# /api/classes/{index}/spellcasting +# /api/2014/classes/{index}/spellcasting class-spellcasting-path: get: summary: Get spellcasting info for a class. tags: - Class parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/Spellcasting' + $ref: '../../schemas/2014/combined.yml#/Spellcasting' example: level: 1 spellcasting_ability: index: cha name: CHA - url: '/api/ability-scores/cha' + url: '/api/2014/ability-scores/cha' info: - name: Cantrips desc: @@ -280,83 +280,83 @@ class-spellcasting-path: content: application/json: schema: - $ref: '../schemas/combined.yml#/error-response' + $ref: '../../schemas/2014/combined.yml#/error-response' example: error: Not found -# /api/classes/{index}/features +# /api/2014/classes/{index}/features class-features-path: get: summary: Get features available for a class. tags: - Class Resource Lists parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: List of features for the class. content: application/json: schema: - $ref: '../schemas/combined.yml#/APIReferenceList' -# /api/classes/{index}/proficiencies + $ref: '../../schemas/2014/combined.yml#/APIReferenceList' +# /api/2014/classes/{index}/proficiencies class-proficiencies-path: get: summary: Get proficiencies available for a class. tags: - Class Resource Lists parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: List of proficiencies for the class. content: application/json: schema: - $ref: '../schemas/combined.yml#/APIReferenceList' -# /api/classes/{index}/multi-classing: + $ref: '../../schemas/2014/combined.yml#/APIReferenceList' +# /api/2014/classes/{index}/multi-classing: class-multi-classing-path: get: summary: Get multiclassing resource for a class. tags: - Class parameters: - - $ref: '../parameters/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/Multiclassing' + $ref: '../../schemas/2014/combined.yml#/Multiclassing' example: prerequisites: - ability_score: index: str name: STR - url: '/api/ability-scores/str' + url: '/api/2014/ability-scores/str' minimum_score: 13 proficiencies: - index: shields name: Shields - url: '/api/proficiencies/shields' + url: '/api/2014/proficiencies/shields' - index: simple-weapons name: Simple Weapons - url: '/api/proficiencies/simple-weapons' + url: '/api/2014/proficiencies/simple-weapons' - index: martial-weapons name: Martial Weapons - url: '/api/proficiencies/martial-weapons' + url: '/api/2014/proficiencies/martial-weapons' proficiency_choices: [] -# /api/classes/{index}/levels +# /api/2014/classes/{index}/levels class-levels-path: get: summary: Get all level resources for a class. tags: - Class Levels parameters: - - $ref: '../parameters/combined.yml#/class-index' - - $ref: '../parameters/combined.yml#/levels-subclass-filter' + - $ref: '../../parameters/2014/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/levels-subclass-filter' responses: '200': description: OK @@ -365,23 +365,23 @@ class-levels-path: schema: type: array items: - $ref: '../schemas/combined.yml#/ClassLevel' -# /api/classes/{index}/levels/{class_level} + $ref: '../../schemas/2014/combined.yml#/ClassLevel' +# /api/2014/classes/{index}/levels/{class_level} class-level-path: get: summary: Get level resource for a class and level. tags: - Class Levels parameters: - - $ref: '../parameters/combined.yml#/class-index' - - $ref: '../parameters/combined.yml#/class-level' + - $ref: '../../parameters/2014/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-level' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/ClassLevel' + $ref: '../../schemas/2014/combined.yml#/ClassLevel' example: level: 1 ability_score_bonuses: 0 @@ -389,10 +389,10 @@ class-level-path: features: - index: rage name: Rage - url: '/api/features/rage' + url: '/api/2014/features/rage' - index: barbarian-unarmored-defense name: Unarmored Defense - url: '/api/features/barbarian-unarmored-defense' + url: '/api/2014/features/barbarian-unarmored-defense' class_specific: rage_count: 2 rage_damage_bonus: 2 @@ -401,64 +401,64 @@ class-level-path: class: index: barbarian name: Barbarian - url: '/api/classes/barbarian' - url: '/api/classes/barbarian/levels/1' -# /api/classes/{index}/levels/{class_level}/features: + url: '/api/2014/classes/barbarian' + url: '/api/2014/classes/barbarian/levels/1' +# /api/2014/classes/{index}/levels/{class_level}/features: class-level-features-path: get: summary: Get features available to a class at the requested level. tags: - Class Levels parameters: - - $ref: '../parameters/combined.yml#/class-index' - - $ref: '../parameters/combined.yml#/class-level' + - $ref: '../../parameters/2014/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/class-level' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/APIReferenceList' + $ref: '../../schemas/2014/combined.yml#/APIReferenceList' example: count: 2 results: - index: barbarian-unarmored-defense name: Unarmored Defense - url: '/api/features/barbarian-unarmored-defense' + url: '/api/2014/features/barbarian-unarmored-defense' - index: rage name: Rage - url: '/api/features/rage' -# /api/classes/{index}/levels/{spell_level}/spells + url: '/api/2014/features/rage' +# /api/2014/classes/{index}/levels/{spell_level}/spells class-spell-level-spells-path: get: summary: Get spells of the requested level available to the class. tags: - Class Levels parameters: - - $ref: '../parameters/combined.yml#/class-index' - - $ref: '../parameters/combined.yml#/spell-level' + - $ref: '../../parameters/2014/combined.yml#/class-index' + - $ref: '../../parameters/2014/combined.yml#/spell-level' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/APIReferenceList' + $ref: '../../schemas/2014/combined.yml#/APIReferenceList' example: count: 5 results: - index: dominate-monster name: Dominate Monster - url: '/api/spells/dominate-monster' + url: '/api/2014/spells/dominate-monster' - index: earthquake name: Earthquake - url: '/api/spells/earthquake' + url: '/api/2014/spells/earthquake' - index: incendiary-cloud name: Incendiary Cloud - url: '/api/spells/incendiary-cloud' + url: '/api/2014/spells/incendiary-cloud' - index: power-word-stun name: Power Word Stun - url: '/api/spells/power-word-stun' + url: '/api/2014/spells/power-word-stun' - index: sunburst name: Sunburst - url: '/api/spells/sunburst' + url: '/api/2014/spells/sunburst' diff --git a/src/swagger/paths/combined.yml b/src/swagger/paths/2014/combined.yml similarity index 100% rename from src/swagger/paths/combined.yml rename to src/swagger/paths/2014/combined.yml diff --git a/src/swagger/paths/2014/common.yml b/src/swagger/paths/2014/common.yml new file mode 100644 index 00000000..444eb5a7 --- /dev/null +++ b/src/swagger/paths/2014/common.yml @@ -0,0 +1,56 @@ +api-base: + get: + summary: Get all resource URLs. + description: Making a request to the API's base URL returns an object containing available endpoints. + tags: + - Common + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + additionalProperties: + type: string + example: + ability-scores: "/api/2014/ability-scores" + alignments: "/api/2014/alignments" + backgrounds: "/api/2014/backgrounds" + classes: "/api/2014/classes" + conditions: "/api/2014/conditions" + damage-types: "/api/2014/damage-types" + equipment-categories: "/api/2014/equipment-categories" + equipment: "/api/2014/equipment" + feats: "/api/2014/feats" + features: "/api/2014/features" + languages: "/api/2014/languages" + magic-items: "/api/2014/magic-items" + magic-schools: "/api/2014/magic-schools" + monsters: "/api/2014/monsters" + proficiencies: "/api/2014/proficiencies" + races: "/api/2014/races" + rules: "/api/2014/rules" + rule-sections: "/api/2014/rule-sections" + skills: "/api/2014/skills" + spells: "/api/2014/spells" + subclasses: "/api/2014/subclasses" + subraces: "/api/2014/subraces" + traits: "/api/2014/traits" + weapon-properties: "/api/2014/weapon-properties" +resource-list: + get: + summary: "Get list of all available resources for an endpoint." + description: | + Currently only the [`/spells`](#get-/api/2014/spells) and [`/monsters`](#get-/api/2014/monsters) endpoints support filtering with query parameters. Use of these query parameters is documented under the respective [Spells](#tag--Spells) and [Monsters](#tag--Monsters) sections. + tags: + - Common + parameters: + - $ref: "../../parameters/2014/combined.yml#/base-endpoint-index" + responses: + "200": + description: "OK" + content: + application/json: + schema: + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" diff --git a/src/swagger/paths/conditions.yml b/src/swagger/paths/2014/conditions.yml similarity index 78% rename from src/swagger/paths/conditions.yml rename to src/swagger/paths/2014/conditions.yml index 2005f2cf..03f3eb5e 100644 --- a/src/swagger/paths/conditions.yml +++ b/src/swagger/paths/2014/conditions.yml @@ -3,25 +3,25 @@ get: description: | # Condition - A condition alters a creature’s capabilities in a variety of ways and can - arise as a result of a spell, a class feature, a monster’s attack, or other - effect. Most conditions, such as blinded, are impairments, but a few, such + A condition alters a creature’s capabilities in a variety of ways and can + arise as a result of a spell, a class feature, a monster’s attack, or other + effect. Most conditions, such as blinded, are impairments, but a few, such as invisible, can be advantageous. tags: - Game Mechanics parameters: - - $ref: "../parameters/combined.yml#/condition-index" + - $ref: "../../parameters/2014/combined.yml#/condition-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Condition" + $ref: "../../schemas/2014/combined.yml#/Condition" example: index: blinded name: Blinded - url: "/api/conditions/blinded" + url: "/api/2014/conditions/blinded" desc: - "- A blinded creature can't see and automatically fails any ability check that requires sight." diff --git a/src/swagger/paths/damage-types.yml b/src/swagger/paths/2014/damage-types.yml similarity index 74% rename from src/swagger/paths/damage-types.yml rename to src/swagger/paths/2014/damage-types.yml index e098de89..8aea0d8d 100644 --- a/src/swagger/paths/damage-types.yml +++ b/src/swagger/paths/2014/damage-types.yml @@ -3,23 +3,23 @@ get: description: | # Damage type - Different attacks, damaging spells, and other harmful effects deal different - types of damage. Damage types have no rules of their own, but other rules, + Different attacks, damaging spells, and other harmful effects deal different + types of damage. Damage types have no rules of their own, but other rules, such as damage resistance, rely on the types. tags: - Game Mechanics parameters: - - $ref: "../parameters/combined.yml#/damage-type-index" + - $ref: "../../parameters/2014/combined.yml#/damage-type-index" responses: "200": description: "OK" content: application/json: schema: - $ref: "../schemas/combined.yml#/DamageType" + $ref: "../../schemas/2014/combined.yml#/DamageType" example: index: acid name: Acid - url: "/api/damage-types/acid" + url: "/api/2014/damage-types/acid" desc: - "The corrosive spray of a black dragon's breath and the dissolving enzymes secreted by a black pudding deal acid damage." diff --git a/src/swagger/paths/equipment-categories.yml b/src/swagger/paths/2014/equipment-categories.yml similarity index 69% rename from src/swagger/paths/equipment-categories.yml rename to src/swagger/paths/2014/equipment-categories.yml index 686aa237..fe9320e7 100644 --- a/src/swagger/paths/equipment-categories.yml +++ b/src/swagger/paths/2014/equipment-categories.yml @@ -20,27 +20,27 @@ get: content: application/json: schema: - $ref: "../schemas/combined.yml#/EquipmentCategory" + $ref: "../../schemas/2014/combined.yml#/EquipmentCategory" example: index: waterborne-vehicles name: Waterborne Vehicles - url: "/api/equipment-categories/waterborne-vehicles" + url: "/api/2014/equipment-categories/waterborne-vehicles" equipment: - index: galley name: Galley - url: "/api/equipment/galley" + url: "/api/2014/equipment/galley" - index: keelboat name: Keelboat - url: "/api/equipment/keelboat" + url: "/api/2014/equipment/keelboat" - index: longship name: Longship - url: "/api/equipment/longship" + url: "/api/2014/equipment/longship" - index: rowboat name: Rowboat - url: "/api/equipment/rowboat" + url: "/api/2014/equipment/rowboat" - index: sailing-ship name: Sailing ship - url: "/api/equipment/sailing-ship" + url: "/api/2014/equipment/sailing-ship" - index: warship name: Warship - url: "/api/equipment/warship" + url: "/api/2014/equipment/warship" diff --git a/src/swagger/paths/equipment.yml b/src/swagger/paths/2014/equipment.yml similarity index 73% rename from src/swagger/paths/equipment.yml rename to src/swagger/paths/2014/equipment.yml index b14ae575..0ea628ba 100644 --- a/src/swagger/paths/equipment.yml +++ b/src/swagger/paths/2014/equipment.yml @@ -3,21 +3,21 @@ get: description: | # Equipment - Opportunities abound to find treasure, equipment, weapons, armor, and more - in the dungeons you explore. Normally, you can sell your treasures and - trinkets when you return to a town or other settlement, provided that you + Opportunities abound to find treasure, equipment, weapons, armor, and more + in the dungeons you explore. Normally, you can sell your treasures and + trinkets when you return to a town or other settlement, provided that you can find buyers and merchants interested in your loot. tags: - Equipment parameters: - - $ref: "../parameters/combined.yml#/equipment-index" + - $ref: "../../parameters/2014/combined.yml#/equipment-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Equipment" + $ref: "../../schemas/2014/combined.yml#/Equipment" example: category_range: Simple Melee contents: [] @@ -29,26 +29,26 @@ get: damage_type: index: bludgeoning name: Bludgeoning - url: "/api/damage-types/bludgeoning" + url: "/api/2014/damage-types/bludgeoning" desc: [] equipment_category: index: weapon name: Weapon - url: "/api/equipment-categories/weapon" + url: "/api/2014/equipment-categories/weapon" index: club name: Club properties: - index: light name: Light - url: "/api/weapon-properties/light" + url: "/api/2014/weapon-properties/light" - index: monk name: Monk - url: "/api/weapon-properties/monk" + url: "/api/2014/weapon-properties/monk" range: long: normal: 5 special: [] - url: "/api/equipment/club" + url: "/api/2014/equipment/club" weapon_category: Simple weapon_range: Melee weight: 2 diff --git a/src/swagger/paths/feats.yml b/src/swagger/paths/2014/feats.yml similarity index 87% rename from src/swagger/paths/feats.yml rename to src/swagger/paths/2014/feats.yml index 93ea54e6..9ac6f548 100644 --- a/src/swagger/paths/feats.yml +++ b/src/swagger/paths/2014/feats.yml @@ -1,7 +1,7 @@ get: summary: "Get a feat by index." description: | - # Feat + # Feat A feat is a boon a character can receive at level up instead of an ability score increase. tags: @@ -21,11 +21,11 @@ get: content: application/json: schema: - $ref: "../schemas/combined.yml#/Feat" + $ref: "../../schemas/2014/combined.yml#/Feat" example: index: grappler name: Grappler - url: "/api/feats/grappler" + url: "/api/2014/feats/grappler" desc: - "You’ve developed the Skills necessary to hold your own in close--quarters Grappling. You gain the following benefits:" @@ -37,5 +37,5 @@ get: - ability_score: index: str name: STR - url: "/api/ability-scores/str" + url: "/api/2014/ability-scores/str" minimum_score: 13 diff --git a/src/swagger/paths/features.yml b/src/swagger/paths/2014/features.yml similarity index 80% rename from src/swagger/paths/features.yml rename to src/swagger/paths/2014/features.yml index d99f220c..bef7e025 100644 --- a/src/swagger/paths/features.yml +++ b/src/swagger/paths/2014/features.yml @@ -1,31 +1,31 @@ get: summary: Get a feature by index. description: | - # Feature + # Feature - When you gain a new level in a class, you get its features for that level. - You don’t, however, receive the class’s starting Equipment, and a few - features have additional rules when you’re multiclassing: Channel Divinity, + When you gain a new level in a class, you get its features for that level. + You don’t, however, receive the class’s starting Equipment, and a few + features have additional rules when you’re multiclassing: Channel Divinity, Extra Attack, Unarmored Defense, and Spellcasting. tags: - Features parameters: - - $ref: "../parameters/combined.yml#/feature-index" + - $ref: "../../parameters/2014/combined.yml#/feature-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Feature" + $ref: "../../schemas/2014/combined.yml#/Feature" example: index: action-surge-1-use name: "Action Surge (1 use)" - url: "/api/features/action-surge-1-use" + url: "/api/2014/features/action-surge-1-use" class: index: fighter name: Fighter - url: "/api/classes/fighter" + url: "/api/2014/classes/fighter" desc: - Starting at 2nd level, you can push yourself beyond your normal limits for a moment. On your turn, you can take one additional action on top of your regular action and diff --git a/src/swagger/paths/languages.yml b/src/swagger/paths/2014/languages.yml similarity index 84% rename from src/swagger/paths/languages.yml rename to src/swagger/paths/2014/languages.yml index 5cac2e33..e4f9ef66 100644 --- a/src/swagger/paths/languages.yml +++ b/src/swagger/paths/2014/languages.yml @@ -7,18 +7,18 @@ get: tags: - Character Data parameters: - - $ref: "../parameters/combined.yml#/language-index" + - $ref: "../../parameters/2014/combined.yml#/language-index" responses: "200": description: "OK" content: application/json: schema: - $ref: "../schemas/combined.yml#/Language" + $ref: "../../schemas/2014/combined.yml#/Language" example: index: elvish name: Elvish - url: "/api/languages/elvish" + url: "/api/2014/languages/elvish" desc: "Elvish is fluid, with subtle intonations and intricate grammar. Elven literature is rich and varied, and their songs and poems are famous among other races. Many bards learn their language so they can add Elvish ballads to their repertoires." type: Standard script: Elvish diff --git a/src/swagger/paths/magic-items.yml b/src/swagger/paths/2014/magic-items.yml similarity index 86% rename from src/swagger/paths/magic-items.yml rename to src/swagger/paths/2014/magic-items.yml index 5cfad101..417ae43c 100644 --- a/src/swagger/paths/magic-items.yml +++ b/src/swagger/paths/2014/magic-items.yml @@ -20,11 +20,11 @@ get: content: application/json: schema: - $ref: "../schemas/combined.yml#/MagicItem" + $ref: "../../schemas/2014/combined.yml#/MagicItem" example: index: adamantine-armor name: Adamantine Armor - url: "/api/magic-items/adamantine-armor" + url: "/api/2014/magic-items/adamantine-armor" desc: - Armor (medium or heavy, but not hide), uncommon - This suit of armor is reinforced with adamantine, one of the hardest substances @@ -33,7 +33,7 @@ get: equipment_category: index: armor name: Armor - url: "/api/equipment-categories/armor" + url: "/api/2014/equipment-categories/armor" rarity: name: Uncommon variants: [] diff --git a/src/swagger/paths/magic-schools.yml b/src/swagger/paths/2014/magic-schools.yml similarity index 78% rename from src/swagger/paths/magic-schools.yml rename to src/swagger/paths/2014/magic-schools.yml index e45bc985..65edd6b6 100644 --- a/src/swagger/paths/magic-schools.yml +++ b/src/swagger/paths/2014/magic-schools.yml @@ -3,23 +3,23 @@ get: description: | # Magic School - Academies of magic group spells into eight categories called schools of - magic. Scholars, particularly wizards, apply these categories to all spells, - believing that all magic functions in essentially the same way, whether it + Academies of magic group spells into eight categories called schools of + magic. Scholars, particularly wizards, apply these categories to all spells, + believing that all magic functions in essentially the same way, whether it derives from rigorous study or is bestowed by a deity. tags: - Game Mechanics parameters: - - $ref: "../parameters/combined.yml#/magic-school-index" + - $ref: "../../parameters/2014/combined.yml#/magic-school-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/MagicSchool" + $ref: "../../schemas/2014/combined.yml#/MagicSchool" example: index: conjuration name: Conjuration - url: "/api/magic-schools/conjuration" + url: "/api/2014/magic-schools/conjuration" desc: "Conjuration spells involve the transportation of objects and creatures from one location to another. Some spells summon creatures or objects to the caster's side, whereas others allow the caster to teleport to another location. Some conjurations create objects or effects out of nothing." diff --git a/src/swagger/paths/monsters.yml b/src/swagger/paths/2014/monsters.yml similarity index 87% rename from src/swagger/paths/monsters.yml rename to src/swagger/paths/2014/monsters.yml index 2c4a26fb..886e3748 100644 --- a/src/swagger/paths/monsters.yml +++ b/src/swagger/paths/2014/monsters.yml @@ -4,32 +4,32 @@ monster-resource-list: tags: - Monsters parameters: - - $ref: '../parameters/combined.yml#/challenge-rating-filter' + - $ref: '../../parameters/2014/combined.yml#/challenge-rating-filter' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/APIReferenceList' + $ref: '../../schemas/2014/combined.yml#/APIReferenceList' monster-index: get: summary: Get monster by index. tags: - Monsters parameters: - - $ref: '../parameters/combined.yml#/monster-index' + - $ref: '../../parameters/2014/combined.yml#/monster-index' responses: '200': description: OK content: application/json: schema: - $ref: '../schemas/combined.yml#/Monster' + $ref: '../../schemas/2014/combined.yml#/Monster' example: index: aboleth name: Aboleth - url: '/api/monsters/aboleth' + url: '/api/2014/monsters/aboleth' actions: - attacks: [] damage: [] @@ -47,17 +47,17 @@ monster-index: damage_type: index: bludgeoning name: Bludgeoning - url: '/api/damage-types/bludgeoning' + url: '/api/2014/damage-types/bludgeoning' - damage_dice: 1d12 damage_type: index: acid name: Acid - url: '/api/damage-types/acid' + url: '/api/2014/damage-types/acid' dc: dc_type: index: con name: CON - url: '/api/ability-scores/con' + url: '/api/2014/ability-scores/con' dc_value: 14 success_type: none desc: "Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 12 (2d6 + @@ -77,7 +77,7 @@ monster-index: damage_type: index: bludgeoning name: Bludgeoning - url: '/api/damage-types/bludgeoning' + url: '/api/2014/damage-types/bludgeoning' desc: 'Melee Weapon Attack: +9 to hit, reach 10 ft. one target. Hit: 15 (3d6 + 5) bludgeoning damage.' name: Tail @@ -87,7 +87,7 @@ monster-index: dc_type: index: wis name: WIS - url: '/api/ability-scores/wis' + url: '/api/2014/ability-scores/wis' dc_value: 14 success_type: none desc: |- @@ -129,7 +129,7 @@ monster-index: damage_type: index: psychic name: Psychic - url: '/api/damage-types/psychic' + url: '/api/2014/damage-types/psychic' desc: One creature charmed by the aboleth takes 10 (3d6) psychic damage, and the aboleth regains hit points equal to the damage the creature takes. name: Psychic Drain (Costs 2 Actions) @@ -137,27 +137,27 @@ monster-index: - proficiency: index: saving-throw-con name: 'Saving Throw: CON' - url: '/api/proficiencies/saving-throw-con' + url: '/api/2014/proficiencies/saving-throw-con' value: 6 - proficiency: index: saving-throw-int name: 'Saving Throw: INT' - url: '/api/proficiencies/saving-throw-int' + url: '/api/2014/proficiencies/saving-throw-int' value: 8 - proficiency: index: saving-throw-wis name: 'Saving Throw: WIS' - url: '/api/proficiencies/saving-throw-wis' + url: '/api/2014/proficiencies/saving-throw-wis' value: 6 - proficiency: index: skill-history name: 'Skill: History' - url: '/api/proficiencies/skill-history' + url: '/api/2014/proficiencies/skill-history' value: 12 - proficiency: index: skill-perception name: 'Skill: Perception' - url: '/api/proficiencies/skill-perception' + url: '/api/2014/proficiencies/skill-perception' value: 10 reactions: [] senses: @@ -173,7 +173,7 @@ monster-index: dc_type: index: con name: CON - url: '/api/ability-scores/con' + url: '/api/2014/ability-scores/con' dc_value: 14 success_type: none desc: diff --git a/src/swagger/paths/proficiencies.yml b/src/swagger/paths/2014/proficiencies.yml similarity index 67% rename from src/swagger/paths/proficiencies.yml rename to src/swagger/paths/2014/proficiencies.yml index 1515482a..5b5baa17 100644 --- a/src/swagger/paths/proficiencies.yml +++ b/src/swagger/paths/2014/proficiencies.yml @@ -1,40 +1,40 @@ get: summary: "Get a proficiency by index." description: | - # Proficiency + # Proficiency By virtue of race, class, and background a character is proficient at using certain skills, weapons, and equipment. Characters can also gain additional proficiencies at higher levels or by multiclassing. A characters starting proficiencies are determined during character creation. tags: - Character Data parameters: - - $ref: "../parameters/combined.yml#/proficiency-index" + - $ref: "../../parameters/2014/combined.yml#/proficiency-index" responses: "200": description: "OK" content: application/json: schema: - $ref: "../schemas/combined.yml#/Proficiency" + $ref: "../../schemas/2014/combined.yml#/Proficiency" example: index: medium-armor name: Medium Armor - url: "/api/proficiencies/medium-armor" + url: "/api/2014/proficiencies/medium-armor" type: Armor classes: - index: barbarian name: Barbarian - url: "/api/classes/barbarian" + url: "/api/2014/classes/barbarian" - index: cleric name: Cleric - url: "/api/classes/cleric" + url: "/api/2014/classes/cleric" - index: druid name: Druid - url: "/api/classes/druid" + url: "/api/2014/classes/druid" - index: ranger name: Ranger - url: "/api/classes/ranger" + url: "/api/2014/classes/ranger" races: [] reference: index: medium-armor name: Medium Armor - url: "/api/equipment-categories/medium-armor" + url: "/api/2014/equipment-categories/medium-armor" diff --git a/src/swagger/paths/races.yml b/src/swagger/paths/2014/races.yml similarity index 74% rename from src/swagger/paths/races.yml rename to src/swagger/paths/2014/races.yml index 2b60a344..7dc017cf 100644 --- a/src/swagger/paths/races.yml +++ b/src/swagger/paths/2014/races.yml @@ -1,4 +1,4 @@ -# /api/races/{index} +# /api/2014/races/{index} race-path: get: summary: Get a race by index. @@ -6,23 +6,23 @@ race-path: tags: - Races parameters: - - $ref: "../parameters/combined.yml#/race-index" + - $ref: "../../parameters/2014/combined.yml#/race-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Race" + $ref: "../../schemas/2014/combined.yml#/Race" example: index: elf name: Elf - url: "/api/races/elf" + url: "/api/2014/races/elf" ability_bonuses: - ability_score: index: dex name: DEX - url: "/api/ability-scores/dex" + url: "/api/2014/ability-scores/dex" bonus: 2 age: Although elves reach physical maturity at about the same age as humans, the elven @@ -42,10 +42,10 @@ race-path: languages: - index: common name: Common - url: "/api/languages/common" + url: "/api/2014/languages/common" - index: elvish name: Elvish - url: "/api/languages/elvish" + url: "/api/2014/languages/elvish" size: Medium size_description: Elves range from under 5 to over 6 feet tall and have slender builds. @@ -54,63 +54,63 @@ race-path: starting_proficiencies: - index: skill-perception name: "Skill: Perception" - url: "/api/proficiencies/skill-perception" + url: "/api/2014/proficiencies/skill-perception" subraces: - index: high-elf name: High Elf - url: "/api/subraces/high-elf" + url: "/api/2014/subraces/high-elf" traits: - index: darkvision name: Darkvision - url: "/api/traits/darkvision" + url: "/api/2014/traits/darkvision" - index: fey-ancestry name: Fey Ancestry - url: "/api/traits/fey-ancestry" + url: "/api/2014/traits/fey-ancestry" - index: trance name: Trance - url: "/api/traits/trance" -# /api/races/{index}/subraces: + url: "/api/2014/traits/trance" +# /api/2014/races/{index}/subraces: race-subraces-path: get: summary: "Get subraces available for a race." tags: - Races parameters: - - $ref: "../parameters/combined.yml#/race-index" + - $ref: "../../parameters/2014/combined.yml#/race-index" responses: "200": description: "List of subraces for the race." content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" -# /api/races/{index}/proficiencies: + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" +# /api/2014/races/{index}/proficiencies: race-proficiencies-path: get: summary: "Get proficiencies available for a race." tags: - Races parameters: - - $ref: "../parameters/combined.yml#/race-index" + - $ref: "../../parameters/2014/combined.yml#/race-index" responses: "200": description: "List of proficiencies for the race." content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" -# /api/races/{index}/traits: + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" +# /api/2014/races/{index}/traits: race-traits-path: get: summary: "Get traits available for a race." tags: - Races parameters: - - $ref: "../parameters/combined.yml#/race-index" + - $ref: "../../parameters/2014/combined.yml#/race-index" responses: "200": description: "List of traits for the race." content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" diff --git a/src/swagger/paths/rule-sections.yml b/src/swagger/paths/2014/rule-sections.yml similarity index 89% rename from src/swagger/paths/rule-sections.yml rename to src/swagger/paths/2014/rule-sections.yml index 2d07eb09..7dcb962d 100644 --- a/src/swagger/paths/rule-sections.yml +++ b/src/swagger/paths/2014/rule-sections.yml @@ -4,18 +4,18 @@ get: tags: - Rules parameters: - - $ref: "../parameters/combined.yml#/rule-section-index" + - $ref: "../../parameters/2014/combined.yml#/rule-section-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/RuleSection" + $ref: "../../schemas/2014/combined.yml#/RuleSection" example: index: time name: Time - url: "/api/rule-sections/time" + url: "/api/2014/rule-sections/time" desc: | ## Time diff --git a/src/swagger/paths/rules.yml b/src/swagger/paths/2014/rules.yml similarity index 82% rename from src/swagger/paths/rules.yml rename to src/swagger/paths/2014/rules.yml index 279a580e..6d420d57 100644 --- a/src/swagger/paths/rules.yml +++ b/src/swagger/paths/2014/rules.yml @@ -1,26 +1,26 @@ get: summary: "Get a rule by index." description: | - # Rule + # Rule - Rules are pages in the SRD that document the mechanics of Dungeons and Dragons. - Rules have descriptions which is the text directly underneath the rule heading + Rules are pages in the SRD that document the mechanics of Dungeons and Dragons. + Rules have descriptions which is the text directly underneath the rule heading in the SRD. Rules also have subsections for each heading underneath the rule in the SRD. tags: - Rules parameters: - - $ref: "../parameters/combined.yml#/rule-index" + - $ref: "../../parameters/2014/combined.yml#/rule-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Rule" + $ref: "../../schemas/2014/combined.yml#/Rule" example: index: using-ability-scores name: Using Ability Scores - url: "/api/rules/using-ability-scores" + url: "/api/2014/rules/using-ability-scores" desc: | # Using Ability Scores @@ -44,19 +44,19 @@ get: subsections: - index: ability-scores-and-modifiers name: Ability Scores and Modifiers - url: "/api/rule-sections/ability-scores-and-modifiers" + url: "/api/2014/rule-sections/ability-scores-and-modifiers" - index: advantage-and-disadvantage name: Advantage and Disadvantage - url: "/api/rule-sections/advantage-and-disadvantage" + url: "/api/2014/rule-sections/advantage-and-disadvantage" - index: proficiency-bonus name: Proficiency Bonus - url: "/api/rule-sections/proficiency-bonus" + url: "/api/2014/rule-sections/proficiency-bonus" - index: ability-checks name: Ability Checks - url: "/api/rule-sections/ability-checks" + url: "/api/2014/rule-sections/ability-checks" - index: using-each-ability name: Using Each Ability - url: "/api/rule-sections/using-each-ability" + url: "/api/2014/rule-sections/using-each-ability" - index: saving-throws name: Saving Throws - url: "/api/rule-sections/saving-throws" + url: "/api/2014/rule-sections/saving-throws" diff --git a/src/swagger/paths/skills.yml b/src/swagger/paths/2014/skills.yml similarity index 84% rename from src/swagger/paths/skills.yml rename to src/swagger/paths/2014/skills.yml index c43c995c..724e5095 100644 --- a/src/swagger/paths/skills.yml +++ b/src/swagger/paths/2014/skills.yml @@ -7,22 +7,22 @@ get: tags: - Character Data parameters: - - $ref: "../parameters/combined.yml#/skill-index" + - $ref: "../../parameters/2014/combined.yml#/skill-index" responses: "200": description: "OK" content: application/json: schema: - $ref: "../schemas/combined.yml#/Skill" + $ref: "../../schemas/2014/combined.yml#/Skill" example: index: acrobatics name: Acrobatics - url: "/api/skills/acrobatics" + url: "/api/2014/skills/acrobatics" ability_score: index: dex name: DEX - url: "/api/ability-scores/dex" + url: "/api/2014/ability-scores/dex" desc: - Your Dexterity (Acrobatics) check covers your attempt to stay on your feet in a tricky situation, such as when you're trying to run across a sheet of ice, balance diff --git a/src/swagger/paths/spells.yml b/src/swagger/paths/2014/spells.yml similarity index 75% rename from src/swagger/paths/spells.yml rename to src/swagger/paths/2014/spells.yml index 24d11f96..3bd45c25 100644 --- a/src/swagger/paths/spells.yml +++ b/src/swagger/paths/2014/spells.yml @@ -4,15 +4,15 @@ spells-resource-list: tags: - Spells parameters: - - $ref: "../parameters/combined.yml#/level-filter" - - $ref: "../parameters/combined.yml#/school-filter" + - $ref: "../../parameters/2014/combined.yml#/level-filter" + - $ref: "../../parameters/2014/combined.yml#/school-filter" responses: "200": description: "OK" content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" spell-by-index: get: @@ -20,24 +20,24 @@ spell-by-index: tags: - Spells parameters: - - $ref: "../parameters/combined.yml#/spell-index" + - $ref: "../../parameters/2014/combined.yml#/spell-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Spell" + $ref: "../../schemas/2014/combined.yml#/Spell" example: index: sacred-flame name: Sacred Flame - url: "/api/spells/sacred-flame" + url: "/api/2014/spells/sacred-flame" attack_type: ranged casting_time: 1 action classes: - index: cleric name: Cleric - url: "/api/classes/cleric" + url: "/api/2014/classes/cleric" components: - V - S @@ -51,13 +51,13 @@ spell-by-index: damage_type: index: radiant name: Radiant - url: "/api/damage-types/radiant" + url: "/api/2014/damage-types/radiant" dc: dc_success: none dc_type: index: dex name: DEX - url: "/api/ability-scores/dex" + url: "/api/2014/ability-scores/dex" desc: - Flame-like radiance descends on a creature that you can see within range. The target must succeed on a dexterity saving throw or take 1d8 radiant damage. The target @@ -72,8 +72,8 @@ spell-by-index: school: index: evocation name: Evocation - url: "/api/magic-schools/evocation" + url: "/api/2014/magic-schools/evocation" subclasses: - index: lore name: Lore - url: "/api/subclasses/lore" + url: "/api/2014/subclasses/lore" diff --git a/src/swagger/paths/subclasses.yml b/src/swagger/paths/2014/subclasses.yml similarity index 68% rename from src/swagger/paths/subclasses.yml rename to src/swagger/paths/2014/subclasses.yml index 7ff742d7..15a02c4a 100644 --- a/src/swagger/paths/subclasses.yml +++ b/src/swagger/paths/2014/subclasses.yml @@ -1,4 +1,4 @@ -# /api/subclass/{index} +# /api/2014/subclass/{index} subclass-path: get: summary: Get a subclass by index. @@ -6,22 +6,22 @@ subclass-path: tags: - Subclasses parameters: - - $ref: "../parameters/combined.yml#/subclass-index" + - $ref: "../../parameters/2014/combined.yml#/subclass-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Subclass" + $ref: "../../schemas/2014/combined.yml#/Subclass" example: index: fiend name: Fiend - url: "/api/subclasses/fiend" + url: "/api/2014/subclasses/fiend" class: index: warlock name: Warlock - url: "/api/classes/warlock" + url: "/api/2014/classes/warlock" desc: - You have made a pact with a fiend from the lower planes of existence, a being whose aims are evil, even if you strive against those aims. Such beings desire the corruption @@ -34,117 +34,117 @@ subclass-path: - index: warlock-1 name: Warlock 1 type: level - url: "/api/classes/warlock/levels/1" + url: "/api/2014/classes/warlock/levels/1" spell: index: burning-hands name: Burning Hands - url: "/api/spells/burning-hands" + url: "/api/2014/spells/burning-hands" - prerequisites: - index: warlock-1 name: Warlock 1 type: level - url: "/api/classes/warlock/levels/1" + url: "/api/2014/classes/warlock/levels/1" spell: index: command name: Command - url: "/api/spells/command" + url: "/api/2014/spells/command" - prerequisites: - index: warlock-3 name: Warlock 3 type: level - url: "/api/classes/warlock/levels/3" + url: "/api/2014/classes/warlock/levels/3" spell: index: blindness-deafness name: Blindness/Deafness - url: "/api/spells/blindness-deafness" + url: "/api/2014/spells/blindness-deafness" - prerequisites: - index: warlock-3 name: Warlock 3 type: level - url: "/api/classes/warlock/levels/3" + url: "/api/2014/classes/warlock/levels/3" spell: index: scorching-ray name: Scorching Ray - url: "/api/spells/scorching-ray" + url: "/api/2014/spells/scorching-ray" - prerequisites: - index: warlock-5 name: Warlock 5 type: level - url: "/api/classes/warlock/levels/5" + url: "/api/2014/classes/warlock/levels/5" spell: index: fireball name: Fireball - url: "/api/spells/fireball" + url: "/api/2014/spells/fireball" - prerequisites: - index: warlock-5 name: Warlock 5 type: level - url: "/api/classes/warlock/levels/5" + url: "/api/2014/classes/warlock/levels/5" spell: index: stinking-cloud name: Stinking Cloud - url: "/api/spells/stinking-cloud" + url: "/api/2014/spells/stinking-cloud" - prerequisites: - index: warlock-7 name: Warlock 7 type: level - url: "/api/classes/warlock/levels/7" + url: "/api/2014/classes/warlock/levels/7" spell: index: fire-shield name: Fire Shield - url: "/api/spells/fire-shield" + url: "/api/2014/spells/fire-shield" - prerequisites: - index: warlock-7 name: Warlock 7 type: level - url: "/api/classes/warlock/levels/7" + url: "/api/2014/classes/warlock/levels/7" spell: index: wall-of-fire name: Wall of Fire - url: "/api/spells/wall-of-fire" + url: "/api/2014/spells/wall-of-fire" - prerequisites: - index: warlock-9 name: Warlock 9 type: level - url: "/api/classes/warlock/levels/9" + url: "/api/2014/classes/warlock/levels/9" spell: index: flame-strike name: Flame Strike - url: "/api/spells/flame-strike" + url: "/api/2014/spells/flame-strike" - prerequisites: - index: warlock-9 name: Warlock 9 type: level - url: "/api/classes/warlock/levels/9" + url: "/api/2014/classes/warlock/levels/9" spell: index: hallow name: Hallow - url: "/api/spells/hallow" + url: "/api/2014/spells/hallow" subclass_flavor: Otherworldly Patron - subclass_levels: "/api/subclasses/fiend/levels" -# /api/subclasses/{index}/features: + subclass_levels: "/api/2014/subclasses/fiend/levels" +# /api/2014/subclasses/{index}/features: subclass-features-path: get: summary: "Get features available for a subclass." tags: - Subclasses parameters: - - $ref: "../parameters/combined.yml#/subclass-index" + - $ref: "../../parameters/2014/combined.yml#/subclass-index" responses: "200": description: "List of features for the subclass." content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" -# /api/subclasses/{index}/levels: + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" +# /api/2014/subclasses/{index}/levels: subclass-levels-path: get: summary: "Get all level resources for a subclass." tags: - Subclasses parameters: - - $ref: "../parameters/combined.yml#/subclass-index" + - $ref: "../../parameters/2014/combined.yml#/subclass-index" responses: "200": description: "List of level resource for the subclass." @@ -153,15 +153,15 @@ subclass-levels-path: schema: type: array items: - $ref: "../schemas/combined.yml#/SubclassLevelResource" -# /api/subclasses/{index}/levels/{subclass_level}: + $ref: "../../schemas/2014/combined.yml#/SubclassLevelResource" +# /api/2014/subclasses/{index}/levels/{subclass_level}: subclass-level-path: get: summary: "Get level resources for a subclass and level." tags: - Subclasses parameters: - - $ref: "../parameters/combined.yml#/subclass-index" + - $ref: "../../parameters/2014/combined.yml#/subclass-index" - name: subclass_level in: path required: true @@ -176,31 +176,31 @@ subclass-level-path: content: application/json: schema: - $ref: "../schemas/combined.yml#/SubclassLevel" + $ref: "../../schemas/2014/combined.yml#/SubclassLevel" example: index: devotion-3 - url: "/api/subclasses/devotion/levels/3" + url: "/api/2014/subclasses/devotion/levels/3" class: index: paladin name: Paladin - url: "/api/classes/paladin" + url: "/api/2014/classes/paladin" features: - index: channel-divinity name: Channel Divinity - url: "/api/features/channel-divinity" + url: "/api/2014/features/channel-divinity" level: 3 subclass: index: devotion name: Devotion - url: "/api/subclasses/devotion" -# /api/subclasses/{index}/levels/{subclass_level}/features: + url: "/api/2014/subclasses/devotion" +# /api/2014/subclasses/{index}/levels/{subclass_level}/features: subclass-level-features-path: get: summary: "Get features of the requested spell level available to the class." tags: - Subclasses parameters: - - $ref: "../parameters/combined.yml#/subclass-index" + - $ref: "../../parameters/2014/combined.yml#/subclass-index" - name: subclass_level in: path required: true @@ -215,4 +215,4 @@ subclass-level-features-path: content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" diff --git a/src/swagger/paths/subraces.yml b/src/swagger/paths/2014/subraces.yml similarity index 66% rename from src/swagger/paths/subraces.yml rename to src/swagger/paths/2014/subraces.yml index be1ab80b..7a7e55f0 100644 --- a/src/swagger/paths/subraces.yml +++ b/src/swagger/paths/2014/subraces.yml @@ -1,4 +1,4 @@ -# /api/subraces/{index} +# /api/2014/subraces/{index} subraces-path: get: summary: Get a subrace by index. @@ -6,63 +6,63 @@ subraces-path: tags: - Subraces parameters: - - $ref: "../parameters/combined.yml#/subrace-index" + - $ref: "../../parameters/2014/combined.yml#/subrace-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Subrace" + $ref: "../../schemas/2014/combined.yml#/Subrace" example: index: hill-dwarf name: Hill Dwarf - url: "/api/subraces/hill-dwarf" + url: "/api/2014/subraces/hill-dwarf" ability_bonuses: - ability_score: index: wis name: WIS - url: "/api/ability-scores/wis" + url: "/api/2014/ability-scores/wis" bonus: 1 desc: As a hill dwarf, you have keen senses, deep intuition, and remarkable resilience. languages: [] race: index: dwarf name: Dwarf - url: "/api/races/dwarf" + url: "/api/2014/races/dwarf" racial_traits: - index: dwarven-toughness name: Dwarven Toughness - url: "/api/traits/dwarven-toughness" + url: "/api/2014/traits/dwarven-toughness" starting_proficiencies: [] -# /api/subraces/{index}/proficiencies +# /api/2014/subraces/{index}/proficiencies subrace-proficiencies-path: get: summary: "Get proficiences available for a subrace." tags: - Subraces parameters: - - $ref: "../parameters/combined.yml#/subrace-index" + - $ref: "../../parameters/2014/combined.yml#/subrace-index" responses: "200": description: "List of proficiences for the subrace." content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" -# /api/subraces/{index}/traits + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" +# /api/2014/subraces/{index}/traits subrace-traits-path: get: summary: "Get traits available for a subrace." tags: - Subraces parameters: - - $ref: "../parameters/combined.yml#/subrace-index" + - $ref: "../../parameters/2014/combined.yml#/subrace-index" responses: "200": description: "List of traits for the subrace." content: application/json: schema: - $ref: "../schemas/combined.yml#/APIReferenceList" + $ref: "../../schemas/2014/combined.yml#/APIReferenceList" diff --git a/src/swagger/paths/traits.yml b/src/swagger/paths/2014/traits.yml similarity index 80% rename from src/swagger/paths/traits.yml rename to src/swagger/paths/2014/traits.yml index 3677ee4c..fd2cd4df 100644 --- a/src/swagger/paths/traits.yml +++ b/src/swagger/paths/2014/traits.yml @@ -3,18 +3,18 @@ get: tags: - Traits parameters: - - $ref: "../parameters/combined.yml#/trait-index" + - $ref: "../../parameters/2014/combined.yml#/trait-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/Trait" + $ref: "../../schemas/2014/combined.yml#/Trait" example: index: trance name: Trance - url: "/api/traits/trance" + url: "/api/2014/traits/trance" desc: - Elves do not need to sleep. Instead, they meditate deeply, remaining semiconscious, for 4 hours a day. (The Common word for such meditation is "trance.") While meditating, @@ -25,5 +25,5 @@ get: races: - index: elf name: Elf - url: "/api/races/elf" + url: "/api/2014/races/elf" subraces: [] diff --git a/src/swagger/paths/weapon-properties.yml b/src/swagger/paths/2014/weapon-properties.yml similarity index 85% rename from src/swagger/paths/weapon-properties.yml rename to src/swagger/paths/2014/weapon-properties.yml index 1dcc2895..af8b2a83 100644 --- a/src/swagger/paths/weapon-properties.yml +++ b/src/swagger/paths/2014/weapon-properties.yml @@ -3,18 +3,18 @@ get: tags: - Equipment parameters: - - $ref: "../parameters/combined.yml#/weapon-property-index" + - $ref: "../../parameters/2014/combined.yml#/weapon-property-index" responses: "200": description: OK content: application/json: schema: - $ref: "../schemas/combined.yml#/WeaponProperty" + $ref: "../../schemas/2014/combined.yml#/WeaponProperty" example: index: ammunition name: Ammunition - url: "/api/weapon-properties/ammunition" + url: "/api/2014/weapon-properties/ammunition" desc: - You can use a weapon that has the ammunition property to make a ranged attack only if you have ammunition to fire from the weapon. Each time you attack with the weapon, diff --git a/src/swagger/paths/2024/.keepme b/src/swagger/paths/2024/.keepme new file mode 100644 index 00000000..e69de29b diff --git a/src/swagger/paths/common.yml b/src/swagger/paths/common.yml deleted file mode 100644 index 8b0bbca3..00000000 --- a/src/swagger/paths/common.yml +++ /dev/null @@ -1,56 +0,0 @@ -api-base: - get: - summary: Get all resource URLs. - description: Making a request to the API's base URL returns an object containing available endpoints. - tags: - - Common - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - additionalProperties: - type: string - example: - ability-scores: "/api/ability-scores" - alignments: "/api/alignments" - backgrounds: "/api/backgrounds" - classes: "/api/classes" - conditions: "/api/conditions" - damage-types: "/api/damage-types" - equipment-categories: "/api/equipment-categories" - equipment: "/api/equipment" - feats: "/api/feats" - features: "/api/features" - languages: "/api/languages" - magic-items: "/api/magic-items" - magic-schools: "/api/magic-schools" - monsters: "/api/monsters" - proficiencies: "/api/proficiencies" - races: "/api/races" - rules: "/api/rules" - rule-sections: "/api/rule-sections" - skills: "/api/skills" - spells: "/api/spells" - subclasses: "/api/subclasses" - subraces: "/api/subraces" - traits: "/api/traits" - weapon-properties: "/api/weapon-properties" -resource-list: - get: - summary: "Get list of all available resources for an endpoint." - description: | - Currently only the [`/spells`](#get-/api/spells) and [`/monsters`](#get-/api/monsters) endpoints support filtering with query parameters. Use of these query parameters is documented under the respective [Spells](#tag--Spells) and [Monsters](#tag--Monsters) sections. - tags: - - Common - parameters: - - $ref: "../parameters/combined.yml#/base-endpoint-index" - responses: - "200": - description: "OK" - content: - application/json: - schema: - $ref: "../schemas/combined.yml#/APIReferenceList" diff --git a/src/swagger/schemas/ability-scores.yml b/src/swagger/schemas/2014/ability-scores.yml similarity index 100% rename from src/swagger/schemas/ability-scores.yml rename to src/swagger/schemas/2014/ability-scores.yml diff --git a/src/swagger/schemas/alignments.yml b/src/swagger/schemas/2014/alignments.yml similarity index 100% rename from src/swagger/schemas/alignments.yml rename to src/swagger/schemas/2014/alignments.yml diff --git a/src/swagger/schemas/armor.yml b/src/swagger/schemas/2014/armor.yml similarity index 100% rename from src/swagger/schemas/armor.yml rename to src/swagger/schemas/2014/armor.yml diff --git a/src/swagger/schemas/backgrounds.yml b/src/swagger/schemas/2014/backgrounds.yml similarity index 100% rename from src/swagger/schemas/backgrounds.yml rename to src/swagger/schemas/2014/backgrounds.yml diff --git a/src/swagger/schemas/classes.yml b/src/swagger/schemas/2014/classes.yml similarity index 100% rename from src/swagger/schemas/classes.yml rename to src/swagger/schemas/2014/classes.yml diff --git a/src/swagger/schemas/combined.yml b/src/swagger/schemas/2014/combined.yml similarity index 100% rename from src/swagger/schemas/combined.yml rename to src/swagger/schemas/2014/combined.yml diff --git a/src/swagger/schemas/common.yml b/src/swagger/schemas/2014/common.yml similarity index 100% rename from src/swagger/schemas/common.yml rename to src/swagger/schemas/2014/common.yml diff --git a/src/swagger/schemas/equipment.yml b/src/swagger/schemas/2014/equipment.yml similarity index 100% rename from src/swagger/schemas/equipment.yml rename to src/swagger/schemas/2014/equipment.yml diff --git a/src/swagger/schemas/feats.yml b/src/swagger/schemas/2014/feats.yml similarity index 100% rename from src/swagger/schemas/feats.yml rename to src/swagger/schemas/2014/feats.yml diff --git a/src/swagger/schemas/features.yml b/src/swagger/schemas/2014/features.yml similarity index 100% rename from src/swagger/schemas/features.yml rename to src/swagger/schemas/2014/features.yml diff --git a/src/swagger/schemas/game-mechanics.yml b/src/swagger/schemas/2014/game-mechanics.yml similarity index 100% rename from src/swagger/schemas/game-mechanics.yml rename to src/swagger/schemas/2014/game-mechanics.yml diff --git a/src/swagger/schemas/language.yml b/src/swagger/schemas/2014/language.yml similarity index 100% rename from src/swagger/schemas/language.yml rename to src/swagger/schemas/2014/language.yml diff --git a/src/swagger/schemas/monsters-common.yml b/src/swagger/schemas/2014/monsters-common.yml similarity index 100% rename from src/swagger/schemas/monsters-common.yml rename to src/swagger/schemas/2014/monsters-common.yml diff --git a/src/swagger/schemas/monsters.yml b/src/swagger/schemas/2014/monsters.yml similarity index 100% rename from src/swagger/schemas/monsters.yml rename to src/swagger/schemas/2014/monsters.yml diff --git a/src/swagger/schemas/multiclassing.yml b/src/swagger/schemas/2014/multiclassing.yml similarity index 100% rename from src/swagger/schemas/multiclassing.yml rename to src/swagger/schemas/2014/multiclassing.yml diff --git a/src/swagger/schemas/proficiencies.yml b/src/swagger/schemas/2014/proficiencies.yml similarity index 100% rename from src/swagger/schemas/proficiencies.yml rename to src/swagger/schemas/2014/proficiencies.yml diff --git a/src/swagger/schemas/races.yml b/src/swagger/schemas/2014/races.yml similarity index 100% rename from src/swagger/schemas/races.yml rename to src/swagger/schemas/2014/races.yml diff --git a/src/swagger/schemas/rules.yml b/src/swagger/schemas/2014/rules.yml similarity index 100% rename from src/swagger/schemas/rules.yml rename to src/swagger/schemas/2014/rules.yml diff --git a/src/swagger/schemas/skills.yml b/src/swagger/schemas/2014/skills.yml similarity index 100% rename from src/swagger/schemas/skills.yml rename to src/swagger/schemas/2014/skills.yml diff --git a/src/swagger/schemas/spell.yml b/src/swagger/schemas/2014/spell.yml similarity index 100% rename from src/swagger/schemas/spell.yml rename to src/swagger/schemas/2014/spell.yml diff --git a/src/swagger/schemas/spellcasting.yml b/src/swagger/schemas/2014/spellcasting.yml similarity index 100% rename from src/swagger/schemas/spellcasting.yml rename to src/swagger/schemas/2014/spellcasting.yml diff --git a/src/swagger/schemas/subclass.yml b/src/swagger/schemas/2014/subclass.yml similarity index 100% rename from src/swagger/schemas/subclass.yml rename to src/swagger/schemas/2014/subclass.yml diff --git a/src/swagger/schemas/subrace.yml b/src/swagger/schemas/2014/subrace.yml similarity index 100% rename from src/swagger/schemas/subrace.yml rename to src/swagger/schemas/2014/subrace.yml diff --git a/src/swagger/schemas/traits.yml b/src/swagger/schemas/2014/traits.yml similarity index 100% rename from src/swagger/schemas/traits.yml rename to src/swagger/schemas/2014/traits.yml diff --git a/src/swagger/schemas/weapon.yml b/src/swagger/schemas/2014/weapon.yml similarity index 100% rename from src/swagger/schemas/weapon.yml rename to src/swagger/schemas/2014/weapon.yml diff --git a/src/swagger/schemas/2024/.keepme b/src/swagger/schemas/2024/.keepme new file mode 100644 index 00000000..e69de29b diff --git a/src/swagger/swagger.yml b/src/swagger/swagger.yml index 5712451e..7099844f 100644 --- a/src/swagger/swagger.yml +++ b/src/swagger/swagger.yml @@ -20,7 +20,7 @@ info: For example, if you paste and run this `curl` command: ```bash - curl -X GET "https://www.dnd5eapi.co/api/ability-scores/cha" -H "Accept: application/json" + curl -X GET "https://www.dnd5eapi.co/api/2014/ability-scores/cha" -H "Accept: application/json" ``` We should see a result containing details about the Charisma ability score: @@ -43,25 +43,25 @@ info: { "name": "Deception", "index": "deception", - "url": "/api/skills/deception" + "url": "/api/2014/skills/deception" }, { "name": "Intimidation", "index": "intimidation", - "url": "/api/skills/intimidation" + "url": "/api/2014/skills/intimidation" }, { "name": "Performance", "index": "performance", - "url": "/api/skills/performance" + "url": "/api/2014/skills/performance" }, { "name": "Persuasion", "index": "persuasion", - "url": "/api/skills/persuasion" + "url": "/api/2014/skills/persuasion" } ], - "url": "/api/ability-scores/cha" + "url": "/api/2014/ability-scores/cha" } ``` @@ -223,104 +223,103 @@ tags: paths: /api: - $ref: './paths/combined.yml#/base' - /api/{endpoint}: - $ref: './paths/combined.yml#/list' - /api/ability-scores/{index}: - $ref: './paths/combined.yml#/ability-scores' - /api/alignments/{index}: - $ref: './paths/combined.yml#/alignments' - /api/backgrounds/{index}: - $ref: './paths/combined.yml#/backgrounds' - /api/classes/{index}: - $ref: './paths/combined.yml#/classes' - /api/classes/{index}/subclasses: - $ref: './paths/combined.yml#/class-subclass' - /api/classes/{index}/spells: - $ref: './paths/combined.yml#/class-spells' - /api/classes/{index}/spellcasting: - $ref: './paths/combined.yml#/class-spellcasting' - /api/classes/{index}/features: - $ref: './paths/combined.yml#/class-features' - /api/classes/{index}/proficiencies: - $ref: './paths/combined.yml#/class-proficiencies' - /api/classes/{index}/multi-classing: - $ref: './paths/combined.yml#/class-multi-classing' - /api/classes/{index}/levels: - $ref: './paths/combined.yml#/class-levels' - /api/classes/{index}/levels/{class_level}: - $ref: './paths/combined.yml#/class-level' - /api/classes/{index}/levels/{class_level}/features: - $ref: './paths/combined.yml#/class-level-features' - /api/classes/{index}/levels/{spell_level}/spells: - $ref: './paths/combined.yml#/class-spell-level-spells' - /api/conditions/{index}: - $ref: './paths/combined.yml#/conditions' - /api/damage-types/{index}: - $ref: './paths/combined.yml#/damage-types' - /api/equipment/{index}: - $ref: './paths/combined.yml#/equipment' - /api/equipment-categories/{index}: - $ref: './paths/combined.yml#/equipment-categories' - /api/feats/{index}: - $ref: './paths/combined.yml#/feats' - /api/features/{index}: - $ref: './paths/combined.yml#/features' - /api/languages/{index}: - $ref: './paths/combined.yml#/languages' - /api/magic-items/{index}: - $ref: './paths/combined.yml#/magic-items' - /api/magic-schools/{index}: - $ref: './paths/combined.yml#/magic-schools' - /api/monsters: - $ref: './paths/combined.yml#/monsters' - /api/monsters/{index}: - $ref: './paths/combined.yml#/monster' - /api/proficiencies/{index}: - $ref: './paths/combined.yml#/proficiencies' - /api/races/{index}: - $ref: './paths/combined.yml#/races' - /api/races/{index}/subraces: - $ref: './paths/combined.yml#/race-subraces' - /api/races/{index}/proficiencies: - $ref: './paths/combined.yml#/race-proficiencies' - /api/races/{index}/traits: - $ref: './paths/combined.yml#/race-traits' - /api/rule-sections/{index}: - $ref: './paths/combined.yml#/rule-sections' - /api/rules/{index}: - $ref: './paths/combined.yml#/rules' - /api/skills/{index}: - $ref: './paths/combined.yml#/skills' - /api/spells: - $ref: './paths/combined.yml#/spells' - /api/spells/{index}: - $ref: './paths/combined.yml#/spell' - /api/subclasses/{index}: - $ref: './paths/combined.yml#/subclasses' - /api/subclasses/{index}/features: - $ref: './paths/combined.yml#/subclass-features' - /api/subclasses/{index}/levels: - $ref: './paths/combined.yml#/subclass-levels' - /api/subclasses/{index}/levels/{subclass_level}: - $ref: './paths/combined.yml#/subclass-level' - /api/subclasses/{index}/levels/{subclass_level}/features: - $ref: './paths/combined.yml#/subclass-level-features' - /api/subraces/{index}: - $ref: './paths/combined.yml#/subraces' - /api/subraces/{index}/proficiencies: - $ref: './paths/combined.yml#/subrace-proficiencies' - /api/subraces/{index}/traits: - $ref: './paths/combined.yml#/subrace-traits' - /api/traits/{index}: - $ref: './paths/combined.yml#/traits' - /api/weapon-properties/{index}: - $ref: './paths/combined.yml#/weapon-properties' + $ref: './paths/2014/combined.yml#/base' + /api/2014/{endpoint}: + $ref: './paths/2014/combined.yml#/list' + /api/2014/ability-scores/{index}: + $ref: './paths/2014/combined.yml#/ability-scores' + /api/2014/alignments/{index}: + $ref: './paths/2014/combined.yml#/alignments' + /api/2014/backgrounds/{index}: + $ref: './paths/2014/combined.yml#/backgrounds' + /api/2014/classes/{index}: + $ref: './paths/2014/combined.yml#/classes' + /api/2014/classes/{index}/subclasses: + $ref: './paths/2014/combined.yml#/class-subclass' + /api/2014/classes/{index}/spells: + $ref: './paths/2014/combined.yml#/class-spells' + /api/2014/classes/{index}/spellcasting: + $ref: './paths/2014/combined.yml#/class-spellcasting' + /api/2014/classes/{index}/features: + $ref: './paths/2014/combined.yml#/class-features' + /api/2014/classes/{index}/proficiencies: + $ref: './paths/2014/combined.yml#/class-proficiencies' + /api/2014/classes/{index}/multi-classing: + $ref: './paths/2014/combined.yml#/class-multi-classing' + /api/2014/classes/{index}/levels: + $ref: './paths/2014/combined.yml#/class-levels' + /api/2014/classes/{index}/levels/{class_level}: + $ref: './paths/2014/combined.yml#/class-level' + /api/2014/classes/{index}/levels/{class_level}/features: + $ref: './paths/2014/combined.yml#/class-level-features' + /api/2014/classes/{index}/levels/{spell_level}/spells: + $ref: './paths/2014/combined.yml#/class-spell-level-spells' + /api/2014/conditions/{index}: + $ref: './paths/2014/combined.yml#/conditions' + /api/2014/damage-types/{index}: + $ref: './paths/2014/combined.yml#/damage-types' + /api/2014/equipment/{index}: + $ref: './paths/2014/combined.yml#/equipment' + /api/2014/equipment-categories/{index}: + $ref: './paths/2014/combined.yml#/equipment-categories' + /api/2014/feats/{index}: + $ref: './paths/2014/combined.yml#/feats' + /api/2014/features/{index}: + $ref: './paths/2014/combined.yml#/features' + /api/2014/languages/{index}: + $ref: './paths/2014/combined.yml#/languages' + /api/2014/magic-items/{index}: + $ref: './paths/2014/combined.yml#/magic-items' + /api/2014/magic-schools/{index}: + $ref: './paths/2014/combined.yml#/magic-schools' + /api/2014/monsters: + $ref: './paths/2014/combined.yml#/monsters' + /api/2014/monsters/{index}: + $ref: './paths/2014/combined.yml#/monster' + /api/2014/proficiencies/{index}: + $ref: './paths/2014/combined.yml#/proficiencies' + /api/2014/races/{index}: + $ref: './paths/2014/combined.yml#/races' + /api/2014/races/{index}/subraces: + $ref: './paths/2014/combined.yml#/race-subraces' + /api/2014/races/{index}/proficiencies: + $ref: './paths/2014/combined.yml#/race-proficiencies' + /api/2014/races/{index}/traits: + $ref: './paths/2014/combined.yml#/race-traits' + /api/2014/rule-sections/{index}: + $ref: './paths/2014/combined.yml#/rule-sections' + /api/2014/rules/{index}: + $ref: './paths/2014/combined.yml#/rules' + /api/2014/skills/{index}: + $ref: './paths/2014/combined.yml#/skills' + /api/2014/spells: + $ref: './paths/2014/combined.yml#/spells' + /api/2014/spells/{index}: + $ref: './paths/2014/combined.yml#/spell' + /api/2014/subclasses/{index}: + $ref: './paths/2014/combined.yml#/subclasses' + /api/2014/subclasses/{index}/features: + $ref: './paths/2014/combined.yml#/subclass-features' + /api/2014/subclasses/{index}/levels: + $ref: './paths/2014/combined.yml#/subclass-levels' + /api/2014/subclasses/{index}/levels/{subclass_level}: + $ref: './paths/2014/combined.yml#/subclass-level' + /api/2014/subclasses/{index}/levels/{subclass_level}/features: + $ref: './paths/2014/combined.yml#/subclass-level-features' + /api/2014/subraces/{index}: + $ref: './paths/2014/combined.yml#/subraces' + /api/2014/subraces/{index}/proficiencies: + $ref: './paths/2014/combined.yml#/subrace-proficiencies' + /api/2014/subraces/{index}/traits: + $ref: './paths/2014/combined.yml#/subrace-traits' + /api/2014/traits/{index}: + $ref: './paths/2014/combined.yml#/traits' + /api/2014/weapon-properties/{index}: + $ref: './paths/2014/combined.yml#/weapon-properties' components: parameters: - $ref: './parameters/combined.yml' + $ref: './parameters/2014/combined.yml' schemas: - $ref: './schemas/combined.yml' - + $ref: './schemas/2014/combined.yml' From c5cf5204ae1620f4ce741bdc77e21029d1c5d9f3 Mon Sep 17 00:00:00 2001 From: Christopher Ward Date: Tue, 31 Dec 2024 15:56:46 -0800 Subject: [PATCH 8/8] Add versioning readme --- README.md | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 2f5c71fa..b19374e3 100644 --- a/README.md +++ b/README.md @@ -37,33 +37,37 @@ Then back over here in the 5e-srd-api repo, in the file `docker-compose.yml`, yo ## Making API Requests Make API requests by using the root address: -`http://localhost:3000/api/` +`http://localhost:3000/api/2014` You should get a response with the available endpoints for the root: ```json { - "ability-scores": "/api/ability-scores", - "classes": "/api/classes", - "conditions": "/api/conditions", - "damage-types": "/api/damage-types", - "equipment-categories": "/api/equipment-categories", - "equipment": "/api/equipment", - "features": "/api/features", - "languages": "/api/languages", - "magic-schools": "/api/magic-schools", - "monsters": "/api/monsters", - "proficiencies": "/api/proficiencies", - "races": "/api/races", - "skills": "/api/skills", - "spells": "/api/spells", - "subclasses": "/api/subclasses", - "subraces": "/api/subraces", - "traits": "/api/traits", - "weapon-properties": "/api/weapon-properties" + "ability-scores": "/api/2014/ability-scores", + "classes": "/api/2014/classes", + "conditions": "/api/2014/conditions", + "damage-types": "/api/2014/damage-types", + "equipment-categories": "/api/2014/equipment-categories", + "equipment": "/api/2014/equipment", + "features": "/api/2014/features", + "languages": "/api/2014/languages", + "magic-schools": "/api/2014/magic-schools", + "monsters": "/api/2014/monsters", + "proficiencies": "/api/2014/proficiencies", + "races": "/api/2014/races", + "skills": "/api/2014/skills", + "spells": "/api/2014/spells", + "subclasses": "/api/2014/subclasses", + "subraces": "/api/2014/subraces", + "traits": "/api/2014/traits", + "weapon-properties": "/api/2014/weapon-properties" } ``` +### Versioning + +The API is versioned by release years of the SRD. Currently only `/api/2014` is available. The next version will be `/api/2024`. + ## Working with a local image of 5e Database If you are working on a feature which requires changes to both this repo, _and_ the 5e-database repo, it is useful to know how to connect the former to the latter for testing purposes. A simple process for doing so is as follows: