mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 21:07:27 +00:00
feat: setup for Lazar
This commit is contained in:
parent
f04f9e95dd
commit
c9fc0c7dc1
2 changed files with 40 additions and 0 deletions
18
server-v2/app/Parsers/MatchParser.ts
Normal file
18
server-v2/app/Parsers/MatchParser.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { MatchDto } from 'App/Services/Jax/src/Endpoints/MatchEndpoint'
|
||||||
|
|
||||||
|
class MatchParser {
|
||||||
|
public async parseOneMatch(match: MatchDto) {
|
||||||
|
// TODO: parse + store in database
|
||||||
|
// From the MatchDto, we need these Models in the DB:
|
||||||
|
// - 1x Match
|
||||||
|
// - 10x MatchPlayer
|
||||||
|
// - 2x MatchTeam
|
||||||
|
}
|
||||||
|
|
||||||
|
public async parse(matches: MatchDto[]) {
|
||||||
|
// TODO
|
||||||
|
// Loop on all matches and call .parse on it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new MatchParser()
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
import HealthCheck from '@ioc:Adonis/Core/HealthCheck'
|
import HealthCheck from '@ioc:Adonis/Core/HealthCheck'
|
||||||
import Route from '@ioc:Adonis/Core/Route'
|
import Route from '@ioc:Adonis/Core/Route'
|
||||||
|
import MatchParser from 'App/Parsers/MatchParser'
|
||||||
|
import Jax from 'App/Services/Jax'
|
||||||
|
|
||||||
Route.get('/', async () => ({
|
Route.get('/', async () => ({
|
||||||
hi: 'Hello World from LeagueStats V2 API',
|
hi: 'Hello World from LeagueStats V2 API',
|
||||||
|
|
@ -40,3 +42,23 @@ Route.post('/summoner/overview', 'SummonersController.overview')
|
||||||
// Route.post('/match/details/ranks', 'MatchesController.showRanks')
|
// Route.post('/match/details/ranks', 'MatchesController.showRanks')
|
||||||
|
|
||||||
// Route.get('/cdragon/runes', 'CDragonController.runes')
|
// Route.get('/cdragon/runes', 'CDragonController.runes')
|
||||||
|
|
||||||
|
Route.get('/test', async () => {
|
||||||
|
const ids = [
|
||||||
|
'EUW1_5221171940',
|
||||||
|
'EUW1_5220845489',
|
||||||
|
'EUW1_5220852134',
|
||||||
|
'EUW1_5220728352',
|
||||||
|
'EUW1_5220656980',
|
||||||
|
'EUW1_5215357679',
|
||||||
|
'EUW1_5215311330',
|
||||||
|
'EUW1_5215244329',
|
||||||
|
'EUW1_5214301786',
|
||||||
|
'EUW1_5212337578',
|
||||||
|
'EUW1_5212353922',
|
||||||
|
'EUW1_5212371343',
|
||||||
|
]
|
||||||
|
const region = 'euw1'
|
||||||
|
const matches = await Promise.all(ids.map((id) => Jax.Match.get(id, region)))
|
||||||
|
await MatchParser.parse(matches)
|
||||||
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue