-
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
d41dbb9
commit d87d7c7
Showing
5 changed files
with
129 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as simulator from './simulator'; | ||
|
||
export const updateProjectRecord = async (uuid, record) => { | ||
await simulator.updateProjectRecord(uuid, record); | ||
}; | ||
|
||
export const createProjectRecord = async (uuid, record) => { | ||
await simulator.createProjectRecord(uuid, record); | ||
}; | ||
|
||
export const deleteProjectRecord = async (uuid) => { | ||
await simulator.deleteProjectRecord(uuid); | ||
}; | ||
|
||
export const updateUnitRecord = async (uuid, record) => { | ||
await simulator.updateUnitRecord(uuid, record); | ||
}; | ||
|
||
export const createUnitRecord = async (uuid, record) => { | ||
await simulator.createUnitRecord(uuid, record); | ||
}; | ||
|
||
export const deleteUnitRecord = async (uuid) => { | ||
await simulator.deleteUnitRecord(uuid); | ||
}; |
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 @@ | ||
export * from './fullnode'; |
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,64 @@ | ||
import { Project, Unit } from '../models'; | ||
const THIRTY_SEC = 30000; | ||
|
||
// Simulate 30 seconds passing before commited to node | ||
|
||
export const updateProjectRecord = async (uuid, record) => { | ||
await deleteProjectRecord(uuid); | ||
await createProjectRecord(uuid, record); | ||
}; | ||
|
||
export const createProjectRecord = (uuid, record) => { | ||
return new Promise(async (resolve) => { | ||
setTimeout(() => { | ||
await Project.create({ | ||
...record, | ||
warehouseProjectId: uuid, | ||
}); | ||
resolve(); | ||
}, THIRTY_SEC); | ||
}); | ||
}; | ||
|
||
export const deleteProjectRecord = (uuid) => { | ||
return new Promise(async (resolve) => { | ||
setTimeout(() => { | ||
await Project.destroy({ | ||
where: { | ||
warehouseProjectId: uuid, | ||
}, | ||
}); | ||
resolve(); | ||
}, THIRTY_SEC); | ||
}); | ||
}; | ||
|
||
export const updateUnitRecord = async (uuid, record) => { | ||
await deleteUnitRecord(uuid); | ||
await createUnitRecord(uuid, record); | ||
}; | ||
|
||
export const createUnitRecord = (uuid, record) => { | ||
return new Promise(async (resolve) => { | ||
setTimeout(() => { | ||
await Unit.create({ | ||
uuid, | ||
...record, | ||
}); | ||
resolve(); | ||
}, THIRTY_SEC); | ||
}); | ||
}; | ||
|
||
export const deleteUnitRecord = (uuid) => { | ||
return new Promise(async (resolve) => { | ||
setTimeout(() => { | ||
await Unit.destroy({ | ||
where: { | ||
uuid, | ||
}, | ||
}); | ||
resolve(); | ||
}, THIRTY_SEC); | ||
}); | ||
}; |
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