-
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
413ea37
commit 6150001
Showing
39 changed files
with
854 additions
and
357 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const modelTypes = require('../src/models/simulator/simulator.modeltypes.cjs'); | ||
|
||
module.exports = { | ||
async up(queryInterface) { | ||
await queryInterface.createTable('simulator', modelTypes); | ||
}, | ||
|
||
async down(queryInterface) { | ||
await queryInterface.dropTable('simulator'); | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const modelTypes = require('../src/models/organizations/organizations.modeltypes.cjs'); | ||
|
||
module.exports = { | ||
async up(queryInterface) { | ||
await queryInterface.createTable('organizations', modelTypes); | ||
}, | ||
|
||
async down(queryInterface) { | ||
await queryInterface.dropTable('organizations'); | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
const dotenv = require('dotenv'); | ||
dotenv.config(); | ||
|
||
const metaStub = [ | ||
{ | ||
metaKey: 'organizationId', | ||
metaValue: 'f1c54511-865e-4611-976c-7c3c1f704662', | ||
}, | ||
{ | ||
metaKey: 'organizationName', | ||
metaValue: 'Demo Org', | ||
}, | ||
]; | ||
|
||
module.exports = { | ||
up: async (queryInterface) => { | ||
if (process.env.USE_SIMULATOR === 'true') { | ||
await queryInterface.bulkInsert('meta', metaStub, {}); | ||
} | ||
}, | ||
|
||
down: async (queryInterface) => { | ||
await queryInterface.bulkDelete('meta'); | ||
}, | ||
}; |
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,13 +1,16 @@ | ||
import { Organization } from '../models/organizations'; | ||
import { updateOrganization } from '../fullnode/dataLayerService'; | ||
|
||
export const findAll = async (req, res) => { | ||
return res.json(await Organization.getOrgsMap()); | ||
}; | ||
|
||
export const create = async (req, res) => { | ||
const { name, icon, website } = req.body; | ||
const { name, icon } = req.body; | ||
return res.json({ | ||
message: 'New organization created successfully.', | ||
orgId: await updateOrganization(name, icon, website), | ||
orgId: await Organization.createHomeOrganization(name, icon, 'v1'), | ||
}); | ||
}; | ||
|
||
// eslint-disable-next-line | ||
export const importOrg = async (req, res) => {}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export const changeListFactory = (action, id, record) => { | ||
console.log({ action, id, record }); | ||
switch (action) { | ||
case 'INSERT': | ||
return { | ||
action: 'insert', | ||
key: Buffer.from(id).toString('hex'), | ||
value: Buffer.from(JSON.stringify(record)).toString('hex'), | ||
}; | ||
case 'UPDATE': | ||
return [ | ||
{ | ||
action: 'delete', | ||
key: Buffer.from(id).toString('hex'), | ||
}, | ||
{ | ||
action: 'insert', | ||
key: Buffer.from(id).toString('hex'), | ||
value: Buffer.from(JSON.stringify(record)).toString('hex'), | ||
}, | ||
]; | ||
case 'DELETE': | ||
return { | ||
action: 'delete', | ||
key: Buffer.from(id).toString('hex'), | ||
}; | ||
} | ||
}; |
Oops, something went wrong.