cc-husky-solo / back

Back-end for my solo Code Chrysalis project
0 stars 0 forks source link

Feat: New one route for riot accounts. #10

Closed gminetoma closed 2 months ago

gminetoma commented 2 months ago

/:region/:gameName/:tagLine

modified: config.ts -> cors add! Update npm. modified: index.ts -> new route for lol accounts : /riot/lol/accounts modified: prisma/schema.prisma -> RiotLolAccount table updated. region added. -> enum Region created new file: prisma/seed.ts -> seeds for the database. new file: src/api/riot/account.ts -> Riot Accounts API. Get an account using game name and tag line and returns an AccountDto.ts object if the response is 200. If is something else, returns null. src/controllers/riotLolAccounts.controller.ts -> getByGameNameAndTagLine - accepts an GetByGameNameAndTagLine parameter. try to search for an account using game name and tag line, if the account does not exist, try to fetch the account using Riot API. If the API return an AccountDto object, we add to the database. If the return from the API is null, we send a 404 to the user. -> addAccount - accepts an AccountDto as parameter and returns a RiotLolAccount. new file: src/interfaces/AccountDto.ts -> Interface from RIOT API. new file: src/models/riotLolAccounts.model.ts -> getByGameNameAndTagLine - accepts GetByGameNameAndTagLine params and returns RiotLolAccount or null. -> addAccount - accepts an AccountDto as parameter and returns a RiotLolAccount. new file: src/routes/riotLolAccount.ts -> added a get endpoint with three parameters: region, game name and tag line.

To use the Riot API is necessary to create a .env file with: RIOT_API_KEY = "RIOT API KEY"

The migrations have been reset to update the database.