pinafore/routes/_database/accountsAndRelationships.js

20 lines
841 B
JavaScript
Raw Normal View History

2018-02-09 06:04:10 +00:00
import { ACCOUNTS_STORE, RELATIONSHIPS_STORE } from './constants'
import { accountsCache, relationshipsCache } from './cache'
import { getGenericEntityWithId, setGenericEntityWithId } from './helpers'
2018-02-09 06:29:29 +00:00
export async function getAccount (instanceName, accountId) {
return getGenericEntityWithId(ACCOUNTS_STORE, accountsCache, instanceName, accountId)
2018-02-09 06:04:10 +00:00
}
2018-02-09 06:29:29 +00:00
export async function setAccount (instanceName, account) {
return setGenericEntityWithId(ACCOUNTS_STORE, accountsCache, instanceName, account)
2018-02-09 06:04:10 +00:00
}
2018-02-09 06:29:29 +00:00
export async function getRelationship (instanceName, accountId) {
return getGenericEntityWithId(RELATIONSHIPS_STORE, relationshipsCache, instanceName, accountId)
2018-02-09 06:04:10 +00:00
}
2018-02-09 06:29:29 +00:00
export async function setRelationship (instanceName, relationship) {
return setGenericEntityWithId(RELATIONSHIPS_STORE, relationshipsCache, instanceName, relationship)
}