beanc16 / roll-of-darkness-bot

A discord bot for rolling dice in the New World of Darkness, Pokemon Tabletop United, and Curseborne tabletop systems
1 stars 0 forks source link

Create a separate REST API service for retrieving ptu pokemon from mongodb #12

Open beanc16 opened 1 day ago

beanc16 commented 1 day ago

Context

Currently, pokemon for the /ptu lookup pokemon command are stored in mongodb. Currently, we connect to the database directly here whilst calling google sheets for most/all other lookup data.

When to do this

The current pattern is not a bad one, because we're doing simple name searches at the time of this issue's creation. If the querying ever becomes more complicated than doing basic queries, it may be smart to abstract this behind its own API in order to separate the concerns. It can be argued that even doing searches with indexed data as we are could be enough to separate the concerns as-is. However, until a stronger need arises, this issue can sit as a living reminder to do so at a later date.

Notes

This should probably be a mini monorepo that includes both the REST API service itself and types for the repo's responses like PtuPokemon. Alternatively, this can go in the pre-existing private mono-package for all microservice abstractions. https://github.com/beanc16/roll-of-darkness-bot/blob/04390821e4895ac03f88757029e6f683b6e142cf/src/commands-slash/Ptu/types/pokemon.ts#L84-L181