-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into helm-chart-simplified
- Loading branch information
Showing
10 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { getPokemonRepository, Pokemon } from '@pokemon/repositories'; | ||
|
||
const create = async (raw: Pokemon): Promise<Pokemon> => { | ||
const repository = getPokemonRepository(); | ||
|
||
return repository.create(new Pokemon(raw)); | ||
}; | ||
|
||
export default create; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getPokemonRepository, Pokemon } from '@pokemon/repositories'; | ||
import { SearchOptions } from '../repositories/pokemon.repository'; | ||
|
||
type PokemonList = { | ||
items: Pokemon[]; | ||
totalCount: number; | ||
}; | ||
|
||
const get = async (query: SearchOptions): Promise<PokemonList> => { | ||
const repository = getPokemonRepository(); | ||
|
||
const [items, totalCount] = await Promise.all([repository.findMany(query), repository.count()]); | ||
|
||
return { | ||
items, | ||
totalCount, | ||
}; | ||
}; | ||
|
||
export default get; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import PokeAPIService from '@pokemon/services/pokeApi.service'; | ||
import PokemonSyncronizer from '@pokemon/services/pokemonSyncronizer.service'; | ||
|
||
const pokeApiService = new PokeAPIService(); | ||
const pokemonSyncronizer = PokemonSyncronizer(pokeApiService); | ||
|
||
const importPokemon = async ({ id = 0 }) => { | ||
await pokemonSyncronizer.queue({ id }); | ||
|
||
return { id }; | ||
}; | ||
|
||
export default importPokemon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import createPokemon from './create.resolver'; | ||
import getPokemonList from './get.resolver'; | ||
import importPokemon from './import.resolver'; | ||
|
||
export default { | ||
getPokemonList, | ||
createPokemon, | ||
importPokemon, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { buildSchema } from 'graphql'; | ||
|
||
const schema = buildSchema(` | ||
type Pokemon { | ||
id: Int | ||
name: String! | ||
type: String! | ||
isFeatured: Boolean! | ||
imageUrl: String | ||
} | ||
type PokemonList { | ||
items: [Pokemon] | ||
totalCount: Int | ||
} | ||
type ImportPokemon { | ||
id: Int! | ||
} | ||
type Query { | ||
getPokemonList(where: String, skip: Int, take: Int): PokemonList | ||
} | ||
type Mutation { | ||
createPokemon(name: String!, type: String!, isFeatured: Boolean!, imageUrl: String): Pokemon! | ||
importPokemon(id: Int!): ImportPokemon! | ||
} | ||
`); | ||
|
||
export default schema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters