-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb88ab5
commit 0b3d58a
Showing
24 changed files
with
707 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,98 @@ | ||
import { Governance } from '../models'; | ||
|
||
import { | ||
assertIsActiveGovernanceBody, | ||
assertIfReadOnlyMode, | ||
assertDataLayerAvailable, | ||
assertWalletIsAvailable, | ||
assertWalletIsSynced, | ||
assertCanBeGovernanceBody, | ||
} from '../utils/data-assertions'; | ||
|
||
export const findAll = async (req, res) => { | ||
try { | ||
const results = await Governance.findAll(); | ||
return res.json(results); | ||
} catch (error) { | ||
res.status(400).json({ | ||
message: 'Can not retreive issuances', | ||
message: 'Can not retreive Governance Data', | ||
error: error.message, | ||
}); | ||
} | ||
}; | ||
|
||
// eslint-disable-next-line | ||
export const createGoveranceBody = async (req, res) => {}; | ||
export const createGoveranceBody = async (req, res) => { | ||
try { | ||
await assertIfReadOnlyMode(); | ||
await assertDataLayerAvailable(); | ||
await assertWalletIsAvailable(); | ||
await assertWalletIsSynced(); | ||
await assertCanBeGovernanceBody(); | ||
|
||
// eslint-disable-next-line | ||
export const setDefaultOrgList = async (req, res) => {}; | ||
await Governance.createGoveranceBody(); | ||
|
||
return res.json({ | ||
message: | ||
'Setting up new Governance Body on this node, this can tae a few mins', | ||
}); | ||
} catch (error) { | ||
res.status(400).json({ | ||
message: 'Cant update default orgs', | ||
error: error.message, | ||
}); | ||
} | ||
}; | ||
|
||
// eslint-disable-next-line | ||
export const setPickList = async (req, res) => {}; | ||
export const setDefaultOrgList = async (req, res) => { | ||
try { | ||
await assertIfReadOnlyMode(); | ||
await assertDataLayerAvailable(); | ||
await assertWalletIsAvailable(); | ||
await assertWalletIsSynced(); | ||
await assertIsActiveGovernanceBody(); | ||
|
||
const orgList = JSON.stringify(req.body); | ||
|
||
await Governance.updateGoveranceBodyData([ | ||
{ key: 'orgList', value: orgList }, | ||
]); | ||
|
||
return res.json({ | ||
message: 'Committed this new organization list to the datalayer', | ||
}); | ||
} catch (error) { | ||
console.trace(error); | ||
res.status(400).json({ | ||
message: 'Cant update default orgs', | ||
error: error.message, | ||
}); | ||
} | ||
}; | ||
|
||
// eslint-disable-next-line | ||
export const subscribeToGovernanceBody = async (req, res) => {}; | ||
export const setPickList = async (req, res) => { | ||
try { | ||
await assertIfReadOnlyMode(); | ||
await assertDataLayerAvailable(); | ||
await assertWalletIsAvailable(); | ||
await assertWalletIsSynced(); | ||
await assertIsActiveGovernanceBody(); | ||
|
||
const pickList = JSON.stringify(req.body); | ||
|
||
await Governance.updateGoveranceBodyData([ | ||
{ key: 'pickList', value: pickList }, | ||
]); | ||
|
||
return res.json({ | ||
message: 'Committed this pick list to the datalayer', | ||
}); | ||
} catch (error) { | ||
res.status(400).json({ | ||
message: 'Cant update picklist', | ||
error: error.message, | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.