You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.5 KiB
64 lines
1.5 KiB
import History from '../dao/history.dao.js' |
|
import Roster from '../dao/roster.dao.js' |
|
|
|
async function getAllRoster() { |
|
return Roster.findAll() |
|
} |
|
|
|
async function getAllHistory() { |
|
return History.findAll() |
|
} |
|
|
|
async function addRoster(options) { |
|
if (!options.name || !options.classe || !options.role) throw new Error('Member has to have a name, a class and a role') |
|
const roster = new Roster({ |
|
name: options.name, |
|
classe: options.classe, |
|
role: options.role |
|
}) |
|
await roster.insert() |
|
} |
|
|
|
async function addHistory(options) { |
|
if (!options.name || !options.fullDate || !options.itemID || !options.itemName) { |
|
throw new Error('History has to have a name, a fullDate, an itemID and an itemName') |
|
} |
|
const history = new History({ |
|
name: options.name.replace('-Auberdine', ''), |
|
fullDate: options.fullDate, |
|
itemID: options.itemID, |
|
itemName: options.itemName, |
|
class: options.class, |
|
response: options.response, |
|
votes: options.votes, |
|
instance: options.instance, |
|
boss: options.boss, |
|
equipLoc: options.equipLoc, |
|
note: options.note |
|
}) |
|
await history.insert() |
|
} |
|
|
|
async function removeRoster(name) { |
|
const roster = await Roster.delete(name) |
|
return roster |
|
} |
|
|
|
async function removeHistory(id) { |
|
const history = await History.delete(id) |
|
return history |
|
} |
|
|
|
async function getBisList(raidDate) { |
|
return Roster.getBisData(raidDate) |
|
} |
|
|
|
export default { |
|
getAllRoster, |
|
getAllHistory, |
|
addRoster, |
|
addHistory, |
|
removeRoster, |
|
removeHistory, |
|
getBisList |
|
} |