-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from oSoc18/develop
Hotfix #2
- Loading branch information
Showing
4 changed files
with
29 additions
and
6 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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
const transformer = require("../helpers/transformer") | ||
const fs = require('fs'); | ||
const fs = require("fs"); | ||
|
||
exports.addService = async (params) => { | ||
return await transformer.makeService(params); | ||
} | ||
|
||
exports.postCodeSearch = async (params) => { | ||
exports.postCodeSearch = (params) => { | ||
return new Promise((resolve, reject) => { | ||
fs.readdir(__dirname + "/../files/", (err, files) => { | ||
if(err) reject() | ||
fs.readdir(__dirname + `/../files/${params.postcode}/gebouwen/`, (err, files) => { | ||
if(err) reject("Geen gebouwen gevonden voor psotcode"); | ||
let response = {} | ||
files.forEach(file => { | ||
fs.readFile(__dirname + `/../files/${params.postcode}/gebouwen/${file}`, (err, data) => { | ||
if(err) reject("Problemen bij het openen van gebouwfile"); | ||
response.push(JSON.parse(data)); | ||
}) | ||
}) | ||
resolve(response); | ||
}) | ||
}) | ||
}) | ||
} |
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