Skip to content

Commit

Permalink
Setup graphql endpoints for 2014
Browse files Browse the repository at this point in the history
  • Loading branch information
bagelbits committed Dec 28, 2024
1 parent 501c8b7 commit 8f81d25
Show file tree
Hide file tree
Showing 60 changed files with 167 additions and 159 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import SkillModel from '../../models/2014/skill/index.js';
import SkillModel from '../../../models/2014/skill/index.js';
import {
coalesceFilters,
getMongoSortDirection,
resolveContainsStringFilter,
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) => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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,
resolveContainsStringFilter,
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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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') {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Option } from '../../models/2014/common/types';
import { Option } from '../../../models/2014/common/types';

const EquipmentMultipleItem = {
__resolveType(option: Option) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Option } from '../../models/2014/common/types';
import { Option } from '../../../models/2014/common/types';

const EquipmentOption = {
__resolveType(option: Option) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Option } from '../../models/2014/common/types';
import { Option } from '../../../models/2014/common/types';

const ExpertiseOption = {
__resolveType(option: Option) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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?: {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Option } from '../../models/2014/common/types';
import { Option } from '../../../models/2014/common/types';

const MonsterActionOption = {
__resolveType(option: Option) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<string, any> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Option } from '../../models/2014/common/types';
import { Option } from '../../../models/2014/common/types';

const ProficiencyOption = {
__resolveType(option: Option) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
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,
resolveContainsStringFilter,
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) => {
Expand Down
File renamed without changes.
Loading

0 comments on commit 8f81d25

Please sign in to comment.