Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions src/models/2014/abilityScore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { getModelForClass, prop } from '@typegoose/typegoose'
import { getModelForClass } from '@typegoose/typegoose'
import { DocumentType } from '@typegoose/typegoose/lib/types'
import { Field, ObjectType } from 'type-graphql'
import { ObjectType } from 'type-graphql'

import { APIReference } from '@/models/common/apiReference'
import { field, T } from '@/util/fieldDectorator'
import { srdModelOptions } from '@/util/modelOptions'

import { Skill } from './skill'
Expand All @@ -13,33 +14,31 @@ import { Skill } from './skill'
})
@srdModelOptions('2014-ability-scores')
export class AbilityScore {
@Field(() => [String], {
@field(() => T.List(String), {
description: 'A description of the ability score and its applications.'
})
@prop({ required: true, index: true, type: () => [String] })
public desc!: string[]

@Field(() => String, { description: 'The full name of the ability score (e.g., Strength).' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The full name of the ability score (e.g., Strength).' })
public full_name!: string

@Field(() => String, { description: 'The unique identifier for this ability score (e.g., str).' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, {
description: 'The unique identifier for this ability score (e.g., str).'
})
public index!: string

@Field(() => String, { description: 'The abbreviated name of the ability score (e.g., STR).' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The abbreviated name of the ability score (e.g., STR).' })
public name!: string

@Field(() => [Skill], { description: 'Skills associated with this ability score.' })
@prop({ type: () => [APIReference] })
@field(() => T.RefList(Skill), {
description: 'Skills associated with this ability score.'
})
public skills!: APIReference[]

@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The canonical path of this resource in the REST API.' })
public url!: string

@Field(() => String, { description: 'Timestamp of the last update.' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'Timestamp of the last update.' })
public updated_at!: string
}

Expand Down
22 changes: 9 additions & 13 deletions src/models/2014/alignment.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
import { getModelForClass, prop } from '@typegoose/typegoose'
import { getModelForClass } from '@typegoose/typegoose'
import { DocumentType } from '@typegoose/typegoose/lib/types'
import { Field, ObjectType } from 'type-graphql'
import { ObjectType } from 'type-graphql'

import { field, T } from '@/util/fieldDectorator'
import { srdModelOptions } from '@/util/modelOptions'

@ObjectType({ description: "Represents a creature's moral and ethical outlook." })
@srdModelOptions('2014-alignments')
export class Alignment {
@Field(() => String, { description: 'A brief description of the alignment.' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'A brief description of the alignment.' })
public desc!: string

@Field(() => String, {
@field(() => T.String, {
description: 'A shortened representation of the alignment (e.g., LG, CE).'
})
@prop({ required: true, index: true, type: () => String })
public abbreviation!: string

@Field(() => String, {
@field(() => T.String, {
description: 'The unique identifier for this alignment (e.g., lawful-good).'
})
@prop({ required: true, index: true, type: () => String })
public index!: string

@Field(() => String, {
@field(() => T.String, {
description: 'The name of the alignment (e.g., Lawful Good, Chaotic Evil).'
})
@prop({ required: true, index: true, type: () => String })
public name!: string

@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The canonical path of this resource in the REST API.' })
public url!: string

@Field(() => String, { description: 'Timestamp of the last update.' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'Timestamp of the last update.' })
public updated_at!: string
}

Expand Down
55 changes: 26 additions & 29 deletions src/models/2014/background.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
import { getModelForClass, prop } from '@typegoose/typegoose'
import { getModelForClass } from '@typegoose/typegoose'
import { DocumentType } from '@typegoose/typegoose/lib/types'
import { Field, Int, ObjectType } from 'type-graphql'
import { ObjectType } from 'type-graphql'

import { APIReference } from '@/models/common/apiReference'
import { Choice } from '@/models/common/choice'
import { field, T } from '@/util/fieldDectorator'
import { srdModelOptions } from '@/util/modelOptions'

import { Equipment } from './equipment'
import { Proficiency } from './proficiency'

@ObjectType({ description: 'Reference to a piece of equipment with a quantity.' })
export class EquipmentRef {
@Field(() => Equipment, { description: 'The specific equipment referenced.' })
@prop({ type: () => APIReference })
@field(() => T.Ref(Equipment), { description: 'The specific equipment referenced.' })
public equipment!: APIReference

@Field(() => Int, { description: 'The quantity of the referenced equipment.' })
@prop({ required: true, index: true, type: () => Number })
@field(() => T.Int, { description: 'The quantity of the referenced equipment.' })
public quantity!: number
}

@ObjectType({ description: 'A special feature granted by the background.' })
class BackgroundFeature {
@Field(() => String, { description: 'The name of the background feature.' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The name of the background feature.' })
public name!: string

@Field(() => [String], { description: 'The description of the background feature.' })
@prop({ required: true, index: true, type: () => [String] })
@field(() => T.List(String), { description: 'The description of the background feature.' })
public desc!: string[]
}

Expand All @@ -36,57 +33,57 @@ class BackgroundFeature {
})
@srdModelOptions('2014-backgrounds')
export class Background {
@Field(() => String, {
@field(() => T.String, {
description: 'The unique identifier for this background (e.g., acolyte).'
})
@prop({ required: true, index: true, type: () => String })
public index!: string

@Field(() => String, { description: 'The name of the background (e.g., Acolyte).' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The name of the background (e.g., Acolyte).' })
public name!: string

@Field(() => [Proficiency], { description: 'Proficiencies granted by this background at start.' })
@prop({ type: () => [APIReference] })
@field(() => T.RefList(Proficiency), {
description: 'Proficiencies granted by this background at start.'
})
public starting_proficiencies!: APIReference[]

// Handled by BackgroundResolver
@prop({ type: () => Choice })
@field(() => T.Model(Choice), { skipResolver: true })
public language_options!: Choice

@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'The canonical path of this resource in the REST API.' })
public url!: string

@Field(() => [EquipmentRef], { description: 'Equipment received when choosing this background.' })
@prop({ type: () => [EquipmentRef] })
@field(() => T.List(EquipmentRef), {
description: 'Equipment received when choosing this background.'
})
public starting_equipment!: EquipmentRef[]

// Handled by BackgroundResolver
@prop({ type: () => [Choice], index: true })
@field(() => T.List(Choice), { skipResolver: true })
public starting_equipment_options!: Choice[]

@Field(() => BackgroundFeature, { description: 'The feature associated with this background.' })
@prop({ type: () => BackgroundFeature })
@field(() => T.Model(BackgroundFeature), {
description: 'The feature associated with this background.'
})
public feature!: BackgroundFeature

// Handled by BackgroundResolver
@prop({ type: () => Choice })
@field(() => T.Model(Choice), { skipResolver: true })
public personality_traits!: Choice

// Handled by BackgroundResolver
@prop({ type: () => Choice })
@field(() => T.Model(Choice), { skipResolver: true })
public ideals!: Choice

// Handled by BackgroundResolver
@prop({ type: () => Choice })
@field(() => T.Model(Choice), { skipResolver: true })
public bonds!: Choice

// Handled by BackgroundResolver
@prop({ type: () => Choice })
@field(() => T.Model(Choice), { skipResolver: true })
public flaws!: Choice

@Field(() => String, { description: 'Timestamp of the last update.' })
@prop({ required: true, index: true, type: () => String })
@field(() => T.String, { description: 'Timestamp of the last update.' })
public updated_at!: string
}

Expand Down
Loading