|
|
|
|
@ -125,6 +125,72 @@ const formatDate = (item) => {
|
|
|
|
|
return DateTime.fromFormat(date, 'dd/MM/yy HH:mm:ss').toMillis() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const assignLegendary = async (request, reply) => { |
|
|
|
|
const { legendary, member, classe } = request.body |
|
|
|
|
const proms = [] |
|
|
|
|
|
|
|
|
|
if (legendary === 'tarecgosa') { |
|
|
|
|
const newHist = { |
|
|
|
|
name: member, |
|
|
|
|
fullDate: DateTime.now().toMillis(), |
|
|
|
|
itemID: 71086, |
|
|
|
|
itemName: 'Courroux du dragon, le Repos de Tarecgosa', |
|
|
|
|
class: classe, |
|
|
|
|
response: 'Bis', |
|
|
|
|
votes: 0, |
|
|
|
|
instance: 'Terres de Feu-25 joueurs', |
|
|
|
|
boss: 'Inconnu', |
|
|
|
|
equipLoc: 'Deux mains', |
|
|
|
|
note: '' |
|
|
|
|
} |
|
|
|
|
proms.push(suiviService.addHistory(newHist).catch((e) => { console.log(e) })) |
|
|
|
|
} else if (legendary === 'crocsPere') { |
|
|
|
|
const newHist1 = { |
|
|
|
|
name: member, |
|
|
|
|
fullDate: DateTime.now().toMillis(), |
|
|
|
|
itemID: 77949, |
|
|
|
|
itemName: 'Golad, le Crépuscule des Aspects', |
|
|
|
|
class: classe, |
|
|
|
|
response: 'Bis', |
|
|
|
|
votes: 0, |
|
|
|
|
instance: 'L\'âme des dragons-25 joueurs', |
|
|
|
|
boss: 'Inconnu', |
|
|
|
|
equipLoc: 'Main droite', |
|
|
|
|
note: '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const newHist2 = { |
|
|
|
|
name: member, |
|
|
|
|
fullDate: DateTime.now().toMillis(), |
|
|
|
|
itemID: 77950, |
|
|
|
|
itemName: 'Tiriosh, le Cauchemar des âges', |
|
|
|
|
class: classe, |
|
|
|
|
response: 'Bis', |
|
|
|
|
votes: 0, |
|
|
|
|
instance: 'L\'âme des dragons-25 joueurs', |
|
|
|
|
boss: 'Inconnu', |
|
|
|
|
equipLoc: 'Main gauche', |
|
|
|
|
note: '' |
|
|
|
|
} |
|
|
|
|
proms.push(suiviService.addHistory(newHist1).catch((e) => { console.log(e) })) |
|
|
|
|
proms.push(suiviService.addHistory(newHist2).catch((e) => { console.log(e) })) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (proms.length) { |
|
|
|
|
try { |
|
|
|
|
return Promise.all(proms).then(() => { |
|
|
|
|
return reply.code(200).send({ |
|
|
|
|
success: true, |
|
|
|
|
message: 'Histories added' |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
return reply.code(500).send({ message: typesError.TECHNICAL_UNKNOWN }) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
getAllRoster, |
|
|
|
|
getAllHistory, |
|
|
|
|
@ -132,5 +198,6 @@ export default {
|
|
|
|
|
addHistories, |
|
|
|
|
deleteRoster, |
|
|
|
|
deleteHistories, |
|
|
|
|
getBisList |
|
|
|
|
getBisList, |
|
|
|
|
assignLegendary |
|
|
|
|
} |
|
|
|
|
|