feat: add cashbox batches log downloader
This commit is contained in:
parent
b8ae64a798
commit
f2f34c6ecd
8 changed files with 60 additions and 30 deletions
|
|
@ -1,8 +1,11 @@
|
|||
const { parseAsync } = require('json2csv')
|
||||
const cashbox = require('../../../cashbox-batches')
|
||||
const logDateFormat = require('../../../logs').logDateFormat
|
||||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
cashboxBatches: () => cashbox.getBatches()
|
||||
cashboxBatches: () => cashbox.getBatches(),
|
||||
cashboxBatchesCsv: (...[, { from, until, timezone }]) => cashbox.getBatches(from, until).then(data => parseAsync(logDateFormat(timezone, data, ['created'])))
|
||||
},
|
||||
Mutation: {
|
||||
createBatch: (...[, { deviceId, cashboxCount }]) => cashbox.createCashboxBatch(deviceId, cashboxCount),
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Query {
|
||||
cashboxBatches: [CashboxBatch]
|
||||
cashboxBatches: [CashboxBatch] @auth
|
||||
cashboxBatchesCsv(from: Date, until: Date, timezone: String): String @auth
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createBatch(deviceId: ID, cashboxCount: Int): CashboxBatch
|
||||
editBatch(id: ID, performedBy: String): CashboxBatch
|
||||
createBatch(deviceId: ID, cashboxCount: Int): CashboxBatch @auth
|
||||
editBatch(id: ID, performedBy: String): CashboxBatch @auth
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue