Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicolas Frandeboeuf
kresus
Commits
5414b0c3
Commit
5414b0c3
authored
Jun 30, 2020
by
Nicolas Frandeboeuf
Committed by
Benjamin Bouvier
Jun 30, 2020
Browse files
API: return accesses label
parent
e6b51aee
Pipeline
#318879
passed with stages
in 16 minutes and 25 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
client/models.js
View file @
5414b0c3
...
...
@@ -19,15 +19,15 @@ export class Access {
this
.
vendorId
=
assertHas
(
arg
,
'
vendorId
'
)
&&
arg
.
vendorId
;
this
.
login
=
assertHas
(
arg
,
'
login
'
)
&&
arg
.
login
;
this
.
enabled
=
assertHas
(
arg
,
'
enabled
'
)
&&
arg
.
enabled
;
this
.
label
=
(
maybeHas
(
arg
,
'
label
'
)
&&
arg
.
label
)
||
null
;
this
.
customLabel
=
(
maybeHas
(
arg
,
'
customLabel
'
)
&&
arg
.
customLabel
)
||
null
;
// Retrieve bank access'
name and
custom fields from the static bank information.
// Retrieve bank access' custom fields from the static bank information.
let
staticBank
=
banks
.
find
(
b
=>
b
.
uuid
===
this
.
vendorId
);
assert
(
typeof
staticBank
!==
'
undefined
'
,
`Unknown bank linked to access:
${
this
.
vendorId
}
`
);
this
.
label
=
staticBank
.
name
;
this
.
isBankVendorDeprecated
=
staticBank
.
deprecated
;
assert
(
!
maybeHas
(
arg
,
'
fields
'
)
||
arg
.
fields
instanceof
Array
);
...
...
server/controllers/all.ts
View file @
5414b0c3
...
...
@@ -16,6 +16,7 @@ import {
isAppriseApiEnabled
,
}
from
'
../helpers
'
;
import
{
bankVendorByUuid
}
from
'
../lib/bank-vendors
'
;
import
{
ConfigGhostSettings
}
from
'
../lib/ghost-settings
'
;
import
{
validatePassword
}
from
'
../shared/helpers
'
;
import
DefaultSettings
from
'
../shared/default-settings
'
;
...
...
@@ -36,10 +37,13 @@ interface GetAllDataOptions {
// FIXME also contains all the fields from Access.
interface
ClientAccess
{
vendorId
:
string
;
enabled
?:
boolean
;
fields
:
{
name
:
string
;
value
:
string
}[];
password
?:
string
|
null
;
session
?:
string
|
null
;
customLabel
:
string
|
null
;
label
?:
string
|
null
;
}
interface
AllData
{
...
...
@@ -52,7 +56,7 @@ interface AllData {
budgets
?:
Budget
[];
}
async
function
getAllData
(
userId
:
number
,
options
:
GetAllDataOptions
=
{})
{
async
function
getAllData
(
userId
:
number
,
options
:
GetAllDataOptions
=
{})
:
Promise
<
AllData
>
{
const
{
isExport
=
false
,
cleanPassword
=
true
}
=
options
;
const
ret
:
AllData
=
{
...
...
@@ -84,6 +88,11 @@ async function getAllData(userId: number, options: GetAllDataOptions = {}) {
delete
clientAccess
.
session
;
}
const
bank
=
bankVendorByUuid
(
clientAccess
.
vendorId
);
if
(
bank
&&
bank
.
name
)
{
clientAccess
.
label
=
bank
.
name
;
}
ret
.
accesses
.
push
(
clientAccess
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment