Skip to content

Instantly share code, notes, and snippets.

@capaj
Last active November 5, 2018 11:30
Show Gist options
  • Save capaj/fd8967ebc72b511e89db493a0506527b to your computer and use it in GitHub Desktop.
Save capaj/fd8967ebc72b511e89db493a0506527b to your computer and use it in GitHub Desktop.
schema.ts
@Schema()
class SuperSchema {
@Query({type: [PropertyModel]})
async allProperties(first: number, filter: FilterInput): Promise<PropertyModel[]> {
const query = PropertyModel.query()
if (filter) {
query.where('appraisedValue', '<', filter.appraisedValue.lessThan)
}
if (first) { query.limit(first) }
return query
}
}
const compiledSchema = compileSchema(SuperSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment