chore: server code formatting
This commit is contained in:
parent
aedabcbdee
commit
68517170e2
234 changed files with 9824 additions and 6195 deletions
|
|
@ -7,7 +7,7 @@ const { AuthenticationError } = require('../errors')
|
|||
function authDirectiveTransformer(schema, directiveName = 'auth') {
|
||||
return mapSchema(schema, {
|
||||
// For object types
|
||||
[MapperKind.OBJECT_TYPE]: (objectType) => {
|
||||
[MapperKind.OBJECT_TYPE]: objectType => {
|
||||
const directive = getDirective(schema, objectType, directiveName)?.[0]
|
||||
if (directive) {
|
||||
const requiredAuthRole = directive.requires
|
||||
|
|
@ -15,7 +15,7 @@ function authDirectiveTransformer(schema, directiveName = 'auth') {
|
|||
}
|
||||
return objectType
|
||||
},
|
||||
|
||||
|
||||
// For field definitions
|
||||
[MapperKind.OBJECT_FIELD]: (fieldConfig, _fieldName, typeName) => {
|
||||
const directive = getDirective(schema, fieldConfig, directiveName)?.[0]
|
||||
|
|
@ -23,26 +23,30 @@ function authDirectiveTransformer(schema, directiveName = 'auth') {
|
|||
const requiredAuthRole = directive.requires
|
||||
fieldConfig._requiredAuthRole = requiredAuthRole
|
||||
}
|
||||
|
||||
|
||||
// Get the parent object type
|
||||
const objectType = schema.getType(typeName)
|
||||
|
||||
|
||||
// Apply auth check to the field's resolver
|
||||
const { resolve = defaultFieldResolver } = fieldConfig
|
||||
fieldConfig.resolve = function (root, args, context, info) {
|
||||
const requiredRoles = fieldConfig._requiredAuthRole || objectType._requiredAuthRole
|
||||
if (!requiredRoles) return resolve.apply(this, [root, args, context, info])
|
||||
|
||||
const requiredRoles =
|
||||
fieldConfig._requiredAuthRole || objectType._requiredAuthRole
|
||||
if (!requiredRoles)
|
||||
return resolve.apply(this, [root, args, context, info])
|
||||
|
||||
const user = context.req.session.user
|
||||
if (!user || !_.includes(_.upperCase(user.role), requiredRoles)) {
|
||||
throw new AuthenticationError('You do not have permission to access this resource!')
|
||||
throw new AuthenticationError(
|
||||
'You do not have permission to access this resource!',
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
return resolve.apply(this, [root, args, context, info])
|
||||
}
|
||||
|
||||
|
||||
return fieldConfig
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ class AuthenticationError extends GraphQLError {
|
|||
constructor() {
|
||||
super('Authentication failed', {
|
||||
extensions: {
|
||||
code: 'UNAUTHENTICATED'
|
||||
}
|
||||
code: 'UNAUTHENTICATED',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -15,8 +15,8 @@ class InvalidCredentialsError extends GraphQLError {
|
|||
constructor() {
|
||||
super('Invalid credentials', {
|
||||
extensions: {
|
||||
code: 'INVALID_CREDENTIALS'
|
||||
}
|
||||
code: 'INVALID_CREDENTIALS',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -25,8 +25,8 @@ class UserAlreadyExistsError extends GraphQLError {
|
|||
constructor() {
|
||||
super('User already exists', {
|
||||
extensions: {
|
||||
code: 'USER_ALREADY_EXISTS'
|
||||
}
|
||||
code: 'USER_ALREADY_EXISTS',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -35,8 +35,8 @@ class InvalidTwoFactorError extends GraphQLError {
|
|||
constructor() {
|
||||
super('Invalid two-factor code', {
|
||||
extensions: {
|
||||
code: 'INVALID_TWO_FACTOR_CODE'
|
||||
}
|
||||
code: 'INVALID_TWO_FACTOR_CODE',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -45,8 +45,8 @@ class InvalidUrlError extends GraphQLError {
|
|||
constructor() {
|
||||
super('Invalid URL token', {
|
||||
extensions: {
|
||||
code: 'INVALID_URL_TOKEN'
|
||||
}
|
||||
code: 'INVALID_URL_TOKEN',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -55,8 +55,8 @@ class UserInputError extends GraphQLError {
|
|||
constructor() {
|
||||
super('User input error', {
|
||||
extensions: {
|
||||
code: ApolloServerErrorCode.BAD_USER_INPUT
|
||||
}
|
||||
code: ApolloServerErrorCode.BAD_USER_INPUT,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -67,5 +67,5 @@ module.exports = {
|
|||
UserAlreadyExistsError,
|
||||
InvalidTwoFactorError,
|
||||
InvalidUrlError,
|
||||
UserInputError
|
||||
}
|
||||
UserInputError,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,60 +12,70 @@ const devMode = require('minimist')(process.argv.slice(2)).dev
|
|||
const REMEMBER_ME_AGE = 90 * T.day
|
||||
|
||||
const generateAttestationOptions = (session, options) => {
|
||||
return users.getUserById(options.userId).then(user => {
|
||||
return Promise.all([credentials.getHardwareCredentialsByUserId(user.id), user])
|
||||
}).then(([userDevices, user]) => {
|
||||
const opts = simpleWebauthn.generateAttestationOptions({
|
||||
rpName: 'Lamassu',
|
||||
rpID: options.domain,
|
||||
userName: user.username,
|
||||
userID: user.id,
|
||||
timeout: 60000,
|
||||
attestationType: 'indirect',
|
||||
excludeCredentials: userDevices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal']
|
||||
})),
|
||||
authenticatorSelection: {
|
||||
userVerification: 'discouraged',
|
||||
requireResidentKey: false
|
||||
}
|
||||
return users
|
||||
.getUserById(options.userId)
|
||||
.then(user => {
|
||||
return Promise.all([
|
||||
credentials.getHardwareCredentialsByUserId(user.id),
|
||||
user,
|
||||
])
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
attestation: {
|
||||
challenge: opts.challenge
|
||||
}
|
||||
}
|
||||
|
||||
return opts
|
||||
})
|
||||
}
|
||||
|
||||
const generateAssertionOptions = (session, options) => {
|
||||
return userManagement.authenticateUser(options.username, options.password).then(user => {
|
||||
return credentials.getHardwareCredentialsByUserId(user.id).then(devices => {
|
||||
const opts = simpleWebauthn.generateAssertionOptions({
|
||||
.then(([userDevices, user]) => {
|
||||
const opts = simpleWebauthn.generateAttestationOptions({
|
||||
rpName: 'Lamassu',
|
||||
rpID: options.domain,
|
||||
userName: user.username,
|
||||
userID: user.id,
|
||||
timeout: 60000,
|
||||
allowCredentials: devices.map(dev => ({
|
||||
attestationType: 'indirect',
|
||||
excludeCredentials: userDevices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal']
|
||||
transports: ['usb', 'ble', 'nfc', 'internal'],
|
||||
})),
|
||||
userVerification: 'discouraged',
|
||||
rpID: options.domain
|
||||
authenticatorSelection: {
|
||||
userVerification: 'discouraged',
|
||||
requireResidentKey: false,
|
||||
},
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
assertion: {
|
||||
challenge: opts.challenge
|
||||
}
|
||||
attestation: {
|
||||
challenge: opts.challenge,
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const generateAssertionOptions = (session, options) => {
|
||||
return userManagement
|
||||
.authenticateUser(options.username, options.password)
|
||||
.then(user => {
|
||||
return credentials
|
||||
.getHardwareCredentialsByUserId(user.id)
|
||||
.then(devices => {
|
||||
const opts = simpleWebauthn.generateAssertionOptions({
|
||||
timeout: 60000,
|
||||
allowCredentials: devices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal'],
|
||||
})),
|
||||
userVerification: 'discouraged',
|
||||
rpID: options.domain,
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
assertion: {
|
||||
challenge: opts.challenge,
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const validateAttestation = (session, options) => {
|
||||
|
|
@ -78,98 +88,112 @@ const validateAttestation = (session, options) => {
|
|||
credential: options.attestationResponse,
|
||||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain
|
||||
})
|
||||
])
|
||||
.then(([user, verification]) => {
|
||||
const { verified, attestationInfo } = verification
|
||||
expectedRPID: options.domain,
|
||||
}),
|
||||
]).then(([user, verification]) => {
|
||||
const { verified, attestationInfo } = verification
|
||||
|
||||
if (!(verified || attestationInfo)) {
|
||||
session.webauthn = null
|
||||
return false
|
||||
}
|
||||
if (!(verified || attestationInfo)) {
|
||||
session.webauthn = null
|
||||
return false
|
||||
}
|
||||
|
||||
const {
|
||||
counter,
|
||||
credentialPublicKey,
|
||||
credentialID
|
||||
} = attestationInfo
|
||||
const { counter, credentialPublicKey, credentialID } = attestationInfo
|
||||
|
||||
return credentials.getHardwareCredentialsByUserId(user.id)
|
||||
.then(userDevices => {
|
||||
const existingDevice = userDevices.find(device => device.data.credentialID === credentialID)
|
||||
return credentials
|
||||
.getHardwareCredentialsByUserId(user.id)
|
||||
.then(userDevices => {
|
||||
const existingDevice = userDevices.find(
|
||||
device => device.data.credentialID === credentialID,
|
||||
)
|
||||
|
||||
if (!existingDevice) {
|
||||
const newDevice = {
|
||||
counter,
|
||||
credentialPublicKey,
|
||||
credentialID
|
||||
}
|
||||
credentials.createHardwareCredential(user.id, newDevice)
|
||||
if (!existingDevice) {
|
||||
const newDevice = {
|
||||
counter,
|
||||
credentialPublicKey,
|
||||
credentialID,
|
||||
}
|
||||
credentials.createHardwareCredential(user.id, newDevice)
|
||||
}
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const validateAssertion = (session, options) => {
|
||||
return userManagement.authenticateUser(options.username, options.password).then(user => {
|
||||
const expectedChallenge = session.webauthn.assertion.challenge
|
||||
return userManagement
|
||||
.authenticateUser(options.username, options.password)
|
||||
.then(user => {
|
||||
const expectedChallenge = session.webauthn.assertion.challenge
|
||||
|
||||
return credentials.getHardwareCredentialsByUserId(user.id).then(devices => {
|
||||
const dbAuthenticator = _.find(dev => {
|
||||
return Buffer.from(dev.data.credentialID).compare(base64url.toBuffer(options.assertionResponse.rawId)) === 0
|
||||
}, devices)
|
||||
return credentials
|
||||
.getHardwareCredentialsByUserId(user.id)
|
||||
.then(devices => {
|
||||
const dbAuthenticator = _.find(dev => {
|
||||
return (
|
||||
Buffer.from(dev.data.credentialID).compare(
|
||||
base64url.toBuffer(options.assertionResponse.rawId),
|
||||
) === 0
|
||||
)
|
||||
}, devices)
|
||||
|
||||
if (!dbAuthenticator.data) {
|
||||
throw new Error(`Could not find authenticator matching ${options.assertionResponse.id}`)
|
||||
}
|
||||
if (!dbAuthenticator.data) {
|
||||
throw new Error(
|
||||
`Could not find authenticator matching ${options.assertionResponse.id}`,
|
||||
)
|
||||
}
|
||||
|
||||
const convertedAuthenticator = _.merge(
|
||||
dbAuthenticator.data,
|
||||
{ credentialPublicKey: Buffer.from(dbAuthenticator.data.credentialPublicKey) }
|
||||
)
|
||||
const convertedAuthenticator = _.merge(dbAuthenticator.data, {
|
||||
credentialPublicKey: Buffer.from(
|
||||
dbAuthenticator.data.credentialPublicKey,
|
||||
),
|
||||
})
|
||||
|
||||
let verification
|
||||
try {
|
||||
verification = simpleWebauthn.verifyAssertionResponse({
|
||||
credential: options.assertionResponse,
|
||||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain,
|
||||
authenticator: convertedAuthenticator
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
return false
|
||||
}
|
||||
let verification
|
||||
try {
|
||||
verification = simpleWebauthn.verifyAssertionResponse({
|
||||
credential: options.assertionResponse,
|
||||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain,
|
||||
authenticator: convertedAuthenticator,
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
return false
|
||||
}
|
||||
|
||||
const { verified, assertionInfo } = verification
|
||||
const { verified, assertionInfo } = verification
|
||||
|
||||
if (!verified) {
|
||||
session.webauthn = null
|
||||
return false
|
||||
}
|
||||
if (!verified) {
|
||||
session.webauthn = null
|
||||
return false
|
||||
}
|
||||
|
||||
dbAuthenticator.data.counter = assertionInfo.newCounter
|
||||
return credentials.updateHardwareCredential(dbAuthenticator)
|
||||
.then(() => {
|
||||
const finalUser = { id: user.id, username: user.username, role: user.role }
|
||||
session.user = finalUser
|
||||
if (options.rememberMe) session.cookie.maxAge = REMEMBER_ME_AGE
|
||||
dbAuthenticator.data.counter = assertionInfo.newCounter
|
||||
return credentials
|
||||
.updateHardwareCredential(dbAuthenticator)
|
||||
.then(() => {
|
||||
const finalUser = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
}
|
||||
session.user = finalUser
|
||||
if (options.rememberMe) session.cookie.maxAge = REMEMBER_ME_AGE
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateAttestationOptions,
|
||||
generateAssertionOptions,
|
||||
validateAttestation,
|
||||
validateAssertion
|
||||
validateAssertion,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,35 +11,41 @@ const devMode = require('minimist')(process.argv.slice(2)).dev
|
|||
const REMEMBER_ME_AGE = 90 * T.day
|
||||
|
||||
const generateAttestationOptions = (session, options) => {
|
||||
return users.getUserById(options.userId).then(user => {
|
||||
return Promise.all([credentials.getHardwareCredentialsByUserId(user.id), user])
|
||||
}).then(([userDevices, user]) => {
|
||||
const opts = simpleWebauthn.generateAttestationOptions({
|
||||
rpName: 'Lamassu',
|
||||
rpID: options.domain,
|
||||
userName: user.username,
|
||||
userID: user.id,
|
||||
timeout: 60000,
|
||||
attestationType: 'indirect',
|
||||
excludeCredentials: userDevices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal']
|
||||
})),
|
||||
authenticatorSelection: {
|
||||
userVerification: 'discouraged',
|
||||
requireResidentKey: false
|
||||
}
|
||||
return users
|
||||
.getUserById(options.userId)
|
||||
.then(user => {
|
||||
return Promise.all([
|
||||
credentials.getHardwareCredentialsByUserId(user.id),
|
||||
user,
|
||||
])
|
||||
})
|
||||
.then(([userDevices, user]) => {
|
||||
const opts = simpleWebauthn.generateAttestationOptions({
|
||||
rpName: 'Lamassu',
|
||||
rpID: options.domain,
|
||||
userName: user.username,
|
||||
userID: user.id,
|
||||
timeout: 60000,
|
||||
attestationType: 'indirect',
|
||||
excludeCredentials: userDevices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal'],
|
||||
})),
|
||||
authenticatorSelection: {
|
||||
userVerification: 'discouraged',
|
||||
requireResidentKey: false,
|
||||
},
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
attestation: {
|
||||
challenge: opts.challenge
|
||||
session.webauthn = {
|
||||
attestation: {
|
||||
challenge: opts.challenge,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return opts
|
||||
})
|
||||
return opts
|
||||
})
|
||||
}
|
||||
|
||||
const generateAssertionOptions = (session, options) => {
|
||||
|
|
@ -50,16 +56,16 @@ const generateAssertionOptions = (session, options) => {
|
|||
allowCredentials: devices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal']
|
||||
transports: ['usb', 'ble', 'nfc', 'internal'],
|
||||
})),
|
||||
userVerification: 'discouraged',
|
||||
rpID: options.domain
|
||||
rpID: options.domain,
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
assertion: {
|
||||
challenge: opts.challenge
|
||||
}
|
||||
challenge: opts.challenge,
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
|
|
@ -77,40 +83,38 @@ const validateAttestation = (session, options) => {
|
|||
credential: options.attestationResponse,
|
||||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain
|
||||
})
|
||||
])
|
||||
.then(([user, verification]) => {
|
||||
const { verified, attestationInfo } = verification
|
||||
expectedRPID: options.domain,
|
||||
}),
|
||||
]).then(([user, verification]) => {
|
||||
const { verified, attestationInfo } = verification
|
||||
|
||||
if (!(verified || attestationInfo)) {
|
||||
session.webauthn = null
|
||||
return false
|
||||
}
|
||||
if (!(verified || attestationInfo)) {
|
||||
session.webauthn = null
|
||||
return false
|
||||
}
|
||||
|
||||
const {
|
||||
counter,
|
||||
credentialPublicKey,
|
||||
credentialID
|
||||
} = attestationInfo
|
||||
const { counter, credentialPublicKey, credentialID } = attestationInfo
|
||||
|
||||
return credentials.getHardwareCredentialsByUserId(user.id)
|
||||
.then(userDevices => {
|
||||
const existingDevice = userDevices.find(device => device.data.credentialID === credentialID)
|
||||
return credentials
|
||||
.getHardwareCredentialsByUserId(user.id)
|
||||
.then(userDevices => {
|
||||
const existingDevice = userDevices.find(
|
||||
device => device.data.credentialID === credentialID,
|
||||
)
|
||||
|
||||
if (!existingDevice) {
|
||||
const newDevice = {
|
||||
counter,
|
||||
credentialPublicKey,
|
||||
credentialID
|
||||
}
|
||||
credentials.createHardwareCredential(user.id, newDevice)
|
||||
if (!existingDevice) {
|
||||
const newDevice = {
|
||||
counter,
|
||||
credentialPublicKey,
|
||||
credentialID,
|
||||
}
|
||||
credentials.createHardwareCredential(user.id, newDevice)
|
||||
}
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const validateAssertion = (session, options) => {
|
||||
|
|
@ -119,17 +123,24 @@ const validateAssertion = (session, options) => {
|
|||
|
||||
return credentials.getHardwareCredentialsByUserId(user.id).then(devices => {
|
||||
const dbAuthenticator = _.find(dev => {
|
||||
return Buffer.from(dev.data.credentialID).compare(base64url.toBuffer(options.assertionResponse.rawId)) === 0
|
||||
return (
|
||||
Buffer.from(dev.data.credentialID).compare(
|
||||
base64url.toBuffer(options.assertionResponse.rawId),
|
||||
) === 0
|
||||
)
|
||||
}, devices)
|
||||
|
||||
if (!dbAuthenticator.data) {
|
||||
throw new Error(`Could not find authenticator matching ${options.assertionResponse.id}`)
|
||||
throw new Error(
|
||||
`Could not find authenticator matching ${options.assertionResponse.id}`,
|
||||
)
|
||||
}
|
||||
|
||||
const convertedAuthenticator = _.merge(
|
||||
dbAuthenticator.data,
|
||||
{ credentialPublicKey: Buffer.from(dbAuthenticator.data.credentialPublicKey) }
|
||||
)
|
||||
const convertedAuthenticator = _.merge(dbAuthenticator.data, {
|
||||
credentialPublicKey: Buffer.from(
|
||||
dbAuthenticator.data.credentialPublicKey,
|
||||
),
|
||||
})
|
||||
|
||||
let verification
|
||||
try {
|
||||
|
|
@ -138,7 +149,7 @@ const validateAssertion = (session, options) => {
|
|||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain,
|
||||
authenticator: convertedAuthenticator
|
||||
authenticator: convertedAuthenticator,
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
|
@ -148,20 +159,22 @@ const validateAssertion = (session, options) => {
|
|||
const { verified, assertionInfo } = verification
|
||||
|
||||
if (!verified) {
|
||||
context.req.session.webauthn = null
|
||||
return false
|
||||
}
|
||||
|
||||
dbAuthenticator.data.counter = assertionInfo.newCounter
|
||||
return credentials.updateHardwareCredential(dbAuthenticator)
|
||||
.then(() => {
|
||||
const finalUser = { id: user.id, username: user.username, role: user.role }
|
||||
session.user = finalUser
|
||||
if (options.rememberMe) session.cookie.maxAge = REMEMBER_ME_AGE
|
||||
return credentials.updateHardwareCredential(dbAuthenticator).then(() => {
|
||||
const finalUser = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
}
|
||||
session.user = finalUser
|
||||
if (options.rememberMe) session.cookie.maxAge = REMEMBER_ME_AGE
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -170,5 +183,5 @@ module.exports = {
|
|||
generateAttestationOptions,
|
||||
generateAssertionOptions,
|
||||
validateAttestation,
|
||||
validateAssertion
|
||||
validateAssertion,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@ const generateAttestationOptions = (session, options) => {
|
|||
excludeCredentials: devices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal']
|
||||
transports: ['usb', 'ble', 'nfc', 'internal'],
|
||||
})),
|
||||
authenticatorSelection: {
|
||||
authenticatorAttachment: 'cross-platform',
|
||||
userVerification: 'discouraged',
|
||||
requireResidentKey: false
|
||||
}
|
||||
requireResidentKey: false,
|
||||
},
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
attestation: {
|
||||
challenge: opts.challenge
|
||||
}
|
||||
challenge: opts.challenge,
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
|
|
@ -48,16 +48,16 @@ const generateAssertionOptions = (session, options) => {
|
|||
allowCredentials: devices.map(dev => ({
|
||||
id: dev.data.credentialID,
|
||||
type: 'public-key',
|
||||
transports: ['usb', 'ble', 'nfc', 'internal']
|
||||
transports: ['usb', 'ble', 'nfc', 'internal'],
|
||||
})),
|
||||
userVerification: 'discouraged',
|
||||
rpID: options.domain
|
||||
rpID: options.domain,
|
||||
})
|
||||
|
||||
session.webauthn = {
|
||||
assertion: {
|
||||
challenge: opts.challenge
|
||||
}
|
||||
challenge: opts.challenge,
|
||||
},
|
||||
}
|
||||
return opts
|
||||
})
|
||||
|
|
@ -73,50 +73,52 @@ const validateAttestation = (session, options) => {
|
|||
credential: options.attestationResponse,
|
||||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain
|
||||
})
|
||||
])
|
||||
.then(([user, verification]) => {
|
||||
const { verified, attestationInfo } = verification
|
||||
expectedRPID: options.domain,
|
||||
}),
|
||||
]).then(([user, verification]) => {
|
||||
const { verified, attestationInfo } = verification
|
||||
|
||||
if (!(verified || attestationInfo)) {
|
||||
session.webauthn = null
|
||||
return verified
|
||||
}
|
||||
|
||||
const {
|
||||
fmt,
|
||||
counter,
|
||||
aaguid,
|
||||
credentialPublicKey,
|
||||
credentialID,
|
||||
credentialType,
|
||||
userVerified,
|
||||
attestationObject,
|
||||
} = attestationInfo
|
||||
|
||||
return credentials
|
||||
.getHardwareCredentialsByUserId(user.id)
|
||||
.then(userDevices => {
|
||||
const existingDevice = userDevices.find(
|
||||
device => device.data.credentialID === credentialID,
|
||||
)
|
||||
|
||||
if (!existingDevice) {
|
||||
const newDevice = {
|
||||
fmt,
|
||||
counter,
|
||||
aaguid,
|
||||
credentialPublicKey,
|
||||
credentialID,
|
||||
credentialType,
|
||||
userVerified,
|
||||
attestationObject,
|
||||
}
|
||||
credentials.createHardwareCredential(user.id, newDevice)
|
||||
}
|
||||
|
||||
if (!(verified || attestationInfo)) {
|
||||
session.webauthn = null
|
||||
return verified
|
||||
}
|
||||
|
||||
const {
|
||||
fmt,
|
||||
counter,
|
||||
aaguid,
|
||||
credentialPublicKey,
|
||||
credentialID,
|
||||
credentialType,
|
||||
userVerified,
|
||||
attestationObject
|
||||
} = attestationInfo
|
||||
|
||||
return credentials.getHardwareCredentialsByUserId(user.id)
|
||||
.then(userDevices => {
|
||||
const existingDevice = userDevices.find(device => device.data.credentialID === credentialID)
|
||||
|
||||
if (!existingDevice) {
|
||||
const newDevice = {
|
||||
fmt,
|
||||
counter,
|
||||
aaguid,
|
||||
credentialPublicKey,
|
||||
credentialID,
|
||||
credentialType,
|
||||
userVerified,
|
||||
attestationObject
|
||||
}
|
||||
credentials.createHardwareCredential(user.id, newDevice)
|
||||
}
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const validateAssertion = (session, options) => {
|
||||
|
|
@ -124,17 +126,24 @@ const validateAssertion = (session, options) => {
|
|||
|
||||
return credentials.getHardwareCredentials().then(devices => {
|
||||
const dbAuthenticator = _.find(dev => {
|
||||
return Buffer.from(dev.data.credentialID).compare(base64url.toBuffer(options.assertionResponse.rawId)) === 0
|
||||
return (
|
||||
Buffer.from(dev.data.credentialID).compare(
|
||||
base64url.toBuffer(options.assertionResponse.rawId),
|
||||
) === 0
|
||||
)
|
||||
}, devices)
|
||||
|
||||
if (!dbAuthenticator.data) {
|
||||
throw new Error(`Could not find authenticator matching ${options.assertionResponse.id}`)
|
||||
throw new Error(
|
||||
`Could not find authenticator matching ${options.assertionResponse.id}`,
|
||||
)
|
||||
}
|
||||
|
||||
const convertedAuthenticator = _.merge(
|
||||
dbAuthenticator.data,
|
||||
{ credentialPublicKey: Buffer.from(dbAuthenticator.data.credentialPublicKey) }
|
||||
)
|
||||
const convertedAuthenticator = _.merge(dbAuthenticator.data, {
|
||||
credentialPublicKey: Buffer.from(
|
||||
dbAuthenticator.data.credentialPublicKey,
|
||||
),
|
||||
})
|
||||
|
||||
let verification
|
||||
try {
|
||||
|
|
@ -143,7 +152,7 @@ const validateAssertion = (session, options) => {
|
|||
expectedChallenge: `${expectedChallenge}`,
|
||||
expectedOrigin: `https://${options.domain}${devMode ? `:3001` : ``}`,
|
||||
expectedRPID: options.domain,
|
||||
authenticator: convertedAuthenticator
|
||||
authenticator: convertedAuthenticator,
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
|
@ -160,16 +169,19 @@ const validateAssertion = (session, options) => {
|
|||
dbAuthenticator.data.counter = assertionInfo.newCounter
|
||||
return Promise.all([
|
||||
credentials.updateHardwareCredential(dbAuthenticator),
|
||||
users.getUserById(dbAuthenticator.user_id)
|
||||
])
|
||||
.then(([_, user]) => {
|
||||
const finalUser = { id: user.id, username: user.username, role: user.role }
|
||||
session.user = finalUser
|
||||
session.cookie.maxAge = REMEMBER_ME_AGE
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
users.getUserById(dbAuthenticator.user_id),
|
||||
]).then(([, user]) => {
|
||||
const finalUser = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
}
|
||||
session.user = finalUser
|
||||
session.cookie.maxAge = REMEMBER_ME_AGE
|
||||
|
||||
session.webauthn = null
|
||||
return verified
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -177,5 +189,5 @@ module.exports = {
|
|||
generateAttestationOptions,
|
||||
generateAssertionOptions,
|
||||
validateAttestation,
|
||||
validateAssertion
|
||||
validateAssertion,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const FIDOUsernameless = require('./FIDOUsernamelessStrategy')
|
|||
const STRATEGIES = {
|
||||
FIDO2FA,
|
||||
FIDOPasswordless,
|
||||
FIDOUsernameless
|
||||
FIDOUsernameless,
|
||||
}
|
||||
|
||||
// FIDO2FA, FIDOPasswordless or FIDOUsernameless
|
||||
|
|
@ -13,5 +13,5 @@ const CHOSEN_STRATEGY = 'FIDO2FA'
|
|||
|
||||
module.exports = {
|
||||
CHOSEN_STRATEGY,
|
||||
strategy: STRATEGIES[CHOSEN_STRATEGY]
|
||||
strategy: STRATEGIES[CHOSEN_STRATEGY],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,16 @@ const credentials = require('../../../hardware-credentials')
|
|||
const REMEMBER_ME_AGE = 90 * T.day
|
||||
|
||||
const authenticateUser = (username, password) => {
|
||||
return users.getUserByUsername(username)
|
||||
return users
|
||||
.getUserByUsername(username)
|
||||
.then(user => {
|
||||
const hashedPassword = user.password
|
||||
if (!hashedPassword || !user.enabled) throw new authErrors.InvalidCredentialsError()
|
||||
return Promise.all([argon2.verify(hashedPassword, password), hashedPassword])
|
||||
if (!hashedPassword || !user.enabled)
|
||||
throw new authErrors.InvalidCredentialsError()
|
||||
return Promise.all([
|
||||
argon2.verify(hashedPassword, password),
|
||||
hashedPassword,
|
||||
])
|
||||
})
|
||||
.then(([isMatch, hashedPassword]) => {
|
||||
if (!isMatch) throw new authErrors.InvalidCredentialsError()
|
||||
|
|
@ -32,7 +37,9 @@ const authenticateUser = (username, password) => {
|
|||
|
||||
const destroySessionIfSameUser = (context, user) => {
|
||||
const sessionUser = getUserFromCookie(context)
|
||||
if (sessionUser && user.id === sessionUser.id) { context.req.session.destroy() }
|
||||
if (sessionUser && user.id === sessionUser.id) {
|
||||
context.req.session.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
const destroySessionIfBeingUsed = (sessID, context) => {
|
||||
|
|
@ -56,15 +63,13 @@ const initializeSession = (context, user, rememberMe) => {
|
|||
}
|
||||
|
||||
const executeProtectedAction = (code, id, context, action) => {
|
||||
return users.getUserById(id)
|
||||
.then(user => {
|
||||
if (user.role !== 'superuser') {
|
||||
return action()
|
||||
}
|
||||
return users.getUserById(id).then(user => {
|
||||
if (user.role !== 'superuser') {
|
||||
return action()
|
||||
}
|
||||
|
||||
return confirm2FA(code, context)
|
||||
.then(() => action())
|
||||
})
|
||||
return confirm2FA(code, context).then(() => action())
|
||||
})
|
||||
}
|
||||
|
||||
const getUserData = context => {
|
||||
|
|
@ -79,10 +84,18 @@ const get2FASecret = (username, password) => {
|
|||
return authenticateUser(username, password)
|
||||
.then(user => {
|
||||
const secret = otplib.authenticator.generateSecret()
|
||||
const otpauth = otplib.authenticator.keyuri(user.username, constants.AUTHENTICATOR_ISSUER_ENTITY, secret)
|
||||
return Promise.all([users.saveTemp2FASecret(user.id, secret), secret, otpauth])
|
||||
const otpauth = otplib.authenticator.keyuri(
|
||||
user.username,
|
||||
constants.AUTHENTICATOR_ISSUER_ENTITY,
|
||||
secret,
|
||||
)
|
||||
return Promise.all([
|
||||
users.saveTemp2FASecret(user.id, secret),
|
||||
secret,
|
||||
otpauth,
|
||||
])
|
||||
})
|
||||
.then(([_, secret, otpauth]) => {
|
||||
.then(([, secret, otpauth]) => {
|
||||
return { secret, otpauth }
|
||||
})
|
||||
}
|
||||
|
|
@ -103,35 +116,43 @@ const confirm2FA = (token, context) => {
|
|||
|
||||
const validateRegisterLink = token => {
|
||||
if (!token) throw new authErrors.InvalidUrlError()
|
||||
return users.validateUserRegistrationToken(token)
|
||||
.then(r => {
|
||||
if (!r.success) throw new authErrors.InvalidUrlError()
|
||||
return { username: r.username, role: r.role }
|
||||
})
|
||||
return users.validateUserRegistrationToken(token).then(r => {
|
||||
if (!r.success) throw new authErrors.InvalidUrlError()
|
||||
return { username: r.username, role: r.role }
|
||||
})
|
||||
}
|
||||
|
||||
const validateResetPasswordLink = token => {
|
||||
if (!token) throw new authErrors.InvalidUrlError()
|
||||
return users.validateAuthToken(token, 'reset_password')
|
||||
.then(r => {
|
||||
if (!r.success) throw new authErrors.InvalidUrlError()
|
||||
return { id: r.userID }
|
||||
})
|
||||
return users.validateAuthToken(token, 'reset_password').then(r => {
|
||||
if (!r.success) throw new authErrors.InvalidUrlError()
|
||||
return { id: r.userID }
|
||||
})
|
||||
}
|
||||
|
||||
const validateReset2FALink = token => {
|
||||
if (!token) throw new authErrors.InvalidUrlError()
|
||||
return users.validateAuthToken(token, 'reset_twofa')
|
||||
return users
|
||||
.validateAuthToken(token, 'reset_twofa')
|
||||
.then(r => {
|
||||
if (!r.success) throw new authErrors.InvalidUrlError()
|
||||
return users.getUserById(r.userID)
|
||||
})
|
||||
.then(user => {
|
||||
const secret = otplib.authenticator.generateSecret()
|
||||
const otpauth = otplib.authenticator.keyuri(user.username, constants.AUTHENTICATOR_ISSUER_ENTITY, secret)
|
||||
return Promise.all([users.saveTemp2FASecret(user.id, secret), user, secret, otpauth])
|
||||
const otpauth = otplib.authenticator.keyuri(
|
||||
user.username,
|
||||
constants.AUTHENTICATOR_ISSUER_ENTITY,
|
||||
secret,
|
||||
)
|
||||
return Promise.all([
|
||||
users.saveTemp2FASecret(user.id, secret),
|
||||
user,
|
||||
secret,
|
||||
otpauth,
|
||||
])
|
||||
})
|
||||
.then(([_, user, secret, otpauth]) => {
|
||||
.then(([, user, secret, otpauth]) => {
|
||||
return { user_id: user.id, secret, otpauth }
|
||||
})
|
||||
}
|
||||
|
|
@ -144,7 +165,10 @@ const deleteSession = (sessionID, context) => {
|
|||
const login = (username, password) => {
|
||||
return authenticateUser(username, password)
|
||||
.then(user => {
|
||||
return Promise.all([credentials.getHardwareCredentialsByUserId(user.id), user.twofa_code])
|
||||
return Promise.all([
|
||||
credentials.getHardwareCredentialsByUserId(user.id),
|
||||
user.twofa_code,
|
||||
])
|
||||
})
|
||||
.then(([devices, twoFASecret]) => {
|
||||
if (!_.isEmpty(devices)) return 'FIDO'
|
||||
|
|
@ -153,21 +177,32 @@ const login = (username, password) => {
|
|||
}
|
||||
|
||||
const input2FA = (username, password, rememberMe, code, context) => {
|
||||
return authenticateUser(username, password)
|
||||
.then(user => {
|
||||
const secret = user.twofa_code
|
||||
const isCodeValid = otplib.authenticator.verify({ token: code, secret: secret })
|
||||
if (!isCodeValid) throw new authErrors.InvalidTwoFactorError()
|
||||
|
||||
initializeSession(context, user, rememberMe)
|
||||
return true
|
||||
return authenticateUser(username, password).then(user => {
|
||||
const secret = user.twofa_code
|
||||
const isCodeValid = otplib.authenticator.verify({
|
||||
token: code,
|
||||
secret: secret,
|
||||
})
|
||||
if (!isCodeValid) throw new authErrors.InvalidTwoFactorError()
|
||||
|
||||
initializeSession(context, user, rememberMe)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
const setup2FA = (username, password, rememberMe, codeConfirmation, context) => {
|
||||
const setup2FA = (
|
||||
username,
|
||||
password,
|
||||
rememberMe,
|
||||
codeConfirmation,
|
||||
context,
|
||||
) => {
|
||||
return authenticateUser(username, password)
|
||||
.then(user => {
|
||||
const isCodeValid = otplib.authenticator.verify({ token: codeConfirmation, secret: user.temp_twofa_code })
|
||||
const isCodeValid = otplib.authenticator.verify({
|
||||
token: codeConfirmation,
|
||||
secret: user.temp_twofa_code,
|
||||
})
|
||||
if (!isCodeValid) throw new authErrors.InvalidTwoFactorError()
|
||||
|
||||
initializeSession(context, user, rememberMe)
|
||||
|
|
@ -202,24 +237,23 @@ const createReset2FAToken = (code, userID, context) => {
|
|||
}
|
||||
|
||||
const createRegisterToken = (username, role) => {
|
||||
return users.getUserByUsername(username)
|
||||
.then(user => {
|
||||
if (user) throw new authErrors.UserAlreadyExistsError()
|
||||
return users.getUserByUsername(username).then(user => {
|
||||
if (user) throw new authErrors.UserAlreadyExistsError()
|
||||
|
||||
return users.createUserRegistrationToken(username, role)
|
||||
})
|
||||
return users.createUserRegistrationToken(username, role)
|
||||
})
|
||||
}
|
||||
|
||||
const register = (token, username, password, role) => {
|
||||
return users.getUserByUsername(username)
|
||||
.then(user => {
|
||||
if (user) throw new authErrors.UserAlreadyExistsError()
|
||||
return users.register(token, username, password, role).then(() => true)
|
||||
})
|
||||
return users.getUserByUsername(username).then(user => {
|
||||
if (user) throw new authErrors.UserAlreadyExistsError()
|
||||
return users.register(token, username, password, role).then(() => true)
|
||||
})
|
||||
}
|
||||
|
||||
const resetPassword = (token, userID, newPassword, context) => {
|
||||
return users.getUserById(userID)
|
||||
return users
|
||||
.getUserById(userID)
|
||||
.then(user => {
|
||||
destroySessionIfSameUser(context, user)
|
||||
return users.updatePassword(token, user.id, newPassword)
|
||||
|
|
@ -228,9 +262,13 @@ const resetPassword = (token, userID, newPassword, context) => {
|
|||
}
|
||||
|
||||
const reset2FA = (token, userID, code, context) => {
|
||||
return users.getUserById(userID)
|
||||
return users
|
||||
.getUserById(userID)
|
||||
.then(user => {
|
||||
const isCodeValid = otplib.authenticator.verify({ token: code, secret: user.temp_twofa_code })
|
||||
const isCodeValid = otplib.authenticator.verify({
|
||||
token: code,
|
||||
secret: user.temp_twofa_code,
|
||||
})
|
||||
if (!isCodeValid) throw new authErrors.InvalidTwoFactorError()
|
||||
|
||||
destroySessionIfSameUser(context, user)
|
||||
|
|
@ -240,7 +278,10 @@ const reset2FA = (token, userID, code, context) => {
|
|||
}
|
||||
|
||||
const getToken = context => {
|
||||
if (_.isNil(context.req.cookies['lamassu_sid']) || _.isNil(context.req.session.user.id))
|
||||
if (
|
||||
_.isNil(context.req.cookies['lamassu_sid']) ||
|
||||
_.isNil(context.req.session.user.id)
|
||||
)
|
||||
throw new authErrors.AuthenticationError('Authentication failed')
|
||||
|
||||
return context.req.session.user.id
|
||||
|
|
@ -267,5 +308,5 @@ module.exports = {
|
|||
register,
|
||||
resetPassword,
|
||||
reset2FA,
|
||||
getToken
|
||||
getToken,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const bills = require('../../services/bills')
|
|||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
bills: (...[, { filters }]) => bills.getBills(filters)
|
||||
}
|
||||
bills: (...[, { filters }]) => bills.getBills(filters),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ const blacklist = require('../../../blacklist')
|
|||
const resolvers = {
|
||||
Query: {
|
||||
blacklist: () => blacklist.getBlacklist(),
|
||||
blacklistMessages: () => blacklist.getMessages()
|
||||
blacklistMessages: () => blacklist.getMessages(),
|
||||
},
|
||||
Mutation: {
|
||||
deleteBlacklistRow: (...[, { address }]) =>
|
||||
|
|
@ -11,8 +11,8 @@ const resolvers = {
|
|||
insertBlacklistRow: (...[, { address }]) =>
|
||||
blacklist.insertIntoBlacklist(address),
|
||||
editBlacklistMessage: (...[, { id, content }]) =>
|
||||
blacklist.editBlacklistMessage(id, content)
|
||||
}
|
||||
blacklist.editBlacklistMessage(id, content),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -5,13 +5,21 @@ const logDateFormat = require('../../../logs').logDateFormat
|
|||
const resolvers = {
|
||||
Query: {
|
||||
cashboxBatches: () => cashbox.getBatches(),
|
||||
cashboxBatchesCsv: (...[, { from, until, timezone }]) => cashbox.getBatches(from, until)
|
||||
.then(data => parseAsync(logDateFormat(timezone, cashbox.logFormatter(data), ['created'])))
|
||||
cashboxBatchesCsv: (...[, { from, until, timezone }]) =>
|
||||
cashbox
|
||||
.getBatches(from, until)
|
||||
.then(data =>
|
||||
parseAsync(
|
||||
logDateFormat(timezone, cashbox.logFormatter(data), ['created']),
|
||||
),
|
||||
),
|
||||
},
|
||||
Mutation: {
|
||||
createBatch: (...[, { deviceId, cashboxCount }]) => cashbox.createCashboxBatch(deviceId, cashboxCount),
|
||||
editBatch: (...[, { id, performedBy }]) => cashbox.editBatchById(id, performedBy)
|
||||
}
|
||||
createBatch: (...[, { deviceId, cashboxCount }]) =>
|
||||
cashbox.createCashboxBatch(deviceId, cashboxCount),
|
||||
editBatch: (...[, { id, performedBy }]) =>
|
||||
cashbox.editBatchById(id, performedBy),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
const { accounts: accountsConfig, countries, languages } = require('../../config')
|
||||
const {
|
||||
accounts: accountsConfig,
|
||||
countries,
|
||||
languages,
|
||||
} = require('../../config')
|
||||
|
||||
const resolver = {
|
||||
Query: {
|
||||
countries: () => countries,
|
||||
languages: () => languages,
|
||||
accountsConfig: () => accountsConfig
|
||||
}
|
||||
accountsConfig: () => accountsConfig,
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolver
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ const { coins, currencies } = require('../../config')
|
|||
const resolver = {
|
||||
Query: {
|
||||
currencies: () => currencies,
|
||||
cryptoCurrencies: () => coins
|
||||
}
|
||||
cryptoCurrencies: () => coins,
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolver
|
||||
|
|
|
|||
|
|
@ -2,32 +2,55 @@ const authentication = require('../modules/userManagement')
|
|||
const queries = require('../../services/customInfoRequests')
|
||||
const DataLoader = require('dataloader')
|
||||
|
||||
const customerCustomInfoRequestsLoader = new DataLoader(ids => queries.batchGetAllCustomInfoRequestsForCustomer(ids), { cache: false })
|
||||
const customerCustomInfoRequestsLoader = new DataLoader(
|
||||
ids => queries.batchGetAllCustomInfoRequestsForCustomer(ids),
|
||||
{ cache: false },
|
||||
)
|
||||
|
||||
const customInfoRequestLoader = new DataLoader(ids => queries.batchGetCustomInfoRequest(ids), { cache: false })
|
||||
const customInfoRequestLoader = new DataLoader(
|
||||
ids => queries.batchGetCustomInfoRequest(ids),
|
||||
{ cache: false },
|
||||
)
|
||||
|
||||
const resolvers = {
|
||||
Customer: {
|
||||
customInfoRequests: parent => customerCustomInfoRequestsLoader.load(parent.id)
|
||||
customInfoRequests: parent =>
|
||||
customerCustomInfoRequestsLoader.load(parent.id),
|
||||
},
|
||||
CustomRequestData: {
|
||||
customInfoRequest: parent => customInfoRequestLoader.load(parent.infoRequestId)
|
||||
customInfoRequest: parent =>
|
||||
customInfoRequestLoader.load(parent.infoRequestId),
|
||||
},
|
||||
Query: {
|
||||
customInfoRequests: (...[, { onlyEnabled }]) => queries.getCustomInfoRequests(onlyEnabled),
|
||||
customerCustomInfoRequests: (...[, { customerId }]) => queries.getAllCustomInfoRequestsForCustomer(customerId),
|
||||
customerCustomInfoRequest: (...[, { customerId, infoRequestId }]) => queries.getCustomInfoRequestForCustomer(customerId, infoRequestId)
|
||||
customInfoRequests: (...[, { onlyEnabled }]) =>
|
||||
queries.getCustomInfoRequests(onlyEnabled),
|
||||
customerCustomInfoRequests: (...[, { customerId }]) =>
|
||||
queries.getAllCustomInfoRequestsForCustomer(customerId),
|
||||
customerCustomInfoRequest: (...[, { customerId, infoRequestId }]) =>
|
||||
queries.getCustomInfoRequestForCustomer(customerId, infoRequestId),
|
||||
},
|
||||
Mutation: {
|
||||
insertCustomInfoRequest: (...[, { customRequest }]) => queries.addCustomInfoRequest(customRequest),
|
||||
removeCustomInfoRequest: (...[, { id }]) => queries.removeCustomInfoRequest(id),
|
||||
editCustomInfoRequest: (...[, { id, customRequest }]) => queries.editCustomInfoRequest(id, customRequest),
|
||||
setAuthorizedCustomRequest: (...[, { customerId, infoRequestId, override }, context]) => {
|
||||
insertCustomInfoRequest: (...[, { customRequest }]) =>
|
||||
queries.addCustomInfoRequest(customRequest),
|
||||
removeCustomInfoRequest: (...[, { id }]) =>
|
||||
queries.removeCustomInfoRequest(id),
|
||||
editCustomInfoRequest: (...[, { id, customRequest }]) =>
|
||||
queries.editCustomInfoRequest(id, customRequest),
|
||||
setAuthorizedCustomRequest: (
|
||||
...[, { customerId, infoRequestId, override }, context]
|
||||
) => {
|
||||
const token = authentication.getToken(context)
|
||||
return queries.setAuthorizedCustomRequest(customerId, infoRequestId, override, token)
|
||||
return queries.setAuthorizedCustomRequest(
|
||||
customerId,
|
||||
infoRequestId,
|
||||
override,
|
||||
token,
|
||||
)
|
||||
},
|
||||
setCustomerCustomInfoRequest: (...[, { customerId, infoRequestId, data }]) => queries.setCustomerData(customerId, infoRequestId, data)
|
||||
}
|
||||
setCustomerCustomInfoRequest: (
|
||||
...[, { customerId, infoRequestId, data }]
|
||||
) => queries.setCustomerData(customerId, infoRequestId, data),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -6,41 +6,56 @@ const customerNotes = require('../../../customer-notes')
|
|||
const machineLoader = require('../../../machine-loader')
|
||||
|
||||
const addLastUsedMachineName = customer =>
|
||||
(customer.lastUsedMachine ? machineLoader.getMachineName(customer.lastUsedMachine) : Promise.resolve(null))
|
||||
.then(lastUsedMachineName => Object.assign(customer, { lastUsedMachineName }))
|
||||
(customer.lastUsedMachine
|
||||
? machineLoader.getMachineName(customer.lastUsedMachine)
|
||||
: Promise.resolve(null)
|
||||
).then(lastUsedMachineName =>
|
||||
Object.assign(customer, { lastUsedMachineName }),
|
||||
)
|
||||
|
||||
const resolvers = {
|
||||
Customer: {
|
||||
isAnonymous: parent => (parent.customerId === anonymous.uuid)
|
||||
isAnonymous: parent => parent.customerId === anonymous.uuid,
|
||||
},
|
||||
Query: {
|
||||
customers: (...[, { phone, email, name, address, id }]) => customers.getCustomersList(phone, name, address, id, email),
|
||||
customer: (...[, { customerId }]) => customers.getCustomerById(customerId).then(addLastUsedMachineName),
|
||||
customerFilters: () => filters.customer()
|
||||
customers: (...[, { phone, email, name, address, id }]) =>
|
||||
customers.getCustomersList(phone, name, address, id, email),
|
||||
customer: (...[, { customerId }]) =>
|
||||
customers.getCustomerById(customerId).then(addLastUsedMachineName),
|
||||
customerFilters: () => filters.customer(),
|
||||
},
|
||||
Mutation: {
|
||||
setCustomer: (root, { customerId, customerInput }, context, info) => {
|
||||
setCustomer: (root, { customerId, customerInput }, context) => {
|
||||
const token = authentication.getToken(context)
|
||||
if (customerId === anonymous.uuid) return customers.getCustomerById(customerId)
|
||||
if (customerId === anonymous.uuid)
|
||||
return customers.getCustomerById(customerId)
|
||||
return customers.updateCustomer(customerId, customerInput, token)
|
||||
},
|
||||
addCustomField: (...[, { customerId, label, value }]) => customers.addCustomField(customerId, label, value),
|
||||
saveCustomField: (...[, { customerId, fieldId, value }]) => customers.saveCustomField(customerId, fieldId, value),
|
||||
removeCustomField: (...[, [ { customerId, fieldId } ]]) => customers.removeCustomField(customerId, fieldId),
|
||||
addCustomField: (...[, { customerId, label, value }]) =>
|
||||
customers.addCustomField(customerId, label, value),
|
||||
saveCustomField: (...[, { customerId, fieldId, value }]) =>
|
||||
customers.saveCustomField(customerId, fieldId, value),
|
||||
removeCustomField: (...[, [{ customerId, fieldId }]]) =>
|
||||
customers.removeCustomField(customerId, fieldId),
|
||||
editCustomer: async (root, { customerId, customerEdit }, context) => {
|
||||
const token = authentication.getToken(context)
|
||||
const editedData = await customerEdit
|
||||
return customers.edit(customerId, editedData, token)
|
||||
},
|
||||
replacePhoto: async (root, { customerId, photoType, newPhoto }, context) => {
|
||||
replacePhoto: async (
|
||||
root,
|
||||
{ customerId, photoType, newPhoto },
|
||||
context,
|
||||
) => {
|
||||
const token = authentication.getToken(context)
|
||||
const { file } = newPhoto
|
||||
const photo = await file
|
||||
if (!photo) return customers.getCustomerById(customerId)
|
||||
return customers.updateEditedPhoto(customerId, photo, photoType)
|
||||
return customers
|
||||
.updateEditedPhoto(customerId, photo, photoType)
|
||||
.then(newPatch => customers.edit(customerId, newPatch, token))
|
||||
},
|
||||
deleteEditedData: (root, { customerId, customerEdit }) => {
|
||||
deleteEditedData: (root, { customerId }) => {
|
||||
// TODO: NOT IMPLEMENTING THIS FEATURE FOR THE CURRENT VERSION
|
||||
return customers.getCustomerById(customerId)
|
||||
},
|
||||
|
|
@ -55,12 +70,13 @@ const resolvers = {
|
|||
deleteCustomerNote: (...[, { noteId }]) => {
|
||||
return customerNotes.deleteCustomerNote(noteId)
|
||||
},
|
||||
createCustomer: (...[, { phoneNumber }]) => customers.add({ phone: phoneNumber }),
|
||||
createCustomer: (...[, { phoneNumber }]) =>
|
||||
customers.add({ phone: phoneNumber }),
|
||||
enableTestCustomer: (...[, { customerId }]) =>
|
||||
customers.enableTestCustomer(customerId),
|
||||
disableTestCustomer: (...[, { customerId }]) =>
|
||||
customers.disableTestCustomer(customerId)
|
||||
}
|
||||
customers.disableTestCustomer(customerId),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const funding = require('../../services/funding')
|
|||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
funding: () => funding.getFunding()
|
||||
}
|
||||
funding: () => funding.getFunding(),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ const resolvers = [
|
|||
status,
|
||||
transaction,
|
||||
user,
|
||||
version
|
||||
version,
|
||||
]
|
||||
|
||||
module.exports = mergeResolvers(resolvers)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const { parseAsync } = require('json2csv')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const logs = require('../../../logs')
|
||||
const serverLogs = require('../../services/server-logs')
|
||||
|
|
@ -8,15 +7,23 @@ const resolvers = {
|
|||
Query: {
|
||||
machineLogs: (...[, { deviceId, from, until, limit, offset }]) =>
|
||||
logs.simpleGetMachineLogs(deviceId, from, until, limit, offset),
|
||||
machineLogsCsv: (...[, { deviceId, from, until, limit, offset, timezone }]) =>
|
||||
logs.simpleGetMachineLogs(deviceId, from, until, limit, offset)
|
||||
.then(res => parseAsync(logs.logDateFormat(timezone, res, ['timestamp']))),
|
||||
machineLogsCsv: (
|
||||
...[, { deviceId, from, until, limit, offset, timezone }]
|
||||
) =>
|
||||
logs
|
||||
.simpleGetMachineLogs(deviceId, from, until, limit, offset)
|
||||
.then(res =>
|
||||
parseAsync(logs.logDateFormat(timezone, res, ['timestamp'])),
|
||||
),
|
||||
serverLogs: (...[, { from, until, limit, offset }]) =>
|
||||
serverLogs.getServerLogs(from, until, limit, offset),
|
||||
serverLogsCsv: (...[, { from, until, limit, offset, timezone }]) =>
|
||||
serverLogs.getServerLogs(from, until, limit, offset)
|
||||
.then(res => parseAsync(logs.logDateFormat(timezone, res, ['timestamp'])))
|
||||
}
|
||||
serverLogs
|
||||
.getServerLogs(from, until, limit, offset)
|
||||
.then(res =>
|
||||
parseAsync(logs.logDateFormat(timezone, res, ['timestamp'])),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -3,24 +3,30 @@ const DataLoader = require('dataloader')
|
|||
const loyalty = require('../../../loyalty')
|
||||
const { getSlimCustomerByIdBatch } = require('../../../customers')
|
||||
|
||||
const customerLoader = new DataLoader(ids => {
|
||||
return getSlimCustomerByIdBatch(ids)
|
||||
}, { cache: false })
|
||||
const customerLoader = new DataLoader(
|
||||
ids => {
|
||||
return getSlimCustomerByIdBatch(ids)
|
||||
},
|
||||
{ cache: false },
|
||||
)
|
||||
|
||||
const resolvers = {
|
||||
IndividualDiscount: {
|
||||
customer: parent => customerLoader.load(parent.customerId)
|
||||
customer: parent => customerLoader.load(parent.customerId),
|
||||
},
|
||||
Query: {
|
||||
promoCodes: () => loyalty.getAvailablePromoCodes(),
|
||||
individualDiscounts: () => loyalty.getAvailableIndividualDiscounts()
|
||||
individualDiscounts: () => loyalty.getAvailableIndividualDiscounts(),
|
||||
},
|
||||
Mutation: {
|
||||
createPromoCode: (...[, { code, discount }]) => loyalty.createPromoCode(code, discount),
|
||||
createPromoCode: (...[, { code, discount }]) =>
|
||||
loyalty.createPromoCode(code, discount),
|
||||
deletePromoCode: (...[, { codeId }]) => loyalty.deletePromoCode(codeId),
|
||||
createIndividualDiscount: (...[, { customerId, discount }]) => loyalty.createIndividualDiscount(customerId, discount),
|
||||
deleteIndividualDiscount: (...[, { discountId }]) => loyalty.deleteIndividualDiscount(discountId)
|
||||
}
|
||||
createIndividualDiscount: (...[, { customerId, discount }]) =>
|
||||
loyalty.createIndividualDiscount(customerId, discount),
|
||||
deleteIndividualDiscount: (...[, { discountId }]) =>
|
||||
loyalty.deleteIndividualDiscount(discountId),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -3,25 +3,29 @@ const DataLoader = require('dataloader')
|
|||
const { machineAction } = require('../../services/machines')
|
||||
|
||||
const machineLoader = require('../../../machine-loader')
|
||||
const machineEventsByIdBatch = require('../../../postgresql_interface').machineEventsByIdBatch
|
||||
const machineEventsByIdBatch =
|
||||
require('../../../postgresql_interface').machineEventsByIdBatch
|
||||
|
||||
const machineEventsLoader = new DataLoader(ids => {
|
||||
return machineEventsByIdBatch(ids)
|
||||
}, { cache: false })
|
||||
const machineEventsLoader = new DataLoader(
|
||||
ids => {
|
||||
return machineEventsByIdBatch(ids)
|
||||
},
|
||||
{ cache: false },
|
||||
)
|
||||
|
||||
const resolvers = {
|
||||
Machine: {
|
||||
latestEvent: parent => machineEventsLoader.load(parent.deviceId)
|
||||
latestEvent: parent => machineEventsLoader.load(parent.deviceId),
|
||||
},
|
||||
Query: {
|
||||
machines: () => machineLoader.getMachineNames(),
|
||||
machine: (...[, { deviceId }]) => machineLoader.getMachine(deviceId),
|
||||
unpairedMachines: () => machineLoader.getUnpairedMachines()
|
||||
unpairedMachines: () => machineLoader.getUnpairedMachines(),
|
||||
},
|
||||
Mutation: {
|
||||
machineAction: (...[, { deviceId, action, cashUnits, newName }, context]) =>
|
||||
machineAction({ deviceId, action, cashUnits, newName }, context)
|
||||
}
|
||||
machineAction({ deviceId, action, cashUnits, newName }, context),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const exchange = require('../../../exchange')
|
|||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
getMarkets: () => exchange.getMarkets()
|
||||
}
|
||||
getMarkets: () => exchange.getMarkets(),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ const resolvers = {
|
|||
Query: {
|
||||
notifications: () => notifierQueries.getNotifications(),
|
||||
hasUnreadNotifications: () => notifierQueries.hasUnreadNotifications(),
|
||||
alerts: () => notifierQueries.getAlerts()
|
||||
alerts: () => notifierQueries.getAlerts(),
|
||||
},
|
||||
Mutation: {
|
||||
toggleClearNotification: (...[, { id, read }]) => notifierQueries.setRead(id, read),
|
||||
clearAllNotifications: () => notifierQueries.markAllAsRead()
|
||||
}
|
||||
toggleClearNotification: (...[, { id, read }]) =>
|
||||
notifierQueries.setRead(id, read),
|
||||
clearAllNotifications: () => notifierQueries.markAllAsRead(),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const pairing = require('../../services/pairing')
|
|||
|
||||
const resolvers = {
|
||||
Mutation: {
|
||||
createPairingTotem: (...[, { name }]) => pairing.totem(name)
|
||||
}
|
||||
createPairingTotem: (...[, { name }]) => pairing.totem(name),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ const resolvers = {
|
|||
return pi.getRawRates().then(r => {
|
||||
return {
|
||||
withCommissions: pi.buildRates(r),
|
||||
withoutCommissions: pi.buildRatesNoCommission(r)
|
||||
withoutCommissions: pi.buildRatesNoCommission(r),
|
||||
}
|
||||
})
|
||||
}),
|
||||
fiatRates: () => forex.getFiatRates()
|
||||
}
|
||||
fiatRates: () => forex.getFiatRates(),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ const resolvers = {
|
|||
checkAgainstSanctions: (...[, { customerId }, context]) => {
|
||||
const token = authentication.getToken(context)
|
||||
return sanctions.checkByUser(customerId, token)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
const { DateTimeISOResolver, JSONResolver, JSONObjectResolver } = require('graphql-scalars')
|
||||
const {
|
||||
DateTimeISOResolver,
|
||||
JSONResolver,
|
||||
JSONObjectResolver,
|
||||
} = require('graphql-scalars')
|
||||
|
||||
const resolvers = {
|
||||
JSON: JSONResolver,
|
||||
JSONObject: JSONObjectResolver,
|
||||
DateTimeISO: DateTimeISOResolver
|
||||
DateTimeISO: DateTimeISOResolver,
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@ const settingsLoader = require('../../../new-settings-loader')
|
|||
const resolvers = {
|
||||
Query: {
|
||||
accounts: () => settingsLoader.showAccounts(),
|
||||
config: () => settingsLoader.loadLatestConfigOrNone()
|
||||
config: () => settingsLoader.loadLatestConfigOrNone(),
|
||||
},
|
||||
Mutation: {
|
||||
saveAccounts: (...[, { accounts }]) => settingsLoader.saveAccounts(accounts),
|
||||
saveAccounts: (...[, { accounts }]) =>
|
||||
settingsLoader.saveAccounts(accounts),
|
||||
saveConfig: (...[, { config }]) => settingsLoader.saveConfig(config),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ const smsNotices = require('../../../sms-notices')
|
|||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
SMSNotices: () => smsNotices.getSMSNotices()
|
||||
SMSNotices: () => smsNotices.getSMSNotices(),
|
||||
},
|
||||
Mutation: {
|
||||
editSMSNotice: (...[, { id, event, message }]) => smsNotices.editSMSNotice(id, event, message),
|
||||
editSMSNotice: (...[, { id, event, message }]) =>
|
||||
smsNotices.editSMSNotice(id, event, message),
|
||||
enableSMSNotice: (...[, { id }]) => smsNotices.enableSMSNotice(id),
|
||||
disableSMSNotice: (...[, { id }]) => smsNotices.disableSMSNotice(id)
|
||||
}
|
||||
disableSMSNotice: (...[, { id }]) => smsNotices.disableSMSNotice(id),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const supervisor = require('../../services/supervisor')
|
|||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
uptime: () => supervisor.getAllProcessInfo()
|
||||
}
|
||||
uptime: () => supervisor.getAllProcessInfo(),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const DataLoader = require('dataloader')
|
||||
const { parseAsync } = require('json2csv')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const filters = require('../../filters')
|
||||
const cashOutTx = require('../../../cash-out/cash-out-tx')
|
||||
|
|
@ -9,35 +8,124 @@ const transactions = require('../../services/transactions')
|
|||
const anonymous = require('../../../constants').anonymousCustomer
|
||||
const logDateFormat = require('../../../logs').logDateFormat
|
||||
|
||||
const transactionsLoader = new DataLoader(ids => transactions.getCustomerTransactionsBatch(ids), { cache: false })
|
||||
const transactionsLoader = new DataLoader(
|
||||
ids => transactions.getCustomerTransactionsBatch(ids),
|
||||
{ cache: false },
|
||||
)
|
||||
|
||||
const resolvers = {
|
||||
Customer: {
|
||||
transactions: parent => transactionsLoader.load(parent.id)
|
||||
transactions: parent => transactionsLoader.load(parent.id),
|
||||
},
|
||||
Transaction: {
|
||||
isAnonymous: parent => (parent.customerId === anonymous.uuid)
|
||||
isAnonymous: parent => parent.customerId === anonymous.uuid,
|
||||
},
|
||||
Query: {
|
||||
transactions: (...[, { from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers }]) =>
|
||||
transactions.batch(from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers),
|
||||
transactionsCsv: (...[, { from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, timezone, excludeTestingCustomers, simplified }]) =>
|
||||
transactions.batch(from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers, simplified)
|
||||
.then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime', 'publishedAt']))),
|
||||
transactions: (
|
||||
...[
|
||||
,
|
||||
{
|
||||
from,
|
||||
until,
|
||||
limit,
|
||||
offset,
|
||||
txClass,
|
||||
deviceId,
|
||||
customerName,
|
||||
fiatCode,
|
||||
cryptoCode,
|
||||
toAddress,
|
||||
status,
|
||||
swept,
|
||||
excludeTestingCustomers,
|
||||
},
|
||||
]
|
||||
) =>
|
||||
transactions.batch(
|
||||
from,
|
||||
until,
|
||||
limit,
|
||||
offset,
|
||||
txClass,
|
||||
deviceId,
|
||||
customerName,
|
||||
fiatCode,
|
||||
cryptoCode,
|
||||
toAddress,
|
||||
status,
|
||||
swept,
|
||||
excludeTestingCustomers,
|
||||
),
|
||||
transactionsCsv: (
|
||||
...[
|
||||
,
|
||||
{
|
||||
from,
|
||||
until,
|
||||
limit,
|
||||
offset,
|
||||
txClass,
|
||||
deviceId,
|
||||
customerName,
|
||||
fiatCode,
|
||||
cryptoCode,
|
||||
toAddress,
|
||||
status,
|
||||
swept,
|
||||
timezone,
|
||||
excludeTestingCustomers,
|
||||
simplified,
|
||||
},
|
||||
]
|
||||
) =>
|
||||
transactions
|
||||
.batch(
|
||||
from,
|
||||
until,
|
||||
limit,
|
||||
offset,
|
||||
txClass,
|
||||
deviceId,
|
||||
customerName,
|
||||
fiatCode,
|
||||
cryptoCode,
|
||||
toAddress,
|
||||
status,
|
||||
swept,
|
||||
excludeTestingCustomers,
|
||||
simplified,
|
||||
)
|
||||
.then(data =>
|
||||
parseAsync(
|
||||
logDateFormat(timezone, data, [
|
||||
'created',
|
||||
'sendTime',
|
||||
'publishedAt',
|
||||
]),
|
||||
),
|
||||
),
|
||||
transactionCsv: (...[, { id, txClass, timezone }]) =>
|
||||
transactions.getTx(id, txClass).then(data =>
|
||||
parseAsync(logDateFormat(timezone, [data], ['created', 'sendTime', 'publishedAt']))
|
||||
),
|
||||
transactions
|
||||
.getTx(id, txClass)
|
||||
.then(data =>
|
||||
parseAsync(
|
||||
logDateFormat(
|
||||
timezone,
|
||||
[data],
|
||||
['created', 'sendTime', 'publishedAt'],
|
||||
),
|
||||
),
|
||||
),
|
||||
txAssociatedDataCsv: (...[, { id, txClass, timezone }]) =>
|
||||
transactions.getTxAssociatedData(id, txClass).then(data =>
|
||||
parseAsync(logDateFormat(timezone, data, ['created']))
|
||||
),
|
||||
transactionFilters: () => filters.transaction()
|
||||
transactions
|
||||
.getTxAssociatedData(id, txClass)
|
||||
.then(data => parseAsync(logDateFormat(timezone, data, ['created']))),
|
||||
transactionFilters: () => filters.transaction(),
|
||||
},
|
||||
Mutation: {
|
||||
cancelCashOutTransaction: (...[, { id }]) => cashOutTx.cancel(id),
|
||||
cancelCashInTransaction: (...[, { id }]) => cashInTx.cancel(id)
|
||||
}
|
||||
cancelCashInTransaction: (...[, { id }]) => cashInTx.cancel(id),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -19,7 +19,11 @@ const getAttestationQueryOptions = variables => {
|
|||
const getAssertionQueryOptions = variables => {
|
||||
switch (authentication.CHOSEN_STRATEGY) {
|
||||
case 'FIDO2FA':
|
||||
return { username: variables.username, password: variables.password, domain: variables.domain }
|
||||
return {
|
||||
username: variables.username,
|
||||
password: variables.password,
|
||||
domain: variables.domain,
|
||||
}
|
||||
case 'FIDOPasswordless':
|
||||
return { username: variables.username, domain: variables.domain }
|
||||
case 'FIDOUsernameless':
|
||||
|
|
@ -32,11 +36,23 @@ const getAssertionQueryOptions = variables => {
|
|||
const getAttestationMutationOptions = variables => {
|
||||
switch (authentication.CHOSEN_STRATEGY) {
|
||||
case 'FIDO2FA':
|
||||
return { userId: variables.userID, attestationResponse: variables.attestationResponse, domain: variables.domain }
|
||||
return {
|
||||
userId: variables.userID,
|
||||
attestationResponse: variables.attestationResponse,
|
||||
domain: variables.domain,
|
||||
}
|
||||
case 'FIDOPasswordless':
|
||||
return { userId: variables.userID, attestationResponse: variables.attestationResponse, domain: variables.domain }
|
||||
return {
|
||||
userId: variables.userID,
|
||||
attestationResponse: variables.attestationResponse,
|
||||
domain: variables.domain,
|
||||
}
|
||||
case 'FIDOUsernameless':
|
||||
return { userId: variables.userID, attestationResponse: variables.attestationResponse, domain: variables.domain }
|
||||
return {
|
||||
userId: variables.userID,
|
||||
attestationResponse: variables.attestationResponse,
|
||||
domain: variables.domain,
|
||||
}
|
||||
default:
|
||||
return {}
|
||||
}
|
||||
|
|
@ -45,11 +61,25 @@ const getAttestationMutationOptions = variables => {
|
|||
const getAssertionMutationOptions = variables => {
|
||||
switch (authentication.CHOSEN_STRATEGY) {
|
||||
case 'FIDO2FA':
|
||||
return { username: variables.username, password: variables.password, rememberMe: variables.rememberMe, assertionResponse: variables.assertionResponse, domain: variables.domain }
|
||||
return {
|
||||
username: variables.username,
|
||||
password: variables.password,
|
||||
rememberMe: variables.rememberMe,
|
||||
assertionResponse: variables.assertionResponse,
|
||||
domain: variables.domain,
|
||||
}
|
||||
case 'FIDOPasswordless':
|
||||
return { username: variables.username, rememberMe: variables.rememberMe, assertionResponse: variables.assertionResponse, domain: variables.domain }
|
||||
return {
|
||||
username: variables.username,
|
||||
rememberMe: variables.rememberMe,
|
||||
assertionResponse: variables.assertionResponse,
|
||||
domain: variables.domain,
|
||||
}
|
||||
case 'FIDOUsernameless':
|
||||
return { assertionResponse: variables.assertionResponse, domain: variables.domain }
|
||||
return {
|
||||
assertionResponse: variables.assertionResponse,
|
||||
domain: variables.domain,
|
||||
}
|
||||
default:
|
||||
return {}
|
||||
}
|
||||
|
|
@ -59,34 +89,82 @@ const resolver = {
|
|||
Query: {
|
||||
users: () => users.getUsers(),
|
||||
sessions: () => sessionManager.getSessions(),
|
||||
userSessions: (...[, { username }]) => sessionManager.getSessionsByUsername(username),
|
||||
userData: (...[, {}, context]) => userManagement.getUserData(context),
|
||||
get2FASecret: (...[, { username, password }]) => userManagement.get2FASecret(username, password),
|
||||
confirm2FA: (...[, { code }, context]) => userManagement.confirm2FA(code, context),
|
||||
validateRegisterLink: (...[, { token }]) => userManagement.validateRegisterLink(token),
|
||||
validateResetPasswordLink: (...[, { token }]) => userManagement.validateResetPasswordLink(token),
|
||||
validateReset2FALink: (...[, { token }]) => userManagement.validateReset2FALink(token),
|
||||
generateAttestationOptions: (...[, variables, context]) => authentication.strategy.generateAttestationOptions(context.req.session, getAttestationQueryOptions(variables)),
|
||||
generateAssertionOptions: (...[, variables, context]) => authentication.strategy.generateAssertionOptions(context.req.session, getAssertionQueryOptions(variables))
|
||||
userSessions: (...[, { username }]) =>
|
||||
sessionManager.getSessionsByUsername(username),
|
||||
userData: (...[, , context]) => userManagement.getUserData(context),
|
||||
get2FASecret: (...[, { username, password }]) =>
|
||||
userManagement.get2FASecret(username, password),
|
||||
confirm2FA: (...[, { code }, context]) =>
|
||||
userManagement.confirm2FA(code, context),
|
||||
validateRegisterLink: (...[, { token }]) =>
|
||||
userManagement.validateRegisterLink(token),
|
||||
validateResetPasswordLink: (...[, { token }]) =>
|
||||
userManagement.validateResetPasswordLink(token),
|
||||
validateReset2FALink: (...[, { token }]) =>
|
||||
userManagement.validateReset2FALink(token),
|
||||
generateAttestationOptions: (...[, variables, context]) =>
|
||||
authentication.strategy.generateAttestationOptions(
|
||||
context.req.session,
|
||||
getAttestationQueryOptions(variables),
|
||||
),
|
||||
generateAssertionOptions: (...[, variables, context]) =>
|
||||
authentication.strategy.generateAssertionOptions(
|
||||
context.req.session,
|
||||
getAssertionQueryOptions(variables),
|
||||
),
|
||||
},
|
||||
Mutation: {
|
||||
enableUser: (...[, { confirmationCode, id }, context]) => userManagement.enableUser(confirmationCode, id, context),
|
||||
disableUser: (...[, { confirmationCode, id }, context]) => userManagement.disableUser(confirmationCode, id, context),
|
||||
deleteSession: (...[, { sid }, context]) => userManagement.deleteSession(sid, context),
|
||||
deleteUserSessions: (...[, { username }]) => sessionManager.deleteSessionsByUsername(username),
|
||||
changeUserRole: (...[, { confirmationCode, id, newRole }, context]) => userManagement.changeUserRole(confirmationCode, id, newRole, context),
|
||||
login: (...[, { username, password }]) => userManagement.login(username, password),
|
||||
input2FA: (...[, { username, password, rememberMe, code }, context]) => userManagement.input2FA(username, password, rememberMe, code, context),
|
||||
setup2FA: (...[, { username, password, rememberMe, codeConfirmation }, context]) => userManagement.setup2FA(username, password, rememberMe, codeConfirmation, context),
|
||||
createResetPasswordToken: (...[, { confirmationCode, userID }, context]) => userManagement.createResetPasswordToken(confirmationCode, userID, context),
|
||||
createReset2FAToken: (...[, { confirmationCode, userID }, context]) => userManagement.createReset2FAToken(confirmationCode, userID, context),
|
||||
createRegisterToken: (...[, { username, role }]) => userManagement.createRegisterToken(username, role),
|
||||
register: (...[, { token, username, password, role }]) => userManagement.register(token, username, password, role),
|
||||
resetPassword: (...[, { token, userID, newPassword }, context]) => userManagement.resetPassword(token, userID, newPassword, context),
|
||||
reset2FA: (...[, { token, userID, code }, context]) => userManagement.reset2FA(token, userID, code, context),
|
||||
validateAttestation: (...[, variables, context]) => authentication.strategy.validateAttestation(context.req.session, getAttestationMutationOptions(variables)),
|
||||
validateAssertion: (...[, variables, context]) => authentication.strategy.validateAssertion(context.req.session, getAssertionMutationOptions(variables))
|
||||
}
|
||||
enableUser: (...[, { confirmationCode, id }, context]) =>
|
||||
userManagement.enableUser(confirmationCode, id, context),
|
||||
disableUser: (...[, { confirmationCode, id }, context]) =>
|
||||
userManagement.disableUser(confirmationCode, id, context),
|
||||
deleteSession: (...[, { sid }, context]) =>
|
||||
userManagement.deleteSession(sid, context),
|
||||
deleteUserSessions: (...[, { username }]) =>
|
||||
sessionManager.deleteSessionsByUsername(username),
|
||||
changeUserRole: (...[, { confirmationCode, id, newRole }, context]) =>
|
||||
userManagement.changeUserRole(confirmationCode, id, newRole, context),
|
||||
login: (...[, { username, password }]) =>
|
||||
userManagement.login(username, password),
|
||||
input2FA: (...[, { username, password, rememberMe, code }, context]) =>
|
||||
userManagement.input2FA(username, password, rememberMe, code, context),
|
||||
setup2FA: (
|
||||
...[, { username, password, rememberMe, codeConfirmation }, context]
|
||||
) =>
|
||||
userManagement.setup2FA(
|
||||
username,
|
||||
password,
|
||||
rememberMe,
|
||||
codeConfirmation,
|
||||
context,
|
||||
),
|
||||
createResetPasswordToken: (...[, { confirmationCode, userID }, context]) =>
|
||||
userManagement.createResetPasswordToken(
|
||||
confirmationCode,
|
||||
userID,
|
||||
context,
|
||||
),
|
||||
createReset2FAToken: (...[, { confirmationCode, userID }, context]) =>
|
||||
userManagement.createReset2FAToken(confirmationCode, userID, context),
|
||||
createRegisterToken: (...[, { username, role }]) =>
|
||||
userManagement.createRegisterToken(username, role),
|
||||
register: (...[, { token, username, password, role }]) =>
|
||||
userManagement.register(token, username, password, role),
|
||||
resetPassword: (...[, { token, userID, newPassword }, context]) =>
|
||||
userManagement.resetPassword(token, userID, newPassword, context),
|
||||
reset2FA: (...[, { token, userID, code }, context]) =>
|
||||
userManagement.reset2FA(token, userID, code, context),
|
||||
validateAttestation: (...[, variables, context]) =>
|
||||
authentication.strategy.validateAttestation(
|
||||
context.req.session,
|
||||
getAttestationMutationOptions(variables),
|
||||
),
|
||||
validateAssertion: (...[, variables, context]) =>
|
||||
authentication.strategy.validateAssertion(
|
||||
context.req.session,
|
||||
getAssertionMutationOptions(variables),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolver
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const serverVersion = require('../../../../package.json').version
|
|||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
serverVersion: () => serverVersion
|
||||
}
|
||||
serverVersion: () => serverVersion,
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = resolvers
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ const resolvers = require('./resolvers')
|
|||
|
||||
module.exports = {
|
||||
resolvers: resolvers,
|
||||
typeDefs: types
|
||||
typeDefs: types,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ const typeDef = gql`
|
|||
|
||||
type Query {
|
||||
cashboxBatches: [CashboxBatch] @auth
|
||||
cashboxBatchesCsv(from: DateTimeISO, until: DateTimeISO, timezone: String): String @auth
|
||||
cashboxBatchesCsv(
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
timezone: String
|
||||
): String @auth
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
const gql = require('graphql-tag')
|
||||
|
||||
const typeDef = gql`
|
||||
|
||||
type CustomInfoRequest {
|
||||
id: ID!,
|
||||
enabled: Boolean,
|
||||
id: ID!
|
||||
enabled: Boolean
|
||||
customRequest: JSON
|
||||
}
|
||||
|
||||
|
|
@ -42,15 +41,31 @@ const typeDef = gql`
|
|||
type Query {
|
||||
customInfoRequests(onlyEnabled: Boolean): [CustomInfoRequest] @auth
|
||||
customerCustomInfoRequests(customerId: ID!): [CustomRequestData] @auth
|
||||
customerCustomInfoRequest(customerId: ID!, infoRequestId: ID!): CustomRequestData @auth
|
||||
customerCustomInfoRequest(
|
||||
customerId: ID!
|
||||
infoRequestId: ID!
|
||||
): CustomRequestData @auth
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
insertCustomInfoRequest(customRequest: CustomRequestInput!): CustomInfoRequest @auth
|
||||
insertCustomInfoRequest(
|
||||
customRequest: CustomRequestInput!
|
||||
): CustomInfoRequest @auth
|
||||
removeCustomInfoRequest(id: ID!): CustomInfoRequest @auth
|
||||
editCustomInfoRequest(id: ID!, customRequest: CustomRequestInput!): CustomInfoRequest @auth
|
||||
setAuthorizedCustomRequest(customerId: ID!, infoRequestId: ID!, override: String!): Boolean @auth
|
||||
setCustomerCustomInfoRequest(customerId: ID!, infoRequestId: ID!, data: JSON!): Boolean @auth
|
||||
editCustomInfoRequest(
|
||||
id: ID!
|
||||
customRequest: CustomRequestInput!
|
||||
): CustomInfoRequest @auth
|
||||
setAuthorizedCustomRequest(
|
||||
customerId: ID!
|
||||
infoRequestId: ID!
|
||||
override: String!
|
||||
): Boolean @auth
|
||||
setCustomerCustomInfoRequest(
|
||||
customerId: ID!
|
||||
infoRequestId: ID!
|
||||
data: JSON!
|
||||
): Boolean @auth
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
|||
|
|
@ -95,20 +95,37 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Query {
|
||||
customers(phone: String, name: String, email: String, address: String, id: String): [Customer] @auth
|
||||
customers(
|
||||
phone: String
|
||||
name: String
|
||||
email: String
|
||||
address: String
|
||||
id: String
|
||||
): [Customer] @auth
|
||||
customer(customerId: ID!): Customer @auth
|
||||
customerFilters: [Filter] @auth
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
setCustomer(customerId: ID!, customerInput: CustomerInput): Customer @auth
|
||||
addCustomField(customerId: ID!, label: String!, value: String!): Boolean @auth
|
||||
saveCustomField(customerId: ID!, fieldId: ID!, value: String!): Boolean @auth
|
||||
addCustomField(customerId: ID!, label: String!, value: String!): Boolean
|
||||
@auth
|
||||
saveCustomField(customerId: ID!, fieldId: ID!, value: String!): Boolean
|
||||
@auth
|
||||
removeCustomField(customerId: ID!, fieldId: ID!): Boolean @auth
|
||||
editCustomer(customerId: ID!, customerEdit: CustomerEdit): Customer @auth
|
||||
deleteEditedData(customerId: ID!, customerEdit: CustomerEdit): Customer @auth
|
||||
replacePhoto(customerId: ID!, photoType: String, newPhoto: Upload): Customer @auth
|
||||
createCustomerNote(customerId: ID!, title: String!, content: String!): Boolean @auth
|
||||
deleteEditedData(customerId: ID!, customerEdit: CustomerEdit): Customer
|
||||
@auth
|
||||
replacePhoto(
|
||||
customerId: ID!
|
||||
photoType: String
|
||||
newPhoto: Upload
|
||||
): Customer @auth
|
||||
createCustomerNote(
|
||||
customerId: ID!
|
||||
title: String!
|
||||
content: String!
|
||||
): Boolean @auth
|
||||
editCustomerNote(noteId: ID!, newContent: String!): Boolean @auth
|
||||
deleteCustomerNote(noteId: ID!): Boolean @auth
|
||||
createCustomer(phoneNumber: String): Customer @auth
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ const types = [
|
|||
status,
|
||||
transaction,
|
||||
user,
|
||||
version
|
||||
version,
|
||||
]
|
||||
|
||||
module.exports = mergeTypeDefs(types)
|
||||
|
|
|
|||
|
|
@ -16,10 +16,34 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Query {
|
||||
machineLogs(deviceId: ID!, from: DateTimeISO, until: DateTimeISO, limit: Int, offset: Int): [MachineLog] @auth
|
||||
machineLogsCsv(deviceId: ID!, from: DateTimeISO, until: DateTimeISO, limit: Int, offset: Int, timezone: String): String @auth
|
||||
serverLogs(from: DateTimeISO, until: DateTimeISO, limit: Int, offset: Int): [ServerLog] @auth
|
||||
serverLogsCsv(from: DateTimeISO, until: DateTimeISO, limit: Int, offset: Int, timezone: String): String @auth
|
||||
machineLogs(
|
||||
deviceId: ID!
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
limit: Int
|
||||
offset: Int
|
||||
): [MachineLog] @auth
|
||||
machineLogsCsv(
|
||||
deviceId: ID!
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
limit: Int
|
||||
offset: Int
|
||||
timezone: String
|
||||
): String @auth
|
||||
serverLogs(
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
limit: Int
|
||||
offset: Int
|
||||
): [ServerLog] @auth
|
||||
serverLogsCsv(
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
limit: Int
|
||||
offset: Int
|
||||
timezone: String
|
||||
): String @auth
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const typeDef = gql`
|
|||
customer: DiscountCustomer!
|
||||
discount: Int
|
||||
}
|
||||
|
||||
|
||||
type DiscountCustomer {
|
||||
id: ID!
|
||||
phone: String
|
||||
|
|
@ -27,7 +27,10 @@ const typeDef = gql`
|
|||
type Mutation {
|
||||
createPromoCode(code: String!, discount: Int!): PromoCode @auth
|
||||
deletePromoCode(codeId: ID!): PromoCode @auth
|
||||
createIndividualDiscount(customerId: ID!, discount: Int!): IndividualDiscount @auth
|
||||
createIndividualDiscount(
|
||||
customerId: ID!
|
||||
discount: Int!
|
||||
): IndividualDiscount @auth
|
||||
deleteIndividualDiscount(discountId: ID!): IndividualDiscount @auth
|
||||
}
|
||||
`
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const typeDef = gql`
|
|||
frontTimestamp: DateTimeISO
|
||||
scanTimestamp: DateTimeISO
|
||||
}
|
||||
|
||||
|
||||
type CashUnits {
|
||||
cashbox: Int
|
||||
cassette1: Int
|
||||
|
|
@ -98,7 +98,12 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Mutation {
|
||||
machineAction(deviceId:ID!, action: MachineAction!, cashUnits: CashUnitsInput, newName: String): Machine @auth
|
||||
machineAction(
|
||||
deviceId: ID!
|
||||
action: MachineAction!
|
||||
cashUnits: CashUnitsInput
|
||||
newName: String
|
||||
): Machine @auth
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Mutation {
|
||||
editSMSNotice(id: ID!, event: SMSNoticeEvent!, message: String!): SMSNotice @auth
|
||||
editSMSNotice(id: ID!, event: SMSNoticeEvent!, message: String!): SMSNotice
|
||||
@auth
|
||||
enableSMSNotice(id: ID!): SMSNotice @auth
|
||||
disableSMSNotice(id: ID!): SMSNotice @auth
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,38 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Query {
|
||||
transactions(from: DateTimeISO, until: DateTimeISO, limit: Int, offset: Int, txClass: String, deviceId: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, swept: Boolean, excludeTestingCustomers: Boolean): [Transaction] @auth
|
||||
transactionsCsv(from: DateTimeISO, until: DateTimeISO, limit: Int, offset: Int, txClass: String, deviceId: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, swept: Boolean, timezone: String, excludeTestingCustomers: Boolean, simplified: Boolean): String @auth
|
||||
transactions(
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
limit: Int
|
||||
offset: Int
|
||||
txClass: String
|
||||
deviceId: String
|
||||
customerName: String
|
||||
fiatCode: String
|
||||
cryptoCode: String
|
||||
toAddress: String
|
||||
status: String
|
||||
swept: Boolean
|
||||
excludeTestingCustomers: Boolean
|
||||
): [Transaction] @auth
|
||||
transactionsCsv(
|
||||
from: DateTimeISO
|
||||
until: DateTimeISO
|
||||
limit: Int
|
||||
offset: Int
|
||||
txClass: String
|
||||
deviceId: String
|
||||
customerName: String
|
||||
fiatCode: String
|
||||
cryptoCode: String
|
||||
toAddress: String
|
||||
status: String
|
||||
swept: Boolean
|
||||
timezone: String
|
||||
excludeTestingCustomers: Boolean
|
||||
simplified: Boolean
|
||||
): String @auth
|
||||
transactionCsv(id: ID, txClass: String, timezone: String): String @auth
|
||||
txAssociatedDataCsv(id: ID, txClass: String, timezone: String): String @auth
|
||||
transactionFilters: [Filter] @auth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue